Commit Graph
54 Commits
Author SHA1 Message Date
noname@inventati.organdRoberto E. Vargas Caballero 9eb70a2d3e 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.
2015-04-13 21:33:36 +02:00
noname@inventati.organdRoberto E. Vargas Caballero 9619760e12 tresize: remove unnecessary if 2015-04-13 17:12:49 +02:00
noname@inventati.organdRoberto E. Vargas Caballero a6af2cc469 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.
2015-04-13 17:06:11 +02:00
noname@inventati.organdRoberto E. Vargas Caballero b94ad75e5d Remove 'titles' variable.
We do not free it until exit anyway.
2015-04-13 17:00:08 +02:00
noname@inventati.organdRoberto E. Vargas Caballero e6dd0f825d Remove useless if in tstrsequence. 2015-04-13 15:17:24 +02:00
noname@inventati.organdRoberto E. Vargas Caballero b0310fba5d Simplify tmoveto.
LIMIT returns value. This fact is already used in x2col and y2row.
2015-04-13 15:15:47 +02:00
noname@inventati.organdRoberto E. Vargas Caballero 9d1495f9ee Fix typo.
It seems that LICENSE files are more common than LICENCE files.
At least this patch makes spelling consistent.
2015-04-13 14:26:01 +02:00
noname@inventati.organdRoberto E. Vargas Caballero c569e3146e Remove 'slide' variable in tresize. 2015-04-13 10:18:08 +02:00
noname@inventati.organdRoberto E. Vargas Caballero 39ae1a4de5 Move tresize comments around. 2015-04-13 09:26:03 +02:00
noname@inventati.organdRoberto E. Vargas Caballero 6352502d64 tresize: move for loop outside if
There is no need to check that slide > 0 before executing loop.
If slide <= 0, loop stops immediately.
2015-04-13 09:21:03 +02:00
noname@inventati.organdRoberto E. Vargas Caballero b9390a5496 Simplify loop condition. 2015-04-13 09:20:00 +02:00
noname@inventati.organdRoberto E. Vargas Caballero d2937b05ae 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.
2015-04-13 09:17:06 +02:00
noname@inventati.organdRoberto E. Vargas Caballero d3e0f3444b Use do..while in window mapping loop. 2015-04-13 09:15:42 +02:00
nonameandRoberto E. Vargas Caballero 93b54cfcc4 Use MAX macro where possible. 2015-04-10 23:34:06 +02:00
nonameandRoberto E. Vargas Caballero 6f5f770186 Remove 'xloadfontset' function.
It was used only once and its return value was ignored.
2015-04-10 23:31:53 +02:00
nonameandRoberto E. Vargas Caballero 6524f022f7 Remove keywords from function definitions. 2015-04-10 23:28:21 +02:00
nonameandRoberto E. Vargas Caballero 9305f3c184 Remove variable names from function declarations. 2015-04-10 23:28:16 +02:00
nonameandRoberto E. Vargas Caballero 69d1fe06a9 Fixed STR sequence termination condition
ascii code may only be checked for characters that have length equal to
1, not width equal to 1
2015-04-06 10:52:47 +02:00
nonameandRoberto E. Vargas Caballero d4a17316d3 Don't set dirty all lines because tswapcreen do it
Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
2014-08-10 22:22:42 +02:00
nonameandRoberto E. Vargas Caballero 20c4f12254 tresize return value is not used
Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
2014-08-10 22:16:21 +02:00
nonameandRoberto E. Vargas Caballero 99fb365aa3 Consistent FALLTHROUGH comments. 2014-05-02 21:49:52 +02:00
nonameandRoberto E. Vargas Caballero 6b315558f8 Do not save cursor in tresize.
This patch fixes the bug introduced in
8f11e1cd03

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'
2014-04-29 15:17:50 +02:00
nonameandRoberto E. Vargas Caballero 5f91983541 Simplify selected(). 2014-04-28 18:49:45 +02:00
nonameandRoberto E. Vargas Caballero 9e3e8ce466 Do not export chscale and cwscale. 2014-04-28 18:49:05 +02:00
nonameandRoberto E. Vargas Caballero 0e439e5624 Simplify xunloadfonts. 2014-04-28 18:48:09 +02:00
nonameandRoberto E. Vargas Caballero 74962bf566 Remove one indentation level in getsel(). 2014-04-28 18:38:07 +02:00
nonameandRoberto E. Vargas Caballero 6681af165b Remove unused dump() function. 2014-04-28 18:38:07 +02:00
nonameandRoberto E. Vargas Caballero 1ae2745fd1 Add missing function prototypes. 2014-04-28 18:38:06 +02:00
nonameandRoberto E. Vargas Caballero a48f2be7f5 Use MODBIT in xseturgency. 2014-04-28 18:38:06 +02:00
nonameandRoberto E. Vargas Caballero 17fa1493ee Compute ena_sel as one expression. 2014-04-28 18:38:06 +02:00
nonameandRoberto E. Vargas Caballero 02d2df5790 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.
2014-04-26 00:14:42 +02:00
nonameandRoberto E. Vargas Caballero c4b79b055d Fix for multibyte characters in techo.
Works for both signed and unsigned char.
2014-04-26 00:03:09 +02:00
nonameandRoberto E. Vargas Caballero 7f1e02e4db s/DSC/DCS/ DCS stands for DEVICE CONTROL STRING 2014-04-26 00:03:09 +02:00
nonameandRoberto E. Vargas Caballero 84f6dbffa5 Use xwrite instead of write. 2014-04-26 00:03:08 +02:00
nonameandRoberto E. Vargas Caballero 2d67f99d28 Remove unnecessary break 2014-04-26 00:03:08 +02:00
nonameandRoberto E. Vargas Caballero 4a8574b439 Comment fix. 2014-04-25 23:57:44 +02:00
nonameandRoberto E. Vargas Caballero 844c503c80 Optimize tputtab.
Before this patch executing
	printf '\e[10000000000I'
or
	printf '\e[10000000000Z'
resulted in long delay.
2014-04-25 23:57:44 +02:00
nonameandRoberto E. Vargas Caballero 1b0b9759dc Use != instead of ^ for logical values.
sel.alt is only changed by
	sel.alt = IS_SET(MODE_ALTSCREEN);
2014-04-25 23:57:43 +02:00
nonameandRoberto E. Vargas Caballero 99d2d6007a Use BETWEEN macro in xsetcolorname and fix style. 2014-04-25 23:57:43 +02:00
nonameandRoberto E. Vargas Caballero 80b32af794 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.
2014-04-25 17:17:48 +02:00
nonameandRoberto E. Vargas Caballero 16ac85bf54 Style fixes in tscrollup. 2014-04-23 20:38:04 +02:00
nonameandRoberto E. Vargas Caballero fe527aa508 Do not set dirty flag twice in tscrollup and tscrolldown. 2014-04-23 20:37:59 +02:00
nonameandRoberto E. Vargas Caballero 3afdb4ff04 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.
2014-04-23 20:35:16 +02:00
nonameandRoberto E. Vargas Caballero f9dc374ea0 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.
2014-04-23 20:31:45 +02:00
nonameandRoberto E. Vargas Caballero fa19f241a3 Make xrealloc and xstrdup style consistent. 2014-04-23 15:39:04 +02:00
nonameandRoberto E. Vargas Caballero df1810dd8f Use BETWEEN in tsetchar. 2014-04-23 15:39:03 +02:00
nonameandRoberto E. Vargas Caballero ed855ea432 Use uint and uchar instead of unsigned int and unsigned char. 2014-04-23 15:39:03 +02:00
nonameandRoberto E. Vargas Caballero 68d97457ec Remove argument names from function prototypes. 2014-04-23 15:39:03 +02:00
nonameandRoberto E. Vargas Caballero 49672dac7b Style fix in tdumpsel. 2014-04-23 15:39:02 +02:00
nonameandRoberto E. Vargas Caballero f21e47f44a Use BETWEEN in tinsertblankline and tdeleteline. 2014-04-23 15:39:02 +02:00
noname@inventati.organdRoberto E. Vargas Caballero 1388870331 move MODBIT to Macros section
Patch moves MODBIT to macros section and uses it in tselcs.
2014-04-20 21:13:37 +02:00
noname@inventati.organdRoberto E. Vargas Caballero 6b56cbf9cc misplaced parenthesis in LEN macro 2014-04-20 21:07:04 +02:00
noname@inventati.organdRoberto E. Vargas Caballero 4ad2fc7f18 Simplify techo
Remove special case for \e because it is handled well by "control code"
case.
2014-04-15 08:16:39 +02:00
noname@inventati.organdRoberto E. Vargas Caballero dc74c4f729 typedefs instead of #defines
Replaced #defines with typedefs where possible, patch attached.
2014-04-15 08:14:46 +02:00