Commit Graph

149 Commits

Author SHA1 Message Date
FRIGN 9de853a98d Unboolify st
This practice proved itself in sbase, ubase and a couple of other
projects.
Also remove the True and False defined in X11 and FcTrue and FcFalse
defined in Fontconfig.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
2015-07-09 18:34:46 +02:00
Quentin Rameau bdd649a102 do not truncate font size when zooming 2015-06-19 11:49:13 +02:00
Roberto E. Vargas Caballero 215bdb2da3 Add tty line support
Not always is desirable to create a pseudo terminal, and some times
we want to open a terminal emulator over a tty line. With this new
patch is possible to do someting like:

	$ st -l /dev/ttyS0 115200

Without this option was needed to launch another terminal emulator
over st (for example minicom, picocom, cu, ...).
2015-04-15 10:52:44 +02:00
Omar Sandoval ecac5ee35e Make DECSCUSR thickness configurable 2015-04-10 23:43:05 +02:00
Christoph Lohmann 2fcfea1bf1 Add Mod + Shift + c/v and no selclear.
Thanks to Alex Pilon <alp@alexpilon.ca>!

Now there is a distinction between the primary and clipboard selection. With
Mod + Shift + c/v the clipboard is handled. The old Insert behavious does
reside.
2015-03-14 07:41:59 +01:00
Roberto E. Vargas Caballero b746816b78 Allow combinations with Backspace
XN_ANY_MOD makes that any combination of backspace will return always
DEL. This patch lets to X to decide which value returns.
2015-03-13 07:26:16 +00:00
Ivan Delalande f5075a9e9d Backspace value shouldn't depend on keypad state 2015-03-11 17:25:48 +00:00
Christoph Lohmann 230d0c8428 Finally resolving the backspace problem.
The majority now using the Linux behaviour. Minorities have to live in their
ghettos.
2015-03-10 00:00:44 +01:00
Christoph Lohmann a7eef8f230 Removing an extra space. 2014-09-29 15:41:10 +02:00
Christoph Lohmann dc8c5c82aa Implementing xzoomreset.
Thanks mvdan@mvdan.cc for proposing this.
2014-09-29 15:38:21 +02:00
Roberto E. Vargas Caballero 5afb3862ba Add support for utmp in st
St runs an interactive shell and not a login shell, and it means
that profile is not loaded. The default terminal configuration
in some system is not the correct for st, but since profile is
not loaded there is no way of getting a script configures the
correct values.

St doesn't update the utmp files, this is the job of another
suckless tool, utmp. Utmp also opens a login shell (it is the
logical behaviour when you create a new user record) it is a
good option execute utmp and then get a correct input in
utmp, wtmp and lastlog file, and execute the content of the
profile.
2014-09-23 07:12:41 +02:00
Roberto E. Vargas Caballero 9d9e049eac Make useful DEL in application mode
DEL key has to generate the sequence ^[P in application mode,
because such sequence means delete current character. It implies
that the character sent in keypad mode must be ^? (DEL character).
2014-08-19 12:57:43 +02:00
Roberto E. Vargas Caballero f8b4998b32 Convert VT102ID to a config variable
VT102ID is the sequence that the terminal returns when it is inquired
to identify itself. This value should be configurable in the same
way that another st parameters.
2014-08-15 15:00:48 +02:00
Eric Pruitt 738f555f66 Fix typo in config.def.h
Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
2014-06-21 10:24:36 +02:00
Hiltjo Posthuma cf890e5bf0 Allow mouse selection override using ShiftMask
Similar to xterm or urxvt holding shift before selecting text with the mouse
allows to override copying text. For example in tmux with "mode-mouse on" or
vim (compiled with --with-x), mc, htop, etc.

forceselmod in config.h sets the modifier to use this mode, by default
ShiftMask.

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-05-14 07:48:25 +02:00
noname 9e3e8ce466 Do not export chscale and cwscale. 2014-04-28 18:49:05 +02:00
Roberto E. Vargas Caballero c46d929fe1 Fix Backspace and Delete characters
Backspace key must generate the backspace character (\010) and
Delete key must generate the delete character (\0177). In
some systems the kernel configuration for erasing previous character
is \0177, so some programs (for example cat, ed, mail, ...), can not
understand the correct meaning of backspace. In this cases it is only
needed this command:

	stty erase 
2014-04-11 15:08:37 +02:00
Roberto E. Vargas Caballero 78f8843bc7 Add sequence for printing the current selection
This is very usefull in order to can select what is sent
to the plumber.
2014-03-06 07:55:07 +01:00
Roberto E. Vargas Caballero 96c230e476 Add key definition for printer sequences
These new combinations generate the same behaviour (basically) of
vt102. It is a good way of communicating st with other programs.

[0] http://www.vt100.net/docs/vt102-ug/chapter2.html
2014-03-06 07:53:15 +01:00
Roberto E. Vargas Caballero 21d905c076 Make Shift+Home equal to CLS in ascii mode 2014-02-02 19:40:38 +01:00
Roberto E. Vargas Caballero 9523233e25 Make CONTROL + DELETE delete a line
If CONTROL + INSERT inserts a line then it seems natural CONTROL + DELETE
removes a line.
2014-02-02 19:30:38 +01:00
Roberto E. Vargas Caballero d2173cd716 Fix SHIFT+DEL definition
The AppMode and AsciiMode were inverted in the definition of this
combination.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
2014-01-31 12:41:37 +01:00
Mark Edgar ef1dc9fc4b Replace alignment tabs with spaces. 2013-12-18 08:11:14 +01:00
Mark Edgar 6162d63151 Fix comments in config.def.h to match field names. 2013-12-18 08:10:44 +01:00
Mark Edgar fb8e3f67f7 Fix definition of F28 key.
Shitf modifier adds 12 to the function number of the function keys,
while Control adds 24, so Control + F4 generates F28
2013-12-18 08:10:22 +01:00
Mark Edgar 297c886b72 Ignore numlock (Mod2Mask) for button events too.
Conflicts:
	config.def.h
	st.c
2013-10-20 09:53:34 +02:00
Christoph Lohmann cc2ea3147a Default volume of the bell is 0. 2013-09-12 20:52:10 +02:00
Roberto E. Vargas Caballero bef599bb27 Add audible bell
\a is the character for bell, and st is only marking the window as urgent
if it is not active. This patch adds an audible bell which can be disable
with bellvolume variable.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
2013-09-12 20:47:41 +02:00
Mark Edgar 4245ba0d12 Correctly initialize altscreen when defaultbg is not 0.
The alternate screen is not properly initialized when st starts. To see
this, set defaultbg in config.h to anything other than 0 (for example, swap
defaultfg and defaultbg), and run:

./st -e sh -c 'tput smcup; read'

You should see that the top-left 80x24 rectangle is black (or whatever
colorname[0] is), while the rest of the screen (if any) has the desired
colorname[defaultbg] color.

The attached patch fixes this by initializing term.c.attr in tnew() before
calling tresize(). It also removes the unnecessary xcalloc() calls, which
misled me on this bug hunt since it is really tclearregion() which
initializes term.lines and term.alt in tresize().
2013-09-04 18:33:02 +02:00
Eric Pruitt 7e3cff33ff Use character size scaling factors
The bounding boxes for characters can be scaled using "cwscale" and "chscale"
to scale the width and height respectively.
2013-08-05 11:44:18 +02:00
Markus Teich 40e4d76d22 fix: whitespace 2013-07-04 09:58:14 +02:00
Markus Teich 7af030c999 fix PageUp Modifier Mask in config.def.h
Signed-off-by: Christoph Lohmann <20h@r-36.net>
2013-06-22 16:45:03 +02:00
Christoph Lohmann 2cf4f366d6 Bumping up the xfps so mouse motion won't reap the CPU. 2013-06-01 14:39:13 +02:00
Christoph Lohmann 8e968739c3 Allow more complex delimiters for word selections.
Thanks Alexander Rezinsky <alexrez@gmail.com>!
2013-05-04 19:04:20 +02:00
Christoph Lohmann e1458ef467 Explaining blinking for the dummies. 2013-04-28 21:32:42 +02:00
Christoph Lohmann a53017c8b4 Add a possibility to modify the string sent by mouse buttons.
Thanks Alexander Rezinsky <alexrez@gmail.com> for the suggestion!
2013-04-28 17:42:30 +02:00
Christoph Lohmann 1e09726518 Enable blinking in st. 2013-04-26 18:41:54 +02:00
Christoph Lohmann 1e7816c202 Drawing a more visible rectangle as cursor on unfocus.
To have a more visible cursor on unfocused windows this patch makes st draw a
rectangle around the terminal cell.

Thanks Mark Hills <mark@xwax.org> for the suggestion!
2013-04-13 09:44:00 +02:00
Christoph Lohmann 580c8bbd46 Add an option to disable alternative screens. 2013-04-03 20:42:27 +02:00
Christoph Lohmann 7e7760c2ed Add the possibility to have default highlight colors.
Thanks to stargrave@stargrave.org for the suggestion!
2013-03-29 19:01:24 +01:00
Christoph Lohmann adde5c6d9d Adding PgUp + Ctrl.
Thanks stargrave@stargrave.org!
2013-03-29 18:45:09 +01:00
Christoph Lohmann f876810626 Adding PgUp and PgDown + Ctrl to config.def.h
Thanks stargrave@stargrave.org!
2013-03-29 18:43:32 +01:00
Christoph Lohmann be7c6d7fb0 Add insert for the primary clipboard to MOD + Shift + Ins.
Thanks Mantas Mikulėnas <grawity@gmail.com> for the patch!
2013-02-23 21:50:13 +01:00
Christoph Lohmann 3865e9eaaf Implement rectangular mouse selection.
Thanks Alexander Sedov <alex0player@gmail.com>!
2013-02-19 19:08:41 +01:00
Christoph Lohmann f4a6c20f46 Adding a way to ignore bits in the state. 2013-02-16 13:57:12 +01:00
Christoph Lohmann a92a678e25 The refresh rate for the action needs to be high too. 2013-02-15 19:34:53 +01:00
Christoph Lohmann de7e0e9c8d Changing the fps to something reasonable high. 2013-02-15 19:32:37 +01:00
Christoph Lohmann 086cd61511 Doing it like the new run() was proposed. 2013-02-15 19:30:43 +01:00
Christoph Lohmann 95033753be Adding a more efficient drawing code.
Thanks Mihail Zenkov <mihail.zenkov@gmail.com> for giving the hint!
2013-02-15 19:10:22 +01:00
Christoph Lohmann 2696f81875 Be careful about mar77i's patches. 2012-12-10 23:02:58 +01:00
Christoph Lohmann fe3fb82d29 Applying the patch of mar771 right. 2012-12-10 15:02:32 +01:00
Christoph Lohmann fdce8bba1a Applying the change of the Del key assingment. Thanks Martti Kühne! 2012-12-09 21:39:02 +01:00
Roberto E. Vargas Caballero d5994b43ca Add support for End key
- Shift + End : Delete until end of line.
    - Control + End : Delete until end of screen.

When  the End  key is  pressed  without any  modifier is  not generated  the
correct sequence for it  (going to the end of the  screen), because the size
of the  terminal is not known,  so it is  not possible write a  sequence for
this purpouse.
---
 config.def.h |   10 ++++++++--
 st.info      |    2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)
2012-11-25 22:13:29 +01:00
Roberto E. Vargas Caballero 7c34ff1703 Add support for Supr key
Del : Delete character under cursor.
    Shift + Del : Delete the line under cursor.
    Ctrl + Del: Delete the full screen.
---
 config.def.h |   16 ++++++++++++----
 st.info      |    2 ++
 2 files changed, 14 insertions(+), 4 deletions(-)
2012-11-25 22:13:24 +01:00
Roberto E. Vargas Caballero 3c99be68e8 Add support for insert key
Insert key stands for a key which allows enter or leaves insert mode, so let
it generates the correct sequence to change between these modes:

   - Insert: Enter in insert mode.
   - Shift + Insert: Leave insert mode (replace mode).
   - Control + Insert: Insert a blank line.

Like Shift + Insert also paste text, if a user want this feature be full
functional he has to modify such shortcut.
---
 config.def.h |   16 ++++++++++++----
 st.info      |    3 +++
 2 files changed, 15 insertions(+), 4 deletions(-)
2012-11-25 22:13:19 +01:00
Christoph Lohmann 61b20f4bc1 Add a notice in the config.def.h file how to obtain the syntax for
xft/fontcache.
2012-11-25 15:59:16 +01:00
Roberto E. Vargas Caballero 172f65436c Add key for toogling numlock handling
Keypad will generate keycodes when keypad application mode is enabled. It
can cause problems with some programs like vi, which operates in such
mode.

This patch change by default don't generate the keycodes never, but this
behaviour can be changed using the combination Alt + NumLock.
---
 config.def.h |   34 ++++++++++++++++++----------------
 st.c         |   17 +++++++++++++++--
 2 files changed, 33 insertions(+), 18 deletions(-)
2012-11-25 09:23:02 +01:00
Christoph Lohmann cf04354e06 Restoring the Alt + Backspace functionality. Thanks Brandon Invergo! 2012-11-19 17:22:32 +01:00
Roberto E. Vargas Caballero 55087ec2c7 Add application cursor sequences for Home
The commit 'Fixing some key issues with mc' fix the problem where mc didn't
recognize home key because the generated code and the terminfo entry were
different (terminfo khome = \E[1~ but generates \033[H).

Home key in ansi mode should generate the sequence CUP (\033[H) to 0,0 (home
position), but it is also interesting generate a application code which
identifies the key. Real vt520 only generates the ansi sequence CUP, linux
console generates only the application code \033[1~, xterm generates CUP in
ansi mode and \033OH in cursor application mode, rxvt only generates the
application code \033[7~.

This patch sets CUP in ansi mode and \033[1~ in cursor application mode, so
it can be used in both modes and the application mode value is similar to
near values (insert = \033[2~, Prior = \033[5~, Next = \033[6~, End =
\033[4~, Supr = \033[3).
---
 config.def.h |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
2012-11-16 11:32:17 +01:00
Christoph Lohmann 1cbe56026b Fixing some key issues with mc. Thanks nsz! 2012-11-16 05:43:00 +01:00
Christoph Lohmann 2b6521f5d2 Optimizing the key lookup to the X11 function key. It is still possible to
remap other keys.
2012-11-15 20:19:35 +01:00
Christoph Lohmann 927d8fb459 Making all function keys accessible. 2012-11-15 20:03:18 +01:00
Christoph Lohmann a29ab30f25 Adding support for XK_F35. 2012-11-15 20:00:46 +01:00
Christoph Lohmann d5640c7729 Fixing the return and keypad enter sent characters. Terminals produce \r. And
some minor style changes.
2012-11-15 16:26:50 +01:00
Christoph Lohmann e87d21bb3d The crlf mode was reversed. 2012-11-15 15:57:01 +01:00
Christoph Lohmann e7bb14e03e Fixing Return in non-crlf mode. 2012-11-15 15:54:34 +01:00
Roberto E. Vargas Caballero 4389f2eb1b Use XK_ANY_MOD instead of XK_NO_MOD in key definition
Usually terminal emulators don't generate any sequence for a combination
they don't have registered, for example Shift + Next, but st behavior
previous to the keyboard patch generates the sequence without the modifier,
in this example Next. This patch uses the XK_ANY_MOD in order to get this
same behaviour.
---
 config.def.h |  114 ++++++++++++++++++++++++++++++----------------------------
 1 file changed, 59 insertions(+), 55 deletions(-)
2012-11-15 15:36:20 +01:00
Roberto E. Vargas Caballero 16ccf344de Fix tab key
When Shift + Tab is pressed X server send the event XK_ISO_Left_Tab with
ShiftMask, so this is the entry we need in config.def.h

This patch also revert the previous patch for this issue because it breaks
the keyboard.
---
 config.def.h |    2 +-
 st.c         |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
2012-11-14 11:14:29 +01:00
Christoph Lohmann 7474a2fc37 The style inquisition was here again. 2012-11-13 20:13:39 +01:00
Roberto E. Vargas Caballero 620e3bb39e Add missed key definitions
This patch adds the keys for the keypad (in both modes, application mode or
ansi mode) and function keys. It uses the same convention than xterm and
instead of using the XK_Fxx values it generates them using F1-F12 and
modifiers. For example:

   F1 -> ^[OP
   F1 + Shift = F13 -> ^[[1;2P
   F1 + Control = F25 -> ^[[1;5P
   F1 + Mod2 = F37 -> ^[[1;6P
   F1 + Mod1 = F49 -> ^[[1;3P
   F1 + Mod3 = F61 -> ^[[1;4P

It is also important notice than the terminfo capability kIC (shifted insert
key) only can be generated using the keypad keyboard, because the shorcut
for selection paste is using the same combination.

After this path the number of elements in the Key array becomes high, and
maybe a sequencial search is not enough efficient now.
---
 TODO         |    6 +---
 config.def.h |  102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 st.info      |   70 ++++++++++++++++++++++++++++++++++++++--
 3 files changed, 169 insertions(+), 9 deletions(-)
2012-11-13 20:05:02 +01:00
Roberto E. Vargas Caballero 44597b359e Add control and meta combinations for arrow keys
Since there isn't any terminfo capability for control and meta modifiers for
arrows keys it is necessary use the same that almost terminal emulators use,
because there are a lot of programs which have these codes hardcoded.

This cause also that shift combinations are also changed, but in this case
this is not a problem since there are terminfo capabilities for them. After
this patch shift-up and shift-down continue not working in emacs with
TERM=st, but they work with TERM=xterm, so it is possible some other changes
are necessary in the terminfo entry.
---
 config.def.h |   16 ++++++++++++----
 st.info      |    8 ++++----
 2 files changed, 16 insertions(+), 8 deletions(-)
2012-11-13 20:04:54 +01:00
Roberto E. Vargas Caballero ea782bfc5d Remove hardcoded keys form kpress
Some keys were in the Key array while others were hardcoded in
kpress().This cause some problems with some keys which can generate more of
one string based in the configuration of the terminal.
---
 config.def.h |   70 ++++++++++++++++++++++++++++++++++++++++-----------------
 st.c         |   71 +++++++++++++++++++++++++---------------------------------
 2 files changed, 79 insertions(+), 62 deletions(-)
2012-11-13 20:04:45 +01:00
Roberto E. Vargas Caballero 93f31166bf Move Shift + Insert to shortcut
Shift + Insert is used like a hot key for paste the selection, so it is more
logical move it to shortcut array instead of having special code for it.
---
 config.def.h |    1 +
 st.c         |   13 +++----------
 2 files changed, 4 insertions(+), 10 deletions(-)
2012-11-13 20:04:39 +01:00
Christoph Lohmann abe85c0e99 Fixing an out-of-bound bug in the selection code. Thanks Szabolczs Nagy! 2012-11-03 03:24:22 +01:00
Christoph Lohmann 393825f9f8 Moving to the dwm config.h variable usage. 2012-11-02 19:56:02 +01:00
Christoph Lohmann 1d378227c0 Removing the now senseless comment in config.def.h. Thanks to bnwe! 2012-10-28 14:13:39 +01:00
Christoph Lohmann 71b09ec4f1 Adding a more flexible fontstring handling, shortcuts and a zoom function. 2012-10-28 13:25:53 +01:00
Christoph Lohmann 5caa46cf57 Turning on antialias by default really makes it more unreadable. Maybe if once
the majority has bigger screens, this can be turned on by default again.
Thanks pancake, for the hint.
2012-10-05 11:07:55 +02:00
Christoph Lohmann 2752018e27 This adds the fontcache dependency to try something out. Additionally the
invert mode now works as expected. In the config.def.h autohint is set to
false, so the fonts are drawn correctly, without any overlapping.
2012-10-04 22:59:45 +02:00
Christoph Lohmann af9e248f97 Removing the now obsolete definitions from the config.def.h file. 2012-09-30 20:23:45 +02:00
Christoph Lohmann 375b6e5b17 Switching to Liberation Mono as default solely because of line drawing. A next
patch to fix the font symbols in all fonts should make it easier to choose a
better font.
2012-09-26 20:21:59 +02:00
Christoph Lohmann 3a095984b0 Implementing line drawing right. 2012-09-26 20:21:08 +02:00
Christoph Lohmann 246d704ba0 Changing the default font to DejaVu Sans Mono, which is more appealing and
activating antialiasing.
2012-09-24 14:01:59 +02:00
Christoph Lohmann 2b3c1219c8 Initial Xft support for st. More to follow. 2012-09-24 10:20:45 +02:00
Aurélien Aptel 1ba5f4172f config.def.h: typo in comment. 2012-09-18 19:13:19 +02:00
Christoph Lohmann a62789788c Implementing italic-bold. This will require an increase of the avgWdth. 2012-09-14 19:46:07 +02:00
Christoph Lohmann 462a966ee2 Implement italic font support. 2012-09-05 21:48:26 +02:00
Aurélien Aptel 751fb765e4 fix default color overwriten bug. 2012-02-16 00:10:32 +01:00
Aurélien Aptel be2877cd04 show dark cursor when unfocused. 2012-02-15 19:33:48 +01:00
Aurélien Aptel d8e11bdb0e document possible configuration. 2012-02-15 19:11:07 +01:00
Aurélien Aptel 907cb8bfa6 no palette limit (thx Nick) 2011-10-06 21:32:34 +02:00
Aurélien Aptel 6f260ba164 fix custom key handling. 2011-08-14 17:13:59 +02:00
Aurélien Aptel 9d5ea14b9d selection clicks, shift+arrow keys, fast(er) redraw, key mask in config.h (thx Magnus Leuthner) 2011-04-22 00:18:53 +02:00
Aurélien Aptel 4d649c2403 fix insert key, terminfo and changed TERM back to st. (thx Ondrej Martinek) 2011-01-23 12:30:01 +01:00
Aurélien Aptel 9b74fcadc4 utf8 support! print text in delicious unicode greatness! all hail to the glorious Damian Okrasa for the patch!
TERM set back to xterm.
changed default fonts.
Note: drawing is now (even) slower.
2010-11-18 01:00:04 +01:00
Aurélien Aptel 58083da61f set terminal colors to xterm default ones. 2010-09-02 22:35:55 +02:00
Aurélien Aptel ebc287271c removed gfx chars not present in xterm acsc. 2010-09-02 21:59:05 +02:00
Aurélien Aptel f732ca5f1f added correct line drawing characters for default font. 2010-09-01 00:30:39 +02:00
pancake 596bb133a5 fix build
use config.def.h mechanism
add SHELL in config.h
2010-08-30 23:49:15 +02:00