Commit Graph

255 Commits

Author SHA1 Message Date
Boris Faure dad9e0db58 remove compatibility #ifs to work with EFL < 1.16 2018-03-13 18:58:41 +01:00
Boris Faure d7432a52d6 move input handling to win.c 2018-02-05 00:07:47 +01:00
Carsten Haitzler 8cfa269b54 tysend - optimize sending - pretty much double the speed
yes. it's still inefficient because we transfer in ascii-ized nibbles
(4 bits) within a utf8 stream that becoems a 32bit per char unicode
buffer then back to utf8 before being "parsed" as a command etc. etc.
... it's not brilliant for transferring binary data. it's horrible
actually. but at least i've dropped overhead for some of the large
escape handling code.

this increases buffer size to 32k per block sent, and have the
terminal escape/buffer handling track if a zero byte exists in the
buffer at all to avoid hunting for one if none is there, making
terminology escape handling much more efficient for large escapes and
buffers.
2017-12-18 15:32:02 +09:00
Boris Faure 496a5f178e have only one concept of title. Ref T5704 2017-08-28 21:41:21 +02:00
Boris Faure 38da9b2ded correctly handle -T option. Ref T5704 2017-08-28 21:41:10 +02:00
Boris Faure acbf3387fa fix selections in the backlog. Closes T5743
In the backlog, every cell but the last one has the autowrapped flag set.
_termpty_cellrow_from_beacon_get() now returns a length in the
"screen space".
2017-08-26 18:51:22 +02:00
Boris Faure 6315ed2949 termpty: remove termstate.had_cr since it's unused 2017-08-21 23:46:28 +02:00
Boris Faure 6f1a2dd452 constify 2017-07-06 21:37:56 +02:00
Boris Faure b0226726f8 termpty: correctly handle DECFRA wrt SGR 0 2017-06-26 23:36:23 +02:00
Boris Faure 7ac685b68c termpty: DECERA only changes codepoints 2017-06-26 21:58:59 +02:00
Boris Faure 387cafa463 tyfuzz needs termpty_resize_tabs() 2017-05-17 22:35:01 +02:00
Boris Faure e188244c72 pty: fallback to ~ or / when creating new term if current dir is not available
Closes T5186
2017-02-17 21:57:57 +01:00
Carsten Haitzler 71f1fdc66c terminology tabs resize - fix access of invalid memory beyond bounds
we memcpy'd the currenty size over, so if prev size was smaller - this
was wrong and valgrind threw a complaint. also the rounding seems
utterly bizarre. it looks like it was meant to round up to the nearest
"lot of 8 tabs" so actually do that... which makes is easy to pass in
old width nicely now to fix the problem.

@fix
2017-01-31 13:03:36 +09:00
Boris Faure 41c4479dc5 termpty: verify that $SHELL is valid before using it. CID1366816 2016-12-24 18:40:18 +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 fae0d7ccee termptyesc: handle correctly Cursor Back Tab. Ref T4992 2016-12-15 23:11:22 +01:00
Carsten Haitzler 60d1c6d05c term pty fd - properly shut down without a 100% cpu hang
i've noticed that the exe cb tries to drain the pty fd but reads
return -1 with EAGAIN so terminology just spins forever in cpu trying
to drain a buffer that does not drain, so make a special case on exe
exit - drain until there just is nothing else to read then give up.

@fix
2016-12-13 11:53:50 +09:00
Al Poole 8dd7aefcb4 Fix bogus hack and restore cursor position to its right place. On OpenBSD and DragonFly the cursor is being incorrectly placed. Seems there was a Linux workaround too. My guess is this will fix that also.
Summary: Should help anyway.

Reviewers: billiob, raster

Differential Revision: https://phab.enlightenment.org/D4465
2016-12-06 23:42:10 +01:00
Boris Faure 273a85af00 termpty: handle BSD special case when the other side of the tty pair has quit 2016-12-06 21:49:15 +01:00
Boris Faure 5770c51d86 termpty: handle read() from tty pair when the other end has died, on some BSD
In such a case, read() returns 0 and sets errno to ECHILD…
2016-12-05 23:39:29 +01:00
Boris Faure 7508c8658b termpty: ensure we're not reading from invalid fd 2016-12-05 22:45:44 +01:00
Boris Faure 9b6bed8033 termpty: fix dead code and remove debugging code. CID1366815 2016-12-05 22:13:54 +01:00
Boris Faure 4b3225bfa9 termpty: make verify_beacon silent by default 2016-12-05 22:13:30 +01:00
Boris Faure 390e4193d0 termpty: fix possible issue when reading and the shell exited 2016-12-05 21:53:15 +01:00
Boris Faure 1f62588e97 termpty: avoid race between exit of the program and reading from it
Also ensure we read what was already in the pipe before we ever polled it.

Closes T4925
2016-12-04 23:24:28 +01:00
Boris Faure 32dbc65c6d env: unset COLUMNS, LINES, TERMCAP 2016-12-04 23:21:58 +01:00
Boris Faure 86f27f0474 termpty: remove useless code 2016-12-04 23:17:56 +01:00
Boris Faure d5f4811b2d improve error message 2016-12-04 18:05:43 +01:00
Boris Faure 51fe6b3428 fix getting lines with the beacon
add quite some testing that is disabled by default, used to ensure that
the beacon is always valid
2016-11-30 23:25:33 +01:00
Boris Faure c47b0c39d5 scrolling: fix issues with the beacon
Add a few comments on how it works
2016-11-20 18:23:56 +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
José Roberto de Souza ae7e96633a Allow user to set the title of the each tab 2016-03-04 11:34:24 -03:00
Andy Williams fbf61bf815 [zoom] fix crash fix.
Sorry to anyone who lost character selection this morning...
2016-01-31 15:01:00 +00:00
Andy Williams 459cf7383d [zoom] Fix some potential crashes when zooming.
Generally just being a little more defensive against
potential errors.
2016-01-31 09:01:44 +00:00
Boris Faure 904f49ccc4 remove statement with no effect 2015-12-26 11:52:31 +01:00
Boris Faure 3091a4e479 Closes T2911. fix reflow
- correctly set `autowrapped`
- reflow the top line when part of its content is in backlog
2015-12-10 21:15:17 +01:00
Boris Faure 66d05abb11 fix text reflow. Closes T2911
I should write unit tests on that someday
2015-12-07 22:05:49 +01:00
Carsten Haitzler 5a5b80ebec fix fuzzing so terminology works at all again
if (len <= 0)

in _cb_fd_read() is ALWAYS coming up with len < 0 for me and that'd
be LOGICAL... eg if read() returns an error (something ok to allow us
to continue) and so my terminal content NEVER appears - because
terminology is returning false from the fb handler asking it to be
deleted. this is wrong so put it inside #ifdef of fuzzing so it
doesn't affect "normal people". i still think it is broken tho... but
at least i have my terminal back now.
2015-11-12 09:53:32 +09:00
Boris Faure a925de13dc tyfuzz: read from stdin but write to /dev/null 2015-11-08 13:06:13 +01:00
Boris Faure 01421754ec make termpty_handle_buf() public to ease fuzzing 2015-11-08 13:05:43 +01:00
Boris Faure 755a4c3f2f enable fuzzing with --enable-fuzzing
Only enable it if you know what you're doing
2015-11-08 13:05:43 +01:00
Boris Faure d11ebd1247 add code to fuzz terminology (wip) 2015-11-08 13:05:43 +01:00
Boris Faure a334bf6554 termpty: fix resizing
do not add a useless newline
do not copy the same content few times
2015-09-13 23:17:17 +02:00
Boris Faure 386cf11b19 fix backlog locking 2015-09-13 23:17:03 +02:00
Boris Faure 78cb50c7a3 fix line length computation 2015-09-13 23:16:30 +02:00
Boris Faure fe58cd058b only use beacon when it seems efficient 2015-08-10 21:44:05 +02:00
Boris Faure d0bedb9a8a backlog: update beacon while browsing 2015-08-10 21:31:24 +02:00
Boris Faure 7af60a58c8 BACKLOG_ROW_GET() should not be called with a "screen" value
the backlog is independent of the screen size. Thus a single line in the
backlog can span many lines on the screen.
2015-08-09 14:10:12 +02:00
Boris Faure b4c91eee47 fix scroll after resize 2015-08-08 16:40:05 +02:00
Boris Faure 5c37589e39 fix resize when cursor alone on last line 2015-08-05 22:57:01 +02:00
Boris Faure 21764bbf85 remove wrong assert when no backlog ever generated 2015-08-03 21:23:38 +02:00
Boris Faure 8fbffdd869 renames to make the code more consistant 2015-08-03 20:44:55 +02:00
Boris Faure 35c8fd79c0 speed up browsing backlog
have a "beacon": single point where the link between an offset in the
backlog and one in screen coordinates
2015-08-03 20:44:55 +02:00
Boris Faure 34592ab5b3 new resize/backlog implementation. Closes T2461
idea: store full lines in the backlog. No need to change them on resize
2015-08-03 20:43:17 +02: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 4abdf4b327 code cleanup: s/if (X) free(X);/free(X);/ 2015-03-18 15:23:39 +01:00
Boris Faure ed178f5a13 typo 2015-03-17 18:47:26 +01:00
Boris Faure 7edeea3503 correctly swap term states. Ref T725 2015-03-17 17:15:50 +01:00
Boris Faure b4ba773e17 fix CSI DECSET 1049. Should fix T725 2015-03-01 17:20:18 +01:00
Boris Faure 27304c456f make terminology start on solaris 2015-02-23 23:33:06 +01:00
Boris Faure cf1a9a3a01 verify that tcgetattr() does not fail 2015-02-23 23:33:01 +01:00
Boris Faure e4d357ace2 make terminology work on solaris
tcsetattr() should only be called on the slave fd. On linux, both master
or slave are accepted, not on solaris.
2015-02-17 22:08:47 +01:00
Carsten Haitzler 6268dc32e4 terminology - fix double click selection and jed display
this fixes breaks introduced by
e94051dd86 (the previous commit).

latest commit: e94051dd86

breaks 2 things.

1. double-click to select a "word" is broken. the right end of the selection is
stuck at the point where the cursor is, not the right end of the word. try it.
at least that is what i see. either way double-click to select a word is now
broken. ;(

2. what used to be black whitespace bg is now "empty" chars (so i see
terminology bg). this breaks jed output pretty badly.

see...

working:
http://www.enlightenment.org/ss/e-54d05f357a3391.24747752.png

not working:
http://www.enlightenment.org/ss/e-54d05f672a4df7.83729511.png
2015-02-03 14:45:23 +09:00
Boris Faure e94051dd86 make selection consistent when selecting space with no text. Closes T2013 2015-01-30 00:24:55 +01:00
Boris Faure cd04b71611 check tcsetattr() 2015-01-10 21:02:05 +01:00
Boris Faure 7f98dba714 set a title to the term based on the shell started 2014-12-16 22:11:06 +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 978f83dc03 just sighup the shell, don't sigpipe it. Closes T1685 2014-09-28 13:46:04 +02:00
Boris Faure b9a994c4bd fix compilation. I'm tired… 2014-09-15 23:30:48 +02:00
Boris Faure 2eb2b9646f fix segfault when OOM on the termpty_save module 2014-09-15 22:07:22 +02:00
Boris Faure 90c53f5974 fix CID 1238659: Dereference after null check (FORWARD_NULL) 2014-09-15 21:04:26 +02:00
Boris Faure 51555f9c35 fork can fail 2014-09-14 22:46:22 +02:00
Boris Faure 6d4219137f try to handle OOM on "termpty_save" 2014-09-14 14:11:14 +02:00
Carsten Haitzler 15b55d5eb7 Revert "do not crash when the scrollback mempool is OOM"
This reverts commit 815a357ad9.

this patch breaks paging and backscroll completely. just try less or
more - eg

man ls

then resize the window. :)
2014-09-10 16:57:32 +09:00
Boris Faure 815a357ad9 do not crash when the scrollback mempool is OOM 2014-09-08 21:28:26 +02:00
Boris Faure 601450db01 review translation strings. Closes T1433 2014-07-26 11:37:27 +02:00
Boris Faure 8a3c15e08e gettextify termcmd.c,termio.c,termpty.c,termptyesc.c 2014-07-26 11:37:26 +02:00
Boris Faure 2b9c9a8351 add some padding fields to be sure holes are initialized (hi valgrind!) 2014-05-08 13:55:01 +02:00
Boris Faure 9346db3ba7 initialize some variables 2014-03-25 21:57:34 +01:00
Boris Faure 0313446e79 let's try to recover from malloc failure: ahah 2014-03-25 21:43:49 +01:00
Boris Faure 8f3258f1b3 use a bit more Eina_Unicode 2014-03-25 21:35:31 +01:00
Sebastian Dransfeld 2263fd872e return after failed memory allocation
CID 1100649
2014-03-24 13:38:42 +01:00
Sebastian Dransfeld 1c53e10b42 don't write to NULL buffer
If we have checked for allocation failure, no need to write to buffer.

CID 1100648
2014-03-24 13:37:07 +01:00
Sebastian Dransfeld fe45b5c73f remove weird check
After allocation of new_screen, we should check the allocation of this
variable, and return if we cannot allocate.

CID 1100647
2014-03-24 13:35:08 +01:00
Aleksandar Popadić ca143565a4 Fix disappearing prompt on resize
...and break reflow of multiline prompt lines.
2014-03-15 21:40:05 +01:00
Boris Faure 864fa1e368 set IUTF8 flag. Closes T656 2014-01-29 22:57:49 +01:00
Boris Faure 7cc50d4e05 fix wrong cast. thanks to OnlyHuman 2014-01-22 23:22:42 +01:00
Carsten Haitzler 870d592139 set EMOTION_ENGINE to tyls (and ethumb etc.) can use it inside shell
this should fix T291
2014-01-22 20:32:25 +09:00
Aleksandar Popadić 4ed6ca9385 Close T643 for the time being.
Reviewers: billiob

Maniphest Tasks: T643

Differential Revision: https://phab.enlightenment.org/D408
2013-12-25 11:57:13 +01:00
Aleksandar Popadić 59a7627e86 Fix reflow on resize when in alternate buffer. Closes T637
Summary:
After commit 05d091483a screen swap form
alternate buffer to primary buffer is not the same as the reversed. Take this
into account when resizing.

Test Plan: Build history, man echo, resize, quit manual.

Reviewers: billiob

Differential Revision: https://phab.enlightenment.org/D370
2013-12-10 21:23:32 +01:00
Carsten Haitzler 6cbc4c1a09 wrap code - line2 COULD be NULL technically, so handle that case 2013-12-06 19:00:23 +09:00
Boris Faure 05d091483a fix changing state when swapping buffers. Closes T605
For some reason, this is not a real swap. Thanks to gregkh for the great
bug report.
2013-12-05 22:48:58 +01:00
Aleksandar Popadić b31638a630 Fix resize from width=1 to wider.
Test Plan:
Shrink terminal to width=1 and expand. Empty lines appear above
prompt line.

Reviewers: billiob

Differential Revision: https://phab.enlightenment.org/D361
2013-12-02 21:51:03 +01:00
Boris Faure fa0cdc0e1d remove unused parameter 2013-12-01 23:19:54 +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