all repos — st @ main

st (suckless terminal) config

b458c19f
apply cursor hack, config
Iris Lightshard nilix@nilfm.cc
54af460b
apply scrollback patches
Iris Lightshard nilix@nilfm.cc
e5e95983
fix buffer overflow when handling long composed input

To reproduce the issue:

"
If you already have the multi-key enabled on your system, then add this line
to your ~/.XCompose file:

[...]
<question> <T> <E> <S> <T> <question> :
"1234567890123456789012345678901234567890123456789012345678901234567890"
"

Reported by and an initial patch by Andy Gozas <andy@gozas.me>, thanks!

Adapted the patch, for now st (like dmenu) handles a fixed amount of composed
characters, or otherwise ignores it. This is done for simplicity sake.
Hiltjo Posthuma hiltjo@codemadness.org
68d1ad9b
bump version to 0.9
Hiltjo Posthuma hiltjo@codemadness.org
00085199
FAQ: document the color emojis crash issue which affected some systems is fixed

It is fixed in libXft 2.3.6:

https://gitlab.freedesktop.org/xorg/lib/libxft/-/blob/libXft-2.3.5/NEWS
Hiltjo Posthuma hiltjo@codemadness.org
72fd3273
st: use `void' to indicate an empty parameter list
Tom Schwindl schwindl@posteo.de
baa9357e
Makefile: add manual path for OpenBSD
Hiltjo Posthuma hiltjo@codemadness.org
8629d9a1
code-golfing: cleanup osc color related code

* adds missing function prototype
* move xgetcolor() prototype to win.h (that's where all the other x.c
  func prototype seems to be declared at)
* check for snprintf error/truncation
* reduces code duplication for osc 10/11/12
* unify osc_color_response() and osc4_color_response() into a single function

the latter two was suggested by Quentin Rameau in his patch review on
the hackers list.
NRK nrk@disroot.org
ef055193
base64_digits: reduce scope, implicit zero, +1 size

the array is not accessed outside of base64dec() so it makes sense to
limit it's scope to the related function. the static-storage duration of
the array is kept intact.

this also removes unnecessary explicit zeroing from the start and end of
the array. anything that wasn't explicitly zero-ed will now be
implicitly zero-ed instead.

the validity of the new array can be easily confirmed via running this
trivial loop:

	for (int i = 0; i < 255; ++i)
		assert(base64_digits[i] == base64_digits_old[i]);

lastly, as pointed out by Roberto, the array needs to have 256 elements
in order to able access it as any unsigned char as an index; the
previous array had 255.

however, this array will only be accessed at indexes which are
isprint() || '=' (see `base64dec_getc()`), so reducing the size of the
array to the highest printable ascii char (127 AFAIK) + 1 might also be
a valid strategy.
NRK nrk@disroot.org
af3bb68a
avoid potential UB when using isprint()

all the ctype.h functions' argument must be representable as an unsigned
char or as EOF, otherwise the behavior is undefined.
NRK nrk@disroot.org
2aefa348
make underlines and strikethroughs respect `chscale`
Zacchary Dempsey-Plante zacc@ztdp.ca
e823e230
Delay redrawals on palette changes

Build on auto-sync and only mark window dirty on palette changes and let
the event handler do the actual draw.
Santtu Lakkala inz@inz.fi
2c5edf28
X10/SGR mouse: use alt as meta key instead of super/windows key
Hiltjo Posthuma hiltjo@codemadness.org
b1d97fec
LICENSE: bump year
Hiltjo Posthuma hiltjo@codemadness.org
ea7cd7b6
Fix mousereport

This patch replaces the previous one I sent.

The following changes are made in this patch:
 - Fix tracking of pressed buttons. Previously, pressing two buttons and
   then releasing one would make st think no buttons are pressed, which
   in particular broke MODE_MOUSEMOTION.
 - Always send the lowest-numbered pressed button on motion events; when
   no button is pressed for a motion event in MODE_MOUSEMANY, then send
   a release. This matches the behaviour of xterm. (Previously, st sent
   the most recently pressed button in the motion report.)
 - Remove UB (?) access to potentially inactive struct member
   e->xbutton.button of XEvent union.
 - Fix (unlikely) possibility of overflow for large button numbers.

The one discrepancy I found between st and xterm is that xterm sometimes
encodes buttons with large numbers (>5) strangely. E.g., xterm reports
presses of buttons 8 and 9 as releases, whereas st properly (?) encodes
them as presses.
robert robertrussell.72001@gmail.com
7fb0c0cc
bump version to 0.8.5
Hiltjo Posthuma hiltjo@codemadness.org
7e1c68f2
FAQ: fix a typo, patch -> path
Hiltjo Posthuma hiltjo@codemadness.org
65f1dc42
Fix overtyping wide characters.

Overtyping the first half of a wide character with the
second half of a wide character results in display garbage.
This is because the trailing dummy is not cleaned up.

i.e.  ATTR_WIDE, ATTR_WDUMMY, ATTR_WDUMMY

Here is a short script for demonstrating the behavior:

	#!/bin/sh
	alias printf=/usr/bin/printf
	printf こんにちは!; sleep 2
	printf '\x1b[5D'; sleep 2
	printf へ; sleep 2
	printf ' '; sleep 2
	echo
jamin acdimalev@gmail.com
a0467c80
Fix null pointer access in strhandle

According to the spec the argument is optional for 104, so p can be
NULL as can be tested with printf '\x1b]104\x07'. This is a regression
of 8e31030.
Jochen Sprickerhof git@jochen.sprickerhof.de
273db5ce
follow-up fix for OSC color sequences, return

Otherwise the message "erresc: unknown str" is printed.
Hiltjo Posthuma hiltjo@codemadness.org
8e310303
Add support for OSC color sequences
Raheman Vaiya r.vaiya@gmail.com
2f6e597e
fix possible rare crash when Xutf8TextPropertyToTextList fails

from the XmbTextListToTextProperty(3) man page:

"If insufficient memory is available for the new value string, the functions
return XNoMemory.  If the current locale is not supported, the functions return
XLocaleNotSupported.  In both of these error cases, the functions do not set
text_prop_return."

Reported by Steffen Nurpmeso <steffen@sdaoden.eu>, thanks!
Hiltjo Posthuma hiltjo@codemadness.org
1d3142da
fix a problem that the standard streams are unexpectedly closed

In the current implementation, the slave PTY (assigned to the variable
`s') is always closed after duplicating it to file descriptors of
standard streams (0, 1, and 2).  However, when the allocated slave PTY
`s' is already one of 0, 1, or 2, this causes unexpected closing of a
standard stream.  The same problem occurs when the file descriptor of
the master PTY (the variable `m') is one of 0, 1, or 2.

In this patch, the original master PTY (m) is closed before it would
be overwritten by duplicated slave PTYs.  The original slave PTY (s)
is closed only when it is not one of the stanrad streams.
Koichi Murase myoga.murase@gmail.com
2ec571a3
Add 14th bit to XK_SWITCH_MOD bitmask

The bits of uint signal in an XKeyEvent which concern the key group (keyboard
layout) are bits 13 and 14, as documented here:
https://www.x.org/releases/X11R7.7/doc/libX11/XKB/xkblib.html#Groups_and_Shift_Levels
In the older version, only bit 13 was marked as part of XK_SWITCH_MOD, this
causes issues for users who have more than two keymaps. the 14th bit is not
in ignoremod, key sequences are not caught by match(), if they switch to a third
or fourth keyboard.
Petar Kapriš petarkapris@firemail.cc
4536f46c
Mild const-correctness improvements.

Only touch a few things, the main focus is to
improve code readability.
Markus F.X.J. Oberhumer markus@oberhumer.com
9e68fdbc
fix: correctly encode mouse buttons >= 8 in X10 and SGR mode

These are typically mapped in X11 to the side-buttons (backward/forwards) on
the mouse. A comparison of the button numbers in SGR mode (first field):

st old:
0 1 2 64 65 66 67 68 69 70

st new (it is the same as xterm now):
0 1 2 64 65 66 67 128 129 130

A script to test and reproduce it, first argument is "h" (on) or "l" (off):

	#!/bin/sh
	printf '\x1b[?1000%s\x1b[?1006%s' "$1" "$1"

	for n in 1 2 3 4 5 6 7 8 9 10; do
		printf 'button %d\n' "$n"
		xdotool click "$n"
		printf '\n\n'
	done
Hiltjo Posthuma hiltjo@codemadness.org
4ef0cbd8
remove unused variable from previous patch
Hiltjo Posthuma hiltjo@codemadness.org
28b4c822
ST: Add WM_ICON_NAME property support

Also added _NET_WM_ICON_NAME.
John Collis john.collis@alliedtelesis.co.nz
fa253f07
bump version to 0.8.4
Hiltjo Posthuma hiltjo@codemadness.org
b27a383a
config.mk: use PKG_CONFIG in commented OpenBSD section
Hiltjo Posthuma hiltjo@codemadness.org
81067c65
LICENSE: bump years
Hiltjo Posthuma hiltjo@codemadness.org
f74a9df6
remove sixel stub code

Remove stub code that was used for an experiment of adding sixel code to st
from the commit f7398434.
Hiltjo Posthuma hiltjo@codemadness.org
818ec746
fix unicode glitch in DCS strings, patch by Tim Allen

Reported on the mailinglist:

"
I discovered recently that if an application running inside st tries to
send a DCS string, subsequent Unicode characters get messed up. For
example, consider the following test-case:

    printf '\303\277\033P\033\\\303\277'

...where:

  - \303\277 is the UTF-8 encoding of U+00FF LATIN SMALL LETTER Y WITH
    DIAERESIS (ÿ).
  - \033P is ESC P, the token that begins a DCS string.
  - \033\\ is ESC \, a token that ends a DCS string.
  - \303\277 is the same ÿ character again.

If I run the above command in a VTE-based terminal, or xterm, or
QTerminal, or pterm (PuTTY), I get the output:

    ÿÿ

...which is to say, the empty DCS string is ignored. However, if I run
that command inside st (as of commit 9ba7ecf), I get:

    ÿÿ

...where those last two characters are \303\277 interpreted as ISO8859-1
characters, instead of UTF-8.

I spent some time tracing through the state machines in st.c, and so far
as I can tell, this is how it works currently:

  - ESC P sets the "ESC_DCS" and "ESC_STR" flags, indicating that
    incoming bytes should be collected into the strescseq buffer, rather
    than being interpreted.
  - ESC \ sets the "ESC_STR_END" flag (when ESC is received), and then
    calls strhandle() (when \ is received) to interpret the collected
    bytes.
  - If the collected bytes begin with 'P' (i.e. if this was a DCS
    string) strhandle() sets the "ESC_DCS" flag again, confusing the
    state machine.

If my understanding is correct, fixing the problem should be as easy as
removing the line that sets ESC_DCS from strhandle():

diff --git a/st.c b/st.c
index ef8abd5..b5b805a 100644
--- a/st.c
+++ b/st.c
@@ -1897,7 +1897,6 @@ strhandle(void)
		xsettitle(strescseq.args[0]);
		return;
	case 'P': /* DCS -- Device Control String */
-		term.mode |= ESC_DCS;
	case '_': /* APC -- Application Program Command */
	case '^': /* PM -- Privacy Message */
		return;

I've tried the above patch and it fixes my problem, but I don't know if
it introduces any others.
"
Hiltjo Posthuma hiltjo@codemadness.org
9ba7ecf7
FAQ: fix single-buffer patch

rebase against master
Hiltjo Posthuma hiltjo@codemadness.org
a2a70449
config.def.h: add an option allowwindowops, by default off (secure)

Similar to the xterm AllowWindowOps option, this is an option to allow or
disallow certain (non-interactive) operations that can be insecure or
exploited.

NOTE: xsettitle() is not guarded by this because st does not support printing
the window title. Else this could be exploitable (arbitrary code execution).
Similar problems have been found in the past in other terminal emulators.

The sequence for base64-encoded clipboard copy is now guarded because it allows
a sequence written to the terminal to manipulate the clipboard of the running
user non-interactively, for example:

printf '\x1b]52;0;ZWNobyBoaQ0=\a'
Hiltjo Posthuma hiltjo@codemadness.org
0f8b4065
FAQ: add some details about the w3m img hack

... and an example patch to switch from double-buffering to a single buffer.
Hiltjo Posthuma hiltjo@codemadness.org
e6e2c619
tiny style fix
Hiltjo Posthuma hiltjo@codemadness.org
94b8ec00
Partially add back in "support REP (repeat) escape sequence"

Add the functionality back in for xterm compatibility, but do not expose the
capability in st.info (yet).

Some notes:

It was reverted because it caused some issues with ncurses in some
configurations, namely when using BSD padding (--enable-bsdpad, BSD_TPUTS) in
ncurses it caused issues with repeating digits.

A fix has been upstreamed in ncurses since snapshot 20200523. The fix is also
backported to OpenBSD -current.
Hiltjo Posthuma hiltjo@codemadness.org
dec6b530
Call xsetcursor to set win.cursor in main

In xsetcursor, remove "DEFAULT(cursor, 1)" because 0 is a valid value.
Increase max allowed value of cursor from 6 to 7 (st extension).
Steve Ward planet36@gmail.com
475a0a36
Revert "support REP (repeat) escape sequence"

This reverts commit e8392b282c2eaa28725241a9612804fb55113da4.

There is currently a bug in older ncurses versions (like on OpenBSD) where a
fix for a bug with REP is not backported yet. Most likely in tty/tty_update.c:

Noticed while using lynx (which uses ncurses/curses).
To reproduce using lynx: echo "Z0000000" | lynx -stdin

or using the program:

int
main(void)
{
	WINDOW *win;
	win = initscr();

	printw("Z0000000");

	refresh();

	sleep(5);

	return 0;
}

This prints "ZZZZZZZ" (incorrectly).
Hiltjo Posthuma hiltjo@codemadness.org
e8392b28
support REP (repeat) escape sequence

The sequence \e[Nb prints the last printed char N (more) times if it's
printable, and it's ignored after newline or other control chars.

This is Ecma-048/ANSI-X3.6 sequence and not DEC VT. It's supported by
xterm, and ncurses uses it when possible, e.g. when TERM is xterm* (and
with this commit also st*).

xterm supports only codepoints<=255, possibly due to internal limits.
We support any value/codepoint which was placed in a cell.

To test:
- tput rep 65 4 -> prints 'AAAA'
- printf "\342\225\246\033[4b" -> prints U+2566 1+4 times.
Avi Halachmi (:avih) avihpit@yahoo.com
f8afebdf
Add rin terminfo capability

Tianlin Qu discovered that st is missing rin (scroll back #1 lines).
Roberto E. Vargas k0ga@shike2.com
bda9c9ff
Make shift+wheel behaves as shift+Prev/Next

St uses a very good hack where mouse wheel genereates ^Y and ^E,
that are the same keys that less and vi uses for backward and
fordward scrolling. Scroll, as many terminal emulators, use
shift+Prev/Next for scrolling, but it is also using ^E and ^Y
for scroling, characters that are reserved in the POSIX shell
in emacs mode for end of line and yanking, making scroll unsable
in st.

This patch adds a new hack, making shift+wheel returning the
same sequences than shift+Prev/Next, meaning that scroll or
any other similar program will not be able to differentiate
between them.
k0ga k0ga@shike2.com
045a0fab
Fix selection: selscroll
Jakub Leszczak szatan@gecc.xyz
9c30066e
Fix selection: ignore ATTR_WRAP when rectangular selection in getsel
Jakub Leszczak szatan@gecc.xyz
8304d4f0
Fix selection: selclear in tputc
Jakub Leszczak szatan@gecc.xyz
914fb825
code-style: add fallthrough comment

Patch by Steve Ward, thanks.
Hiltjo Posthuma hiltjo@codemadness.org
cde480c6
optimize column width calculation and utf-8 encode for ASCII

In particular on OpenBSD and on glibc wcwidth() is quite expensive.
On musl there is little difference.
Hiltjo Posthuma hiltjo@codemadness.org
8211e36d
fix for incorrect (partial) written sequences when libc wcwidth() == -1

Fix an issue with incorrect (partial) written sequences when libc wcwidth() ==
-1. The sequence is updated to on wcwidth(u) == -1:

	c = "\357\277\275"

but len isn't.

A way to reproduce in practise:

* st -o dump.txt
* In the terminal: printf '\xcd\xb8'
- This is codepoint 888, on OpenBSD it reports wcwidth() == -1.
- Quit the terminal.
- Look in dump.txt (partial written sequence of "UTF_INVALID").

This was introduced in:

"	commit 11625c7166b7e4dad414606227acec2de1c36464
	Author: czarkoff@gmail.com <czarkoff@gmail.com>
	Date:   Tue Oct 28 12:55:28 2014 +0100

	    Replace character with U+FFFD if wcwidth() is -1

	    Helpful when new Unicode codepoints are not recognized by libc."

Change:

Remove setting the sequence. If this happens to break something, another
solution could be setting len = 3 for the sequence.
Hiltjo Posthuma hiltjo@codemadness.org
87545c61
tiny code-style and typo-fix in comment
Hiltjo Posthuma hiltjo@codemadness.org
1d590910
auto-sync: draw on idle to avoid flicker/tearing

st could easily tear/flicker with animation or other unattended
output. This commit eliminates most of the tear/flicker.

Before this commit, the display timing had two "modes":

- Interactively, st was waiting fixed `1000/xfps` ms after forwarding
  the kb/mouse event to the application and before drawing.

- Unattended, and specifically with animations, the draw frequency was
  throttled to `actionfps`. Animation at a higher rate would throttle
  and likely tear, and at lower rates it was tearing big frames
  (specifically, when one `read` didn't get a full "frame").

The interactive behavior was decent, but it was impossible to get good
unattended-draw behavior even with carefully chosen configuration.

This commit changes the behavior such that it draws on idle instead of
using fixed latency/frequency. This means that it tries to draw only
when it's very likely that the application has completed its output
(or after some duration without idle), so it mostly succeeds to avoid
tear, flicker, and partial drawing.

The config values minlatency/maxlatency replace xfps/actionfps and
define the range which the algorithm is allowed to wait from the
initial draw-trigger until the actual draw. The range enables the
flexibility to choose when to draw - when least likely to flicker.

It also unifies the interactive and unattended behavior and config
values, which makes the code simpler as well - without sacrificing
latency during interactive use, because typically interactively idle
arrives very quickly, so the wait is typically minlatency.

While it only slighly improves interactive behavior, for animations
and other unattended-drawing it improves greatly, as it effectively
adapts to any [animation] output rate without tearing, throttling,
redundant drawing, or unnecessary delays (sounds impossible, but it
works).
Avi Halachmi (:avih) avihpit@yahoo.com
d6ea0a1a
replace exit(3) by _exit(2) in signal handler sigchld()

exit(3) is not async-signal-safe but, _exit(2) is.
This change prevents st to crash and dump core.
Jan Klemkow j.klemkow@wemelug.de
43a395ae
bump version to 0.8.3
Hiltjo Posthuma hiltjo@codemadness.org
72e3f6c7
Update XIM cursor position only if changed

Updating XIM cursor position is expensive, so only update it when cursor
position changed.
Ivan Tham pickfire@riseup.net
33a9a456
just remove the EOF message
Hiltjo Posthuma hiltjo@codemadness.org
771bc401
Add st-mono terminfo entry

This entry is intended for monocolor display and it is very
helpful for color haters.
Roberto E. Vargas Caballero k0ga@shike2.com
d66bd405
config.def.h: add a comment for the scroll variable
Hiltjo Posthuma hiltjo@codemadness.org
e9973035
Fix small typos
Hiltjo Posthuma hiltjo@codemadness.org
c1145268
Launch scroll program with the default shell
Quentin Rameau quinq@fifth.space
0b73612c
Update FAQ with the last modifications
Roberto E. Vargas Caballero k0ga@shike2.com
019449a7
Add terminfo entries for backspace mode

St used to use backspace as BS until the commit 230d0c8, but due
to general lack of knowledge of lusers, we moved to the most common
configuration in linux to avoid answering the same question 3 times
per month. With the most common configuration we have a backspace
that returns a DEL, and we have a Delete key that doesn't return a
DEL character neither a BS.

When dealing with devices connected using a serial line (or even
with Plan9) it is more common Backspace as BS and Delete as DEL. For
this reason, st is not always the best tool when you talk with a
serial device.

This patch adds new terminfo entries for Backspace as BS and Delete
as DEL. A patch for confg.h is also added, to make easier switch
between both configurations.
Roberto E. Vargas Caballero k0ga@shike2.com
fbae700a
Fix style issue
Roberto E. Vargas Caballero k0ga@shike2.com
e52319cc
ttyread: test for EOF while reading tty

When a read operation returns 0 then it means that we arrived to the end of the
file, and new reads will return 0 unless you do some other operation such as
lseek(). This case happens with USB-232 adapters when they are unplugged.
Roberto E. Vargas Caballero k0ga@shike2.com
21e0d6e8
Add support for scroll(1)

Scroll is a program that stores all the lines of its child and be used in st as
a way of implementing scrollback.

This solution is much better than implementing the scrollback in st itself
because having a different program allows to use it in any other program
without doing modifications to those programs.
Roberto E. Vargas Caballero k0ga@shike2.com
5703aa03
make argv0 not static, fixes a warning with tcc

Reported by Aajonus, thanks!
Hiltjo Posthuma hiltjo@codemadness.org
28ad2883
mouseshortcuts: fix custom modifier on release

This line didn't work at mshortcuts at config.h:

  /*  mask       button   function  arg       release */
    { ShiftMask, Button2, selpaste, {.i = 0}, 1 },

and now it does work.

The issue was that XButtonEvent.state is "the logical state ... just prior
to the event", which means that on release the state has the Button2Mask
bit set because button2 was down just before it was released.

The issue didn't manifest with the default shift + middle-click on release
(to override mouse mode) because its specified modifier is XK_ANY_MOD, at
which case match(...) ignores any specific bits and simply returns true.

The issue also doesn't manifest on press, because prior to the event
Button<N> was not down and its mask bit is not set.

Fix by filtering out the mask of the button which we're currently matching.

We could have said "well, that's how button events behave, you should
use ShiftMask|Button2Mask for release", but this both not obvious to
figure out, and specifically here always filtering does not prevent
configuring any useful modifiers combination. So it's a win-win.
Avi Halachmi (:avih) avihpit@yahoo.com
51e19ea1
Remove explicit XNFocusWindow

XCreateIC ICValues default XNFocusWindow to XNClientWindow if not
specified, it can be omitted since it is the same.

From the documentation
https://www.x.org/releases/current/doc/libX11/libX11/libX11.html

> Focus Window
>
> The XNFocusWindow argument specifies the focus window. The primary
> purpose of the XNFocusWindow is to identify the window that will receive
> the key event when input is composed.
>
> When this XIC value is left unspecified, the input method will use the
> client window as the default focus window.
Ivan Tham pickfire@riseup.net
26cdfebf
x: fix XIM handling

Do not try to set specific IM method, let the user specify it with
XMODIFIERS.

If the requested method is not available or opening fails, fallback to
the default input handler and register a handler on the new IM server
availability signal.

Do the same when the input server is closed and (re)started.
Quentin Rameau quinq@fifth.space
cd785755
x: check we still have an XIC context before accessing it
Quentin Rameau quinq@fifth.space
2cb53914
x: do not instantiate a new nested list on each cursor move
Quentin Rameau quinq@fifth.space
99de3339
x: move IME variables into XWindow ime embedded struct
Quentin Rameau quinq@fifth.space
895e5b50
Increase XmbLookupString buffer

Current buffer is too short to input medium to long sentences from IME.
Input with longer text will show the wrong input, taking 64 instead of
32 bytes should be enough for most of the cases. Broken cases before,

Chinese (taken from song 也可以)
可不可以轻轻的松开自己

Japanese (taken from bootleggers rom quote)
あなたは家のように感じる
Ivan Tham pickfire@riseup.net
38483011
update FAQ

- add common question about the w3m image drawing hack.
- remove some bad advise about $TERM.
- change some links to https.
Hiltjo Posthuma hiltjo@codemadness.org
2e54a21b
OSC 52 - copy to clipboard: don't limit to 382 bytes

Strings which an application sends to the terminal in OSC, DCS, etc
are typically small (title, colors, etc) but one exception is OSC 52
which copies text to the clipboard, and is used for instance by tmux.

Previously st cropped these strings at 512 bytes, which for OSC 52
limited the copied text to 382 bytes (remaining buffer space before
base64). This made it less useful than it can be.

Now it's a dynamic growing buffer. It remains allocated after use,
resets to 512 when a new string starts, or leaked on exit.

Resetting/deallocating the buffer right after use (at strhandle) is
possible with some more code, however, it doesn't always end up used,
and to cover those cases too will require even more code, so resetting
only on new string is good enough for now.
Avi Halachmi (:avih) avihpit@yahoo.com
289c52b7
CSIEscape, STREscape: use size_t for buffer length
Hiltjo Posthuma hiltjo@codemadness.org
7ceb3d1f
STREscape: don't trim prematurely

STRescape holds strings in escape sequences such as OSC and DCS, and
its buffer is 512 bytes.

If the input is too big then trailing chars are ignored, but the test
was off-by-1 such that it took 510 chars instead of 511 (before a
terminating NULL is added).

Now the full size can be utilized.
Avi Halachmi (:avih) avihpit@yahoo.com
ea4d933e
base64dec: don't read out of bounds

Previously, base64dec checked terminating input '\0' every 4 calls to
base64dec_getc, where the latter progressed one or more chars on each
call, and could read past '\0' in the way it was used.

The input to base64dec currently comes only from OSC 52 escape seq
(copy to clipboard), and reading past '\0' or even past the buffer
boundary was easy to trigger.

Also, even if we could trust external input to be valid base64, there
are different base64 standards, and not all of them require padding
to 4 bytes blocks (using trailing '=' chars).

It didn't affect short OSC 52 strings because the buffer is initialized
to 0's, so typically it did stop within the buffer, but if the string
was trimmed to fit (the buffer is 512 bytes) then it did also read past
the end of the buffer, and the decoded suffix ended up arbitrary.

This patch makes base64dec_getc not progress past '\0', and instead
produce fake trailing padding of '='.

Additionally, at base64dec, if padding is detected at the first or
second byte of a quartet, then we identify it as invalid and abort
(a valid quartet has at least two leading non-padding bytes).
Avi Halachmi (:avih) avihpit@yahoo.com
83866428
Fix tmux terminfo extensions Se and Ss

The tmux terminfo extensions Ss and Se are currently specified as
booleans in `st.info`. They should be strings. See
https://github.com/tmux/tmux/blob/eeedb43ae847a0a692ceea965f7556e84bca4fd0/tty-term.c
lines 254 and 265.

I have used the values from
https://invisible-island.net/ncurses/terminfo.src.html#toc-_S_I_M_P_L_E_T_E_R_M
for this patch.
Sebastian J. Bronner waschtl@sbronner.com
1f09f0b0
apply hints before initial mapping (ICCCM)

For WM_CLASS this is mentioned in the ICCCM docs
https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.2.5
(third sentence).

When changing the WM_CLASS from the command line, this is necessary for
window managers to pick it up before applying class-based rules.
Ingo Lohmar ingo.lohmar@posteo.net
a2c479c4
mouse shortcuts: allow using forcemousemod (e.g. shift)

The recent mouse shurtcuts commits allow customization, but ignore
forcemousemod mask (default: shift) as a modifier, for no good reason
other than following the behavior of the KB shortcuts.

Allow using forcemousemod too, which now can be used to invoke
different shortcuts, though the automatic effect of forcemousemod will
be lost for buttons which use mask with forcemousemod.

E.g. the default is:

static uint forcemousemod = ShiftMask;
...
{ XK_ANY_MOD,           Button4, ttysend,        {.s = "\031"} },
...

where ttysend will be invoked for button4 with any mod when not in mouse
mode, and with shift when in mouse mode.

Now it's possible to do this:
{ ShiftMask,            Button4, ttysend,        {.s = "foo"} },
{ XK_ANY_MOD,           Button4, ttysend,        {.s = "\031"} },

Which will invoke ttysend("foo") while shift is held and ttysend("\031")
otherwise. Shift still overrides mouse mode, but will now send "foo".

Previously with this setup the second binding was always invoked
because the forceousemod mask was always removed from the event.

Buttons which don't use forcemousemod behave the same as before.

This is useful e.g. for the scrollback mouse patch, which wants to
configure shift+wheel for scrollback, while keeping the normal behavior
without shift.
Avi Halachmi (:avih) avihpit@yahoo.com
d2b75db8
mouse shortcuts: don't hardcode selpaste

Because selpaste is activated on release, a release flag was added to
mouse shortcuts which controls whether activation is on press/release,
and selpaste binding to button2 was moved to config.h .

button1 remains the only hardcoded mouse button - for selection + copy.
Avi Halachmi (:avih) avihpit@yahoo.com
b6d280de
mouse shortcuts: allow override for all shortcuts

Allow forceselmod to override all mouse shortcuts rather than only
selection, and rename it to forcemousemod as it's now more appropriate.

This will affect mouse shortcuts which use mask other than XK_ANY_MOD.

This does not affect the default behavior because the default mouse
shortcuts (wheel) use XK_ANY_MOD, where forceselmod already activated
the override also before this change.

Previously, if a mouse shortcut was configured with a specific mod and
forceselmod was held, then the shortcut did not execute unless the
configured mod included forceselmod.
Avi Halachmi (:avih) avihpit@yahoo.com
ba7f4d69
mouse shortcuts: allow same functions as kb shortcuts

Previously mouse shortcuts supported only ttywrite.

This required adding an "Arg" function ttysend - which does what the
original mouse shortcuts did.
Avi Halachmi (:avih) avihpit@yahoo.com
2b8333f5
config.def.h: remove crlf value section

this is not used anymore.

patch sent as an ed script using RFC2549 by k0ga.
Hiltjo Posthuma hiltjo@codemadness.org
caa1d8fb
FAQ: add entry about color emoji Xft bug

This has been asked many times on IRC and the mailinglist. Make it easier to
find information about this particular Xft issue by adding it to the FAQ.
Hiltjo Posthuma hiltjo@codemadness.org
f1546cf9
selection: fix view to match actual selection on first cell
Avi Halachmi (:avih) avihpit@yahoo.com
21367a04
revert part of commit add0211522737b79dad990ccd65c8af63b5cc1dd

"use iswspace()/iswpunct() to find word delimiters

    this inverts the configuration logic: you no longer provide a list of
    delimiters -- all space and punctuation characters are considered
    delimiters, unless listed in extrawordchars."

Feedback from IRC and personal preference.
Hiltjo Posthuma hiltjo@codemadness.org
b6502560
dont print color warning on color reset OSC 104 without parameter

also print explicitly "(null)" when printf "%s" p=NULL.

noticed when exiting mutt: printf '\x1b]104\x07'
Hiltjo Posthuma hiltjo@codemadness.org
9acec468
minor code-style, initialize var at the top of function
Hiltjo Posthuma hiltjo@codemadness.org
927621f6
config.def.h: tweak extra worddelimiters

This changes the selection more like xterm.
To test try: "find /" and select a path.
Hiltjo Posthuma hiltjo@codemadness.org
add02115
use iswspace()/iswpunct() to find word delimiters

this inverts the configuration logic: you no longer provide a list of
delimiters -- all space and punctuation characters are considered
delimiters, unless listed in extrawordchars.
Lauri Tirkkonen lotheac@iki.fi
d5efd256
replace utf8strchr with wcschr
Lauri Tirkkonen lotheac@iki.fi
75b4ba4b
be silent about explicitly unhandled mouse modes
Lauri Tirkkonen lotheac@iki.fi
ed68fe7d
simplify (greedy) font caching allocating a bit

POSIX says:
"If ptr is a null pointer, realloc() shall be equivalent to malloc() for the
 specified size."
Hiltjo Posthuma hiltjo@codemadness.org
4e0135af
style: remove double empty newlines
Hiltjo Posthuma hiltjo@codemadness.org
a8cb8e94
fix use after free in font caching algorithm

Current font caching algorithm contains a use after free error. A font
removed from `frc` might be still listed in `wx.specbuf`. It will lead
to a crash inside `XftDrawGlyphFontSpec()`.

Steps to reproduce:
$ st -f 'Misc Tamsyn:scalable=false'
$ curl https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt

Of course, result depends on fonts installed on a system and fontconfig.
In my case, I'm getting consistent segfaults with different fonts.

I replaced a fixed array with a simple unbounded buffer with a constant
growth rate. Cache starts with a capacity of 0, gets increments by 16,
and never shrinks. On my machine after `cat UTF-8-demo.txt` buffer
reaches a capacity of 192. During casual use capacity stays at 0.
magras dr.magras@gmail.com
e85b6b64
better Input Method Editor (IME) support

Features:

- Allow input methods swap with hotkey (E.g. left ctrl + left shift).
- Over-the-spot pre-editing style, pre-edit data placed over insertion point.
- Restart IME without segmentation fault.

TODO:

- Automatically pickup IME if st started before IME
Ivan Tham pickfire@riseup.net
75f92eb3
bump version to 0.8.2
Hiltjo Posthuma hiltjo@codemadness.org
3be4cf11
config: add Shift+Insert as selpaste() again

This was changed before in:
commit 20f713548de451b67db3306cf8cf7b2f38fee05c on Wed Jan 25 19:17:38 2017
Hiltjo Posthuma hiltjo@codemadness.org
16d98738
Let the user specify CPPFLAGS

This complements the work done in d4928ed, allowing the user to specify
the preprocessor flags with the CPPFLAGS environment variable. This is
useful for example to specify preprocessor macros with -D.

CFLAGS could be used instead, but CPPFLAGS is more correct and is expected
to be honored in some cases. For example, the helper scripts to build
Debian packages make use of CPPFLAGS, but the variable is currently
being ignored unless manually appended to CFLAGS.
Paride Legovini pl@ninthfloor.org
e23acb91
Set the path of pkg-config in a variable instead of hardcoding it

In this way the path of pkg-config can be overridden from the command
line. This is useful for example when cross-compiling.
Paride Legovini pl@ninthfloor.org
7e19e116
Makefile: fix dependencies on config.h

patch by Younes Khoudli (changed slightly). Thanks
Hiltjo Posthuma hiltjo@codemadness.org
096b125d
output child WEXITSTATUS/WTERMSIG on abnormal termination
Lauri Tirkkonen lotheac@iki.fi
d7bf023b
fix memory leak in xloadcols()

reported by Avi Halachmi (:avih)" <avihpit@yahoo.com>

patch slightly changed by me.
Hiltjo Posthuma hiltjo@codemadness.org
b4d68d4d
st: small typofix in comment
Hiltjo Posthuma hiltjo@codemadness.org
30ec9a3d
small code-style fix
Hiltjo Posthuma hiltjo@codemadness.org
67d0cb65
Remove the ISO 14755 feature

And move it to the patches section.
Keeping it would force to add an exec pledge on OpenBSD, and some
people think it's bloated, so bye!
Quentin Rameau quinq@fifth.space
4f4bccd1
Revert "Simplify cursor color handling"

This reverts commit 1911c9274d9b03f3d7999c6ce26e2d5169642d26.
Hiltjo Posthuma hiltjo@codemadness.org
8ed7a4b3
Revert "Make cursor follow text color"

This reverts commit b51bcd5553af3db394014efbd78acf7828fa48ff.
Hiltjo Posthuma hiltjo@codemadness.org
732be223
Revert "Fix crash when cursor color is truecolor"

This reverts commit 5535c1f04c665c05faff2a65d5558246b7748d49.
Hiltjo Posthuma hiltjo@codemadness.org
5535c1f0
Fix crash when cursor color is truecolor

Reported-by: Ivan Tham <pickfire@riseup.net>
Jules Maselbas jules.maselbas@grenoble-inp.org
b51bcd55
Make cursor follow text color
Jules Maselbas jules.maselbas@grenoble-inp.org
1911c927
Simplify cursor color handling
Jules Maselbas jules.maselbas@grenoble-inp.org
29f341da
Fix crash on resize

Prevent to realloc xw.specbuc with a negative number of col.
Add proper hints for the minimal size, for one character.
Jules Maselbas jules.maselbas@grenoble-inp.org
dc3b5bab
config.mk: remove extra newline before EOF
Hiltjo Posthuma hiltjo@codemadness.org
235a783e
code-style for pledge(2)

feedback from Klemens, thanks
Hiltjo Posthuma hiltjo@codemadness.org
30ce2cc0
Pledge on OpenBSD
Hiltjo Posthuma hiltjo@codemadness.org
041912a7
error message style and use strerror in a few places
Hiltjo Posthuma hiltjo@codemadness.org
bd3f7fd8
st -v: remove years and copyright text
Hiltjo Posthuma hiltjo@codemadness.org
74cff67b
set sel.alt in selstart instead of selextend
Daniel Tameling tamelingdaniel@gmail.com
6f0f2b7e
bump version to 0.8.1
Hiltjo Posthuma hiltjo@codemadness.org
f4020b2c
fix regression by selecting clipboard text

"restore the old behaviour that the primary doesn't get deleted by a simple
left click"

Patch by Daniel Tameling <tamelingdaniel@gmail.com>, thanks!
Hiltjo Posthuma hiltjo@codemadness.org
a5a928bf
don't modify argv, use a counter

on some platforms (OpenBSD) this changes the exposed argv in tools using
the kvm_* interface, such as ps and pgrep.
Hiltjo Posthuma hiltjo@codemadness.org
6ac8c8aa
selextend: clarify: !sel.mode == SEL_IDLE
Hiltjo Posthuma hiltjo@codemadness.org
5345db3c
clipcopy: no need to check for free(NULL), set to NULL after free
Hiltjo Posthuma hiltjo@codemadness.org
7648697f
minor code-style: whitespace fixes
Hiltjo Posthuma hiltjo@codemadness.org
0b507bb7
Fix title initialization
Quentin Rameau quinq@fifth.space
e7ef3c4c
Fix regression from 69e32a6 when setting title.
Quentin Rameau quinq@fifth.space
8ab62903
LICENSE: fix a few years
Hiltjo Posthuma hiltjo@codemadness.org
a712c2dd
update LICENSE: major contributors
Hiltjo Posthuma hiltjo@codemadness.org
0f245dfe
Makefile: add all files to make dist
Hiltjo Posthuma hiltjo@codemadness.org
49a4f91f
bump version to 0.8
Hiltjo Posthuma hiltjo@codemadness.org
c5ba9c02
use math.h for ceilf
Hiltjo Posthuma hiltjo@codemadness.org
b81888ee
xhints: no need to initialize sizeh
Hiltjo Posthuma hiltjo@codemadness.org
8b8255ac
regression: include termios.h for tcsendbreak etc
Hiltjo Posthuma hiltjo@codemadness.org
20e0da7f
General cleanup

Simplifies logic in a couple places and removes a redundant function
call.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
403c57eb
Clean up #includes

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
e0215d53
Reduce visibility wherever possible

When possible, declare functions/variables static and move struct
definitions out of headers.  In order to allow utf8decode to become
internal, use codepoint for DECSCUSR extension directly.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
30683c70
Limit usage of extern to config.h globals

Prefer passing arguments to declaring external global variables.  The
only remaining usage of extern is for config.h variables which are
needed in st.c instead of x.c (where it is now included).

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
a3beb626
Remove x.c dependency on term

The xinit function only needs to the rows/cols, so pass those in rather
than accessing term directly.  With a bit of arithmetic, we are able to
avoid the need for term.row and term.col in x2col, y2row, and
xdrawglyphfontspecs as well, completing the removal.

Term is now fully internal to st.c.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
a5dc1b46
Pull term references out of xdrawcursor

Gradually reducing x.c dependency on Term object.  Old and new cursor
glyph/position are passed to xdrawcursor.  (There may be an opportunity
to refactor further if we can unify "clear old cursor" and "draw new
cursor" functionality.)

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
88d8293f
Move win-agnostic parts of draw/drawregion to st.c

Introduces three functions to encapsulate X-specific behavior:
 * xdrawline: draws a portion of a single line (used by drawregion)
 * xbegindraw: called to prepare for drawing (will be useful for e.g.
   Wayland) and returns true if drawing should happen
 * xfinishdraw: called to finish drawing (used by draw)

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
05c66cb3
Split mode bits between Term and TermWindow

Moves the mode bits used by x.c from Term to TermWindow, absorbing
UI/input-related mode bits (visible/focused/numlock) along the way.

This is gradually reducing external references to Term.  Since
TermWindow is already internal to x.c, we add xsetmode() to allow st to
modify window bits in accordance with escape sequences.

IS_SET() is redefined accordingly (term.mode in st.c, win.mode in x.c).

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
33201ac6
Move CRLF input processing into ttywrite

This also allows us to remove the crlf field from the Key struct, since
the only difference it made was converting "\r" to "\r\n" (which is now
done automatically in ttywrite).  In addition, MODE_CRLF is no longer
referenced from x.c.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
52d6fb1a
Move terminal echo logic into st.c

The only thing differentiating ttywrite and ttysend was the potential
for echo; make this a parameter and remove ttysend.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
cfc7acdf
Move remaining selection mode logic into selextend

The "done" parameter indicates a change which finalizes the selection
(e.g. a mouse button release as opposed to motion).

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
bcb5d3ad
Move terminal-related selection logic into st.c

The front-end determines information about mouse clicks and motion, and
the terminal handles the actual selection start/extend/dirty logic by
row and column.

While we're in the neighborhood, we'll also rename getbuttoninfo() to
mousesel() which is, at least, less wrong.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
5683b1f8
Move X-specific selection info into XSelection

Data about PRIMARY/CLIPBOARD and clicks are part of the front-end, not
the terminal.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
138caf29
Have selected() check whether selection exists

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
d84f3f4b
Rely on ttyresize to set tty size

This removes ttynew's dependency on cresize being called first, and then
allows us to absorb the ttyresize call into cresize (which always
precedes it).

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
8b564c1a
Remove X and fontconfig from st.c

None of the X-related includes are needed any longer.  In addition, move
the X modifier defines into x.c, as they are not used outside.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
3bb900cd
Remove Time argument from xsetsel

This is an X type and should be internal to x.c.

The selcopy() function was a single line and only used in one place, so
it was inlined to reduce LOC.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
323d38da
Make win variable internal to x.c

There was only a single reference to the `win` variable in st.c, so
exporting that to x.c allows us to rid ourselves of another extern.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
416dd257
Move X-related config.h types into x.c

No need to expose Shortcut, MouseShortcut, and Key anymore.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
75c9a0ee
Remove unneeded array-length variables

These were only used in x.c, which now has direct visibility of the
config.h arrays.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
428f0196
Inline clipboard functions

No need to keep a function that only calls another function in the same
file.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
65976c1a
Move config.h include from st.c to x.c

config.h includes references to KeySyms and other X stuff.  Until we
come up with a cleaner way to separate configuration, it is simpler
(leads to more code removal) to have this here.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
32d3b1d0
Factor out equivalent code from ttyread/ttysend

The echo-to-terminal portions of ttyread and ttysend were actually doing
the same thing.  New function twrite() now handles this.  The parameter
show_ctrl determines whether control characters are shown as "^A".  This
was the only difference between tputc and techo, and techo is now unused
and removed.

(This commit should not change st's behaviour.)

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
69e32a61
Move opt_* into same file as main()/run()

This commit is purely about reducing externs and LOC.  If the main and
run functions ever move elsewhere (which will probably make sense
eventually), these should come along with them.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
ed132e11
Move key-matching functions into x.c

Modifiers and keysyms are specific to X, and the functions match and
kmap are only used in x.c.  Needed to global-ize the key arrays and
lengths from config.h (for now).

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
dbe8676d
Pass new dimensions into ttyresize

This removes another reference to TermWindow from st.c.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
a8314643
Move window-manipulating functions into x.c

xresize is now internal to x.c

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
a09138af
Move font/fontspec variables into x.c and XWindow

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
626b0ae4
Move window urgency handling entirely into x.c

This allows us to make xseturgency internal.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
d5275012
Move zoom functions into x.c

This makes x(un)loadfonts internal to x.c.  Needed to reorder includes
and move a typedef to keep the compiler happy.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
3518dba2
Move usage() to be with run() in x.c

run/usage/xinit are now all internal to x.c

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
3e44ee55
Call xsetenv() in main process instead of child

This makes xsetenv internal to x.c, and allows iso14755's external
command to use $WINDOWID instead of having to snprintf it again.  (The
same benefit will apply to the externalpipe patch.)  The xwinid function
is no longer needed.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Devin J. Pohly djpohly@gmail.com
1f24bde8
Fix color with FAINT attribute

The alpha value needs to be initialized as well.
Benno Fünfstück benno.fuenfstueck@gmail.com
e829e13b
Apply ATTR_REVERSE after ATTR_FAINT

An example where the new behaviour makes more sense:

Suppose some text is formatted with ATTR_FAINT for red for the foreground, so it
is rendered in a dark red. In that case, when selected with the mouse, the
intended behaviour is that foreground and background color are swapped: so the
selection should be rendered in dark red and the text in the default background
color.

Before this patch, what happened was that the selection would be in normal red
and the text in the darkened background color, making it almost unreadable.

For an example application that uses the FAINT attribute, try dmesg from
util-linux with color support, it uses FAINT for segfault messages.
Benno Fünfstück benno.fuenfstueck@gmail.com
c1d23afa
Fix FAQ typo
George Ornbo george@shapeshed.com
0ac685fc
Fix manpage typo

Signed-off-by: Paride Legovini <pl@ninthfloor.org>
Paride Legovini pl@ninthfloor.org
b1338e91
Add an error for XftFontOpenPattern failure.
Gary Allen Vollink gary@vollink.com
b2ac9177
Revert "Revert "fixed STLDFLAG order in broken st Makefile""

This reverts commit 274d46ace00003d1df718b974d17642cbce167d5.

Sorry, the original commit was correct after all. It allows has the
correct link order and supports static-linking also.

Just a reminder: it is important to give a (brief) rationale of the
patch intentions.
Hiltjo Posthuma hiltjo@codemadness.org
ee5cc8e9
base64dec: skip non-printable characters like \r\n

Non-printable characters, such as line breaks, in a base64 encoded
string violate the "string length must be a multiple of four" rule.

This patch pads the result buffer by one extra unit of four bytes,
and skips over non-printable characters found in the input string.
Suraj N. Kurapati sunaku@riseup.net
274d46ac
Revert "fixed STLDFLAG order in broken st Makefile"

This reverts commit 7f990328e4fec8dfaaad311cb8af2304b58c872e.

this was wrong as pointed out by k0ga:
"STLDFLAGS is about flags to the linker, for example -L
not about -l for that reason it must go before the object list".
Hiltjo Posthuma hiltjo@codemadness.org
9c61f29b
Revert "make clipboard patch obsolete"

This reverts commit 77c51c5a6b16387f1792e23acbcf2080f790aa25.

Having multiple clipboards are useful, for example for plumber scripts.
I've discussed this on IRC and it is useful to have.
Hiltjo Posthuma hiltjo@codemadness.org
77c51c5a
make clipboard patch obsolete
Anselm R Garbe anselm@garbe.us
7f990328
fixed STLDFLAG order in broken st Makefile
Anselm R Garbe anselm@garbe.us
8dacdfba
Revert "Add bold off SGR"

This reverts commit 6cb6d61525931c88971cce323f63e40451a6d365.
This wasn't a useful thing after all.
Quentin Rameau quinq@fifth.space
c0882f2e
Add dim/smxx/rmxx to terminfo, remove duplicate kich1
Quentin Rameau quinq@fifth.space
d4928edb
Let the user specify C and LD FLAGS
Quentin Rameau quinq@fifth.space
fabd4602
Do not obfuscate what make is doing.

Change some styling too while we're at it.
Quentin Rameau quinq@fifth.space
b331da55
Add color change terminfo capabilities
Marc André Tanner mat@brain-dump.org
6cb6d615
Add bold off SGR
Quentin Rameau quinq@fifth.space
5a10aca7
st.1: modify man page to accurately reflect default keybindings

Attached.

===> 2/ (text/x-patch) [file]
	cp /mail/fs/mbox/298/2/body /usr/k0ga/0001-st.1-modify-man-page-to-accurately-reflect-default-k.patch

From 265db94b1eca5850d484f86b7db4af8e57822cfe Mon Sep 17 00:00:00 2001
From: Greg Reagle <greg.reagle@umbc.edu>
Date: Sun, 9 Apr 2017 23:05:47 -0400
Subject: [PATCH] st.1: modify man page to accurately reflect default
 keybindings
greg.reagle@umbc.edu greg.reagle@umbc.edu
745c40f8
Simplify how we keep ATTRs under cursor

Thanks to tarug0 for the suggestion/patch.
Quentin Rameau quinq@fifth.space
149c0d3a
Fix commented out code
Alexander Krotov ilabdsf@gmail.com
f2bfd513
keep some glyph modes for the cursor

st currently does not keep any mode for the cursor that was active
in the underlying glyph (e.g. italic text), the mode is always
ATTR_NULL [1].  At [2] you can find a screenshot that shows the
implications.  Other terminals (at least vte-based, such as
XFCE-terminal) keep some modes for the cursor.  I find the current
behaviour very disruptive, so here is a patch that keeps a few
(arbitrarily chosen) modes for the cursor.

[1] http://git.suckless.org/st/tree/st.c#n3963
[2] http://i.imgur.com/R2yCEaC.png
Nils Reuße n.reusse@hxgn.net
e7ed326d
Support xterm Ms feature to set clipboard

This is used by, e.g., tmux.
osandov@osandov.com osandov@osandov.com
20f71354
Change default keybindings

CTRL+SHIFT is an impossible combination in the terminal world
(0x20 | x & 0x1F), so it is perfect to be used for internals
shortcuts of terminals, and being a double combination
reduces the prossibility of having comflicts.
Roberto E. Vargas Caballero k0ga@shike2.com
e2ee5ee6
Split X-specific code into x.c
Michael Forney mforney@mforney.org
c63a87cd
Move column and row default numbers into config.h
fpqc harry.gindi@live.com
e4483240
Revert "Initial font size issue."

This reverts commit 424202798b02554092ba84dd59fb7b79b59b7b75.
Roberto E. Vargas Caballero k0ga@shike2.com
fa9a4599
Fixed 'missing glyph doesn't use fontconfig config substitutions' bug

XftFontMatch does display-specific font configuration (commit 528241a).
Nice. Unfortunately, when we switched from FcFontMatch, we also stopped
storing the post-Fc{Config,Default}Substitute FcPattern for future
lookups. The result is that if a glyph isn't found in the primary font,
secondary font lookups use the original FcPattern, not the configured
one. If you have custom fontconfig rules (like me), this can be
disappointing.

I basically just copied the guts out of XftFontMatch[1] and saved
the intermediate configured FcPattern. Could be related to the bug that
inspired commit 4242027.

[1]: https://cgit.freedesktop.org/xorg/lib/libXft/tree/src/xftfont.c
Spencer Phippen spencer.phippen@gmail.com
740ada14
make the various combinations of arrow keys and shift/control/meta work

When using st with screen, I've bound next, prev, new screen to
combinations like Ctrl-Alt-Right,Left,Down; xterm and (u)rxvt work fine
when this combination of modifiers is pressed, st does not seem to
transport all of them; a single modifier key is fine (e.g. Ctrl-Up,
Alt-Down etc., but combinations are not). While I'm not terribly
familiar with this, I have tried to hack config.h in a more or less
systematic way to generate the expected sequences.
Manuel Tobias Schiller mala@hinterbergen.de
42420279
Initial font size issue.

Hi,

When I specify a font by point size (I'm using "Inconsolata:size=12"),
characters that are substituted from another font because they are not in the
main one appear too small.  Doing a zoom reset fixes it.  For example:

Before: http://i.imgur.com/G4Mfv4X.png
After:  http://i.imgur.com/PMDhfQA.png

I found that adding the pixel size (acquired from the initial font load) to the
pattern then reloading the font fixes the problem.  I'm not sure if this is a
proper fix, though.
ian@remmler.org ian@remmler.org
3ca7249c
tic -s -> tic -sx (Treat unknown capabilities as user-defined.)
pl@ninthfloor.org pl@ninthfloor.org
06f8cf8c
Add tmux capabilities to st.info
pl@ninthfloor.org pl@ninthfloor.org
902a392b
Make strdump(), csidump(), print to stderr

The two functions strdump(), csidump() are called to show errors and
their output is introduced by a message printed to stderr. Thus, it it
more consistent to have them print to stderr.

Moreover stderr is unbuffered (at least on Linux), making problems
immediately visible.
pl@ninthfloor.org pl@ninthfloor.org
8c999156
Do not use color when font attributes are supported

If fontconfig gives us a font without the attributes we asked for,
display an alternative color instead.
Quentin Rameau quinq@fifth.space
7854fde1
st.1: add an entry for ISO-14755 shortcut
Quentin Rameau quinq@fifth.space
68bae9c7
Add support for iso14755

We launch dmenu for getting a codepoint, then convert it and send it to
the terminal.
Quentin Rameau quinq@fifth.space
331033f1
Add missing device path to '-l' example

Also, it's ttyS0 not ttySO.
Klemens Nanni kl3@posteo.org
f7398434
Add parsing of DCS q sequences

These sequences are used to operate with sixels, but they are still
str sequences, so they are finished with \a, ST or with a C1 control
code. This patch also disables utf8 handling for the case of sixels.
Roberto E. Vargas Caballero roberto.vargas@igrid-td.com
f0e2d287
Add support for enabling/disabling utf

There are some ocasions where we want to disable the enconding/decoding of utf8, mainly
because it adds an important overhead. This is partial patch for ESC % G and ESC % @,
where they modified the way that st reads and write from/to the serial line, but it does
not modifies how it interacts with the X window part.
Roberto E. Vargas Caballero roberto.vargas@igrid-td.com
078337d7
Delete ncv capability from terminfo

We do not need to disable the previous ncv definition, because
there is not previous definition.
Roberto E. Vargas Caballero roberto.vargas@igrid-td.com
5ce853a1
st.info: do not prevent st from displaying attributes

With ncv set to 3, we prevent st from displaying A_STANDOUT and
A_UNDERLINE with colors while our virtual terminal is capable of it.
Quentin Rameau quinq@fifth.space
023225ef
Update the LICENSE.

This is for the next release.
Christoph Lohmann 20h@r-36.net
6e79e835
0.7 release
Christoph Lohmann 20h@r-36.net
308bfbf6
Change who's expanding tabs.
Christoph Lohmann 20h@r-36.net
c4f245ec
Add some hint to have the pseudo terminal in the right mode.

If you don't make sure that the terminal does not expand tabs to spaces, of
course such a setting won't work.
Christoph Lohmann 20h@r-36.net
2251f646
Add comment about tabspaces.

st.info needs to be changed too, when tabspaces are changed.
Christoph Lohmann 20h@r-36.net
235b438e
Consistent Alt+BackSpace behavior

The default config specifies BackSpace as "\177". The default behavior
should persist across modifier keys, commonly Mod1 (Alt or Meta) which
is widely used to delete a word on readline and text editors, notably
Emacs.

This will make Alt+BackSpace behaves as expected, i.e. sends "\033\177"
instead of "\033\010" as previous default behavior.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Alive 4ever alive4ever@live.com
528241aa
Use XftFontMatch in place of FcFontMatch.

git am -s didn't like your patch:

From: Mark Edgar <medgar123@gmail.com>

XftFontMatch calls XftDefaultSubstitute which configures various match
properties according to the user's configured Xft defaults (xrdb) as well as
according to the current display and screen. Most importantly, the screen DPI
is computed [1]. Without this, st uses a "default" DPI of 75 [2].

[1]: https://cgit.freedesktop.org/xorg/lib/libXft/tree/src/xftdpy.c?id=libXft-2.3.2#n535
[2]: https://cgit.freedesktop.org/fontconfig/tree/src/fcdefault.c?id=2.11.1#n255
Christoph Lohmann 20h@r-36.net
60aeb37e
delete clipboard properties after pasting them

https://tronche.com/gui/x/icccm/sec-2.html#s-2.4 specifies:
> Once all the data in the selection has been retrieved,
> the requestor should delete the property in the SelectionNotify request

Most Clipboard-Owners ignore whether or not the property is already set,
so this is mostly a cosmetic change to keep the windows property list clean.

However, at least synergy decides to wait for the requestor to delete
the properties if they are already set by a previous paste (from synergy).

Signed-off-by: Christoph Lohmann <20h@r-36.net>
v4hn me@v4hn.de
66556d96
Remove stupid assignation in memcpy()
Roberto E. Vargas Caballero roberto.vargas@igrid-td.com
39964614
st: Fix off-by-one error when calculating character width.

LEN(str) is one larger than strlen(str) because it also counts the zero
terminator. The original code would include the .notdef glyph (since it'll
try to encode character 0, which gets encoded to the .notdef glyph) when
measuring the average dimensions of printable ascii characters.

This causes problems with fonts like GNU Unifont where the .notdef glyph is
not the same width as the usual half-width characters.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Tor Andersson tor@ccxvii.net
0e48a199
Fix vertical character alignment in some cases

The y-position of a character found by asking fontconfig for a matching
font does not take the border pixels into account, resulting in a
slightly misaligned vertical position.

Signed-off-by: Ton van den Heuvel <tonvandenheuvel@gmail.com>
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Ton van den Heuvel tonvandenheuvel@gmail.com
6d8f8523
I like empty lines.
Christoph Lohmann 20h@r-36.net
034a5c8a
Measure the single advance width with a heuristic method

This fix is needed to use dual-width fonts, which have double-width
glyphs (e.g. CJK unified ideographs).

Signed-off-by: Ryusei Yamaguchi <mandel59@gmail.com>
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Ryusei Yamaguchi mandel59@gmail.com
30440295
xtermclear() is now done by xdrawglyphfontspecs()

Thanks Ton van den Heuvel for the proposal!
Christoph Lohmann 20h@r-36.net
4fdba860
arg.h: fixed argv checks order

This prevents accessing to a potentially out-of-bounds memory section.

Signed-off-by: Lucas Gabriel Vuotto <l.vuotto92@gmail.com>
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Lucas Gabriel Vuotto l.vuotto92@gmail.com
6d636beb
Fix forgotten bracket and duplicate option in usage()

Scratch the preceding patch, this one is more correct
(don't forget to 'git am --scissors' ;))
-- >8 --

Also reformat the strings in a saner layout

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Quentin Rameau quinq@fifth.space
6e70bb97
Extract ttyresize() out of cresize()

This way we can call cresize() to set the terminal size before creating
a tty or spawning a process, which will start with the correct size.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Quentin Rameau quinq@fifth.space
82335583
Ok, no need for a separate version function.

This is just redundant metadata. Please add Java comment meta classes too.
Christoph Lohmann 20h@r-36.net
0cd5117a
Add -n option for setting WM_CLASS instance name

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Quentin Rameau quinq@fifth.space
bd5fdbe6
Reformat usage and separate version from it

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Quentin Rameau quinq@fifth.space
504a1652
Enforce a terminal size to reduce race conditions in too efficient apps.

dvtm is too fast in starting up. It will then have a race condition in finding
the right. terminal size.
Christoph Lohmann 20h@r-36.net
9031e228
Height is height.
Christoph Lohmann 20h@r-36.net
610723a5
Bump year.
Christoph Lohmann 20h@r-36.net
ff241199
Fixing the XClassHint setting in st.
Christoph Lohmann 20h@r-36.net
375b2872
Avoid recursive call to ttywrite from ttyread

Ttyread() calls to ttywrite, so if we check for reading before
that for writing in ttywrite we can get a circular call sequence.
Roberto E. Vargas Caballero k0ga@shike2.com
d836561b
arg.h: remove unused macros

ARGUM isn't used and ARGNUMF uses estrtol() that isn't defined anywhere.
Those were probably copied from sbase arg.h.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Quentin Rameau quinq+hackers@fifth.space
00873e65
Introduce lim in all ttywrite() checks.
Christoph Lohmann 20h@r-36.net
9f6d8845
Fix ttywrite()

ttywrite was assuming that if it could not write then it could
read, but this is not necessarily true, there are some situations
where you cannot read or write. The correct behaviour is to detect
if you can read or/and write.
Roberto E. Vargas Caballero k0ga@shike2.com
f0398db4
Now the mshortcuts are even more consistent.

    Keep everyone happy

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Ivan Tham pickfire@riseup.net
e2aa03e6
Now the Shortcuts are more consistent.

Keep the debile happy.
Christoph Lohmann 20h@r-36.net
f56c58a9
fix bug where first selection snaps to lines
Jason Woofenden jason@jasonwoof.com
293f573e
Fix the cursor colors selection

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Quentin Rameau quinq@fifth.space
2ea02c93
Normalize the whole color selection in xdrawcursor.
Christoph Lohmann 20h@r-36.net
80fe97f8
Fix the cursor color when over selection.

If we want to show a custom selected cursor color, we must not set the
revert attribute to the drawn glyph.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Quentin Rameau quinq@fifth.space
a2a60f0a
Make the cursor shapes more descriptive.

»IBeam« is now »Bar« because it's named like that in the source code.
Christoph Lohmann 20h@r-36.net
52d0e82d
Snowman is everywhere.
Christoph Lohmann 20h@r-36.net
78b04865
Style normalisation in the config.def.h.

This adds an awareness commit for the big key array too.
Christoph Lohmann 20h@r-36.net
f7b80cae
The definition of the reverse cursor is now up to the user.
Christoph Lohmann 20h@r-36.net
594a2598
Fixing the cursor movement in selections.

Before the fix the cursor wouldn't obey if it's in a selection. If it is
inside it will now change to the reverse. This patch also adds that the
defaultcs will be reversed for the manually drawn cursors.
Christoph Lohmann 20h@r-36.net
91c70213
When the cursor is moved, clear the selection.
Christoph Lohmann 20h@r-36.net
26772961
Reverse the cursor on selection.
Christoph Lohmann 20h@r-36.net
5ece2b5f
More style changes. We forgot some switches.
Christoph Lohmann 20h@r-36.net
2bef36ab
Small style change.
Christoph Lohmann 20h@r-36.net
16824843
There's no need for libXext to compile st.
Christoph Lohmann 20h@r-36.net
4be353e3
Fix extra bracketed paste markers when pasting >8kb

Before this patch, when pasting over BUFSIZE (8192 bytes here), st would
do the following:

    \e[200~...8192 bytes...\e[201~\e[200~...remaining bytes...\e[201~

With this patch, the start marker is only sent when the offset is 0 (at
the beginning of selnotify) and the end marker is only sent when the
remaining bytes to read are 0 (at the end).

For short pastes, both conditions are true in the same iteration.

For long pastes, it removes the extra markers in the middle, keeping the
intended wrapping:

    \e[200~...8192 bytes......remaining bytes...\e[201~

Signed-off-by: Christoph Lohmann <20h@r-36.net>
dequis dx@dxzone.com.ar
20d53ceb
dup() -> dup2()

gcc would warn about an unused result. We know it is 0 and dup()
can't fail in these circumstances, as we closed fd0 previously.
Using dup2() to do the same saves one line and shuts gcc up, bringing
us a clean build back.
FRIGN dev@frign.de
bf8c71e4
The times of bad fonts are over.

The antialiasing was false due to circumstances that do not exist anymore. We
need antialiasing on big screens with big fonts. Autohinting too.
Christoph Lohmann 20h@r-36.net
5d2d9d54
Fix copy of line with len = 0

When a line has no any character linelen is 0, so last = &term.line[y][MIN(lastx, linelen-1)]
generated a pointer to the end of the previous line. The best thing we can do in this case
is to add a newline, because we don't have a glyph to print (and consult its state of
wrapping).
Roberto E. Vargas Caballero k0ga@shike2.com
a1ed5071
Change Pause to Break in shortcut for serial break
Roberto E. Vargas Caballero k0ga@shike2.com
3ba9c8fc
Expose cursor shape in config.def.h

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Jan Christoph Ebersbach jceb@e-jc.de
1f087aa8
Add key to send a break to the serial line
Roberto E. Vargas Caballero k0ga@shike2.com
473326f2
Set default values of stty according to the man page

This configuration is basically 38400 8N1, without echo and
in raw mode. Kernel will not process any of the characters
sent by the user.
Roberto E. Vargas Caballero k0ga@shike2.com
aa5d4c3b
Making st.1 more descriptive about -l and fix -l in st.c.
Christoph Lohmann 20h@r-36.net
080a5ae4
Fix the st manpage for -l line.
Christoph Lohmann 20h@r-36.net
9eeb4e1e
Reordering and adding control codes.

For completeness and documentation add all C1 control codes.
Christoph Lohmann 20h@r-36.net
0c94f862
Merge branch 'master' of ssh://suckless.org/gitrepos/st
Christoph Lohmann 20h@r-36.net
0d838b72
Don't read if we chunked the input data.
Christoph Lohmann 20h@r-36.net
9984ad4b
st.info: replace the acsc entry from xterm to urxvt

The current acsc entry, copied from xterm was not exposing capability to
display arrows.
Quentin Rameau quinq@fifth.space
ee5cad43
Adding mouse colour/shape settings
Alex Kozadaev akozadaev at yahoo com
dc33d1d6
Adding -T to the usage too.
Christoph Lohmann 20h@r-36.net
b5e29cce
Add -T, as recommended by Dmitrij D. Czarkoff
Christoph Lohmann 20h@r-36.net
4a193b96
Fix type for write(2) return variable.

A little fix in xwrite().

>From 3727d2e3344b57128ab51c7839795204f1f839ff Mon Sep 17 00:00:00 2001
From: Quentin Rameau <quinq@fifth.space>
Date: Fri, 24 Jul 2015 11:40:46 +0200
Subject: [PATCH] Fix type for write(2) return variable.

The allocated lengh of s fits into an integer so we can safely use
ssize_t here.
Quentin Rameau quinq+hackers@fifth.space
1d348e98
added note about the low precedence of shell to config.def.h
Mytchel Hammond mytchel@openmailbox.org
62756fdb
Fix style in execsh
Roberto E. Vargas Caballero k0ga@shike2.com
d032b615
Make the comment for the IM XFilter more understandable.
Christoph Lohmann 20h@r-36.net
684c72d0
Return style unification.
Christoph Lohmann 20h@r-36.net
b823f57f
Aligning the macros.
Christoph Lohmann 20h@r-36.net
684f0a07
Unix end of file.
Christoph Lohmann 20h@r-36.net
d3c7b6fb
No inline declarations please.
Christoph Lohmann 20h@r-36.net
41f70a1c
Typo and the missing incr atom from the patches.
Christoph Lohmann 20h@r-36.net
261ea4b7
Implement chunked write to the cmdfd.

This is needed so big input like a paste of several megabyte does not clog our
I/O.
Christoph Lohmann 20h@r-36.net
f8c6e7d0
Implement INCR transfers in the clipboard.
Christoph Lohmann 20h@r-36.net
539afe3a
Update LICENSE

Signed-off-by: Christoph Lohmann <20h@r-36.net>
FRIGN dev@frign.de
f1307d91
Don't treat clauses like functions

and add a space between the keyword and the parentheses.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
FRIGN dev@frign.de
13233574
Use BSD-style function notation

Put the opening brace on a new line. This was already used for some
functions inside st.c.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
FRIGN dev@frign.de
9de853a9
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>
FRIGN dev@frign.de
abfad4c4
Remove insane *_FILENO and EXIT_* usage

Any system having different assignments than the usual 0, 1, 2 for
the standard file numbers and 0, 1 for the exit-statuses is broken
beyond repair.
Let's keep it simple and just use the numbers, no reason to fall
out of the window here and bend down for POSIX.
In one occasion, the ret-variable was not necessary. The check was
rewritten.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
FRIGN dev@frign.de
92e092ef
Commit to push the 0.6 release.
Christoph Lohmann 20h@r-36.net
5f48e897
Revert "Remove unnecessary XFilterEvent call."

This reverts commit d2937b05aed9cee8d6651cd806d31682a853c773.
Weng Xuetian wengxt@gmail.com
bdd649a1
do not truncate font size when zooming
Quentin Rameau quinq@quinq.eu.org
71fa10f6
Revert "Optimize memory footprint of line buffers"

This reverts commit 7ab6c92e18d468968811256e808b02309c160a22.
We need 32 bits for real color support.
Roberto E. Vargas Caballero k0ga@shike2.com
caa97cc7
Support UTF-8 characters as word delimiters

For a higher usefulness of the utf8strchr function, the index of the
UTF-8 character could be returned in addition with a Rune instead of a
char*.  Since utf8strchr is currently only used by ISDELIM I didn't
bother to increase the complexity.
Jan Christoph Ebersbach jceb@e-jc.de
c0354875
Merge branch 'master' of ssh://suckless.org/gitrepos/st
Roberto E. Vargas Caballero k0ga@shike2.com
8e15887d
set selection to IDLE on clear

Otherwise a tangling bmotion event will consider
the selection still valid and selnormalize segfaults
because of an invalid sel.ob.y index.
v4hn me@v4hn.de
89cf0fc5
Small bugfix for makeglyphfontspecs call in drawregion

Here's a patch that fixes a bug when calling `makedrawglyphfontspecs'
in `drawregion'. Wasn't offseting the pointer into the input glyphs
array by `x1'. The bug isn't causing any problems currently, because
`drawregion' is always called with `x1' and `y1' values of 0, but if
this ever changes in the future, the bug would certainly cause some
problems.
suigin suigin@national.shitposting.agency
ae1923d2
Clean up xdraws and optimize glyph drawing with non-unit kerning values

I have another patch here for review that optimizes the performance of
glyph drawing, primarily when using non-unit kerning values, and fixes a
few other minor issues. It's dependent on the earlier patch from me that
stores unicode codepoints in a Rune type, typedef'd to uint_least32_t.

This patch is a pretty big change to xdraws so your scrutiny is
appreciated.

First, some performance numbers. I used Yu-Jie Lin termfps.sh shell
script to benchmark before and after, and you can find it in the
attachments. On my Kaveri A10 7850k machine, I get the following
results:

Before Patch
============

1) Font: "Liberation Mono:pixelsize=12:antialias=false:autohint=false"
   cwscale: 1.0, chscale: 1.0
   For 273x83 100 frames.
   Elapsed time :     1.553
   Frames/second:    64.352
   Chars /second: 1,458,159

2) Font: "Inconsolata:pixelsize=14:antialias=true:autohint=true"
   cwscale: 1.001, chscale: 1.001
   For 239x73 100 frames.
   Elapsed time :   159.286
   Frames/second:     0.627
   Chars /second:    10,953

After Patch
===========

3) Font: "Liberation Mono:pixelsize=12:antialias=false:autohint=false"
   cwscale: 1.0, chscale: 1.0
   For 273x83 100 frames.
   Elapsed time :     1.544
   Frames/second:    64.728
   Chars /second: 1,466,690

4) Font: "Inconsolata:pixelsize=14:antialias=true:autohint=true"
   cwscale: 1.001, chscale: 1.001
   For 239x73 100 frames.
   Elapsed time :     1.955
   Frames/second:    51.146
   Chars /second:   892,361

As you can see, while the improvements for fonts with unit-kerning is
marginal, there's a huge ~81x performance increase with the patch when
using kerning values other than 1.0.

So what does the patch do?

The `xdraws' function would render each glyph one at a time if non-unit
kerning values were configured, and this was the primary cause of the
slow down. Xft provides a handful of functions which allow you to render
multiple characters or glyphs at time, each with a unique <x,y> position,
so it was simply a matter of massaging the data into a format that would
allow us to use one of these functions.

I've split `xdraws' up into two functions. In the first pass with
`xmakeglyphfontspecs' it will iterate over all of the glyphs in a given
row and it will build up an array of corresponding XftGlyphFontSpec
records. Much of the old logic for resolving fonts for glyphs using Xft
and fontconfig went into this function.

The second pass is done with `xrenderglyphfontspecs' which contains the
old logic for determining colors, clearing the background, and finally
rendering the array of XftGlyphFontSpec records.

There's a couple of other things that have been improved by this patch.
For instance, the UTF-32 codepoints in the Line's were being re-encoded
back into UTF-8 strings to be passed to `xdraws' which in turn would then
decode back to UTF-32 to verify that the Font contained a matching glyph
for the code point. Next, the UTF-8 string was being passed to
`XftDrawStringUtf8' which internally mallocs a scratch buffer and decodes
back to UTF-32 and does the lookup of the glyphs all over again.

This patch gets rid of all of this redundant round-trip encoding and
decoding of characters to be rendered and only looks up the glyph index
once (per font) during the font resolution phase. So this is probably
what's responsible for the marginal improvements seen when kerning values
are kept to 1.0.

I imagine there are other performance improvements here too, not seen in
the above benchmarks, if the user has lots of non-ASCII code plane characters
on the screen, or several different fonts are being utilized during
screen redraw.

Anyway, if you see any problems, please let me know and I can fix them.
suigin suigin@national.shitposting.agency
38af006b
Changed type for UTF-32 codepoints from long to uint_least32_t
suigin suigin@national.shitposting.agency
c990abfe
Fix empty selection highlighting bug.

When user clicks LMB, one character is selected, but will not be copied
to selection until the user moves cursor a bit. Therefore, the character
should not be highlighted as selected yet.

Before the patch, the trick was not to mark line as dirty to avoid
highlighting it. However, if user has already selected something and
clicks in line that contains selection, selclear sets the line as dirty
and one character is highlighted when it should not.

This patch replaces dirty trick with explicit check for sel.mode inside
selected().
noname noname@inventati.org
3cb7f27a
Fix indentation.
noname noname@inventati.org
1811b603
Add enumeration for sel.mode

This patch also prevents sel.mode from increasing beyond 2. It is almost
impossible, but sel.mode may overflow if mouse is moved around for too
long while selecting.
noname noname@inventati.org
22571ea4
selnormalize: make special case explicit

Special case is when regular selection spans multiple lines.
Otherwise, just sort sel.ob.x and sel.ob.y.
noname noname@inventati.org
8751809a
selsnap: simplify SNAP_LINE case

Also make sure y never exceeds term.row-1 even if ATTR_WRAP is set for
some reason.
noname noname@inventati.org
765bb0fd
Remove first argument of selsnap.
noname noname@inventati.org
07ce96a3
Fix sigchld

Only wait for termination of the shell.
Jochen Sprickerhof dwm@jochen.sprickerhof.de
190b94c7
len assignment is never used

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
mvdan@mvdan.cc mvdan@mvdan.cc
4f21c41a
Clarify calculation precedence for '&' and '?'

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
mvdan@mvdan.cc mvdan@mvdan.cc
3a5053f6
Use %u for uint

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
mvdan@mvdan.cc mvdan@mvdan.cc
7ab6c92e
Optimize memory footprint of line buffers
suigin suigin@national.shitposting.agency
0622ad9b
Make tputc, tsetchar and techo accept unicode
noname@inventati.org noname@inventati.org
21f76542
Change internal character representation.
noname@inventati.org noname@inventati.org
753fe862
Remove last parameter of utf8encode

This parameter was always UTF_SIZ, so it is better remove it and
use directly UTF_SIZ in it.
noname@inventati.org noname@inventati.org
61c35cd2
Use utf8len instead of utf8decode.
noname@inventati.org noname@inventati.org
742a41d6
Make build shut up about system() without return value check.

    st.c:1321:2: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
            system(cmd);
            ^~~~~~ ~~~

Debatable whether an error here should case exit(EXIT_FAILURE). Just
preserving the existing behaviour for now.
alp@alexpilon.ca alp@alexpilon.ca
f36dd277
Merge remote-tracking branch 'origin/master'
Roberto E. Vargas Caballero k0ga@shike2.com
0d7448da
Fix segmentation fault in strhandle()

We cannot pass strescseq.args[0] to atoi when nargs is zero,
because in this case it will be null.
Roberto E. Vargas Caballero k0ga@shike2.com
b17aa18f
Uses a &[] pointer loop instead of + pointer loop
Roberto E. Vargas Caballero k0ga@shike2.com
736685d6
Do not set terminal title based on stty arguments.
noname@inventati.org noname@inventati.org
2fdcc5e5
Remove WIN_REDRAW flag.

WIN_REDRAW flag was not used since introduction of Xdbe
in commit 94771d05886fbdd2422e66b7c0256ab27fa375cb
noname@inventati.org noname@inventati.org
ab69ea89
Place memset arguments in the correct order.
noname@inventati.org noname@inventati.org
5528280f
Remove explicit 'return' from 'void' functions.
noname@inventati.org noname@inventati.org
6dc2b546
Increment accuaracy in drawtime calculation

This way is a bit more accurate.
noname@inventati.org noname@inventati.org
c27c731b
Monotonic clock cannot jump backwards.

The check was introduced back when st used gettimeofday.
The condition is also modified to increment the accuaracy of the
calculation.
noname@inventati.org noname@inventati.org
6ee56d65
Place tlinelen type on separate line.
noname@inventati.org noname@inventati.org
215bdb2d
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, ...).
Roberto E. Vargas Caballero k0ga@shike2.com
56abffb4
Fix memmove() invocation with src/dst being NULL

This fixes a segmentation fault on some systems.
sin sin@2f30.org
aff35af2
Use as command arguments the remaining parameters

This change allows execute st as 'st mutt' while it keeps the
compability with xterm and urxt.
noname@inventati.org noname@inventati.org
83e73c62
Merge branch 'master' of ssh://suckless.org/gitrepos/st
Roberto E. Vargas Caballero k0ga@shike2.com
9619760e
tresize: remove unnecessary if
noname@inventati.org noname@inventati.org
a6af2cc4
Remove old TODO entry.

It probably refers to
http://lists.suckless.org/dev/1211/13427.html
and does not seem like a bug in st.
noname@inventati.org noname@inventati.org
b94ad75e
Remove 'titles' variable.

We do not free it until exit anyway.
noname@inventati.org noname@inventati.org
e6dd0f82
Remove useless if in tstrsequence.
noname@inventati.org noname@inventati.org
b0310fba
Simplify tmoveto.

LIMIT returns value. This fact is already used in x2col and y2row.
noname@inventati.org noname@inventati.org
9d1495f9
Fix typo.

It seems that LICENSE files are more common than LICENCE files.
At least this patch makes spelling consistent.
noname@inventati.org noname@inventati.org
c569e314
Remove 'slide' variable in tresize.
noname@inventati.org noname@inventati.org
39ae1a4d
Move tresize comments around.
noname@inventati.org noname@inventati.org
6352502d
tresize: move for loop outside if

There is no need to check that slide > 0 before executing loop.
If slide <= 0, loop stops immediately.
noname@inventati.org noname@inventati.org
b9390a54
Simplify loop condition.
noname@inventati.org noname@inventati.org
d2937b05
Remove unnecessary XFilterEvent call.

XFilterEvent usually filters KeyPress events according to input method.
At this point the window is not mapped. The only events that we process
are ConfigureNotify and MapNotify. They should not be filtered by input
method.
noname@inventati.org noname@inventati.org
d3e0f344
Use do..while in window mapping loop.
noname@inventati.org noname@inventati.org
ecac5ee3
Make DECSCUSR thickness configurable
Omar Sandoval osandov@osandov.com
93b54cfc
Use MAX macro where possible.
noname noname@inventati.org
6f5f7701
Remove 'xloadfontset' function.

It was used only once and its return value was ignored.
noname noname@inventati.org
6524f022
Remove keywords from function definitions.
noname noname@inventati.org
9305f3c1
Remove variable names from function declarations.
noname noname@inventati.org
5bb90125
Remove redundant control check

control was set, but it was not ever used because it was set
again some lines later.
Roberto E. Vargas Caballero k0ga@shike2.com
69d1fe06
Fixed STR sequence termination condition

ascii code may only be checked for characters that have length equal to
1, not width equal to 1
noname noname@inventati.org
288f80cb
Remove strsep() call

strsep() is not a POSIX function, and it means that every system
needs different defines to expose it. If the prototype of strsep
is not exposed then an ugly int/pointer is done and it might mean
a crash. The best solution?, to remove the strsep and make a custom
loop. If C programmers cannot do this kind of loops without calling
a library function, then maybe we should move all the suckless
software to Java.
Roberto E. Vargas Caballero k0ga@shike2.com
c9357a8e
Merge remote-tracking branch 'origin/master'
Roberto E. Vargas Caballero k0ga@shike2.com
580302f3
Support the DECSCUSR CSI escape sequence
LemonBoy thatlemon@gmail.com
86d1e432
Support XA_STRING in notify request

Some programs can only deal with XA_STRING, and it makes impossible st
be able of copying to them. This patch makes st answer also to XA_STRING,
althought it sends utf8 strings. It is not a problem because moderm
applications must support utf8.
Roberto E. Vargas Caballero k0ga@shike2.com
c7e24e44
TODO: Fix fontconfig
Christoph Lohmann 20h@r-36.net
5406e655
Add the new selection shortcuts to the manpage.
Christoph Lohmann 20h@r-36.net
72d2accc
Glibc wants me to use _DEFAULT_SOURCe. I do obey.
Christoph Lohmann 20h@r-36.net
2fcfea1b
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.
Christoph Lohmann 20h@r-36.net
b746816b
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.
Roberto E. Vargas Caballero k0ga@shike2.com
4f607514
FAQ: fix wording
Alexander Huemer alexander.huemer@xx.vu
f5075a9e
Backspace value shouldn't depend on keypad state
Ivan Delalande colona@ycc.fr
c87d4546
Merge branch 'master' of ssh://suckless.org/gitrepos/st
Christoph Lohmann 20h@r-36.net
28259f57
St now does only set PRIMARY on selection.

http://standards.freedesktop.org/clipboards-spec/clipboards-latest.txt
Christoph Lohmann 20h@r-36.net
9494362d
Fixing the C reading test.

This was a test to see if anyone actually reads what is submitted. The list of
people not contributing will be valuable in the future.
Christoph Lohmann 20h@r-36.net
cf1fcc4d
Change the FAQ for the new Backspace behaviour.
Christoph Lohmann 20h@r-36.net
230d0c84
Finally resolving the backspace problem.

The majority now using the Linux behaviour. Minorities have to live in their
ghettos.
Christoph Lohmann 20h@r-36.net
b0bddc69
Add a hack to handle unknown chars in fontconfig.

The unicode long is added to the cache. So when fontconfig does fall back to
the default font (where there is no easy way to find this out from the
pattern) it isn't reloaded.
Christoph Lohmann 20h@r-36.net
487bbb24
Update kdch1 definition to three octal digits.

ncurses wasn't able to detect the delete-character key as KEY_DC.  This
patch fixes that.

kdch1 was defined as "\0177", but terminfo(5) states:
	... characters may be given as three octal digits after a \.

The delete-character key is correctly defined in config.def.h.
Johannes Postma jgmpostma@gmail.com
29619a1a
Small improvements to the FAQ
Roberto E. Vargas Caballero k0ga@shike2.com
b8804f9f
document keys in man page
Greg Reagle greg.reagle@umbc.edu
1b514048
Let curses do the dirty work for flash

Use the terminfo delay syntax ($<x>) in our flash capability to avoid
hardcoding a fixed delay in redraw() when called from tsetmode() with
DECSCNM.
We need to turn on the npc capability so that delays are made with
xon/xoff instead of padding characters.
Ivan Delalande colona@ycc.fr
3604445f
Comment default CC assignment

CC by default is cc, so the assignment was doing nothing, but
it was using non standard syntax, so some system (NetBSD) fail
to compile.
Roberto E. Vargas Caballero k0ga@shike2.com
ac11bbb0
Update dates in LICENSE
Roberto E. Vargas Caballero k0ga@shike2.com
c5f1d74f
Update year in usage()
Nils Reuße ml@hxgn.net
7dd24bfb
Fix crash on font resize resize

if you keep downsizing your fontsize until either xw.ch or xw.cw gets 0,
st crashes, because there is an unchecked division in cresize.
Nils Reuße ml@hxgn.net
aba6c292
Correct shift amount on MODE_INSERT in tputc()

When MODE_INSERT is set we'd shift characters on the same
line forward before inserting our character in tputc().
This did not account for wide characters where width != 1.
This patch makes it so we shift the correct amount.
Rian Hunter rian@alum.mit.edu
4d14d975
Fix crash due to wide characters

In tputc(), when a character wasn't large enough to fit
on the current line, we would call tnewline() to place it on
the next line. Unfortunately, we weren't resetting our glyph
pointer and this caused memory corruption when a
wide character (width == 2) was being written. This patch
resets our glyph pointer after calls to tnewline().
Rian Hunter rian+suckless-dev@thelig.ht
708b697e
Fix crash due to invalid timespec given to pselect

If blinktimeout is set to a value greater than 1000, pselect will
receive a timeout argument with tv_nsec greater than 1E9 (1 sec), and
fail, making st crash. This patch just ensures that the timespec
structure is correctly filled with a value properly decomposed between
tv_sec and tv_nsec.

Reported by JasonWoof on IRC. Thanks!
Ivan Delalande colona@ycc.fr
09f5d982
Trim trailing whitespaces in every selection case

Trailing whitespaces are trimmed when copying from normal selection and
rectangular selection on lines that have their last character included
or on the left of the selection. It leads to inconsistent behaviors when
copying the exact same text from the left and right window in
applications with vertical splits.
This patch solves this issue by always trimming the selection.
Ivan Delalande colona@ycc.fr
4418939d
Call _exit() instead of exit() if exec*() fails

exit() will also unwind the atexit() functions.  This is bad
because if exec*() fails the process is in an inconsistent state.
sin sin@2f30.org
bafbba56
Check for presence of SHELL environment variable

- POSIX states the SHELL environment variable "... shall represent a
  pathname of the user's preferred command language interpreter." As
  such, st should check for its presence when deciding what shell to
  use; just as HOME can be defined to override one's passwd-defined home
  directory, a user should also be able to override their passwd-defined
  shell using the SHELL environment variable.
Eric Pruitt eric.pruitt@gmail.com
11625c71
Replace character with U+FFFD if wcwidth() is -1

Helpful when new Unicode codepoints are not recognized by libc.
czarkoff@gmail.com czarkoff@gmail.com
008aae54
Avoid failing when embedding with a Window id of 0

I'd like to let st run with its own window when trying to embed it to a window with id 0 instead of exiting with an error.
Quentin Rameau quinq.ml@gmail.com
cd159883
Reverting smacs and rmacs to the xterm defaults.

These are needed by ncurses to correctly handle the switch between line
drawing. The changes to the alternative characterset code already fixed the
urwid hack.
Christoph Lohmann 20h@r-36.net
f9fb6209
Do not set SHELL to utmp ever

SHELL must be set to the SHELL of the user, but it was possible set
it to utmp.
Roberto E. Vargas Caballero k0ga@shike2.com
86633ada
patch for bell in st

The XBell() call currently used when a bell is recieved sends a message
to the X server, but if the X server doesn't know how to sound it,
it just gets ignored and I have not been able to find anywhere in x.org's
code a way to configure the action that the server does.

However, if you use XkbBell() then you can have a process listening for
the XkbBellNotifyEvent that is produced and either alert you visually or
play an audio file or whatever you want as your notification. You have
to include one more header file but the function seems to be compiled as
part of Xlib, at least on my installation.

CustaiCo
CustaiCo custaico@openmailbox.org
dcfe505d
Use G1 for alternate charset

St has enacs, which must be printed if a program requires to use
the alternate charset (graphic charset), that in st case was to
select charset graphic for G1, but it was not useful
at all because smacs and rmacs were always redefining the value
of G0.
Roberto E. Vargas Caballero k0ga@shike2.com
88429cdc
Add LS2 and LS3

These sequences are the equivalents of LS0 and LS1, but for G2 and
G3.
Roberto E. Vargas Caballero k0ga@shike2.com
0c8feecb
Fix SI and SO

SI (0x0F or ^O) means Shift In, and it selects G1 charset definition,
and SO (0x0E or ^N) means Shift Out, and it selects G0 charset
definition, but st was doing just the inverse.
Roberto E. Vargas Caballero k0ga@shike2.com
a7eef8f2
Removing an extra space.
Christoph Lohmann 20h@r-36.net
63a07eb1
Minor style changes for the last patch.
Christoph Lohmann 20h@r-36.net
dc8c5c82
Implementing xzoomreset.

Thanks mvdan@mvdan.cc for proposing this.
Christoph Lohmann 20h@r-36.net
c7a945c4
Add missed names of charset sequences
Roberto E. Vargas Caballero k0ga@shike2.com
5afb3862
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.
Roberto E. Vargas Caballero k0ga@shike2.com
0392d165
Remove indentation level in xdrawcursor
Roberto E. Vargas Caballero k0ga@shike2.com
98a1085d
Removing wrapping newlines from selection

When getting selected text, lines that were wrapped because of length
ought not include the wrapping newline in the selection.

This comes up, for example, when copying a bash command that is long
enough to wrap from the console and pasting it back into the console.
The extra newline breaks it.

Similiarly, changes behavior when trimming whitespace from the end of a
physical line to only do so if the line does not wrap. Otherwise we are
trimming whitespace from the middle of a logical line, which may change
its meaning.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Ben Hendrickson ben@1m7.com
51466e01
Change the behavior of word snapping on delimiters

This makes any sequence of identical delimiters be considered a single
word in word-snapping mode. This seems more coherent for this mode and
is similar to what xterm does.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Ivan Delalande colona@ycc.fr
c490a60b
Move calls to selsnap into selnormalize

This simplifies getbuttoninfo() and bpress(), and fixes a bug which made word
snapping behave incorrectly when a delimiter was at the beginning or end of
line.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Ivan Delalande colona@ycc.fr
83dea7fd
Improve readability of enum members

The 'left shift from one' notation of power of two integers is more
expressive than the result.

Signed-off-by: Alexander Huemer <alexander.huemer@xx.vu>
Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Alexander Huemer alexander.huemer@xx.vu
e5f6736e
Add eschandle()

We already have a csihandle() function, where is located code about
CSI sequences, so it is logical do the same with ESC sequences.
This change helps to simplify tcontrol(), which has a complex flow
and should be rewritten.
Roberto E. Vargas Caballero k0ga@shike2.com
a3549c2e
Improve execsh() and don't allow anonymous shells

This patch improves the shell selection on execsh and forbid
shell with users don't registered in the passwd file.
Roberto E. Vargas Caballero k0ga@shike2.com
8342036f
Fix definition of CONTROLC0

DEL character is not thecnically talking a C0 control character,
although it has some common properties with them, so it is useful
for us consider it as C0. Before this patch DEL (\177), was not
ignored as it ought to be.
Roberto E. Vargas Caballero k0ga@shike2.com
9d9e049e
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).
Roberto E. Vargas Caballero k0ga@shike2.com
177d888d
reset the alt screen in treset

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Quentin Carbonneaux q@c9x.me
fa04911c
simplify loop in tresize

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Quentin Carbonneaux q@c9x.me
19263053
Simplify README

The term 'virtual terminal emulator' was broken. There is nothing
virtual about it, it's a terminal emulator.

Signed-off-by: Alexander Huemer <alexander.huemer@xx.vu>
Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Alexander Huemer alexander.huemer@xx.vu
8f3e6a57
Fix man page and usage()

Man page was repeating -f option, the second time instead of -i,
and this option was lost in usage() message. This patch also indent
the output of usage().
Roberto E. Vargas Caballero k0ga@shike2.com
f8b4998b
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.
Roberto E. Vargas Caballero k0ga@shike2.com
6530025b
Fix portability problem in techo()

ISCONTROL chechks if a value is between 0 and 0x1f or
between 0x80 and 0x9f. Char signess depends of architecture
and compiler, so in some environment the second case is
always false (and wrong), Techo() calls ISCONTROL with a
char variable, whose type cannot be changed because tpuc()
expects a pointer to char, so the solution is to insert a
cast in the call to ISCONTROL.
Roberto E. Vargas Caballero k0ga@shike2.com
d4a17316
Don't set dirty all lines because tswapcreen do it

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
noname noname@inventati.org
20c4f122
tresize return value is not used

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
noname noname@inventati.org
821a6e00
Remove ul capability

This capability indicates that underscore '_' overstrike current
letter under the cursor. It means that you can generate a
underline 'b' using 'b^H_', because it writes a 'b' then backward
one characther and then overstrike '_'. St has not such behaviour,
so it is an error to have this capability.
Roberto E. Vargas Caballero k0ga@shike2.com
8de8ae39
Unset mode when clearing regions

tclearregion() was clearing regions using spaces and the current
attributes of the terminal. It was correct with all the modes excepct
underline, because they didn't affect the space character, but in
the case of underline it was a problem. A easy way of seeing this
problem is writing this in the last line of the terminal:

	tput smul ; echo first; tput rmul; echo second; echo third

Fist was underlined, and second and third were not underlined, but
the spaces at the right of second was underlined becuause in the
previous scrool underline mode was set.
Roberto E. Vargas Caballero k0ga@shike2.com
ec326896
Add error message when child exits whit error

Master proccess was not showing any error message when the child
died with an error, and it was very confusing for the user (for
example with incorrect -e command).
Roberto E. Vargas Caballero k0ga@shike2.com
769d4818
Remove difference between fast and slow blinking

One blinking mode is good enough, and two is too much. The best aproach
is emulate the fast blinking with the slow blinking, that it is more
used.
It is removed the flag ATTR_FASTBLINK because it has not a different
meaning of ATTR_BLINK, so it is not needed.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Roberto E. Vargas Caballero k0ga@shike2.com
b4dfa181
Fix disabling of bold and fastblink

According to ECMA-48¹ 8.3.117, an attribute value of 21 is "doubly
underlined", while 22 is "normal colour or normal intensity (neither
bold nor faint)".

Additionally, 25 is "steady (not blinking)", which likely means neither
slow blink nor fast blink.

¹: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Michael Forney mforney@mforney.org
e8f3513b
Add info about Backspace and Delete to the FAQ

Here is a modest attempt at cleaning it up a little bit. I changed a
few phrases that seemed awkward, but I think the content is the same.

--
Wolfgang Corcoran-Mathe

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Wolfgang Corcoran-Mathe first.lord.of.teal@gmail.com
f210ea26
Add info about Backspace and Delete to the FAQ
Roberto E. Vargas Caballero k0ga@shike2.com
8306568b
Add information about librt and OpenBSD to the FAQ
Roberto E. Vargas Caballero k0ga@shike2.com
844cd7ce
Add information about librt and OpenBSD to the FAQ
Roberto E. Vargas Caballero k0ga@shike2.com
8c5ba1cf
Add information about librt and OpenBSD to the FAQ
Roberto E. Vargas Caballero k0ga@shike2.com
3949aa7c
Very minor grammar fixes in FAQ

Self-explanatory.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Wolfgang Corcoran-Mathe first.lord.of.teal@gmail.com
84ceefe0
Fix st with input method.

XFilterEvent need to be called against every event, otherwise it would
missing some message in the xim protocol and misbehave on some im server.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Weng Xuetian wengxt@gmail.com
b5d0a13c
Changed inconsistent indent

- A line was indented using spaces despite the rest of the code using
  tabs.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Eric Pruitt eric.pruitt@gmail.com
984c12d2
Add 8 bit version of DCS, APC, PM, OSC

DCS, APC, PM, OSC version for 7 bits environments already was implemented
in st.  This patch adds the 8 bit version of it.
Roberto E. Vargas Caballero k0ga@shike2.com
da78629c
Add 8 bit version of HTS

HTS version for 7 bits environments already was implemented in st.
This patch adds the 8 bit version of it.
Roberto E. Vargas Caballero k0ga@shike2.com
f5356d01
Add 8 bit version of NEL

NEL version for 7 bits environments already was implemented in st.
This patch adds the 8 bit version of it.
Roberto E. Vargas Caballero k0ga@shike2.com
bcbaf5d9
Add 8 bit version of DECID

DECID version for 7 bits environments already was implemented in st.
This patch adds the 8 bit version of it.
Roberto E. Vargas Caballero k0ga@shike2.com
f796533b
Render faint attribute

Faint text is implemented by allocating a new color at one-half
intensity of each of the r, g, b components, or if the text bold at the
same time, it is not made lighter.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Anders Eurenius aes@spotify.com
955923b3
Remove all strcmp and strlen calls on Glyph.c[]

There were a few occurrences of strcmp and strlen being called on Glyph.c[],
which is not always null-terminated (this actually depends on the last values in
the buffer s in ttyread()). This patch replace all the calls to strcmp with a
test on c[0] directly or a call to tlinelen, and the one to strlen with utf8len.
I also took the opportunity to refactor getsel and tdumpline.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Ivan Delalande colona@ycc.fr
0015e198
Making surf compile again with rt.

The clock_gettime patch needs librt to be linked to surf.

Thanks _odie for the hint.
Christoph Lohmann 20h@r-36.net
1fc4afd1
Render struck-out attribute

Implement crossed-out text with an XftDrawRect call, similar to how
underline is implemented. The line is drawn at 2/3 of the font ascent,
which seems to work nicely in practice.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Anders Eurenius aes@spotify.com
21bd4f4f
Render invisible attribute

Implement invisible mode by setting the foreground color to be the same
as the background color. Not rendering anything would also be an
alternative, but this seems less likely to cause surprises in
conjunction with any hacks.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Anders Eurenius aes@spotify.com
50e6355e
Reorder and extend glyph attributes

Faint, invisible, struck and fast blink are added as glyph attributes.
Since there's an edit here, let's take the opportunity to reorder them
so that they correspond to the two's power of the corresponding escape
code. (just for neatness, let's hope that property never gets used for
anything.)

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Anders Eurenius aes@spotify.com
77569526
Remove CEIL macro

This macro was not correct in some cases, and it was used only in
one place, where we did'nt get any benefit in performance of in size,
so the macro is removed and ceilf is used instead of it. The only
function needed from math.h is ceilf, so this patch defines the
prototype of it instead of including math.h.
Roberto E. Vargas Caballero k0ga@shike2.com
19d09571
Fixed wrong nanosecond factor 10E6.

Commit 5edeec1 introduced a wrong factor for nanosecond computation, the correct
value is 1E6. Time and timeout values are 10 times less than they should be and
this cause high CPU usage.

Reported by pyroh on IRC. Thanks!

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Ivan Delalande colona@ycc.fr
5edeec1b
Use monotonic clock to prevent timing issues

This patch replaces the gettimeofday()/timeval-system with
uses of clock_gettime() with a monolithic clock and timespec-structs.
gettimeofday() is not accurate and prone to jumps and POSIX.1-2008
marks it as obsolete. Read more here [0].

The patch should speak for itself and decreases the binary
size for me by almost 200K(!).

[0]: http://blog.habets.pp.se/2010/09/gettimeofday-should-never-be-used-to-measure-time

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
FRIGN dev@frign.de
738f555f
Fix typo in config.def.h

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Eric Pruitt eric.pruitt@gmail.com
58eaa998
update size hints on zoom

On font zooming (i.e. xzoom()), window size hints are not updated.  This
patch does that.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Troy Sankey sankeytms@gmail.com
c2fd2754
Refactor the innermost loop of the xdraws function

Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Silvan Jegen s.jegen@gmail.com
27b28f1d
FAQ: update typo and escape code for smkx

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Hiltjo Posthuma hiltjo@codemadness.org
587b4435
Style police.
Christoph Lohmann 20h@r-36.net
93661042
Simplify tdeftrans
Roberto E. Vargas Caballero k0ga@shike2.com
18a05fdf
Remove unnecessary typedef

This should also fix compiling-errors on OpenBSD,
as reported by Nils R. Thanks!

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
FRIGN dev@frign.de
5159d55c
Refactor selsnap SNAP_WORD.

Refactor the SNAP_WORD part in selsnap, and fix a bug that caused the word
delimiters to be ignored if it was at the very beginning or end of a wrapped
line.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Colona colona@ycc.fr
6fd88707
Fix rectangular selection.

selsort computes the wrong normalized coordinates when rectangular
selection is enabled, causing rectangular selection to only work
when going toward either the top left corner, or the bottom right
one.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Colona colona@ycc.fr
bb6dc332
tiny cleanup

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Hiltjo Posthuma hiltjo@codemadness.org
2323e962
Make selection consistent over line breaks.

Currently, selection is expanded to the end of the line over line breaks only in
regular selection mode, when the line in not empty and when going down and/or
right. This covers all the cases including word selection mode, with the
exception of rectangular selection because it would make this mode too rigid.
This adjustment is made in selsort so I renamed it to selnormalize to better
reflect what it does now.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Colona colona@ycc.fr
c6fcb78b
Fixing color and refactor xsetcolorname.

By  the recommendation of FRIGN I refactored xsetcolorname to remove the
unnecessary r, g, b variables when allocating a new  color.  Colors  are
now freed and set to the new color. A die() should not happen here. Oth‐
erwise it is easy for applications to kill st. St should be resilent  to
malicious input.

Second  this  patch  standardises  the  naming  of  »color«. There is no
»colour« here. Maybe in some parts of the world.
Christoph Lohmann 20h@r-36.net
8b4cfcea
Revert "Refactor xsetcolorname()"

This reverts commit a32c5f5726f514b49bd396f27aab0e78c40126d3.
Christoph Lohmann 20h@r-36.net
a32c5f57
Refactor xsetcolorname()

I mainly improved the slightly off algorithm used to load colours in the 256-colour-space and
removed unnecessary local values (r,g,b,colour).
"colour" is not necessary as a punchbag for XftColorAlloc[Value,Name], as they don't mess with
the result-adress until they are absolutely sure everything worked out[0].

Being at it, I changed the error-returns for AllocValue to dies (just like in xloadcols()), as
a failure is most likely an OOM-situation you better catch early.
In case of an invalid name everything stays the same.

[0]: http://www.opensource.apple.com/source/X11libs/X11libs-40/libXft/libXft-2.1.13/src/xftcolor.c

Signed-off-by: Christoph Lohmann <20h@r-36.net>
FRIGN dev@frign.de
ba36d139
Don't report release events for mouse wheel

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Balazs Kezes rlblaster@gmail.com
ede83bd0
Fixing italic bold.

Thanks Felipe Spychalski <spychalski@gmail.com> for the patch!
Christoph Lohmann 20h@r-36.net
2411308b
Fixed copying empty lines inside selection.

The code was assuming that empty lines have implicit wrap-around attribute.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Alexander alex0player@gmail.com
d03aa8d2
Fix some more LICENSE changes.
Christoph Lohmann 20h@r-36.net
80d80512
Add FRIGN to License, remove trailing whitespace

Signed-off-by: Christoph Lohmann <20h@r-36.net>
FRIGN dev@frign.de
488977c8
Brightening is again on the TODO list.
Christoph Lohmann 20h@r-36.net
f4ebb318
Fixing trailing whitespaces.
Christoph Lohmann 20h@r-36.net
3544e354
Fix colour-model and simplify xloadcols()

Signed-off-by: Christoph Lohmann <20h@r-36.net>
FRIGN dev@frign.de
cf890e5b
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>
Hiltjo Posthuma hiltjo@codemadness.org
bdb850a1
Redraw needs all dirty lines to have flash etc. work.
Christoph Lohmann 20h@r-36.net
e31829f6
End a sequence only on CAN, SUB, \a and C1s.
Colona colona@ycc.fr
5e917ab2
Also clears ESC_START on interrupt characters during sequences.

Otherwise, the rest of the input is interpreted as a new escape
sequence.
For the ESC character, ESC_START is re-set in tcontrolcode.
Colona colona@ycc.fr
99fb365a
Consistent FALLTHROUGH comments.
noname noname@inventati.org
870f961c
Fix displaying control code

Control code are never displayed. It is not important if graphic
charset is displayed or not.
Roberto E. Vargas Caballero k0ga@shike2.com
1629363f
Remove ATTR_GFX and tselcs

ATTR_GFX was used long time ago to detect when terminal was in
graphic mode. Today graphic mode is implemented using a charset
pointer, so ATTR_GFX is not needed anymore because graphic
condition can be detected directly checking if current charset
is GRAPHICS C0.
Roberto E. Vargas Caballero k0ga@shike2.com
6b315558
Do not save cursor in tresize.

This patch fixes the bug introduced in
8f11e1cd034ff28ca47bb4955505db7fa8016ba8

To reproduce the bug:
1. Save cursor: printf '\e[s'
2. Load cursor: printf '\e[u'
3. Resize st window.
4. Load cursor again: printf '\e[u'
noname noname@inventati.org
5f919835
Simplify selected().
noname noname@inventati.org
9e3e8ce4
Do not export chscale and cwscale.
noname noname@inventati.org
0e439e56
Simplify xunloadfonts.
noname noname@inventati.org
74962bf5
Remove one indentation level in getsel().
noname noname@inventati.org
6681af16
Remove unused dump() function.
noname noname@inventati.org
1ae2745f
Add missing function prototypes.
noname noname@inventati.org
a48f2be7
Use MODBIT in xseturgency.
noname noname@inventati.org
17fa1493
Compute ena_sel as one expression.
noname noname@inventati.org
a8a9e66a
Simplify expressions in tputc()
Roberto E. Vargas Caballero k0ga@shike2.com
17290f49
Fix misplaced break

This misplaced break was causing an incorrect fall through
from DSR to DECSTBM.
Roberto E. Vargas Caballero k0ga@shike2.com
43d74ef3
Create a function for DEC test

Almost of the sequences execute their action in a separate function,
which is good because helps to read the full set of sequences
faster.
Roberto E. Vargas Caballero k0ga@shike2.com
3764f38f
Fix tputc control code handling

The patch 53105cf modified how control codes were detected, because
it tried to handle also C1 control codes (0x80-0x9f), that have
upper bit to 1, so they are multi byte character in utf8.
Code was checking the value of width in order to known that after
decoding the unicode point had a width of 1 byte, but it as incorrect
because this width is the columnb width.
Roberto E. Vargas Caballero k0ga@shike2.com
53105cf7
Remove repeated initialisation of term.esc

Once a sequence is completed term.esc must return to 0, so
instead of repeating this expression in all the cases is
better put it at the end of the block.
Roberto E. Vargas Caballero k0ga@shike2.com
aa35bbd7
Cancel DCS with SUB, CAN, ESC or any CC1 code

From http://www.vt100.net/docs/vt510-rm/chapter4:

	*The VT510 ignores all following characters until it receives a
	 SUB, ST, or any other C1 control character.

So OSC, PM and APC sequence ends with a SUB (it cancels the sequence
and show a question mark as error), ST or any another C1 (8 bits)
code, or their C0 (7 bits) equivalent sequences (at this moment we
do not handle C1 codes, but we should). But it is also said that:

	Cancel  CAN
	1/8     Immediately cancels an escape sequence, control sequence,
		or device control string in progress. In this case, the
		VT510 does not display any error character.

	Escape  ESC
	1/11    Introduces an escape sequence. ESC also cancels any escape
		sequence, control sequence, or device control string in
		progress.
Roberto E. Vargas Caballero k0ga@shike2.com
704d1244
add break;s for last cases in switch statements
Markus Teich markus.teich@stusta.mhn.de
02d2df57
Do not eat ESC character if control string is not properly terminated.

Currently tputc handles the case of too long control string waiting for
the end of control string.

Another case is when there is ESC character is encountered but is not
followed by '\\'.  In this case st stops processing control string,
but ESC character is ignored.

After this patch st processes ESC characters in control strings properly.

Test case:
printf '\e]0;abc\e[1mBOLD\e[0m'

Also ^[\ is actually processed in the code that handles ST.
According to ECMA-048 ST stands for STRING TERMINATOR and is used to
close control strings.
noname noname@inventati.org
c4b79b05
Fix for multibyte characters in techo.

Works for both signed and unsigned char.
noname noname@inventati.org
7f1e02e4
s/DSC/DCS/ DCS stands for DEVICE CONTROL STRING
noname noname@inventati.org
84f6dbff
Use xwrite instead of write.
noname noname@inventati.org
2d67f99d
Remove unnecessary break
noname noname@inventati.org
4a8574b4
Comment fix.
noname noname@inventati.org
8f11e1cd
On terminal resize, clear the alt screen with its own cursor.

Currently the alternate screen get messed up on resize if it has
different colors or mode.
Colona colona@ycc.fr
844c503c
Optimize tputtab.

Before this patch executing
	printf '\e[10000000000I'
or
	printf '\e[10000000000Z'
resulted in long delay.
noname noname@inventati.org
1b0b9759
Use != instead of ^ for logical values.

sel.alt is only changed by
	sel.alt = IS_SET(MODE_ALTSCREEN);
noname noname@inventati.org
99d2d600
Use BETWEEN macro in xsetcolorname and fix style.
noname noname@inventati.org
fe31a3f6
Conformity in the -g geometry handling.

Thanks to Yuri Karaban for suggesting this!

These changes make -g correspond to <cols>x<rows> and honor it so non-tiling
window managers can work with the size hints afterwards. It also adds a -i
flag to force the window size. This is needed so -g keeps being useful in dwm.
Christoph Lohmann 20h@r-36.net
6b7f63ba
Simplify a bit more tdeletechar and tinsertblank

The large and repeated expression used in memmove to indirect
the line can be simplified using a pointer, that makes more
clear where begins and where ends the movement.
Roberto E. Vargas Caballero k0ga@shike2.com
80b32af7
Simplify tdeletechar and tinsertblank and fix memory corruption.

Current CSI parsing code uses strtol to parse arguments and allows them
to be negative. Negative argument is not properly handled in tdeletechar
and tinsertblank and results in memory corruption in memmove.

Reproduce with printf '\e[-500@'

Patch also removes special handling for corner case and simplifies
the code.

Removed
	term.dirty[term.c.y] = 1
because tclearregion sets dirty flag.
noname noname@inventati.org
16ac85bf
Style fixes in tscrollup.
noname noname@inventati.org
fe527aa5
Do not set dirty flag twice in tscrollup and tscrolldown.
noname noname@inventati.org
3afdb4ff
Use tsetdirt in tscrollup and tscrolldown.

tscrollup and tscrolldown do not use tsetdirt, but their code is
equivalent to

        tsetdirt(orig, term.bot-n);
        tsetdirt(orig+n, term.bot);

tclearregion also marks cleared lines as dirty.
In tscrolldown it sets lines from term.bot-n+1 to term.bot dirty, and in
tscrollup it sets lines from orig to orig+n-1 dirty.

In both functions all lines from orig to term.bot are effectively set
dirty, but in tscrolldown lines from orig+n to term.bot are set dirty
twice, and in tscrollup lines from orig to term.bot-n are set dirty
twice.

These patches make it clear which lines are set dirty and sets them
dirty once in each funciton.
noname noname@inventati.org
f9dc374e
Fix techo handling of control and multibyte characters.

techo compares signed char to '\x20'. Any character with code less then
'\x20' is treated as control character.  This way characters with MSB
set to 1 are considered control characters too.

Also this patch makes techo display DEL character as ^?.

To reprocuce the bug, enable echo mode using printf '\e[12l',
then type DEL character or any non-ASCII character.
noname noname@inventati.org
fa19f241
Make xrealloc and xstrdup style consistent.
noname noname@inventati.org
df1810dd
Use BETWEEN in tsetchar.
noname noname@inventati.org
ed855ea4
Use uint and uchar instead of unsigned int and unsigned char.
noname noname@inventati.org
68d97457
Remove argument names from function prototypes.
noname noname@inventati.org
49672dac
Style fix in tdumpsel.
noname noname@inventati.org
f21e47f4
Use BETWEEN in tinsertblankline and tdeleteline.
noname noname@inventati.org
87abc7cd
It's 2014 now.
Christoph Lohmann 20h@r-36.net
13888703
move MODBIT to Macros section

Patch moves MODBIT to macros section and uses it in tselcs.
noname@inventati.org noname@inventati.org
6b56cbf9
misplaced parenthesis in LEN macro
noname@inventati.org noname@inventati.org
3269bf21
remove confusing SERRNO macro

I found the SERRNO Macro slightly confusing, since you have to look
it up, if you don't know it already. A web search showed it does
not seem to be any kind of standard. Also there was no reason in
the commit log when it was introduced in 2009. As you can see it
also leads to new patches, which don't use this macro (probably the
author did not know about it).
Markus Teich markus.teich@stusta.mhn.de
4ad2fc7f
Simplify techo

Remove special case for \e because it is handled well by "control code"
case.
noname@inventati.org noname@inventati.org
dc74c4f7
typedefs instead of #defines

Replaced #defines with typedefs where possible, patch attached.
noname@inventati.org noname@inventati.org
b8d6171c
fix cursor handling when alt screen is disabled

I don't like this alt screen thing, but when
allowaltscreen == 0, the cursor is still saved
and restored after calling 'less' (or 'man').

This patch makes allowaltscreen == 0 usable.
q@c9x.me q@c9x.me
ebb6e032
Merge remote-tracking branch 'origin/master' into omaster
Roberto E. Vargas Caballero k0ga@shike2.com
3cb80840
Increment XSync consistency

This patch cleans up a style inconsistency.
Toaster Toaster toaster23456@gmail.com
c46d929f
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 
Roberto E. Vargas Caballero k0ga@shike2.com
0baf2d8b
0.5 release.
Christoph Lohmann 20h@r-36.net
62f91424
Updating the TODO in preparating for 0.5.
Christoph Lohmann 20h@r-36.net
a495fce1
There is no need for a full dirt redraw.
Christoph Lohmann 20h@r-36.net
6f4cfa51
Fixing a compiler warning with the assignment.
Christoph Lohmann 20h@r-36.net
672e4e4b
Fix segfault when pressing PrintScr without a selection
Rafa Garcia Gallego rafael.garcia.gallego@gmail.com
45b808b8
new utf decoder

This patch replaces current utf decoder with a new one, which is ~50
lines shorter and should be easier to understand. Parsing 5 and 6
sequences, if necessary, requires trivial modification of UTF_SIZ
constant and utfbyte, utfmask, utfmin, utfmax arrays.
Damian Okrasa dokrasa@gmail.com
71328cbc
Merge branch 'master' of ssh://suckless.org/gitrepos/st
Roberto E. Vargas Caballero k0ga@shike2.com
85f8a414
Add terminfo entries for printer

These capabilities inform to programs how print in local printer
of the terminal.
Roberto E. Vargas Caballero k0ga@shike2.com
78f8843b
Add sequence for printing the current selection

This is very usefull in order to can select what is sent
to the plumber.
Roberto E. Vargas Caballero k0ga@shike2.com
96c230e4
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
Roberto E. Vargas Caballero k0ga@shike2.com
6166a1af
Add MC for the full screen

This sequence is very useful because allows comunicate the content
of the terminal to another program.
Roberto E. Vargas Caballero k0ga@shike2.com
cf332a32
Add MC for a single line

This sequence print the current line. It is different to the
'printer on' sequence, where all the characters that arrive to the
terminal are printer. Here only the ascii characters are printed.
Roberto E. Vargas Caballero k0ga@shike2.com
1f0d981b
Add MC sequence

This sequence control when the printer is enabled or disabled. This
sequence control the behaviour of the -o option.
Roberto E. Vargas Caballero k0ga@shike2.com
cdb3b189
Add xstrdup function

Since we are using xmalloc, xrealloc ..., then it is not logical
call directly to strdup.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Roberto E. Vargas Caballero k0ga@shike2.com
315b7ee9
Merge remote-tracking branch 'origin/master'
Roberto E. Vargas Caballero k0ga@shike2.com
6521b5dc
Remove non defined behaviour in selcopy

It is not defined when lateral effects of expressions are
calculated, so an expression as:

	--last >= gp && !(selected(last - gp, y)

is non portable.
Roberto E. Vargas Caballero k0ga@shike2.com
a8d58700
Remove duplicated code in strhandle

The error condition was duplicated in two different switches.
This new version centralized the error handling in only one place.
Roberto E. Vargas Caballero k0ga@shike2.com
21d905c0
Make Shift+Home equal to CLS in ascii mode
Roberto E. Vargas Caballero k0ga@shike2.com
9523233e
Make CONTROL + DELETE delete a line

If CONTROL + INSERT inserts a line then it seems natural CONTROL + DELETE
removes a line.
Roberto E. Vargas Caballero k0ga@shike2.com
d2173cd7
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>
Roberto E. Vargas Caballero k0ga@shike2.com
95591001
Use character scaling in XCopyArea
Eric Pruitt eric.pruitt@gmail.com
c0a56ef4
Make w3mimgdisplay work with st

Before this patch draw() calls drawregion which calls xdraws and then
updates whole window in one call thus overdrawing anything drawn by
w3mimgdisplay. After moving XCopyArea to xdraws it only updates the
regions which are being updated by XftDraw* functions. It may do a few
more calls to XCopyArea with this patch.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Amadeusz Sławiński amade@asmblr.net
9df9a472
Fix truecolor escapes, when both bg and fg are set

for example
echo -e "\e[48;2;255;0;0m\e[38;2;0;0;255m test "
should render on red bg with blue fg

also now elinks works correctly when using 'truecolor' option
in preferences

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Amadeusz Sławiński amade@asmblr.net
e8dba891
query pixel size from matched font

Sorry for another duplicated mail. I found the patch is malformed
significantly. I've been away from my laptop for a while, so I'm quite
unfamiliar with the settings on this system...
Eon S. Jeon esjeon@hyunmu.am
33da67da
Update arg.h from sbase

sbase did some interesting modifications to arg.h (basically it
was fixed an incorrect use of the _ namespace), and this commit
take this last version for st.
Roberto E. Vargas Caballero k0ga@shike2.com
d60ee733
Prevent resizing stdin

This fixes a bug that the parent tty gets resized whenever you launch
st through command line.

The problem was that ioctl was resizing cmdfd before it gets
initialized in ttynew. Since cmdfd is a global variable, its initial
value is 0, and consequently stdin was being resized.
Eon S. Jeon esjeon@hyunmu.am
ef1dc9fc
Replace alignment tabs with spaces.
Mark Edgar medgar123@gmail.com
6162d631
Fix comments in config.def.h to match field names.
Mark Edgar medgar123@gmail.com
fb8e3f67
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
Mark Edgar medgar123@gmail.com
39f28b18
Set _NET_WM_PID attribute
Eric Pruitt eric.pruitt@gmail.com
2738592d
Fix rmul definition

rmul means "exit underline mode", so a full reset of all
the attributes is not the correct way of exiting from
underline mode, because it is going to modify also another
attributes not related.
Eric Pruitt eric.pruitt@gmail.com
08a3eea5
Add stdint include

Since st is using now int32_t and uint32_t the inclusion of
stdint or inttype is mandatory, because in other case the
definition of these new types will not be known by the
compiler.
René Rietz rrietz@informatik.tu-cottbus.de
53474391
Fix stupid bug in tdefcolor returning -1 in unsigned function

k0ga misktook applying patch of others. Sorry guys!!!!
Roberto E. Vargas Caballero k0ga@shike2.com
1fe0a5f3
Use int instead of long for color

This patch replaces long by int32_t. It saves
some memory on 64bit systems.
Johannes Hofmann johannes.hofmann@gmx.de
4435e0ee
add _NET_WM_NAME
Carlos J. Torres vlaadbrain@gmail.com
72638207
Simplify logic in kmap().
Mark Edgar medgar123@gmail.com
1fa27b93
Simplify logic in match().
Mark Edgar medgar123@gmail.com
3d3c37bc
Merge remote-tracking branch 'origin/master' into omaster
Roberto E. Vargas Caballero k0ga@shike2.com
297c886b
Ignore numlock (Mod2Mask) for button events too.

Conflicts:
	config.def.h
	st.c
Mark Edgar medgar123@gmail.com
0f6942cd
Avoid buffer overrun in bpress()

Use correct type for Mousekey.b (XButtonEvent.button).
Mark Edgar medgar123@gmail.com
8e577322
New ttysend() function calls ttywrite() and techo(). Honor MODE_ECHO when pasting in selnotify().
Mark Edgar medgar123@gmail.com
939e1495
Avoid buffer overrun in kpress() and remove limit on shortcut strings.
Mark Edgar medgar123@gmail.com
02ae3ce6
Simplify Mod1 logic in kpress(), eliminating locals and a memcpy.
Mark Edgar medgar123@gmail.com
7a4eefe8
Add support for multiple charset definitions

vt100 has support for two defined charset, G0 and G1. Each charset
can be defined, but in each moment is selected only one of both
charset. This is usually used selecting a national charset in G0
and graphic charset in G1, so you can switch between graphic
charset and text charset without losing the national charset
already defined.

st hasn't support for national charsets, because it is an utf8
based terminal emulator, but it has support for graphic
charset because it is heavily used, but it only supports G0,
without understanding G1 selection sequences, which causes some
programs in some moments can print some garbage in the screen.

This patch adds a fake support for multiple charset definitions,
where we only support graphic charset and us-ascii charset, but
we allow more of one charset definition.

This patch allow define G0 until G3 charsets, but only accepts
select G0 or G1, and it accepts some national charset definitions
but all of them are mapped to us-ascii.
Roberto E. Vargas Caballero k0ga@shike2.com
c5c2365a
People, learn to keep to styles. Thanks.
Christoph Lohmann 20h@r-36.net
62ab9389
Fix save/restore cursor

st was assuming that save/restore cursor position was independent
of the screen that was shown in each moment, but it is not true,
because each screen has a different save/restore buffer. This
patch fixes it.
Mihail Zenkov mihail.zenkov@gmail.com
2b1bc808
Add DSR cursor position sequence
Mihail Zenkov mihail.zenkov@gmail.com
eeae9b0c
Fix core in multi-line selection on OpenBSD

OpenBSD 5.3 amd64 release version with the most current st
version from git, crash and dump core when selecting multiple
lines whith the cursor.  This happens, because on line 964
of st.c (gp-1)->mode is accessed, although gp is still
pointing at the beginning of the array term.line[y] (see
line 939 for initialization of gp).
Maurice Quennet mjq@gmx.net
8ac0a5f8
Add bracketed paste mode

This patch enables bracketed paste mode (
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#Bracketed%20Paste%20Mode
).

It's mainly useful for text editors to disable line wrapping and auto
indentation when text is being pasted, rather than typed from keyboard.

On the emulator side, it is supported by at least xterm, urxvt,
gnome-terminal, putty, iterm2; and I have a patch for konsole.

On the application side, vim can be configured easily to handle this, and
I have pending patches for mcedit and joe. Probably many others also
support it.
Egmont Koblinger egmont@gmail.com
eae31a53
Fix some bugs in mouse tracking logic

* Button number in X10 mode:

  I believe the button - 1 came from "C b is button - 1" from [0].
  However, above this section, it states

    "Normally, parameters (such as pointer poisition and button number)
     for all mouse tracking escape sequences generated by xterm encode
     numeric parameters in a single character as value+32. For example, !
     specifies the value 1."

  Also, from the description of SGR,

    "The encoded button value in this case does not add 32 since that
     was useful only in the X10 scheme for ensuring that the byte
     containing the button value is a printable code."

  This suggests that we should still add 32 to the button value when in
  MODE_MOUSEX10.

* No button release reporting in X10 mode:

    "X10 compatibility mode sends an escape sequence only on button press,
     encoding the location and the mouse button pressed."

* Fix MODE_MOUSEMOTION:

  Currently, motion reporting is skipped when oldbutton == 3
  (corresponding to no button being pressed). However, oldbutton is
  only set on a button press, which will never be 3.

[0]: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
Michael Forney mforney@mforney.org
cc2ea314
Default volume of the bell is 0.
Christoph Lohmann 20h@r-36.net
bef599bb
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>
Roberto E. Vargas Caballero rvargas@bsccs347.bsc.es
210dda95
Wide character support.

Thanks "Eon S. Jeon" <esjeon@hyunmu.am>!
Christoph Lohmann 20h@r-36.net
a4358a1f
Adding some contributors. Thanks to you all!
Christoph Lohmann 20h@r-36.net
4245ba0d
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().
Mark Edgar medgar123@gmail.com
f3d438b1
Regarding commit 7e3cff3

Hello.

I reviewed and tested commit 7e3cff3, and made a patch that fixes some
problems in it.

1. There's a semicolon after an if statement, which is obviously a
typo.

2. The current way of calculating text position in "xdraws" yields
inconsistent results in some cases. This is due to the use of
"font->width", which varies. Instead, "xw.cw" has to be used as the
character width.

Sincerely,
Eon
Eon S. Jeon esjeon@hyunmu.am
587bc939
Tmux is using C-b by default.

Thanks for noticing Fidel Barrera Cruz!
Christoph Lohmann 20h@r-36.net
8d21ced0
Correcting the bitmask value check.
Christoph Lohmann 20h@r-36.net
45796938
Add terminfo definitions for terminals with meta key

Some programs don't check the value of km and use smm and rmm
capabilites, and they cause the terminal change to meta enabled
mode even in cases where is not desirable.

Allmost all people is using the terminal waiting that meta sends
escape, so rmm and smm are not needed. If someone needs meta
sets 8 bit he can use the correct terminfo definition in TERM.
Roberto E. Vargas Caballero k0ga@shike2.com
347a45c3
Fix signess of tdefcolor

tdefcolor() returns -1 on error, while its return type is
unsigned long. At the same time, line 1724 and 1731 are checking the
positivity of its unsigned return value.
Eon S. Jeon esjeon@lavabit.com
22eeda56
Fixed memory leak in xsettitle().
Alexander Sedov alex0player@gmail.com
86c03ddc
Fix blink mode check

ATTR_BLINK is an attribute for a Glyph and will not be set in term.mode.
Michael Forney mforney@mforney.org
7e3cff33
Use character size scaling factors

The bounding boxes for characters can be scaled using "cwscale" and "chscale"
to scale the width and height respectively.
Eric Pruitt eric.pruitt@gmail.com
aaee0e8b
Reload colors in reset

Colors definition can be changed using a OSC sequence, so
we have to reload them if we want be sure all the colors
are the correct.

Could be desirable free the colors allocated due to rgb
colors and inverse colors (XftColorAllocValues in xdraws),
but it is impossible due we use the same structure for all
of them.
Roberto E. Vargas Caballero k0ga@shike2.com
8dde8cde
Add RGB color definition

This patch uses the bit 24 in the color descriptor as an indicator
of RGB color, so we can take the values and generating the XftColour
directly in xdraws.
Roberto E. Vargas Caballero k0ga@shike2.com
33ad83d4
Improved font caching

I made a patch that improves the performance of font caching mechanism.
This is based on a funny behaviour of FontConfig: it was handling
FcCharSet in a somewhat unexpected way.

So, we are currently adding "a character" to a new FcCharSet, and then
add it to a FcPattern. However, if we toss the FcPattern to FontConfig,
it loads the entire language(charset) that contains the character we
gave. That is, we don't always have to load a new font for each unknown
character. Instead, we can reused cached fonts, and this significantly
reduces the number of calls to extremely slow FontConfig matching
functions.

One more thing. I found that, in libXft, there's a function called
XftCharExists. XftCharIndex internally calls this function, and
does more stuffs if the character does exist. Since the returned index
is never used in st, we should call XftCharExists instead of
XftCharIndex. Please note that I already made this change in the patch.
Eon S. Jeon esjeon@lavabit.com
40e4d76d
fix: whitespace
Markus Teich markus.teich@stusta.mhn.de
fbc589d5
Remove long text being cropped/wrapped to standard 80x24 on launch.

To be more specific, now tty creation is delayed until X window is
actually mapped; last ConfigureNotify before mapping determines
initial tty size.
Please report problems if there are any.
Alexander Sedov alex0player@gmail.com
6fc471cc
fix: consistent usage of bitmask operations on unicode functions
Markus Teich markus.teich@stusta.mhn.de
8b602a37
fix: do not need an extra variable for a single read
Markus Teich markus.teich@stusta.mhn.de
6e1c7c8a
Fix match function bugs

There were two problems with match denfinition.

1) There was a forward declaration in the form:

	static inline bool match(uint, uint);

but later the function was defined as:

	inline bool
	match(uint mask, uint state) {

This causes that there were two different functions in the code, one local
and inline, and other inline but extern. All was working without problems
due to we were using -Os, and the compiler was using the extern definition
and it was no expanding the static declaration. If you removed the -Os flag,
then you got linker errors due it was no able to find the static definition
of the static declaration.

2) The mask checking was incorrect because we were doing the test:

	(state & mask) != state

and this test only was saying that at least all the enabled bits of state
were enabled also in mask, but no all the possible bits in mask. This was
the origin of the bug reported by Xavier Cartron, where he said it was
possible activated some shortcuts with some of the modifiers defined in the
config.h file.
Roberto E. Vargas Caballero k0ga@shike2.com
90c6f055
Remove unneded call to draw

draw is the function which update the Xwindow with the information st has,
and it is designed in a way that it must be called once in the main loop
(run function), and calling it in other places it is a waste of time.
Roberto E. Vargas Caballero k0ga@shike2.com
ebbac77d
Fix selection clearing

The way st knows if there is a selection activated is checking if sel.ob.x
is equal to -1. In some parts of the code the way of disabling the selection
was only setting it to -1, but after it you can't be sure if the selection
is clearing from the terminal representation, because it is necessary mark
all the lines affected by the selection as dirty. Already there is a functon
which perform this task, selclear.
Roberto E. Vargas Caballero k0ga@shike2.com
7af030c9
fix PageUp Modifier Mask in config.def.h

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Markus Teich teichm@fs.tum.de
5d3318c0
Fixing title setting with the title argument.
Christoph Lohmann 20h@r-36.net
369734c8
Adding xterm behaviour to setting the title.

Thanks Airwave!
Christoph Lohmann 20h@r-36.net
2cf4f366
Bumping up the xfps so mouse motion won't reap the CPU.
Christoph Lohmann 20h@r-36.net
75306949
Adding true mouse motion support.
Christoph Lohmann 20h@r-36.net
d743b93f
This is a shorter bit handling in MODE_MOUSE.
Christoph Lohmann 20h@r-36.net
317b7859
Add some comments about the other mouse reporting modes.
Christoph Lohmann 20h@r-36.net
405fd89a
Implementing mouse focus and all events.
Christoph Lohmann 20h@r-36.net
8315dc41
Fixing bad highlighting on first SNAP_WORD multiline select.
Christoph Lohmann 20h@r-36.net
b5144100
Fixing the selection in a single line again.

Thanks p37sitdu@lavabit.com!
Christoph Lohmann 20h@r-36.net
8f1bef05
Fixing the selection scrolling and the selection naming.

Thanks p37sitdu@lavabit.com!
Christoph Lohmann 20h@r-36.net
8f47c4a4
Lazy font unloading too.
Christoph Lohmann 20h@r-36.net
62502a88
Lazy fontset loading.

Thanks Johannes Hofmann <Johannes.Hofmann@gmx.de>!
Christoph Lohmann 20h@r-36.net
678eff6e
Removing an old select() regression.
Christoph Lohmann 20h@r-36.net
8e968739
Allow more complex delimiters for word selections.

Thanks Alexander Rezinsky <alexrez@gmail.com>!
Christoph Lohmann 20h@r-36.net
0c2b513d
Expand the last line with '\n' in case of overselection.

Thanks Alexander Rezinsky <alexrez@gmail.com>!
Christoph Lohmann 20h@r-36.net
634c247f
Select to the end of row if end of line is reached.

Thanks Alexander Rezinsky <alexrez@gmail.com>!
Christoph Lohmann 20h@r-36.net
5938fa9d
Better comments for the snapping code.
Christoph Lohmann 20h@r-36.net
8618386d
More stable blinking.
Christoph Lohmann 20h@r-36.net
e1458ef4
Explaining blinking for the dummies.
Christoph Lohmann 20h@r-36.net
911ba567
Selection snapping is now considering wrapping.

Thanks Alexander Rezinsky <alexrez@gmail.com> for mentioning this!
Christoph Lohmann 20h@r-36.net
a53017c8
Add a possibility to modify the string sent by mouse buttons.

Thanks Alexander Rezinsky <alexrez@gmail.com> for the suggestion!
Christoph Lohmann 20h@r-36.net
a77b0117
Be more efficient in blinking.
Christoph Lohmann 20h@r-36.net
1e097265
Enable blinking in st.
Christoph Lohmann 20h@r-36.net
1b2751f5
Fixing the selection handling to allow one char selection.

Thanks Alexander Sedov <alex0player@gmail.com> for suggesting the fix!
Christoph Lohmann 20h@r-36.net
0851f2be
Fixing the selection issue in altscreens.
Christoph Lohmann 20h@r-36.net
011c0f9e
Removed redundant check in draw code.

We're now clearing empty areas with spaces, so there is no point to check
if character contains non-empty string.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Alexander Sedov alex0player@gmail.com
048c54fd
Fix selecting clearing and BCE

The commit b78c5085f72 changed the st behaviour enabling BCE capability,
that means erase regions using background color. Problem comes when you
clear a region with a selection, because in this case the real mode of the
Glyph is not the value of term.line[y][x], due in drawregion we had enabled
the ATTR_REVERSE bit.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Roberto E. Vargas Caballero k0ga@shike2.com
6b03bb76
Now clipping is more clear.
Christoph Lohmann 20h@r-36.net
db6f796e
Removing the overdrawing of some fonts.
Christoph Lohmann 20h@r-36.net
7ea68632
Yes, rs2 != is2.
Christoph Lohmann 20h@r-36.net
8037dac8
There is no 8bit by default and reset 8bit too.
Christoph Lohmann 20h@r-36.net
2bd6afd1
Implementing 8 bit mode for meta.
Christoph Lohmann 20h@r-36.net
b596d6ba
Adding wrap handling in selection.
Christoph Lohmann 20h@r-36.net
872a7f18
Added support for double/triple click+dragging.

Now double-click+dragging automatically snaps both ends to word boundaries
(unless on series of spaces), and triple-click selects whole lines.
As a side effect, snapping now occurs on button press, not button release
like it previously was, but I hope that won't be inconvenient for anyone.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Alexander Sedov alex0player@gmail.com
3c546ae7
0.4.1 release.
Christoph Lohmann 20h@r-36.net
645c1b0a
Making st compile on OpenBSD again.
Christoph Lohmann 20h@r-36.net
e5ff7464
Selection now handles empty lines less counter-intuitively.

Now, when you are selecting a region, you will get all empty lines that happen
to be in it, including trailing ones. Last line terminator is omitted as it previously
was, though.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Alexander Sedov alex0player@gmail.com
da182612
Removing trailing whitespace.
Christoph Lohmann 20h@r-36.net
b7e6a5c8
Got rid of redundant Glyph state.

Now, newly allocated Glyphs are set to spaces and current cursor colors
with tclearregion() routine.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Alexander Sedov alex0player@gmail.com
3ae02990
Removing unneeded comments.
Christoph Lohmann 20h@r-36.net
fed9968b
Got rid of code duplication in tnew() and tresize().

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Alexander Sedov alex0player@gmail.com
0ca0dd8b
Strip trailing spaces from lines when copying selection.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Alexander Sedov alex0player@gmail.com
c371fe58
Enable BCE everywhere.
Christoph Lohmann 20h@r-36.net
44db38a5
Fix the geometry handling.
Christoph Lohmann 20h@r-36.net
4de64fa4
\033 should be used in printf in the FAQ.

Never apply patches of Apple users without shouting at them. The basic rule of
nature is that when you apply Appl users patches without shouting at them that
something will go horribly wrong.
Christoph Lohmann 20h@r-36.net
de4cd2f6
Resize now uses xclear().
Christoph Lohmann 20h@r-36.net
1e7816c2
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!
Christoph Lohmann 20h@r-36.net
5dc48af2
Patching while not really woken up.
Christoph Lohmann 20h@r-36.net
5984657c
Minor naming issue fixed.
Christoph Lohmann 20h@r-36.net
4018b2c5
Making the copy and pasting consistent.

The copying and pasting in the terminald and GUI world is flawed. Due to the
discussion on the mailinglist it seems that sending '\n' is what GUIs expect
and '\r' what terminal applications want. St now implements that behaviour.
Christoph Lohmann 20h@r-36.net
ddd429ea
Convert FAQ into Markdown, to make it easier to integrate it into http://st.suckless.org/

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Kai Hendry hendry@webconverger.com
684cf55a
Make st work with a plain -e command.
Christoph Lohmann 20h@r-36.net
b1813b14
Adopting arg.h with more flexible cmd handling.
Christoph Lohmann 20h@r-36.net
580c8bbd
Add an option to disable alternative screens.
Christoph Lohmann 20h@r-36.net
502911e5
Updating the TODO file for after 0.4.
Christoph Lohmann 20h@r-36.net
a3a5b8e1
Releasing 0.4.
Christoph Lohmann 20h@r-36.net
7e7760c2
Add the possibility to have default highlight colors.

Thanks to stargrave@stargrave.org for the suggestion!
Christoph Lohmann 20h@r-36.net
adde5c6d
Adding PgUp + Ctrl.

Thanks stargrave@stargrave.org!
Christoph Lohmann 20h@r-36.net
f8768106
Adding PgUp and PgDown + Ctrl to config.def.h

Thanks stargrave@stargrave.org!
Christoph Lohmann 20h@r-36.net
a1e3b94b
Removing an undefined case. just do regular selections.
Christoph Lohmann 20h@r-36.net
4b17dddb
Making rectangular selection work again.

People sending me patches against strange revisions and basing on their own
revisions make me having to reapply them. Then such errors appear.

Thanks Alexander Sedov <alex0player@gmail.com> for noticing this.
Christoph Lohmann 20h@r-36.net
55adf0aa
Pange seems to use ascent + descent instead of height.

Thanks Bobby Powers <bobbypowers@gmail.com> for noticing this!
Christoph Lohmann 20h@r-36.net
82494f24
Making st compile on OS X.
Christoph Lohmann 20h@r-36.net
c6b89f23
Using strsep and fixing null termination in csiparse.

Thanks for the hint from Alexander Sedov <alex0player@gmail.com>!
Christoph Lohmann 20h@r-36.net
1c1621da
Changing the way how paste is handled, just for the nano people.
Christoph Lohmann 20h@r-36.net
1aa26b4e
Fixing a bug while parsing empty arguments in csiparse.
Christoph Lohmann 20h@r-36.net
7d32471e
Fixing bugs in the strtol and strtok_r replacements.

Thanks "Roberto E. Vargas Caballero" <k0ga@shike2.com> for the comments!
Christoph Lohmann 20h@r-36.net
7cb0d955
Using strtok_r for the string parsing.
Christoph Lohmann 20h@r-36.net
37863356
Using strtol with overflow checking.
Christoph Lohmann 20h@r-36.net
be7c6d7f
Add insert for the primary clipboard to MOD + Shift + Ins.

Thanks Mantas Mikulėnas <grawity@gmail.com> for the patch!
Christoph Lohmann 20h@r-36.net
e40d8da1
Removing dbe and introducing umlauts to titles.

Thanks Alexander Sedov <alex0player@gmail.com> for the title patch!
Christoph Lohmann 20h@r-36.net
efaf1c2a
Add umlaut support for title change.

Thanks Alexander Sedov <alex0player@gmail.com>!
Christoph Lohmann 20h@r-36.net
1b6c6535
Replace parse_int with atoi().
Christoph Lohmann 20h@r-36.net
800800a3
Added basic xterm-ish palette swap support.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Alexander Sedov alex0player@gmail.com
3865e9ea
Implement rectangular mouse selection.

Thanks Alexander Sedov <alex0player@gmail.com>!
Christoph Lohmann 20h@r-36.net
e5295629
ensure that the italic font has the same weight as the normal font

The specified font[] pattern need not have a medium weight. It could be
specified as a number too or have a different weight other than medium.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
joe9 joe9mail@gmail.com
0e738c3d
Style inquisition.
Christoph Lohmann 20h@r-36.net
7f297e29
Fixing the reverse mode of st colors.

Thanks Alexander Sedov <alex0player@gmail.com> for finding this!
Christoph Lohmann 20h@r-36.net
f4a6c20f
Adding a way to ignore bits in the state.
Christoph Lohmann 20h@r-36.net
e0ec2cf9
Style inquisition.
Christoph Lohmann 20h@r-36.net
a92a678e
The refresh rate for the action needs to be high too.
Christoph Lohmann 20h@r-36.net
de7e0e9c
Changing the fps to something reasonable high.
Christoph Lohmann 20h@r-36.net
086cd615
Doing it like the new run() was proposed.
Christoph Lohmann 20h@r-36.net
95033753
Adding a more efficient drawing code.

Thanks Mihail Zenkov <mihail.zenkov@gmail.com> for giving the hint!
Christoph Lohmann 20h@r-36.net
b7261c84
Tmux wants this to be mutually exclusive.

Thanks Egmont Koblinger <egmont@gmail.com> for noticing this!
Christoph Lohmann 20h@r-36.net
05a1ff03
Adding mor explict font patterns.
Christoph Lohmann 20h@r-36.net
eeffbe11
Making st not activate the cursor in case of Mod + k in dwm.

Thanks Jens Nyberg <jens.nyberg@gmail.com>!
Christoph Lohmann 20h@r-36.net
8a9475a0
Setting the surrounding border to defaultbg.

Thanks Stephen Caraher <moskvax@gmail.com>!
Christoph Lohmann 20h@r-36.net
ce3efa9e
Removing some debug messages.
Christoph Lohmann 20h@r-36.net
efd04cca
Fixing the menus in mc.
Christoph Lohmann 20h@r-36.net
26c101b7
Fixing the black remaining lines in mc and dialog.

This also applies some style fixes and handles some old blink codes.
Christoph Lohmann 20h@r-36.net
384fabdb
Adding extended mouse reporting in st.

Thanks Egmont Koblinger <egmont@gmail.com>!
Christoph Lohmann 20h@r-36.net
deb720af
Removing the debug messages again.
Christoph Lohmann 20h@r-36.net
57f39def
Fixing the clipboard copying to st itself.
Christoph Lohmann 20h@r-36.net
3036051f
St is in 2013 now.
Christoph Lohmann 20h@r-36.net
d8f38093
Removing BCE from the TODO list.
Christoph Lohmann 20h@r-36.net
b78c5085
Implementing Back Color Erase (BCE).
Christoph Lohmann 20h@r-36.net
b4b513c7
Make line drawing work again.
Christoph Lohmann 20h@r-36.net
15c2bff9
Yes, xft should be on the buffer. Thanks Mihail Zenkov.
Christoph Lohmann 20h@r-36.net
c7b033b8
Trying out the double buffering without dbe.
Christoph Lohmann 20h@r-36.net
0e232a41
Dbe is not required anymore.
Christoph Lohmann 20h@r-36.net
3ce96aea
Adding the FAQ entry for zsh.

Thanks Roberto E. Vargas Caballero! You were committing this patch against the
wrong version of the FAQ, so I had to rewrite it.
Christoph Lohmann 20h@r-36.net
ed90afb7
The title can now be set with UTF-8 characters.

Thanks Mihail Zenkov <mihail.zenkov@gmail.com>!
Christoph Lohmann 20h@r-36.net
c9bd58e4
Adding a nasty resize bug. Maybe it can be fixed.
Christoph Lohmann 20h@r-36.net
f25c75d7
Removing the .hgtags file. Thanks ilf.
Christoph Lohmann 20h@r-36.net
1827e064
Standout mode has changed. Thanks p37sitdu@lavabit.com!
Christoph Lohmann 20h@r-36.net
b3326ab6
A different double buffering strategy so the background is default set.
Christoph Lohmann 20h@r-36.net
f741df9c
Standout is now reverse. This makes bsd-games work in st.
Christoph Lohmann 20h@r-36.net
73879c17
Adding an FAQ entry for the keypad handling.

Thanks "Roberto E. Vargas Caballero" <k0ga@shike2.com>!
Christoph Lohmann 20h@r-36.net
5facd29f
Synchronizing the FAQ of the website and the repository.
Christoph Lohmann 20h@r-36.net
b233007e
Damn, my fault. The cache should have at least some entries.
Christoph Lohmann 20h@r-36.net
c772a6e5
Applying the changes to the docs; by Peter Hartman.
Christoph Lohmann 20h@r-36.net
4682cc95
Making the fontconfig and freetype paths portable in config.mk.
Christoph Lohmann 20h@r-36.net
4e14a4a9
A fix for the XopenIM() errors.
Christoph Lohmann 20h@r-36.net
c99db5b0
Increasing font cache for speeding up UTF8 demos.
Christoph Lohmann 20h@r-36.net
44e1b79a
Removing the warning about extents.
Christoph Lohmann 20h@r-36.net
08e06ef0
Fixing the font unloading in case of zoom.
Christoph Lohmann 20h@r-36.net
addc8483
Speeding up the drawing, then all characters are known.
Christoph Lohmann 20h@r-36.net
9c44229c
Adding fallback support to st.
Christoph Lohmann 20h@r-36.net
082bab29
Fixing a compile error.
Christoph Lohmann 20h@r-36.net
ac4c6da4
Fixing a off-by-one error in the penultimate row drawing.
Christoph Lohmann 20h@r-36.net
4d37763e
Fixing a precedence problem. Thanks tridactyla!
Christoph Lohmann 20h@r-36.net
fc2b3669
Checking for the lower X11 special keys too. Thanks Benjamin R. Haskell!
Christoph Lohmann 20h@r-36.net
3c6ec199
Adding error checks for XCreateIC and XOpenIM.
Christoph Lohmann 20h@r-36.net
2696f818
Be careful about mar77i's patches.
Christoph Lohmann 20h@r-36.net
78215c8e
Fixing the nasty selection bug. Thanks p37sitdu@lavabit.com!
Christoph Lohmann 20h@r-36.net
fe3fb82d
Applying the patch of mar771 right.
Christoph Lohmann 20h@r-36.net
fdce8bba
Applying the change of the Del key assingment. Thanks Martti Kühne!
Christoph Lohmann 20h@r-36.net
d5994b43
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(-)
Roberto E. Vargas Caballero k0ga@shike2.com
7c34ff17
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(-)
Roberto E. Vargas Caballero k0ga@shike2.com
3c99be68
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(-)
Roberto E. Vargas Caballero k0ga@shike2.com
e7904128
Fix value of ka1 terminfo capability

ka1 stands for upper left of keypad, so the correct value is the one
generated by Home in application keypad mode.
---
 st.info |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Roberto E. Vargas Caballero k0ga@shike2.com
61b20f4b
Add a notice in the config.def.h file how to obtain the syntax for

xft/fontcache.
Christoph Lohmann 20h@r-36.net
373a8f56
The style inquisition was here.
Christoph Lohmann 20h@r-36.net
172f6543
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(-)
Roberto E. Vargas Caballero k0ga@shike2.com
b26df1d0
Fixing the calculation of the base tty pixel size.
Christoph Lohmann 20h@r-36.net
cf04354e
Restoring the Alt + Backspace functionality. Thanks Brandon Invergo!
Christoph Lohmann 20h@r-36.net
55087ec2
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(-)
Roberto E. Vargas Caballero k0ga@shike2.com
1cbe5602
Fixing some key issues with mc. Thanks nsz!
Christoph Lohmann 20h@r-36.net
440a19a6
Getbuttoninfo is always used the same and just a helper function. Shrinking it

a bit. Thanks nsz!
Christoph Lohmann 20h@r-36.net
6312f76c
Fix speech error in comment

---
 st.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Roberto E. Vargas Caballero k0ga@shike2.com
0df350cd
Remove unused fields in cursor_movement

---
 st.c |    4 ----
 1 file changed, 4 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
1cea02be
Removing my debug fprintf().
Christoph Lohmann 20h@r-36.net
2b6521f5
Optimizing the key lookup to the X11 function key. It is still possible to

remap other keys.
Christoph Lohmann 20h@r-36.net
927d8fb4
Making all function keys accessible.
Christoph Lohmann 20h@r-36.net
a29ab30f
Adding support for XK_F35.
Christoph Lohmann 20h@r-36.net
90e14276
Fix Shift + Insert shortcut

This patch apply the same code for shortcuts that it is used now for defined
keys. So it is possible use now XK_NO_MOD and XK_ANY_MOD for defining shortcuts.
---
 st.c |   35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
cc86d148
Changing the TODO to the current state.
Christoph Lohmann 20h@r-36.net
d5640c77
Fixing the return and keypad enter sent characters. Terminals produce \r. And

some minor style changes.
Christoph Lohmann 20h@r-36.net
801ea034
Import the patch of Eckehard Berns to add insert mode. Thanks!
Christoph Lohmann 20h@r-36.net
e87d21bb
The crlf mode was reversed.
Christoph Lohmann 20h@r-36.net
e7bb14e0
Fixing Return in non-crlf mode.
Christoph Lohmann 20h@r-36.net
4389f2eb
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(-)
Roberto E. Vargas Caballero k0ga@shike2.com
88bb76c1
Fix XK_NO_MOD and XK_ANY_MOD behavior

XK_NO_MOD match a key without modifiers and XK_ANY_MOD match a key does not
matter what modifiers are pressed to. Like they are mask the best value for
XK_ANY_MOD is all the bits to 1, so the and with any state will be equal to
the state. This also imply that is necessary check the case for XK_NO_MOD
(no modifiers at all) with some modifier in state, and the inverse
(some mask different to XK_ANY_MOD or XK_NO_MOD and no modifiers in state).
---
 st.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
16ccf344
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(-)
Roberto E. Vargas Caballero k0ga@shike2.com
461aac15
Fixing the tab key, when no mask is wanted.
Christoph Lohmann 20h@r-36.net
7474a2fc
The style inquisition was here again.
Christoph Lohmann 20h@r-36.net
620e3bb3
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(-)
Roberto E. Vargas Caballero k0ga@shike2.com
44597b35
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(-)
Roberto E. Vargas Caballero k0ga@shike2.com
3b16695f
Fix arrow keys terminfo capabilities

Usually the arrow keys generate the ANSI sequence which terminal will
understand like a movement, so it is not necessary any dealing for them, the
program can not know if the sequence is generate for a echo key or directly
from the program. If you need really know if the key was pressed then you
need activate the keypad mode where the keys will generate a special code
for each keypad key.

The terminfo capabilities kcub1, kcud1, kcuf1 and kcuu1 are used for this
keypad code, not for the sequence generate in the ansi mode.
---
 st.info |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
ea782bfc
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(-)
Roberto E. Vargas Caballero k0ga@shike2.com
93f31166
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(-)
Roberto E. Vargas Caballero k0ga@shike2.com
69ee3ba3
Fix keypad mode and cursor mode

Keypad mode is used for detecting when keys in the auxiliary keypad are
pressed, while cursor mode is used for detecting when a cursor is pressed,
but they are different modes.

St was mixing both modes and DECPAM and DECPNM modified the cursor mode, and
this was incorrect.
---
 st.c    |    5 +++--
 st.info |    4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
73177ba3
Add SRM sequence

This sequence enable/disable the local echo.
---
 st.c |   76 ++++++++++++++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 56 insertions(+), 20 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
ace789a7
Gc is not used anymore.
Christoph Lohmann 20h@r-36.net
c4a9ccec
Removing some xft naming cruft.
Christoph Lohmann 20h@r-36.net
5d5a7c62
Moving the alt declaration to the beginning of the function.
Christoph Lohmann 20h@r-36.net
86659052
Move unsupported sequences to ignored.

These sequences will be never implemented and in this moment they are
generating a lot of noise.
---
 st.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
27468403
Ignore DECARM sequence

DECARM modify the auto repeat settings in the keyboard, and since we can not
modify this setting in the Xserver the best solution is only ignore it.
---
 st.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
d5b80e05
Fix VPR sequence

VPR stands for Move cursor down a number of rows, and the code was moving
the cursor up instead of moving it down.
---
 st.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
5260a9ea
Add DECOM sequence

DECOM sequence allows to the user defines a new home position. The home
position is used as base for all the movement commands except HVP and
VPA. It is important notice than DECSLM moves cursor to absolute position
0,0.
---
 st.c |   33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
ee3e0a9f
Save cursor position in terminal reset

After terminal reset saved terminal position is reset to 0, allowing know
where cursor will go in next restore cursor operation.
---
 st.c |    2 ++
 1 file changed, 2 insertions(+)
Roberto E. Vargas Caballero k0ga@shike2.com
ba9d0365
Clarify some or exclusive expressions

Since relational expresions are always evaluated to 0 or 1, we can use
bitwise xor operator instead of using more complex boolean expressions.
---
 st.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
950ff21e
Fix bug restoring cursor position

Sequences like DECSC, DECRC, ESC [?1047l or ESC [?1047h save and restore
cursor attributes, than taken from vt100 manual are:

       Save Cursor (DECSC) ESC   7
       ===========================
       Saves the following in terminal memory.

      - cursor position
      - graphic rendition
      - character set shift state
      - state of wrap flag
      - state of origin mode

      Restore Cursor (DECRC) ESC 8
      ===========================
      Restores the states described for (DECSC) above. If none of these
      characteristics were saved, the cursor moves to home position; origin
      mode is reset; no character attributes are assigned; and the default
      character set mapping is established.

This implies that hide attribute of the cursor should not be saved/restored
in these sequences. The best way to fix this problem is moving hide
attribute into the terminal mode, instead of having it in the cursor state.
---
 st.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
5d39afc9
Adding scrollwheel support. Thanks Brandon Invergo!
Christoph Lohmann 20h@r-36.net
9df1e561
Changing the license to MIT/X.
Christoph Lohmann 20h@r-36.net
0fbe1559
Fixing meta+return. Thanks Szabolcs Nagy!
Christoph Lohmann 20h@r-36.net
86261187
Removing the debugging for the last fix too.
Christoph Lohmann 20h@r-36.net
9888c506
Fixing a resize bug, if a smaller amount than the lineheight is resized.

Thanks c00kiemon5ter!
Christoph Lohmann 20h@r-36.net
f8db6543
Fixing bold fonts in reverse mode.
Christoph Lohmann 20h@r-36.net
76a8e5f7
Now italic and bold works.
Christoph Lohmann 20h@r-36.net
abe85c0e
Fixing an out-of-bound bug in the selection code. Thanks Szabolczs Nagy!
Christoph Lohmann 20h@r-36.net
091ae143
Fixing the italic-bold font check. Thanks nsz.
Christoph Lohmann 20h@r-36.net
cd90969c
Added tag 0.3 for changeset 9d54ce4daf34
Christoph Lohmann 20h@r-36.net
b0ed3e28
0.3 release.
Christoph Lohmann 20h@r-36.net
c631e9bb
Make it possible to use the corefont font description too. It is not very

useful, but easy to implement.
Christoph Lohmann 20h@r-36.net
393825f9
Moving to the dwm config.h variable usage.
Christoph Lohmann 20h@r-36.net
e5d7c5a6
Adding a FAQ to reference utmp(1).
Christoph Lohmann 20h@r-36.net
784765ca
Cleaning up the TODO file.
Christoph Lohmann 20h@r-36.net
1d378227
Removing the now senseless comment in config.def.h. Thanks to bnwe!
Christoph Lohmann 20h@r-36.net
c5dd7fb3
Applying the patch of the little girl <yui@blekksprut.net> to make cjk input

possible. Thanks!
Christoph Lohmann 20h@r-36.net
b56a0da2
Applying the tab expansion patch from koga.
Christoph Lohmann 20h@r-36.net
71b09ec4
Adding a more flexible fontstring handling, shortcuts and a zoom function.
Christoph Lohmann 20h@r-36.net
6d4e525e
Applying the patch of Roberto Caballero to set WINDOWID and all the pwuid()

variables. Thanks! xinit() and ttynew() had to be switched in their
call-appearance. Otherwise xw.win is not set.
Christoph Lohmann 20h@r-36.net
35421371
Applying the patch of Rafa Garcia Gallega <rafael.garcia.gallego@gmail.com> to

not emulate the vt100 behaviour of selecting all whitespaces. Thanks!
Christoph Lohmann 20h@r-36.net
ee3fbeb6
Add error control to iofile

write can write less bytes than we request, so it is necessary check the
return value, in case of error print a message and don't continnue writing
in the file.
---
 st.c |   39 ++++++++++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 9 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
2e38ab7a
Well, I was confused. Damn state exams. Instead of discussing this shit I

should really learn opthalmology instead. :O
Christoph Lohmann 20h@r-36.net
eb6713ac
If there is really someone without SHELL set, help him/her.
Christoph Lohmann 20h@r-36.net
9e813947
Add DEC alignment test

This sequence was used by DEC personal in to for verifying the screen adjust
of terminals. It is the unique test sequence implemented by all the
emulators, and I think it is because they want be conforms with vttest which
uses this sequence in some tests.
---
 st.c |   31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
b7a7f171
Avoid initialization of vt100_0 in each call to tsetchar

If vt100_0 is a automatic variable then it is initializated in each call to
tsetchar, but if the variable is static it is initializated only in compile
time.
---
 st.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Roberto E. Vargas Caballero k0ga@shike2.com
25f47cb8
Fix Identification sequences

Do not send NUL character in the identification (use (sizeof(VT102ID) - 1),
and finish  the sequence once you execute it.
---
 st.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
ffeeb678
Add DA and DECID sequences

These sequences are used by the host in order to can detect which kind of
terminal is connected. St will answer like a vt102 terminal with this patch.
---
 st.c |    9 +++++++++
 1 file changed, 9 insertions(+)
Roberto E. Vargas Caballero k0ga@shike2.com
bffa6e5c
Fixing a typo.
Christoph Lohmann 20h@r-36.net
b16b5d77
Fixing a off-by-one error in the new border clearing code.
Christoph Lohmann 20h@r-36.net
2bd0c23f
Print control codes only in graphic mode

Non handled codes must be ignored, except in graphic mode. Also STR
sequences have higher priority than control codes, so they must be handled
before of them.
---
 st.c |  160 ++++++++++++++++++++++++++++++++++++------------------------------
 1 file changed, 87 insertions(+), 73 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
034dc71f
Add SI and SO control codes

SI and SO allows change the G0 and G1 selection. This implementation is not
full vt100 compatible, but it is complatible with linux virtual terminal
implementation. For full vt100 compatibility we need remake a lot of stuff
relate to the different charmaps.
---
 st.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
fbfa1f83
Add SUB and CAN control codes

These control codes reset any escape sequence already initialised.
---
 st.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
ac8f05c4
Add documentation to control codes

Add the documentation from the vt100 manual programmer:

Control 	Octal      Action Taken
Character	Code
-------------------------------------------
NUL		000	Ignored on input (not stored in input buffer;
			see full duplex protocol).
ENQ		005	Transmit answerback message.
BEL		007	Sound bell tone from keyboard.
BS		010	Move the cursor to the left one character position,
			unless it is at the left margin,
			in which case no action occurs.
HT		011	Move the cursor to the next tab stop,
			or to the right margin if no further tab stops
			are present on the line.
LF		012	This code causes a line feed or
			a new line operation. (See new line mode).
VT		013	Interpreted as LF.
FF		014	Interpreted as LF.
CR		015	Move cursor to the left margin on the current line.
SO		016	Invoke G1 character set, as designated by SCS
			control sequence.
SI		017	Select G0 character set, as selected by ESC ( sequence.
XON		021	Causes terminal to resume transmission.
XOFF		023	Causes terminal to stop transmitted all codes
			except XOFF and XON.
CAN		030	If sent during a control sequence, the sequence is
			immediately terminated and not executed. It also causes
			the error character to be displayed.
SUB		032	Interpreted as CAN.
ESC		033	Invokes a control sequence.
DEL		177	Ignored on input (not stored in input buffer).
--------------------------------------------
---
 st.c |   28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
02f3b37a
Forgot to remove the xclearborders() definition from the last commit.
Christoph Lohmann 20h@r-36.net
0cc7ee5e
Removing the xclearborders() hack. St now cleans up the parts of the border,

if something needs to be drawn close to it.
Christoph Lohmann 20h@r-36.net
4eddf19f
The style inquisition was here. Yes, making it a unified style. The last

infidels will be squashed too!
Christoph Lohmann 20h@r-36.net
7efa4514
Adding the patch of David Dufberg Töttrup to implement WM_DELETE_WINDOW. Thank you!
Christoph Lohmann 20h@r-36.net
bf6cf05b
Fixing the brightening on bold. For the 256 colors and greyscale I assumed a

reasonable solution.
Christoph Lohmann 20h@r-36.net
5caa46cf
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.
Christoph Lohmann 20h@r-36.net
0b489c4a
When the drawing behaviour was changed underline was not corrected.

Thanks to Peter A. Shevtsov!
Christoph Lohmann 20h@r-36.net
2752018e
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.
Christoph Lohmann 20h@r-36.net
0d88f1ef
Thanks to c00kiemon5ter. Not changing bold to bright colors seems to be the

right choice.
Christoph Lohmann 20h@r-36.net
af9e248f
Removing the now obsolete definitions from the config.def.h file.
Christoph Lohmann 20h@r-36.net
5dfd5df4
This changes -f to be the parameter for the font. Now -f is -o.

The parameters were reordered according to the alphabet too.
Christoph Lohmann 20h@r-36.net
9cae1eb0
Remove the cruft of the user to have to define the different font styles.
Christoph Lohmann 20h@r-36.net
ed5b8700
We need all the colors to be available, so die() on some not available.

This is a new opportunity to see if X11 somewhen handled colors in a strange
way.
Christoph Lohmann 20h@r-36.net
d7b1e31e
All xcolors are not Xft colors and the clearing of the borders has been

optimized. There is a speedup when resizing windows.
Christoph Lohmann 20h@r-36.net
29b209f5
Vt escape sequences allow escape sequences in escape sequences and escape

sequences, so we have to support escape sequences in escape sequences that
escape sequences in escape sequences – setting a title won't notify you
anymore.
Christoph Lohmann 20h@r-36.net
3af49e34
Allow control characters inside escape sequences

Taken from vt100 manual programmer:

	Control characters (codes \0 to \37 inclusive) are specifically
	excluded from the control sequence syntax, but may be embedded
	within a control sequence. Embedded control characters are executed
	as soon as they are encountered by the VT100. The processing of the
	control sequence then continues with the next character received.
---
 st.c |   68 +++++++++++++++++++++++++++++++++---------------------------------
 1 file changed, 34 insertions(+), 34 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
a7d7e293
Ignore all control characters not handled

Taken from vt100 programmer manual:

	Control characters have values of \000 - \037, and \177. The control
	characters recognized by the VT100 are shown in Table 3-10. All
	other control codes cause no action to be taken.

We have to take attention when we are using alternate charset, because in
this cases they are not used as control characters.
---
 st.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
375b6e5b
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.
Christoph Lohmann 20h@r-36.net
3a095984
Implementing line drawing right.
Christoph Lohmann 20h@r-36.net
c3b0e220
A reset should reset the line drawing too.
Christoph Lohmann 20h@r-36.net
980c5956
Enabling enacs and adding compatibility to xterm and urxvt for alternative

charsets.
Christoph Lohmann 20h@r-36.net
eb360e5f
Fix bug in tputc writing to io file

If -f options is enabled then tputc() writes all the data to a file. Actual
code assumes that all the strings in 'c' parameters have always 1 byte
length, but this is not always true, because due to utf-8 encoding some
characters can have a diferent length. So it is necessary pass string length
to tputc in order it can call to write() correctly.
---
 st.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
246d704b
Changing the default font to DejaVu Sans Mono, which is more appealing and

activating antialiasing.
Christoph Lohmann 20h@r-36.net
055a4f6d
The xinit() call needs to be behind all the tty init, otherwise all the

allocated structures are wrong. The xclear() is now done on purpose. Please
keep X11 calls out of the way of pure tty-related calls.
Christoph Lohmann 20h@r-36.net
e9c67781
Adding a TODO for xft fallback.
Christoph Lohmann 20h@r-36.net
74d6abfe
Add some documentetion to tsetmode

The names of the terminal modes supported by vt102 are (taken from the VT220
programmer reference manual):

Table 4-7 ANSI-Standardized Modes
Name  Mnemonic		    Parameter (Ps)
Error (ignored)		    -         0 (3/0)
Keyboard action		    KAM	      2 (3/2)
Insert/replace		    IRM	      4 (3/4)
Send/receive		    SRM	      12 (3/1 3/2)
Line feed/new line	    LNM       20 (3/2 3/0)

Table 4-8 ANSI-Compatible DEC Private Modes
Name  Mnemonic		  Parameter (Ps)
Error (ignored)		  -	    0 (3/0)
Cursor key		  DECCKM    1 (3/1)
ANSI/VT52		  DECANM    2 (3/2)
Column			  DECCOLM   3 (3/3)
Scroll			  DECSCLM   4 (3/4)
Screen			  DECSCNM   5 (3/5)
Origin			  DECOM	    6 (3/6)
Auto wrap		  DECAWM    7 (3/7)
Auto repeat		  DECARM    8 (3/8)
Printer form feed	  DECPFF    18 (3/1 3/8)
Printer extent		  DECPEX    19 (3/1 3/9)
Text cursor enable	  DECTCEM   25 (3/2 3/5)
National replacement character sets DECNRCM 42 (3/4 3/2)

This patch adds a comment for each one of these sequences.
---
 st.c |   26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
c3b63455
Fix LNM sequence

LNM sequence is a standard ANSI mode, not a DEC private mode.
---
 st.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
2f215654
Add KAM sequence

This sequence lock/unlock the keyboard ignoring all the key pressing events
from X server.
---
 st.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Roberto E. Vargas Caballero k0ga@shike2.com
11bec678
Remove unused parameters in ttyresize

---
 st.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
b6cfff16
Clear X window in tsetreset()

tsetreset() is called when it is necessary a full initialization of the
terminal, so it also should clean the full X window and not only the
terminal content. It is necessary change the order of the
initialization in main(), and put xinit before of tnew(), because tnew()
calls to tsetreset(), and  this can cause a call to xreset() with
incorrect values.
---
 st.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Roberto E. Vargas Caballero k0ga@shike2.com
21a0c4a2
Merging xft and current st heads.
Christoph Lohmann 20h@r-36.net
2b3c1219
Initial Xft support for st. More to follow.
Christoph Lohmann 20h@r-36.net
1ba5f417
config.def.h: typo in comment.
Aurélien Aptel aurelien.aptel@gmail.com
50a619ce
LEGACY: typo.
Aurélien Aptel aurelien.aptel@gmail.com
0eaed8f0
Redrawing is fixed.
Christoph Lohmann 20h@r-36.net
e4bf2679
Fixing the redrawing patch of k0ga, so it's using xclear() in redraw() too.
Christoph Lohmann 20h@r-36.net
4876d6e0
Clean windows display after resizing

Some times the size after a resizing is not an exact multiply of a number of
characters, so redrawn the screen using the lines and columns of the neww
size can cause that some old graphics keep in the screen. Solution is clean
all the windows with the background color.
---
 st.c |    3 +++
 1 file changed, 3 insertions(+)
Roberto E. Vargas Caballero k0ga@shike2.com
88a8f85a
Copy non set positions as spaces

st selection don't insert in the selection position whose value is not
set. This is correct for the positions in the end of the line, but cause
some problems in the beginning. For example echo -e 'a\tb' will print in the
screen:

a	b

but after selecting and copying in some place you get:

ab

because positions from 1 to 7 don't have any value. This patch deals all
positions without value as blank (even at the end of the line).
---
 st.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
111199cf
Add newline in error messages

---
 st.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
e3671006
Add xcalloc wrapper

malloc and realloc are called through xmalloc and xrealloc, so calloc should
be called through xcalloc.
---
 st.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
426887cc
Applying a shortening proposal for the run loop of k0ga.
Christoph Lohmann 20h@r-36.net
58a57a23
Remove call to draw in resize

In previous commits draw was removed from all the X events, but I forgot do
it in resize.
---
 st.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
22579322
Adding some more fields to the manpage, like authors, license etc.
Christoph Lohmann 20h@r-36.net
b93741e3
Remove some solved issues and add some new.
Christoph Lohmann 20h@r-36.net
9fbafe55
Preliminary solution to the stuttering problem.
Christoph Lohmann 20h@r-36.net
d81250e5
Fix selection bug

After the commit named "Remove timeout in the main loop", selection is not
working in the proper way. After selecting something, press mouse button in
a line outside of selection causes an incorrect highlight. This patch fix
the problem forcing a draw after the press event, but this is only a fast
hack. Real solution means rewriting selection code.
---
 st.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Roberto E. Vargas Caballero k0ga@shike2.com
c5a9b799
Render only once in each main loop iteration

draw() runs over all lines of the screen and renders only the dirty lines,
this avoids render lines which are not modified since last draw() call. In
this moment the main loop is something like:

     - Wait something to read from file descriptors
     - Read from pseudo tty
     - Call draw() for rending
     - Read X events

This cause the problem that all the X events that have to update the screen
have to call draw() (because draw() is called before of X events handling),
so you can have multiples renderings in only one iteration, that will waste
a lot of resources.

This patch change the main loop to:

     - Wait something to read from file descriptors
     - Read from pseudo tty
     - Read X events
     - Call draw() for rending

So X events don't have to worry about rendering, because draw() is called
after them.

The only place where draw is called outside of the main loop is in redraw(),
but it is necessary for getting a good tput flash.
---
 st.c |   29 ++++++-----------------------
 1 file changed, 6 insertions(+), 23 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
85849ce7
Remove timeout in the main loop

The main loop waits until there is some data to read in file descriptors of
the X server or the pseudo tty. But it uses a timeout in select(), which
causes that st awake each 20 ms, even it doesn't have something to do. This
patch removes this problem removing the timeout, which is not needed.
---
 TODO |    1 -
 st.c |   27 +++------------------------
 2 files changed, 3 insertions(+), 25 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
15cc8754
Call XSync in redraw

It is necessary call to XSync if you want a good tput flash, because in
other way you can not be sure that white screen will be shown.
---
 st.c |    1 +
 1 file changed, 1 insertion(+)
Roberto E. Vargas Caballero k0ga@shike2.com
ba1e9dae
Call XdbeQueryExtension before of calling any Xdbe function

XdbeQueryExtension() tells to the caller if the Xdbe extension is present in
the X server, so it should be called for sanity. But like is said in
XdbeQueryExtension(3):

	No other Xdbe functions may be called before this function.  If a
	client violates this rule, the effects of all subsequent Xdbe calls
	that it makes are undefined.

it is mandatory call this function.
---
 st.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
a6278978
Implementing italic-bold. This will require an increase of the avgWdth.
Christoph Lohmann 20h@r-36.net
b1563526
Ignore NUL character as a padding character. Telnet may use this. Patch of

Roberto Vargas.
Christoph Lohmann 20h@r-36.net
776a022e
Importing the patch of Roberto Vargas to inherit signal handlers.
Christoph Lohmann 20h@r-36.net
fe2ba95b
Reset window title on terminal reset too.
Christoph Lohmann 20h@r-36.net
977c5d90
Adding a statemant on legacy support.
Christoph Lohmann 20h@r-36.net
d018c9c8
Adding another bold off sequence.
Christoph Lohmann 20h@r-36.net
720cb816
Remove buffering to fileio instead of calling fflush

By default text files are line buffered, and this means that -f option will
not write the line until a \n is printed. This is not very useful for
debugging, so a call to fflush was added. This patch substitute this call
(which will be done by each character painted) by the full remove of the
buffering in the file.
---
 st.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
b9d5fec4
Add xmalloc and xrealloc wrappers

If malloc  or realloc fail they return NULL. Theorically this condition
should be tested in the code, but it's a strange condition today (basically
if this is hapenning thenyou have a big problem), and even Linux never returns
NULL in the default configuration (only if the process don't have room in
the space address, something a bit impossible in the case of st). But stis
enough small for being executed in low resources computers where this can be
a real problem. So the easy way is creating a wrappers function for them and
call to die in case of error.
---
 st.c |   44 +++++++++++++++++++++++++++++++-------------
 1 file changed, 31 insertions(+), 13 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
8f1144ed
Make nyancat(1) work. Important release feature!
Christoph Lohmann 20h@r-36.net
121d9109
Add preliminary blink stubs. Real implementation is still missing.
Christoph Lohmann 20h@r-36.net
c092bce3
Add another obscure way to set a window title.
Christoph Lohmann 20h@r-36.net
af29fb2a
Fixing the too small window in non-tiling window managers.
Christoph Lohmann 20h@r-36.net
122ed577
Making the selection work again.
Christoph Lohmann 20h@r-36.net
a1cd28f8
Allow simpler stdout -f handling.
Christoph Lohmann 20h@r-36.net
f2da43a0
Adding instantenous debug output and fixing italic with a reset.
Christoph Lohmann 20h@r-36.net
86cf8e30
Adding the removal of the timeouts to the TODO.
Christoph Lohmann 20h@r-36.net
4a4ae191
Removing masks for unhandled enter and leaving events.
Christoph Lohmann 20h@r-36.net
dd0b7a07
If the selection is cleared, draw() and do it on button press too.
Christoph Lohmann 20h@r-36.net
f471a32d
Unhighlight selection when selection is owner by other window

st marks the active selection using reverse colors in the box selection, but
once that another window becomes owner of the selection, it is very
confusing that st keeps highlight the old selection. Usually terminal
emulators remove the highlight when it is not valid anymore.

X sends a SelectionClear event in this situation, so we only have to add a
callback which unhighlight the selectin box.
---
 st.c |    9 +++++++++
 1 file changed, 9 insertions(+)
Roberto E. Vargas Caballero k0ga@shike2.com
017af76f
Forcing the parameter limit to xcopy() and selpaste(). Thanks to Rob Pilling.
Christoph Lohmann 20h@r-36.net
42505c52
Removing unneeded arguments to copy(). Thanks to Andrew Hills.
Christoph Lohmann 20h@r-36.net
462a966e
Implement italic font support.
Christoph Lohmann 20h@r-36.net
56c551e4
Add to TODO to make function keys work.
Christoph Lohmann 20h@r-36.net
a61b9ea8
Enable keypad set and unset commands.
Christoph Lohmann 20h@r-36.net
da4a77ed
Disable BCE again.
Christoph Lohmann 20h@r-36.net
98dc91eb
Removing the resize issue from the TODO file.
Christoph Lohmann 20h@r-36.net
67c1a230
Fixing the resizing behaviour.
Christoph Lohmann 20h@r-36.net
e09709d9
Forgot one line. It's late.
Christoph Lohmann 20h@r-36.net
b1d383a0
Cleaning up the fixed window size and the resizing of clients.
Christoph Lohmann 20h@r-36.net
e02d7244
Another thing for TODO – resize.
Christoph Lohmann 20h@r-36.net
052a6178
Updating the TODO and enabling BCE.
Christoph Lohmann 20h@r-36.net
6e88c7f6
CUP == HVP; CHA == HPA;
Christoph Lohmann 20h@r-36.net
59fe59d3
Unifying the old style.
Christoph Lohmann 20h@r-36.net
98b6f84b
Check alternative screen before drawing box selection

Some programs use the alternative screen (vi, less, ...), whose
content is different of the main screen. If you select text in one of
the screen, you don't wait the box selection is painted in the other
screen, so it is necessary check if the selection was done in the same
screen we are going to paint. Before to this commit, you could do
something like:

	$ LESS="" ls | less
	(select some code)
	q

and selection box remains drawing in the main screen, but the content
of selection keeps text of the alternate screen.
---
 st.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Roberto E. Vargas Caballero k0ga@shike2.com
66669a55
Add newline to stderr message

---
 st.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Roberto E. Vargas Caballero k0ga@shike2.com
1d670202
Fixing the border pixel when there is a negative position.
Christoph Lohmann 20h@r-36.net
579f12d4
Add -g geometry to st and the manpage.
Christoph Lohmann 20h@r-36.net
466decd5
Fixing a type in in2 in the st.info.
Christoph Lohmann 20h@r-36.net
930b2c4a
Force redisplay of all lines in DECSCNM

When it is called DECSCNM all lines become dirty, because it is necessary
redraw all lines for getting the new colors. It is easy see the problem
running 'echo ^[[?5h'.

In order to get a correct flash when running tput flash is necessary wait
after DECSCNM, until the changes are displayed, because in other case the
switch between reverse on/reverse off will be too much fast and nothing will
happen.
---
 st.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
Roberto E. Vargas Caballero k0ga@shike2.com
a984ffc4
Add write I/O to file

This is a theorical feature listed in http://st.suckless.org/goals. All the
input/output of the terminal will be written to a file, which can be very
useful for debugging, and also allow interconnect st to other process
through named pipes.
---
 st.1 |    6 ++++++
 st.c |   14 +++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
Roberto E. Vargas Caballero k0ga@shike2.com
cfefa054
Patch from Roberto Vargas. »Add initialization strings in terminfo«


Taken from the description:

When tput init is executed the list of task performed are (taken from
terminfo(5)):

              run the program
                     iprog

              output is1 is2

              set the margins using
                     mgc, smgl and smgr

              set tabs using
                     tbc and hts

              print the file
                     if

              and finally
                     output is3.

When reset is executed, a more stronger initialization process is performed,
so the terminal can return from an unknown state. rs1, rs2 and rs3 are used
in this case instead of
using is1, is2 and is3.

This patch makes is2 = rs2, resets insert mode and set normal keypad
mode. For rs1 it performs a full initilization using ^[c.
Christoph Lohmann 20h@r-36.net
b11d85c9
Add standout mode.
Christoph Lohmann 20h@r-36.net
7f17a708
Cleaning up lonely tabs.
Christoph Lohmann 20h@r-36.net
588ba51a
Make it more obvious where the wrong attribute is used.
Christoph Lohmann 20h@r-36.net
c79df9f7
Enable multiple arguments in SM and RM

SM and RM can receive multiple parameters, but the code only was accepting
only one. This patch join the code of set and reset modes (SM and RM) in a
common function and uses a loop which deals with all the arguments of the
sequence. This patch improves xterm and vt100 compability.
---
 st.c |  180 ++++++++++++++++++++++++++++--------------------------------------
 1 file changed, 76 insertions(+), 104 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
4cdcc395
Add vpa terminfo capability

---
 st.info |    2 ++
 1 file changed, 2 insertions(+)
Roberto E. Vargas Caballero k0ga@shike2.com
81c678e5
Silencing the compiler but keeping strparse.

This will really be needed when there is a full 256 color support.
Christoph Lohmann 20h@r-36.net
c58950f2
Applying the CBT patch of Roberto Vargas. Thanks.
Christoph Lohmann 20h@r-36.net
91fa81db
Never trust terminfo fata morganas. And adding other xterm compatibility.
Christoph Lohmann 20h@r-36.net
6696ef85
Add OSC, DSC, PM, APC and settitle.
Christoph Lohmann 20h@r-36.net
ff040e98
Adding setb and setf and a comment about terminfo installation.
Christoph Lohmann 20h@r-36.net
aaef13aa
Add CHT sequence

This sequence performs "Cursor Forward Tabulation <n> tab stops", which
although is not present in vt100 or vt102, xterm accepts it.
---
 st.c |    5 +++++
 1 file changed, 5 insertions(+)
Roberto E. Vargas Caballero k0ga@shike2.com
12de47a9
Applying the patches of k0ga and changing the LICENSE file in the appropriate

way.
Christoph Lohmann 20h@r-36.net
c084c06b
Add TBC sequence

This sequence clears tab stops in the terminal. If the argument is not present
or is zero, then removes the tab stop of the current horizontal position. If
the argument is 3 then removes all the tab stops of the terminal. It was
necessary modify the terminfo entry tbc, because it has \E[2g instead of the
correct \E[3g.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
---
 st.c    |   12 ++++++++++++
 st.info |    2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
Roberto E. Vargas Caballero k0ga@shike2.com
93901ca4
Add HTS sequence

This sequence adds a new tab stop in the current horizontal position. This
means that tputtab must be look for the next tab stop in the tabs array
instead of using a hard coded value offset. Also, CHT sequence XXX message
is removed because it is not a vt10x sequence (as far as I know it is a
vt50x sequence), and it is not implemented by linux virtual terminal neither
by xterm.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
---
 st.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
ee7fd748
Add tabs field into Term struct

Tabs stop are simulated in st using a fixed size of 8, always, without be
worried about sequences changing the tab stops. A user can put a tab stop in
each horizontal position of the screen, so we need at least one flag for
each column of the screen. In the same way as dirty flags is used for the
rows, it is used a bool dinamic array.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
---
 st.c |   22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
Roberto E. Vargas Caballero k0ga@shike2.com
c6853fe1
apply post-XDBE patch BORDER fix
Brandon Invergo brandon@invergo.net
94771d05
Implement Xdbe-based double-buffering
Brandon Invergo brandon@invergo.net
8fdba749
update TODO.
Aurélien Aptel aurelien.aptel@gmail.com
cfea72c7
cleanup. refactored dirt-related function.
Aurélien Aptel aurelien.aptel@gmail.com
6c0a1eff
use SHELL as default shell.
Aurélien Aptel aurelien.aptel@gmail.com
7823aeb1
revert to "tip" in VERSION.
Aurélien Aptel aurelien.aptel@gmail.com
83b06565
Added tag 0.2.1 for changeset 108926a0fe61
Aurélien Aptel aurelien.aptel@gmail.com
970d44a6
bump version.
Aurélien Aptel aurelien.aptel@gmail.com
ff5edcfd
replace fwrite by printf.
Aurélien Aptel aurelien.aptel@gmail.com
cb2e0e9c
rewrite csidump().
Aurélien Aptel aurelien.aptel@gmail.com
53ac69e9
clean and name enum definitions.
Aurélien Aptel aurelien.aptel@gmail.com
751fb765
fix default color overwriten bug.
Aurélien Aptel aurelien.aptel@gmail.com
be2877cd
show dark cursor when unfocused.
Aurélien Aptel aurelien.aptel@gmail.com
d8e11bdb
document possible configuration.
Aurélien Aptel aurelien.aptel@gmail.com
33558ca0
handle dim/bright colors.
Aurélien Aptel aurelien.aptel@gmail.com
6de1ba6e
merge
Aurélien Aptel aurelien.aptel@gmail.com
cee6ccc6
reduce size of each glyph for faster copy.
Aurélien Aptel aurelien.aptel@gmail.com
b6b90253
Added tag 0.2 for changeset 3c2f9f2ab5e4
Aurélien Aptel aurelien.aptel@gmail.com
bcb7ec68
cosmetic, whitespace, etc.
Aurélien Aptel aurelien.aptel@gmail.com
df54ab04
fix PRINT/DRAW _TIMEOUT and fix redrawing bug.
Aurélien Aptel aurelien.aptel@gmail.com
896310e5
copy dirty lines to screen, add select() timeout & min time between draw() calls.


* add a timeout value (SELECT_TIMEOUT) of 20ms in the select() call
* wait at least 20ms (DRAW_TIMEOUT) between draw() calls
* only copy dirty lines from the buffer to the screen

what draw() does:
* clears dirty lines in the buffer
* draws the longest same-attributes string of each
  dirty line to the buffer with multiple xdraws() call
* copies the current dirty line from buffer to the screen with a single
  xcopy() call

this changeset makes st run ~10x faster.
Aurélien Aptel aurelien.aptel@gmail.com
13a8eeb8
fix segfault in selection. (thx Martti Kühne)
Aurélien Aptel aurelien.aptel@gmail.com
ab9c9a4e
merge.
Aurélien Aptel aurelien.aptel@gmail.com
a20125a3
fix selection. (thx Tarmo Heiskanen)
Aurélien Aptel aurelien.aptel@gmail.com
0dbf9c8c
add dirty flag for lines
Aurélien Aptel aurelien.aptel@gmail.com
907cb8bf
no palette limit (thx Nick)
Aurélien Aptel aurelien.aptel@gmail.com
9d613092
simplify version format.
Aurélien Aptel aurelien.aptel@gmail.com
4bd08776
selection is removed or scrolled properly. (thx Rafa Garcia Gallego)
Aurélien Aptel aurelien.aptel@gmail.com
b032814e
working on old repo, merging recent changesets.
Aurélien Aptel aurelien.aptel@gmail.com
8e66b5cc
move xembedatom in XWindow struct, add link to xembed specs.
Aurélien Aptel aurelien.aptel@gmail.com
8d2d8848
tweak focus to support XEMBED client message and remove focus on EnterNotify. (thx Adrian)
Aurélien Aptel aurelien.aptel@gmail.com
d5f3d120
remove dup of default window size.
Aurélien Aptel aurelien.aptel@gmail.com
8503f954
fix focus state when embed in another window.
Aurélien Aptel aurelien.aptel@gmail.com
cddbd6ee
fix segfault with mouse selection. (thx anonymous)
Aurélien Aptel aurelien.aptel@gmail.com
3959a992
add -w option to embed st. (thx nodus cursorius)
Aurélien Aptel aurelien.aptel@gmail.com
4736edd4
applied parts of "anonymous" cleanup patch.
Aurélien Aptel aurelien.aptel@gmail.com
189a81ca
add altscreen escseq alias & caps to terminfo entry. (thx Bert Münnich)
Aurélien Aptel aurelien.aptel@gmail.com
9b404c0d
disable mouse highlight when mouse report enabled. (thx Bert Münnich)
Aurélien Aptel aurelien.aptel@gmail.com
d59f92d6
reverse video mode. (thx Bert Münnich)
Aurélien Aptel aurelien.aptel@gmail.com
b2db58c2
add status bar (window title) to terminfo. (thx Rafa Gallego)
Aurélien Aptel aurelien.aptel@gmail.com
6734de9b
set title before mapping window (thx Kamil Cholewiński).
Aurélien Aptel aurelien.aptel@gmail.com
7d352f14
applied parts of Connor Lane Smith's cleanup patch.
Aurélien Aptel aurelien.aptel@gmail.com
5beae6a6
macro cleanup.
Aurélien Aptel aurelien.aptel@gmail.com
0107293a
add mouse report escape to terminfo entry.
Aurélien Aptel aurelien.aptel@gmail.com
80da3720
support for x11 xterm mouse reporting
Aurélien Aptel aurelien.aptel@gmail.com
8eaed2cd
whitespace.
Aurélien Aptel aurelien.aptel@gmail.com
babf4db5
cleanup.
Aurélien Aptel aurelien.aptel@gmail.com
aede91e2
update TODO
Aurélien Aptel aurelien.aptel@gmail.com
9d5ea14b
selection clicks, shift+arrow keys, fast(er) redraw, key mask in config.h (thx Magnus Leuthner)
Aurélien Aptel aurelien.aptel@gmail.com
d3c5aba2
update README.
Aurélien Aptel aurelien.aptel@gmail.com
742a4a18
quick bug-fixing 0.1.1 release.
Aurélien Aptel aurelien.aptel@gmail.com
73e37f56
update VERSION.
Aurélien Aptel aurelien.aptel@gmail.com
89c8a3a2
take BORDER into account for selection. (thx Petr Sabata)
Aurélien Aptel aurelien.aptel@gmail.com
9b63dd9f
fix utf8 clipboard. (thx Petr Sabata)
Aurélien Aptel aurelien.aptel@gmail.com
1adf2e39
Added tag 0.1 for changeset cbc18c988236
Aurélien Aptel aurelien.aptel@gmail.com
674434ef
add support for utf8 clipboard. fix usage message.
Aurélien Aptel aurelien.aptel@gmail.com
a047431d
do not add newline to selection text if next line not selected (Nick)
pancake@nopcode.org unknown
fe724836
remove debugging printf
pancake@nopcode.org unknown
1ab42fd4
apply Nick's patch to fix some error printf to use stderr
pancake@nopcode.org unknown
4d649c24
fix insert key, terminfo and changed TERM back to st. (thx Ondrej Martinek)
Aurélien Aptel aurelien.aptel@gmail.com
0a208cb6
change X cursor to "I".
Aurélien Aptel aurelien.aptel@gmail.com
e8b18dd9
update terminfo entry.
Aurélien Aptel aurelien.aptel@gmail.com
fd114986
add new line glitch to terminfo entry.
Aurélien Aptel aurelien.aptel@gmail.com
86c5cb6d
change -e behaviour and update man page.
Aurélien Aptel aurelien.aptel@gmail.com
732b9601
-e flag handles arguments.
Aurélien Aptel aurelien.aptel@gmail.com
54bc450d
use memmove() instead of memcpy() in ttyread().
Aurélien Aptel aurelien.aptel@gmail.com
af75c433
fix and clean ttyread(). buf wasn't static.
Aurélien Aptel aurelien.aptel@gmail.com
41a4497e
merge.
Aurélien Aptel aurelien.aptel@gmail.com
00ba6969
s/xw.dis/xw.dpy/
Aurélien Aptel aurelien.aptel@gmail.com
b61925b5
cleanup & bugfix in xdraws().
Aurélien Aptel aurelien.aptel@gmail.com
81a048d6
clean comment regarding redrawing in bmotion().
Aurélien Aptel aurelien.aptel@gmail.com
b61afd24
Add -c option to override the default window class
Gregor Best gbe@ring0.de
70464e20
some code cleaning.
Aurélien Aptel aurelien.aptel@gmail.com
9b74fcad
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.
Aurélien Aptel aurelien.aptel@gmail.com
d581bfcc
selection code cleanup.
Aurélien Aptel aurelien.aptel@gmail.com
b1e60992
fixed ED.
Aurélien Aptel aurelien.aptel@gmail.com
edfbc9b4
redraw if we scroll on resize
Devin J. Pohly djpohly@djpohly.com
638a3035
get rid of artifacts in border on resize down
Devin J. Pohly djpohly@djpohly.com
d85f7319
copy old pixmap to new on resize
Devin J. Pohly djpohly@djpohly.com
12435817
move code into new xresize func, add early exit to resize
Devin J. Pohly djpohly@djpohly.com
722688d9
\v and \f are have the same behaviour of \n.
Aurélien Aptel aurelien.aptel@gmail.com
6f87a394
added LNM mode; re-organized kpress() to handle it.
Aurélien Aptel aurelien.aptel@gmail.com
ce27e634
redraw optimization.
Aurélien Aptel aurelien.aptel@gmail.com
9e004846
fixed newline bug.
Aurélien Aptel aurelien.aptel@gmail.com
68d8fcf6
replaced memset by loops in tresize(); turns out it's faster.
Aurélien Aptel aurelien.aptel@gmail.com
e4bf56ae
remove useless draw().
Aurélien Aptel aurelien.aptel@gmail.com
d693b304
applied xclipboard patch. thx David Isaac Wolinsky.
Aurélien Aptel aurelien.aptel@gmail.com
3a50a4fd
clean button selection code.
Aurélien Aptel aurelien.aptel@gmail.com
3470e3af
compose key patch. thx federico luna.
Aurélien Aptel aurelien.aptel@gmail.com
6faedce5
s/hasfocus/focus/ for consistency.
Aurélien Aptel aurelien.aptel@gmail.com
ab7037cb
don't draw if the window is not visible.
Aurélien Aptel aurelien.aptel@gmail.com
f6934763
use xclear() in draw().
Aurélien Aptel aurelien.aptel@gmail.com
8c375798
use XCreateWindow(), set gravity bit.
Aurélien Aptel aurelien.aptel@gmail.com
273d4ba9
cleaning st.info. added comment in st.c for DECSCNM.
Aurélien Aptel aurelien.aptel@gmail.com
c4352615
cleaning st.info. fixed cvvis.
Aurélien Aptel aurelien.aptel@gmail.com
58083da6
set terminal colors to xterm default ones.
Aurélien Aptel aurelien.aptel@gmail.com
ebc28727
removed gfx chars not present in xterm acsc.
Aurélien Aptel aurelien.aptel@gmail.com
7d325a37
fixed start/end sequence of gfx.
Aurélien Aptel aurelien.aptel@gmail.com
223909e0
undefined gfx doesn't draw \0.
Aurélien Aptel aurelien.aptel@gmail.com
b6af0fdc
fixed makefile.
Aurélien Aptel aurelien.aptel@gmail.com
2080dfeb
added manpage.
Aurélien Aptel aurelien.aptel@gmail.com
fbc6ec32
resize from the top.
Aurélien Aptel aurelien.aptel@gmail.com
9d82bdd9
added -e and -t option.
Aurélien Aptel aurelien.aptel@gmail.com
97695baf
factored code and fixed behaviour of tnewline().
Aurélien Aptel aurelien.aptel@gmail.com
32e160c9
updated TODO.
Aurélien Aptel aurelien.aptel@gmail.com
42344b71
started to go through st.info and fix things.
Aurélien Aptel aurelien.aptel@gmail.com
a79bc96c
capabilities sorted by capname in st.info. copy acsc from xterm.
Aurélien Aptel aurelien.aptel@gmail.com
df5c5ed0
removed debug code.
Aurélien Aptel aurelien.aptel@gmail.com
5ce6c5c0
fixed IL and DL.
Aurélien Aptel aurelien.aptel@gmail.com
ef691180
factor and cleanup code.
Aurélien Aptel aurelien.aptel@gmail.com
f732ca5f
added correct line drawing characters for default font.
Aurélien Aptel aurelien.aptel@gmail.com
cfe89755
use struct instead of array.
Aurélien Aptel aurelien.aptel@gmail.com
9703859e
cleanup.
Aurélien Aptel aurelien.aptel@gmail.com
591d147a
fix segfault when selecting big buffers

shift+insert paste clipboard
honor CFLAGS and LDFLAGS in config.mk
pancake@nopcode.org unknown
1132d9e2
fix build.
Aurélien Aptel aurelien.aptel@gmail.com
c4225bdc
add selinit() and renamed clipboard_* to sel*.
Aurélien Aptel aurelien.aptel@gmail.com
f211bc2e
move event configuration in xinit().
Aurélien Aptel aurelien.aptel@gmail.com
ee858b48
use one global struct instead of many vars for selection. Cleanup.
Aurélien Aptel aurelien.aptel@gmail.com
80f70f1c
use GLYPH_SET to test if a char is set; cleanup.
Aurélien Aptel aurelien.aptel@gmail.com
23cc3fc5
fix crash for small windows

use unconditional infinite loops
pancake@nopcode.org unknown
160bda1b
toggle ATTR_REVERSE on selected text, factored some code and fixed Makefile.
Aurélien Aptel aurelien.aptel@gmail.com
596bb133
fix build

use config.def.h mechanism
add SHELL in config.h
pancake pancake@nopcode.org
0ba53e48
initial implementation of selection and clipboard
pancake pancake@nopcode.org
e1ce89f2
fix segfault
pancake@nopcode.org unknown
12c25bce
added support for alternate screen.
Aurélien Aptel aurelien.aptel@gmail.com
326586ba
cursor is hid when unfocused.
Aurélien Aptel aurelien.aptel@gmail.com
ae5baac9
use predefined OS macro instead of uname.
Aurélien Aptel aurelien.aptel@gmail.com
bef87acd
st should compile on NetBSD.
Aurélien Aptel aurelien.aptel@gmail.com
1bb7398f
removed pty.h. minimal system guessing added in config.mk.
Aurélien Aptel aurelien.aptel@gmail.com
e851736e
removed (visual) bell. '\a' sets the urgency flag if st is unfocused.
Aurélien Aptel aurelien.aptel@gmail.com
188293c8
removed useless cursor init. and renamed xcursor() to xdrawcursor().
Aurélien Aptel aurelien.aptel@gmail.com
7d88cf88
added support for the "magic margin", changed c.hide to c.state, changed xcursor() to use term instead of a

parameter and fixed the cursor position after setting a scrolling region.
Aurélien Aptel aurelien.aptel@gmail.com
1f6e7b84
removed old VT52 escapes, fixed VT100 IND.
Aurélien Aptel aurelien.aptel@gmail.com
5258d605
fixed optimized drawing routine and factored some code.
Aurélien Aptel aurelien.aptel@gmail.com
b4f623f9
fixed pixmap buffer drawing.
Aurélien Aptel aurelien.aptel@gmail.com
eab9aad1
added a XFlush() in xbell().
Aurélien Aptel aurelien.aptel@gmail.com
21810405
moved term.hidec in term.c for consistency, put back delay in xbell()

along with duration in config.h, factored some code in tnew()/treset()
and cleaned some code.
Aurélien Aptel aurelien.aptel@gmail.com
c186c8ef
merged tscroll() with tscrollup().
Aurélien Aptel aurelien.aptel@gmail.com
6db6980e
st now runs on Linux, OpenBSD and FreeBSD.
Aurélien Aptel aurelien.aptel@gmail.com
c5633285
removed XINERAMA from config.mk and fixed a segfault when st is

started without a display. (thx Hiltjo Posthuma)
Aurélien Aptel aurelien.aptel@gmail.com
a1018e0e
fixed potential bug in IS_SET().
Aurélien Aptel aurelien.aptel@gmail.com
fbb66da9
merged tcursorwrap() with tnewline(), added few comments and updated copyright.
Aurélien Aptel aurelien.aptel@gmail.com
42b2912e
cleaned some spaces.
Aurélien Aptel aurelien.aptel@gmail.com
5d611cd5
added macro to test flags, removed tmovecursor().
Aurélien Aptel aurelien.aptel@gmail.com
4db3df31
faster resizing.
Aurélien Aptel aurelien.aptel@gmail.com
e8c13ebe
close master/slave pty in the shell process.
Aurélien Aptel aurelien.aptel@gmail.com
5c93f399
clean \t.
Aurélien Aptel aurelien.aptel@gmail.com
44226483
update function prototypes.
Aurélien Aptel aurelien.aptel@gmail.com
b09401b9
fix \b and clean \t.
Aurélien Aptel aurelien.aptel@gmail.com
a7922bd1
added F1-12 key, fixed DCH and ICH.
Aurélien Aptel aurelien.aptel@gmail.com
ce3f4fc6
fixed backspace problem, updated terminfo entry and moved TNAME in config.h.
Aurélien Aptel aurelien.aptel@gmail.com
d2f157c7
renamed a function.
Aurélien Aptel aurelien.aptel@gmail.com
10e49a05
applied Devin J Pohly's st color info patches, thanks Devin!
Anselm R Garbe anselm@garbe.us
9e8f5f13
fix gcc warnings
pancake@nopcode.org unknown
499c70cd
fixed background color bug (thx Devin J. Pohly).
Aurélien Aptel aurelien.aptel@gmail.com
2f96cfea
added PBaseSize hint and set default title to "st".
Aurélien Aptel aurelien.aptel@gmail.com
2f5ebe0a
rearranged code, resize fixed.
Aurélien Aptel aurelien.aptel@gmail.com
476f9379
little clean up.
Aurélien Aptel aurelien.aptel@gmail.com
d01c55c9
use SHELL environment variable (thx Thomas Adam)
Aurélien Aptel aurelien.aptel@gmail.com
b3b7ffce
double-buffering added using pixmap (finally).

results in a lot of simplification :
	- no more dirty flags (perf are good enough).
	- no more ugly gfx call in emulation functions.
LINESPACE removed from config.h.
BORDER is now handled correctly.
Aurélien Aptel aurelien.aptel@gmail.com
0f4dd503
bold attribute is back.

visibility of the cursor is not saved/loaded anymore.
scrolling up/down is fixed.
added RI and RIS sequences.
fixed cursor drawing bug.
Aurélien Aptel aurelien.aptel@gmail.com
7cdaf130
added VT100 NEL.
Aurélien Aptel aurelien.aptel@gmail.com
639f16d2
added VT100 RI.
Aurélien Aptel aurelien.aptel@gmail.com
636c369d
added VT100 save&load cursor support.
Aurélien Aptel aurelien.aptel@gmail.com
3ba517e7
ECH handled correctly.
Aurélien Aptel aurelien.aptel@gmail.com
eff05c7b
more escapes & more compability:

cursor keys are handled in kpress according to the Application Mode (DECPAM).
define & enum were renamed.
tcursor() is now tmovecursor() which is more correct.
tcpos() is now tcursor(), as DECSC is also supposed to save attributes.
capnames are indicated whenever possible.

Currently:
alsamixer looks fine, totally usable.
ncmpc is almost ok.
emacs looks like shit.
Aurélien Aptel aurelien.aptel@gmail.com
e6b3f5c7
graphic charset and a few more escapes.
Aurélien Aptel aurelien.aptel@gmail.com
09814375
TERM set to xterm by default (which broke a lot of stuff), better escape handling (title), and a little clean up.
Aurélien Aptel aurelien.aptel@gmail.com
f2dff29a
drawing is faster but the bold attr is not supported anymore.
Aurélien Aptel aurelien.aptel@gmail.com
4e6915a1
Fixed possible segfault by reverting to the key struct (again).
Aurélien Aptel aurelien.aptel@gmail.com
dab8326e
only compile tdump if DEBUG flag is set
Anselm R Garbe garbeam@gmail.com
cf65699a
we definately need pixmaps for the drawing, currently drawing into the window is painfully slow! much more slower than drawing into a pixmap and mapping that when finished -- several optimisations
Anselm R Garbe garbeam@gmail.com
0a5e5102
reverted back to the old Key struct.
Aurélien Aptel aurelien.aptel@gmail.com
4d794b34
updated "key" to a lookup table.
Aurélien Aptel aurelien.aptel@gmail.com
44d8c319
removed old unused cursor() proto.
Aurélien Aptel aurelien.aptel@gmail.com
b8ffa1d7
fixed the scrolling bug and cleaned some stuff.
Aurélien Aptel aurelien.aptel@gmail.com
d5f45544
dump escseq if not handled.
Aurélien Aptel aurelien.aptel@gmail.com
53937e04
clean up.
Aurélien Aptel aurelien.aptel@gmail.com
2e377529
added/removed files, updated Makefile.
Aurélien Aptel aurelien.aptel@gmail.com
8b4bfe31
made kpress() more flexible, removed st.h, added config.h.
Aurélien Aptel aurelien.aptel@gmail.com
5d8aa08b
updated TODO.
Aurélien Aptel aurelien.aptel@gmail.com
ad39f000
added sigchld handler, cleaned error checking.
Aurélien Aptel aurelien.aptel@gmail.com
2f35cef5
cleaned up (removed space indentation). select/event bug fixed.
Aurélien Aptel aurelien.aptel@gmail.com
129bcd75
fixed a memory leak & segfault in tresize.
Aurélien Aptel aurelien.aptel@gmail.com
059d2ba2
updated TODO.
Aurélien Aptel aurelien.aptel@gmail.com
a866108a
tab moves the cursor instead of inserting spaces.
Aurélien Aptel aurelien.aptel@gmail.com
1cf8b77d
handle tabulation (still not perfect)
Aurélien Aptel aurelien.aptel@gmail.com
0ecfcc39
removed truecolor stuff
Aurélien Aptel aurelien.aptel@gmail.com
abe6f3b0
removed the truecolor stuff
Aurélien Aptel aurelien.aptel@gmail.com
86fa7560
same thing, really fixed this time.
Aurélien Aptel aurelien.aptel@gmail.com
ccafacb3
added some error checking in xinit (fixed the segfault caused by a missing font)
Aurélien Aptel aurelien.aptel@gmail.com
fd281ad3
Removed unused variable and cleaned some comment.
Aurélien Aptel aurelien.aptel@gmail.com
d58dd3b8
backport of local changes
Anselm R Garbe garbeam@gmail.com
802f1922
add accidentally omitted word
Matthias-Christian Ott ott@enolink.de
a7f50ebb
use stdio(3)
Matthias-Christian Ott ott@enolink.de
07d1edcd
add description of std
Matthias-Christian Ott ott@enolink.de
d61a2a8f
add prototype for command parsing
Matthias-Christian Ott ott@enolink.de
240411e7
correct year of copyright notice
Matthias-Christian Ott ott@enolink.de
e0d0a2b9
simplify Makefile


Due to consideration of POSIX compliance issues config.mk had
to be removed. Configuration variables can be overridden by
environment variables or specified via command line.

Additionally all pretty-printed messages were removed and
built-in rules are used. This also simplifies and purges
the Makefile.
Matthias-Christian Ott ott@enolink.de
082d8bb8
reunite pty.c with std.c
Matthias-Christian Ott ott@enolink.de
6c6b65ea
correct programme name
Matthias-Christian Ott ott@enolink.de
746931a3
use errx() for help and version messages
Matthias-Christian Ott ott@enolink.de
a95f4f2e
merge with backout head
Matthias-Christian Ott ott@enolink.de
fb4508b0
remove TODO
Matthias-Christian Ott ott@enolink.de
0cbcedb8
make ptm and pts static
Matthias-Christian Ott ott@enolink.de
afc73c92
remove useless variable
Matthias-Christian Ott ott@enolink.de
b3902ca1
remove emallocz()
Matthias-Christian Ott ott@enolink.de
f982c1c3
replace eprint() functions with BSD error functions
Matthias-Christian Ott ott@enolink.de
d83cbc27
simplify flushing
Matthias-Christian Ott ott@enolink.de
3cb67937
correct buffering
Matthias-Christian Ott ott@enolink.de
cf147ae9
make local functions and variables static
Matthias-Christian Ott ott@enolink.de
f9a0524f
add select(2)-based i/o multiplexing
Matthias-Christian Ott ott@enolink.de
a49919a1
drop stdio usage


Std requires I/O multiplexing which is very complicated with
stdio, because it provides no transparent buffering.
Matthias-Christian Ott ott@enolink.de
0c0ada8a
make st and std separate programmes
Matthias-Christian Ott ott@enolink.de
339e7f35
add missing header file
Matthias-Christian Ott ott@enolink.de
09fe1e22
assume glibc by default
Matthias-Christian Ott ott@enolink.de
5f287254
source utility functions out to util.c
Matthias-Christian Ott ott@enolink.de
05ebee60
add copyright comment
Matthias-Christian Ott ott@enolink.de
47d8633f
source getpty() out to pty.c
Matthias-Christian Ott ott@enolink.de
0dedee5d
update TODO
Matthias-Christian Ott ott@enolink.de
0dce422d
correct function name
Matthias-Christian Ott ott@enolink.de
b8f79f0e
remove xinerama flags


The xinerama related variables in config.mk are a relict of
dwm and therefore should be removed.
Matthias-Christian Ott ott@enolink.de
5e680d71
add missing header file
Matthias-Christian Ott ott@enolink.de
dc01596e
add parser loop
Matthias-Christian Ott ott@enolink.de
5d055fdc
remove useless variable
Matthias-Christian Ott ott@enolink.de
a6efc851
replace state with separate variables
Matthias-Christian Ott ott@enolink.de
50b4785f
terminate error message with newline
Matthias-Christian Ott ott@enolink.de
c61b34e8
correct LENGTH()
Matthias-Christian Ott ott@enolink.de
693e2413
simplify control flow
Matthias-Christian Ott ott@enolink.de
0b3510df
remove debug code
Matthias-Christian Ott ott@enolink.de
40c0ecfe
remove stdio slave pty opening
Matthias-Christian Ott ott@enolink.de
e2ac1676
drop support for proprietary UNIX variants


Proprietary UNIX variants like AIX, HP-UX or SCO UNIX
are nowadays rarely used and maintaining compatibility to
non-standard operating systems interfaces is wasteful and
practically useless.

Projects like xterm suffer from backward compatibility to decades-old
UNIX variants and terminal standards. This does not conform to st's
design goals.
Matthias-Christian Ott ott@enolink.de
375efb88
slight changes
Anselm R Garbe garbeam@gmail.com
771ece25
applied Matthias-Christians changes to std.c
Anselm R Garbe garbeam@gmail.com
1987ae4b
added some new files for the initial rewrite of st from scratch
Anselm R Garbe garbeam@gmail.com
16f373e3
added new TODO
arg@localhost.localdomain unknown
7a132bd6
Backed out changeset d2bb4220fdf3


Ptm and pts are used by pty.c, thus they have to be non-static.
Matthias-Christian Ott ott@enolink.de
581ae58b
fix warning
pancake pancake@nopcode.org
eaf38bf3
Fix unused variable issue and OSX includes
pancake@nopcode.org unknown
f78b793d
change "op" cap in terminfo entry to xterm/rxvt value.
Aurélien Aptel aurelien.aptel@gmail.com
6f260ba1
fix custom key handling.
Aurélien Aptel aurelien.aptel@gmail.com
23bb97d9
drawregion() only copies region on screen.
Aurélien Aptel aurelien.aptel@gmail.com
b11e22df
some minor fixes
anselm@garbe.us unknown
816a70c0
use typedef'd unsigned type and regular bool type.
Aurélien Aptel aurelien.aptel@gmail.com
489982d4
Fixed lock up when system time jumps backwards

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Rob Pilling rob@egbert
c2026a49
Removing the w3img support.

The patch to add w3img support destroys our way to handle fps and so stop
wasting resources on fast scrolling. Due to w3img being a hack to display
images in an ugly way, is there no need to support this. Use some real way to
display images.
Christoph Lohmann 20h@r-36.net
1584956a
Style cleanup.

Add some note about the main reason why st is still that big.
Christoph Lohmann 20h@r-36.net
d2ec39f0
Style matters.
Christoph Lohmann 20h@r-36.net
f27b44b7
Removing two unnecessary gettimeofday().
Christoph Lohmann 20h@r-36.net
adeb2e95
FAQ: fix wording
Alexander Huemer alexander.huemer@xx.vu
246c3481
arg.h wasn't used for dist.
Christoph Lohmann 20h@r-36.net
b341e513
Handle pasting of empty selection.

Otherwise, pasting the X11 primary selection when empty results an
error and Xlib forcibly exits.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Alex Pilon alp@alexpilon.ca
42fa1f5c
Implement most ICCCM rules for selection handling.

ICCCM mandates the use of real timestamps to interact with the
selection, to rule out race conditions if the clients are run at
different speeds. I have implemented the low hanging fruit, putting the
timestamps into text selection. Also, ICCCM mandates a check for whether
XSetSelectionOwner() worked. Not sure my version is correct, though.
Markus Wichmann nullplan@gmx.net
23ed1285
Merge branch 'master' of ssh://suckless.org/gitrepos/st
Roberto E. Vargas Caballero k0ga@shike2.com
9eb70a2d
Do not use tmoveto in tputtab.

tmoveto resets CURSOR_WRAPNEXT.

Simple testcase:

for i in $(seq 1 200); do
	printf '\t.';
	usleep 100000;
	printf '\t@';
	usleep 100000;
done

In st executing this script causes @ and . to overwrite each other in
the last column.
noname@inventati.org noname@inventati.org
89807ed4
Move common code to xloadcolor
noname@inventati.org noname@inventati.org
84c756b9
Use LEN(dc.col) instead of LEN(colorname).

LEN(colorname) may be below 256 for some configurations.
noname@inventati.org noname@inventati.org
980991fa
Fix the new -e handling. An empty cmd has to work for backwards compatibility.
Christoph Lohmann 20h@r-36.net
7e61f5e4
Do not mark as invalid UTF8 control codes

wcwidth() returns -1 for all the non visible characters, but it doesn't
necessarilly mean that they are incorrect. It only means that they are not
printable.
Roberto E. Vargas Caballero k0ga@shike2.com