Commit Graph

266 Commits

Author SHA1 Message Date
Boris Faure 7ac685b68c termpty: DECERA only changes codepoints 2017-06-26 21:58:59 +02:00
Boris Faure 956f1eaa13 termptyesc: restrict right/bottom rectangle coordinates 2017-06-07 20:40:17 +02:00
Boris Faure 400b675fc9 termptyesc: restrict CUP/HVP to right/bottom margins 2017-06-06 23:00:22 +02:00
Boris Faure cc5fcac03d termptyesc: fix handling of DECSLRM. Ref T5533 2017-06-05 23:53:07 +02:00
Boris Faure bbfa60120e termpty: handle DECERA 2017-06-05 21:04:29 +02:00
Boris Faure 9f72ea3a9d termptyesc: handle DECFRA 2017-06-05 20:47:41 +02:00
Boris Faure e117ff9153 termptyesc: correctly handle cursor wrt right/left margins 2017-06-05 16:49:36 +02:00
Boris Faure 7d497c08c6 termptyesc: extract handling CUP/HVP to one function 2017-06-05 01:04:24 +02:00
Jean Guyomarc'h ede4196eae termptyesc: fix invalid clamping on CSI X
Fixes a regression introduced by commit bd6c81e, which broke the ncurses
rendering of the Kernel menuconfig, making it impossible to be used.
2017-06-04 18:35:46 +02:00
Jean Guyomarc'h 20cbab21fc termptyesc: improve const-correctness of data 2017-06-04 18:35:22 +02:00
Boris Faure c2d731aced termptyesc: cleanup handling of DECSTBM 2017-06-04 00:33:32 +02:00
Boris Faure 7ab925dc76 termpty: very early support of Right/Left margins 2017-06-03 23:17:33 +02:00
Boris Faure 91ce6e8960 termptyesc: correctly handle missing arguments in CUP/HVP 2017-06-01 23:33:58 +02:00
Boris Faure e0f6867a88 termptyesc: _csi_arg_get() now correctly handles missing arguments
Only affects when multiple ones were expected
2017-06-01 23:29:55 +02:00
Boris Faure dbc75a0cc0 termptyesc: only do IL/DL when inside margins 2017-06-01 22:52:16 +02:00
Boris Faure 339b72174c termptyesc: CUP/HVP are impacted by DECOM 2017-06-01 22:51:34 +02:00
Boris Faure 8168b019c9 termptyesc: improve debug 2017-06-01 21:29:07 +02:00
Boris Faure 816f60369f termptyesc: correctly handle DECOM
also fix regions with only one argument
2017-05-31 00:39:02 +02:00
Boris Faure 6ce96da8c4 s/scroll_y1/top_margin/, s/scroll_y2/bottom_margin/ 2017-05-29 23:26:32 +02:00
Boris Faure a4a26de7c3 termptyesc: fix parsing size on xterm 50 command 2017-05-28 23:32:37 +02:00
Boris Faure 7b5a9b74bc termptyesc: use macro to restrict field value 2017-05-17 23:40:19 +02:00
Boris Faure 490a065fb1 termptyesc: _csi_arg_get() could be called with nothing to read
Could be the case when an error was already found while decoding the
stream
2017-05-17 23:38:28 +02:00
Boris Faure 0517be32f4 termptyesc: no logging when fuzzing 2017-05-17 23:33:06 +02:00
Boris Faure ce490ededc termptyesc: fix issue with tmux introduced by previous commit 2017-05-17 21:49:52 +02:00
Boris Faure 63d65ed4bb termptyesc: restrict values on scrolling regions 2017-05-16 22:48:18 +02:00
Boris Faure 17e5e1be55 termpyesc: only compute logging content if it's going to be printed 2017-05-15 23:54:25 +02:00
Boris Faure bd6c81ed39 termptyesc: restrict CSI values to avoid denial of service 2017-05-15 22:34:01 +02:00
Boris Faure 2b47545fac termptyesc: ensure colors are valid 2017-05-15 21:56:54 +02:00
Boris Faure 99f55b7bbc termptyesc: support DECSED3 to erase the backlog. Closes T3713 2016-12-20 22:43:37 +01:00
Boris Faure b9d5a55aa4 termptyesc: correctly handle tab forward. Closes T4992 2016-12-18 19:17:42 +01:00
Boris Faure f3dd6f62fb termpty: Tab markers are the same for each line. Ref 4992 2016-12-18 18:48:03 +01:00
Boris Faure 82d9ead6f2 termptyesc: handle correctly Character Tabulation Set (HTS). Ref T4992 2016-12-15 23:11:22 +01:00
Boris Faure 7c720058a1 termptyesc: add some debug 2016-12-15 23:11:22 +01:00
Boris Faure fae0d7ccee termptyesc: handle correctly Cursor Back Tab. Ref T4992 2016-12-15 23:11:22 +01:00
Boris Faure f4263d5098 termptyesc: add missing break (CID1365404) 2016-11-07 11:35:50 +01:00
Boris Faure 566c6d3680 termpty: correctly handle saving cursor + switching to/from altbuf
Closes T4718
2016-10-18 00:15:06 +02:00
Boris Faure 76f1bf4342 prefix EINA_UNUSED parameters with an underscore
and fix related issues
2016-10-05 22:00:22 +02:00
Boris Faure 0c466d767c Merge remote-tracking branch 'raboof/comment' 2016-05-21 22:39:14 +02:00
Boris Faure f33aa07b81 termptyesc: fix signedness comparison 2016-05-21 22:38:39 +02:00
Arnout Engelen 9a501470aa Fix comment for 't' escape sequence 2016-05-21 15:15:19 +02:00
Arnout Engelen ef8ee3fbda Allow font size to be updated via escape sequence 2016-05-21 14:53:17 +02:00
José Roberto de Souza ae7e96633a Allow user to set the title of the each tab 2016-03-04 11:34:24 -03:00
Boris Faure a0c249e6ca fix crash when running tyfuzz. not in terminology 2015-11-14 21:26:37 +01:00
Boris Faure 4913364a22 fix int overflow 2015-11-08 13:06:13 +01:00
Boris Faure 9c4167f74f always support double-width 2015-09-19 16:23:41 +02:00
Boris Faure 2b3eda694f always support italic 2015-09-19 16:18:17 +02:00
Boris Faure 3a7238978e turn error messages about unhandled escape codes into warnings 2015-09-08 21:59:11 +02:00
Boris Faure 144e0b5068 add option to disable terminology escape codes that could be considered
security issues by some

They are enabled by default.
2015-08-23 20:57:49 +02:00
Boris Faure 7fd86d8968 warn about window operations' escape codes being not supported 2015-08-17 23:18:50 +02:00
Boris Faure b80bedc7c2 do not report unsanitized input. See CVE-2003-0063 2015-08-17 23:18:49 +02:00
Boris Faure f40c63bbb6 typo 2015-08-03 20:52:54 +02:00
Jean-Philippe Andre 09b4fddf84 escapes: pretty-print some escapse and avoid ESC in debug logs
ERR("Hello '%c'", ESC) would result in "Hello '\033'" which means
the parent terminal (another terminology, maybe) would then try to
interpret ' as an escape char (ESC is \033 or 0x1b), and so it would
then forward more escapes to the parent.

Also, avoid printing BEL (and, well, beeping) when we are just
printing an error log.

I believe all those "Unhandled escape" logs should go to WRN or higher
log levels. Any thoughts, @billiob ?

See T2506 (for the test file)
2015-06-24 13:46:48 +09:00
Boris Faure 681bb029c2 ensure cursor coordinates are always valid, 2nd version 2015-06-03 23:02:31 +02:00
Carsten Haitzler 074eece5f7 Revert "ensure cursor coordinates are always valid"
This reverts commit 1f3f779258.

this breaks terminal scrolling entirely! can't scroll anymore at all
in standard shell. just try a simple: find / -print
2015-06-03 15:00:13 +09:00
Boris Faure 1f3f779258 ensure cursor coordinates are always valid 2015-06-02 22:48:50 +02:00
Boris Faure c86b35309c rename a bunch of _termpty_*() to termpty_*() 2015-06-02 21:47:06 +02:00
Boris Faure be62d87f89 separate "termstate" from cursor state and screens. Closes T725 2015-04-23 20:02:53 +02:00
Boris Faure b4ba773e17 fix CSI DECSET 1049. Should fix T725 2015-03-01 17:20:18 +01:00
Boris Faure f13d9ad111 fix compilation on solaris 2015-02-23 22:20:18 +01:00
Boris Faure 296cdcd102 usual round of fixes to make it compile with efl 1.7 2015-02-14 12:08:50 +01:00
Boris Faure 87d653ea4d add xterm 777 notification support. Closes T1765 2015-01-12 23:13:43 +01:00
Boris Faure 36e5ca2165 "handle" HTS 2015-01-10 21:02:04 +01:00
Boris Faure da809eb023 "handle" TBC 2015-01-10 21:02:04 +01:00
Boris Faure cbc92a55fc Fix screen mangling from prompt redraws on resize. Closes T1193
There are still some oddities because the shell doesn't expect us to
reflow.

Let's say we have the following where X is the cursor.

+-------+
|foobar$|
|X      |
+-------+
Here, the shell explicitly told us to go to a new line after '$'. We don't
consider '$' is on the same line as 'foobar'.
Decrease the width of that window.
+------+
|foobar|
|$     |
|X     |
+------+
Let the shell know the new size. It decides to redraw the prompt. It
remembers it told us to go to a new line, so the first thing it tells us
is to go one line up: to '$' and not 'foobar'. Then it tells us to clear
the screen downward from there and to print "foobar$" (and go to new
line).

Thus we have the following:
+------+
|foobar|
|foobar|
|$     |
|X     |
+------+
2014-12-07 23:51:23 +01:00
Boris Faure caed00cc1f fix segfault due to using isdigit with non unsigned char value. Closes T1625
Also rename _termpty_handle_seq() to termpty_handle_seq() since it's not static.
2014-09-15 23:10:55 +02:00
Boris Faure fd1e4ffd45 fix segfault when decoding buggy xterm sequence. cf T1625 2014-09-04 20:45:02 +02:00
Boris Faure 6c50375f26 Party time! be able to set foreground color
Reset is not yet implemented for that…

Idea is from http://www.reddit.com/r/linux/comments/2ds0he/xterm_party/
2014-08-17 22:20:40 +02:00
Boris Faure 5dfb63a14a handle queries on some xterm escape codes 2014-08-17 17:44:19 +02:00
Boris Faure 61050bd7cc clean up xterm escape codes handling 2014-08-17 17:32:57 +02:00
Boris Faure 9a16eb57a1 handle some DSR: the cursor position reports 2014-08-14 21:48:26 +02:00
Boris Faure ae820f3897 extract csi_reset_mode 2014-08-11 22:03:56 +02:00
Boris Faure 8a3c15e08e gettextify termcmd.c,termio.c,termpty.c,termptyesc.c 2014-07-26 11:37:26 +02:00
godfath3r 54280b97f6 cleanup. Remove lines with values stored to variables never used
Summary:
  as found with clang static analysis tool.

Reviewers: billiob, raster

Differential Revision: https://phab.enlightenment.org/D1207
2014-07-21 20:42:57 +02:00
Boris Faure e51c2168e9 fix segfault. Closes T1286 2014-06-08 15:52:34 +02:00
Boris Faure c3c8310218 Fix bracketed paste mode. Closes T1233. Patch by Egmont 2014-05-07 20:41:14 +02:00
Boris Faure 02856cbdec terminology supports fraktur!! 2014-04-06 14:42:38 +02:00
Sebastian Dransfeld cd189663bd remove dead code
We make sure that arg >= 0 before this line, so check is redundant.

CID 1100658
2014-03-24 13:40:05 +01:00
Boris Faure c27d887c1c save wrapnext when saving cursor. Closes T1080 2014-03-15 18:35:59 +01:00
Boris Faure 87e06d7a87 add some doc about RM 34/36 2014-03-15 17:35:56 +01:00
Boris Faure f47eb5e410 fix buffer overflows. Closes T1050 2014-03-05 22:37:38 +01:00
Boris Faure 735e5d1a3d cleanup code 2014-03-05 21:42:33 +01:00
Boris Faure 2063e2f4f4 fix ^[22m: no bold/bright, no faint 2014-03-03 23:02:17 +01:00
Boris Faure 5067594760 improve TODO message 2014-03-01 16:07:16 +01:00
Boris Faure b22a4f6ab1 handle soft reset (DECSTR) 2014-03-01 15:39:58 +01:00
Boris Faure 42e4fdfc59 improve debug for unhandled csi 2014-03-01 15:29:32 +01:00
Boris Faure f6a08ac7d8 skip buffer when dcs parsing overflows. Closes T932 2014-02-11 22:18:12 +01:00
Boris Faure 878f456160 fix copy/paste error: CID 1163307 2014-01-23 03:44:07 +01:00
Boris Faure ab9243b94f oops 2014-01-22 23:19:11 +01:00
Boris Faure 4602641ac0 fix typo: CID 1100646 2014-01-22 22:53:48 +01:00
Boris Faure defca7b58b remove dead code: CID 1100658 2014-01-22 22:52:27 +01:00
Boris Faure ac4117ce8a add bracketed paste (by egmont). Closes T670 2014-01-06 21:51:23 +01:00
Aleksandar Popadić ae9226f823 Give commit 5ab7a6f827 another go
"Do not let CUU and CUD scroll off screen."
Previously I missed how the default values are implemented.

Reviewers: billiob, cedric

Differential Revision: https://phab.enlightenment.org/D417

Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
2013-12-27 16:17:15 +09:00
Cedric BAIL 1cc793f564 Revert "Do not let CUU and CUD scroll off screen."
This reverts commit 5ab7a6f827.

This patch did completely break emacs for me. I have no idea what the intent was, but
at least my application/OS is broken.
2013-12-26 11:36:51 +09:00
Aleksandar Popadić 1f62a447a3 DECCOLM - do not change terminal height
Summary: I'm taking xterm as a reference here.

Reviewers: billiob

Reviewed By: billiob

Differential Revision: https://phab.enlightenment.org/D410
2013-12-25 12:09:54 +01:00
Aleksandar Popadić 5ab7a6f827 Do not let CUU and CUD scroll off screen.
Summary:
ISO 6429 is a bit vague here but I don't think that the cursor should
be let go off screen.

Test Plan: terminology -g80x30, vttest, 1 -> test failed

Reviewers: billiob

Reviewed By: billiob

Differential Revision: https://phab.enlightenment.org/D409
2013-12-25 12:07:13 +01:00
Aleksandar Popadić e170f85ce3 Do not switch buffer if buffer already switched.
Summary:
Mutt does this. It sets the alternate buffer, it disables it, it
disables it again and enables it back.

Test Plan:
Run mutt, quit mutt, run mutt, quit mutt. You should see the
residual background from mutt.

Reviewers: billiob

Differential Revision: https://phab.enlightenment.org/D371
2013-12-10 21:45:11 +01:00
Aleksandar Popadić d0c6c1d457 Rewrite reflow on resize
Summary:
simplify code (treat every resize as a single case) and fill the lines
from the bottom up

Reviewers: billiob

Differential Revision: https://phab.enlightenment.org/D355
2013-12-01 19:47:12 +01:00
Boris Faure 81a7d98f2f fix handling of DCH. Closes T537
As characters are deleted, the remaining characters between the cursor and
right margin move to the left. Character attributes move with the characters.
The terminal adds blank spaces with no visual character attributes at the right
margin. DCH has no effect outside the scrolling margins.
2013-11-23 19:31:49 +01:00
Boris Faure df2b87308b add termpty_screen_swap() to simplify code 2013-11-18 21:41:30 +01:00
Aleksandar Popadić 7447178071 Fix screen refresh with screen, ssh, vim, ...
Summary: This closes T143.

Reviewers: billiob

Reviewed By: billiob

Maniphest Tasks: T143

Differential Revision: https://phab.enlightenment.org/D340
2013-11-18 20:45:47 +01:00
Boris Faure f8edf059d4 fix scrolling bug. Closes T106
Was fixed with help from great bug report by thomasg.

scroll_rev was ok
2013-11-17 17:28:32 +01:00
Boris Faure 40f0dc6950 simplify code 2013-11-17 17:28:32 +01:00
Boris Faure 4bc3357a91 improve debug output 2013-11-17 17:28:32 +01:00
Boris Faure 7617f39f1a small debug-related changes 2013-11-10 15:35:16 +01:00
Daniel Juyung Seo f5df6ce99d termptyesc: removed unnecessary null check for free.
This fixes coverity CID 1100643.
2013-11-08 08:13:37 +09:00
Daniel Juyung Seo e0bd4fd6f7 termptyesc: fixed up wrong null check.
This solves coverity CID 1100642.
2013-11-08 08:08:39 +09:00
Boris Faure 02e42a747b esc: export color_set to its own function 2013-09-21 18:54:57 +02:00
Boris Faure 97c2275e8c improve debug logs 2013-09-15 15:32:11 +02:00
Boris Faure a8206c8b03 add some comments, clean-up code 2013-08-31 17:12:32 +02:00
Boris Faure 30392f23a9 s/__UNUSED__/EINA_UNUSED/g 2013-08-27 15:36:50 +02:00
Chris Michael cf2eb65f98 Fix warning: 'len' may be used uninitialized in this function
Signed-off-by: Chris Michael <devilhorns@comcast.net>
2013-06-19 09:21:58 +01:00
Boris Faure 604a9abd85 compat: fix scrolling not clearing some text
Test case was provided by weechat.
2013-06-09 12:03:52 +02:00
Boris Faure 1dccb22ffc compat: add some debug 2013-06-09 12:03:52 +02:00
Boris Faure 7bad3a491f compat: discard (ftm) key resources used by xterm 2013-06-09 12:03:52 +02:00
Boris Faure 75f40ae3c2 compat: improve doc/parsing on DCS escape codes 2013-06-09 12:03:52 +02:00
Boris Faure 7f5f407d7d compat: fix len computation when handling DCS escape codes 2013-06-09 12:03:52 +02:00
Boris Faure 72bbb101f8 compat: csi parameters are always decimal
There can be some leading zeros.
2013-06-09 12:03:52 +02:00
Boris Faure 71d27572b3 compat: handle cursor-controls chars in ESC sequences 2013-06-09 12:03:52 +02:00
Boris Faure 0b6e44bbd6 compat: add margin top support on Origin mode 2013-06-09 12:03:52 +02:00
Boris Faure d5cc45a690 compat: add ugly testing code to change between 80/132 cols 2013-06-09 12:03:52 +02:00
Boris Faure f5cad4ff7f compat: only clear cells when scrolling to add text
and to delete lines, but not when just moving the cursor
2013-06-09 12:03:51 +02:00
Boris Faure c41fb7f0b1 compat: add some csi dec private modes TODOs 2013-06-09 12:03:51 +02:00
Boris Faure 861bcf04a9 handle DCS status string requests 2013-06-09 12:03:51 +02:00
Carsten Haitzler 3fc3ce4c79 add whitepsace debug mode and termsave abstraction infra. 2013-05-04 11:45:45 +09:00
Boris Faure b6d2b1b4ad revert a bunch of commits that weren't ready for prime time
664c5a23: Revert "compat: csi parameters are always decimal"
3694c88c: Revert "compat: handle cursor-controls chars in ESC sequences"
16e143f9: Revert "compat: add margin top support on Origin mode"
4daccf1f: Revert "compat: add ugly testing code to change between 80/132 cols"
d5be8a64: Revert "add termio_win_get();"
cff21ea5: Revert "compat: only clear cells when scrolling to add text"
13a11e5a: Revert "compat: add some csi dec private modes TODOs"
65f07f77: Revert "handle DCS status string requests"
2013-05-02 10:33:39 +02:00
Boris Faure fa1817bbd4 remove dbg 2013-04-28 21:23:46 +02:00
Boris Faure 664c5a2392 compat: csi parameters are always decimal
There can be some leading zeros.
2013-04-28 17:35:48 +02:00
Boris Faure 3694c88ccb compat: handle cursor-controls chars in ESC sequences 2013-04-27 21:17:14 +02:00
Boris Faure 16e143f970 compat: add margin top support on Origin mode 2013-04-22 22:38:56 +02:00
Boris Faure 4daccf1fe4 compat: add ugly testing code to change between 80/132 cols 2013-04-22 22:28:50 +02:00
Boris Faure cff21ea5b8 compat: only clear cells when scrolling to add text
and to delete lines, but not when just moving the cursor
2013-04-21 21:51:07 +02:00
Boris Faure 13a11e5a92 compat: add some csi dec private modes TODOs 2013-04-21 21:51:07 +02:00
Boris Faure 65f07f7700 handle DCS status string requests 2013-04-21 21:51:07 +02:00
Boris Faure 59ad20f6f8 improve device attributes queries 2013-04-21 21:51:07 +02:00
Carsten Haitzler eca8593193 infra for multiple terms per split slot. 2013-03-17 23:52:13 +09:00
Carsten Haitzler 7d90f43fff restore terminology escapes. 2013-03-14 20:27:36 +09:00
Jean-Philippe Andre ffd8f82a52 Fix last commit
Invalid buffer size
2013-03-14 12:14:34 +09:00
Jean-Philippe Andre 3223e32949 Fix crashes in escape sequence parsings
Crashes happen when using cat against binary files (png, mp4, ...)

Buffer overflow in _handle_esc_dcs()
Suspected overflow in _handle_esc_terminology()
Invalid return value in _handle_esc_terminology()
Don't write "ABC\r\n" on ENQ symbol
Silence some errors
2013-03-14 12:14:34 +09:00
Carsten Haitzler c0dcca4c2d no sleep on nul bytes - seems as if term hangs.. when its just slow...
SVN revision: 83705
2013-02-07 06:48:03 +00:00
Carsten Haitzler 0015767f4b tidy yp tycat - handle edj and mp3/audio files - ahare extensions
handling and filtering, actually free tup termblocks when no longer
referenced without needing a gc, etc. ...



SVN revision: 83441
2013-01-29 15:54:47 +00:00
Carsten Haitzler 6618fb3262 require escape to bgein and end any run of chars that represent a
block item.



SVN revision: 83398
2013-01-29 03:34:50 +00:00
Carsten Haitzler 3b9b38b86c make block insert allow the inserter to specify a character to replace
on insert. this allows multiple insertions to be "active
simultaneously". until all the inset chars are used up. need to wrap
these insert chars with begin/end escapes still for efficiency and so
you can use insert chars elsewhere in the same text output area.

also clean up warnings.



SVN revision: 83394
2013-01-29 00:43:13 +00:00
Carsten Haitzler 2781da8076 tcat... comes out to play fir the first time. not final... but a start.
SVN revision: 83385
2013-01-28 16:06:26 +00:00
Boris Faure 526cc2aeac use device id from xterm
Should fix some emacs compatibility issues.
Bug was fixed with help from 'ptyproxy' I wrote:
https://github.com/billiob/ptyproxy

SVN revision: 83047
2013-01-21 22:51:26 +00:00
Cedric BAIL e36295ce3e terminology: improve speed of text scrolling by using a circular buffer.
SVN revision: 83038
2013-01-21 14:02:32 +00:00
Cedric BAIL 548e12472e terminology: revert previous commit at it is not ready yet for primetime.
SVN revision: 83013
2013-01-20 10:48:17 +00:00
Cedric BAIL 61576f1496 terminology: use a circular buffer for the screen.
SVN revision: 83012
2013-01-20 10:15:47 +00:00
Carsten Haitzler 4cb6987ecf ummm shouldnt dbg.. be a dbg log? :)
SVN revision: 81013
2012-12-15 07:48:17 +00:00
Boris Faure d18cc90367 terminology: cleanup escape sequences parsing. Fix #1628
Charset length for example was not correctly handled and could even lead
to segfaults.

SVN revision: 80980
2012-12-14 18:52:19 +00:00
Boris Faure 480c5506b7 terminology: rewrite mouse handling
Fix mouse in vim. Should also fix it in mc.

SVN revision: 78412
2012-10-24 21:34:36 +00:00