Commit Graph
34 Commits
Author SHA1 Message Date
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