Commit Graph

153 Commits

Author SHA1 Message Date
Nicholas Marriott
c30fbd1d8d When resizing a screen smaller in alternate screen mode, all the lines needed
could be consumed by deleting from the bottom, leaving none to be removed from
the top. In this case, don't call grid_view_delete_lines with ny of 0 as this
is incorrect and causes a bounds check to fatal error if built with -DDEBUG.
2009-07-18 11:06:35 +00:00
Nicholas Marriott
21cfef45d6 When resizing a screen smaller in alternate screen mode, all the lines needed
could be consumed by deleting from the bottom, leaving none to be removed from
the top. In this case, don't call grid_view_delete_lines with ny of 0 as this
is incorrect and causes a bounds check to fatal error if built with -DDEBUG.
2009-07-17 18:35:55 +00:00
Nicholas Marriott
ad006bc6b6 When resizing a screen smaller in alternate screen mode, all the lines needed
could be consumed by deleting from the bottom, leaving none to be removed from
the top. In this case, don't call grid_view_delete_lines with ny of 0 as this
is incorrect and causes a bounds check to fatal error if built with -DDEBUG.
2009-07-17 18:35:11 +00:00
Nicholas Marriott
e63567d51c Support "alternate screen" mode (terminfo smcup/rmcup) typically used by full
screen interactive programs to preserve the screen contents. When activated, it
saves a copy of the visible grid and disables scrolling into and resizing out
of the history; when deactivated the visible data is restored and the history
reenabled.
2009-07-14 06:40:33 +00:00
Nicholas Marriott
359285928b Support "alternate screen" mode (terminfo smcup/rmcup) typically used by full
screen interactive programs to preserve the screen contents. When activated, it
saves a copy of the visible grid and disables scrolling into and resizing out
of the history; when deactivated the visible data is restored and the history
reenabled.
2009-07-13 10:43:52 +00:00
Nicholas Marriott
8be8016a76 When the terminal size is reduced horizontally, don't truncate lines to the new
width, so that if the same lines are later increased in size the content
reappears.
2009-07-12 17:03:11 +00:00
Nicholas Marriott
58361eb965 When the terminal size is reduced horizontally, don't truncate lines to the new
width, so that if the same lines are later increased in size the content
reappears.
2009-07-09 22:48:20 +00:00
Nicholas Marriott
2ddcb51df3 Fix $Id$. 2009-07-08 18:03:03 +00:00
Nicholas Marriott
9875be3327 When reinitialising the screen, do not omit to clear the last line. 2009-07-08 18:02:31 +00:00
Nicholas Marriott
8c497ecac0 When reinitialising the screen, do not omit to clear the last line. 2009-07-08 05:56:11 +00:00
Nicholas Marriott
32312e0252 vis compat stuff. 2009-06-25 20:27:32 +00:00
Nicholas Marriott
a5830b9603 Restore $Id$ and add script to do so. 2009-06-25 16:21:32 +00:00
Nicholas Marriott
3ec8efc803 Fix a type mismatch warning in assignment. 2009-06-25 16:04:43 +00:00
Nicholas Marriott
e6e1b45fa1 Change to match xterm's resizing behaviour, including pushing lines into the
history from the top when reducing vertical size and pulling them again when
increasing size.
2009-06-25 16:02:10 +00:00
Nicholas Marriott
1b245388b5 Proper support for tab stops (\033H etc), using a bitstring(3). Makes another
vttest test happy.
2009-06-25 15:54:38 +00:00
Nicholas Marriott
7597cb6834 Pass window titles through vis(1). <0x20 is dropped anyway by the input state
machine but top-bit-set nonprintables could cause trouble, and they are neater
like this anyway.
2009-06-25 15:49:27 +00:00
Nicholas Marriott
3db2433448 Fix a type mismatch warning in assignment. 2009-06-24 22:51:47 +00:00
Nicholas Marriott
f4b8f00255 Change to match xterm's resizing behaviour, including pushing lines into the
history from the top when reducing vertical size and pulling them again when
increasing size.

ok todd sthen
2009-06-24 19:12:44 +00:00
Nicholas Marriott
d42fb43f4f Proper support for tab stops (\033H etc), using a bitstring(3). Makes another
vttest test happy.
2009-06-04 18:48:24 +00:00
Nicholas Marriott
2faec76afa Pass window titles through vis(1). <0x20 is dropped anyway by the input state
machine but top-bit-set nonprintables could cause trouble, and they are neater
like this anyway.

Suggested by deraadt a few days ago.
2009-06-03 19:33:04 +00:00
Nicholas Marriott
35876eaab9 Import tmux, a terminal multiplexor allowing (among other things) a single
terminal to be switched between several different windows and programs
displayed on one terminal be detached from one terminal and moved to another.

ok deraadt pirofti
2009-06-01 22:58:49 +00:00
Nicholas Marriott
143aa718e5 Space trimmage mega-diff. 2009-05-04 17:58:27 +00:00
Nicholas Marriott
cf7b384c43 Better UTF-8 support, including combined characters. Unicode data is now stored
as UTF-8 in a separate array, the code does a lookup into this every time it
gets to a UTF-8 cell. Zero width characters are just appended onto the UTF-8
data for the previous cell. This also means that almost no bytes extra are
wasted non-Unicode data (yay).

Still some oddities, such as copy mode skips over wide characters in a strange
way, and the code could do with some tidying.
2009-03-28 20:17:29 +00:00
Nicholas Marriott
6c0728fe07 Step 2 of the Grand Plan To Make UTF-8 Better.
Split grid into two arrays, one containing grid attributes/flags/colours (keeps
the name grid_cell for now) and a separate with the character data (called
text). The text is stored as a u_short but is treated as a uint64_t elsewhere;
eventually the grid will have two arrays.

I'm not happy with the naming so that might change.

Still need to decide where to go from here. I'm not sure whether to combine
the peek/set functions together, and also whether to continue to treat the
text as a uint64_t (and convert to/from Unicode) or make it a char array
(of size one when UTF-8 disabled, eight when enabled) and keep everything
as UTF-8.

Also since UTF-8 will eventually become an attribute of the grid itself it
might be nice to move all the padding crap into grid.c.
2009-03-28 16:30:05 +00:00
Nicholas Marriott
989d67ccd7 struct grid_data -> struct grid. Stage 1 of the Grand Plan To Make UTF-8 Better. 2009-03-28 15:43:41 +00:00
Nicholas Marriott
a1b43faa43 Trim spaces. 2009-01-10 01:51:22 +00:00
Nicholas Marriott
7a82e86827 Make window options work the same was as session options, add mode-fg/mode-bg options, force -g for global on set/show/setw/showw/ 2008-12-08 16:19:51 +00:00
Nicholas Marriott
23e7da1ccb Clear correct range. 2008-10-09 05:31:04 +00:00
Nicholas Marriott
c2a5ffa6a4 Shut gcc up. 2008-09-29 16:59:47 +00:00
Nicholas Marriott
9d6827ebb2 UINT_MAX. 2008-09-29 16:58:02 +00:00
Nicholas Marriott
62457bce0b Trim. 2008-09-26 06:45:28 +00:00
Nicholas Marriott
efe557313a Internal screen data rewrite for better 256 colour/UTF-8 support. 2008-09-25 20:08:57 +00:00
Nicholas Marriott
f07cedf048 Rename some functions. 2008-09-10 19:15:06 +00:00
Nicholas Marriott
ded348064a Split colour functions from screen. 2008-09-10 18:59:29 +00:00
Nicholas Marriott
19a2c87f04 Initial UTF-8 support. 2008-09-09 22:16:37 +00:00
Nicholas Marriott
6674197e85 Fix bold/non-bold mismatch in 256 colour mode by adding an extra 8 bits (ick) onto the attributes and using two of them to mark the fg and bg as 256 colours when necessary. If only it was 255 colours we would have one value for default and wouln't need this :-/. 2008-09-08 22:03:56 +00:00
Nicholas Marriott
4235ddb4e8 Initial 256 colour support, lightly tested. 2008-09-08 17:40:51 +00:00
Nicholas Marriott
3337dfcae5 Support keypad mode, and get rid of SCREEN_DEF*. Meant to commit these separately but forgot :-/. 2008-07-24 21:42:40 +00:00
Nicholas Marriott
815b217482 These flags are off by default. 2008-07-24 07:01:57 +00:00
Nicholas Marriott
ee8a9d2458 Handle kcursor+kkeypad (switch to OA from [A). 2008-07-24 00:03:15 +00:00
Nicholas Marriott
d90d646ca8 Zombie windows, requested by Will Maier. 2008-06-29 07:04:31 +00:00
Nicholas Marriott
99df48d70f Trimify. 2008-06-18 22:21:51 +00:00
Nicholas Marriott
62d7ad2690 Clear blank area properly on redraw, and add a marker line below it. 2008-06-14 12:05:06 +00:00
Nicholas Marriott
9e6090a7a2 Per-session configuration options. 2008-06-03 21:42:37 +00:00
Nicholas Marriott
205b78ec58 Some key tweaks, fix status bar to not rely on attr. 2008-01-03 21:32:11 +00:00
Nicholas Marriott
e215e177df Filling with the right attr should be done in screen-display.c. 2007-12-06 22:13:14 +00:00
Nicholas Marriott
21d10e6894 Use the current attr/colours for filling in new areas, this fixes the echo \\033[35\;46m\\033[2J bug. 2007-12-06 21:57:57 +00:00
Nicholas Marriott
103748d6ad Major reorganisation of screen handling. 2007-12-06 09:46:23 +00:00
Nicholas Marriott
8419e99789 The tty code already stores attributes and doesn't modify them if unaltered, so the screen drawing code doesn't need to do so too. This probably also fixes bugs when switching screens where the actual tty attributes may not have been what the draw code (erroneously) expected. 2007-12-02 18:23:10 +00:00
Nicholas Marriott
3962c5f706 Change window name on \ek...\e\. 2007-11-30 11:08:35 +00:00
Nicholas Marriott
77386db04b Turn mouse on/off as appropriate. 2007-11-28 08:20:41 +00:00
Nicholas Marriott
c6384a765b Flush data on tty open. Also reset colour before clearing line/screen. 2007-11-27 21:07:38 +00:00
Nicholas Marriott
80e30f693c Minor tweaks/missed bits. 2007-11-27 19:32:15 +00:00
Nicholas Marriott
76c8a590db Big internal reorganisation to move tty control into parent. 2007-11-27 19:23:34 +00:00
Nicholas Marriott
14610569c8 This is better than disabling it. 2007-11-26 22:06:11 +00:00
Nicholas Marriott
f903cc9a56 Rv EOL optimisation, it screws up selection. 2007-11-26 20:45:13 +00:00
Nicholas Marriott
89db56fb09 Disable this optimisation since cursor can be updated by stuff outside. 2007-11-25 13:03:01 +00:00
Nicholas Marriott
9a3dde0f53 Oops, use correct y. 2007-11-25 11:13:46 +00:00
Nicholas Marriott
87b418b13e Redo output logging in local.c. Optimise line drawing. 2007-11-25 10:56:22 +00:00
Nicholas Marriott
5ad9b31ac5 Scroll region reset homes the cursor, so start at 0,0 when drawing. Also don't set region after DECRC. 2007-11-24 19:29:56 +00:00
Nicholas Marriott
b2d78b67d8 Use screen_draw_* to write message, avoids leaving attribute changes around. 2007-11-24 17:58:45 +00:00
Nicholas Marriott
4cd1f86359 Only show history size. 2007-11-23 13:02:45 +00:00
Nicholas Marriott
9c584432d0 history-limit option. 2007-11-23 12:48:20 +00:00
Nicholas Marriott
26c8303733 Tidier code by moving mess into functions. 2007-11-22 19:40:17 +00:00
Nicholas Marriott
7b4556946d Make C-space toggle. Fix sel on same line. 2007-11-22 19:26:20 +00:00
Nicholas Marriott
7ab0b466fe Text selection with C-space. 2007-11-22 19:17:01 +00:00
Nicholas Marriott
18d72e6928 Partial copy mode. Currently does the same as scroll mode but using a cursor. Also fix bug where resizing would leave crap lying around. 2007-11-22 18:09:43 +00:00
Nicholas Marriott
df7be0ddab Split SCREEN_BACKGROUND flag into BACKGROUND/NOCURSOR in preparation for copy mode. 2007-11-22 09:11:20 +00:00
Nicholas Marriott
c64cf68244 Cut memory consumption by only allocating lines when there is actually data on them, and only as much as the right-most data. Everything else is filled in at runtime. 2007-11-21 22:20:44 +00:00
Nicholas Marriott
1e5cb8d2e4 Free entire screen when destroyed. 2007-11-21 21:28:58 +00:00
Nicholas Marriott
d0984b890b Sort out cursors with a new flag - BACKGROUND - for window modes. Free text on more exit. 2007-11-21 19:53:57 +00:00
Nicholas Marriott
24c39950ff Redo screen.c functions to make them readable and more flexible. Make scroll mode only redraw waht it needs. 2007-11-21 18:24:49 +00:00
Nicholas Marriott
d5edaf988e Horizontal history/scrolling. 2007-11-21 15:35:53 +00:00
Nicholas Marriott
ef18b7d637 Move from the right place. 2007-11-21 14:55:31 +00:00
Nicholas Marriott
08a0c5e661 Use screen_* versions to avoid range checks (s->dy may be wrong), fix miscalculated free. 2007-11-21 14:30:15 +00:00
Nicholas Marriott
9a6e47cfa8 Initial history support. 2007-11-21 13:11:41 +00:00
Nicholas Marriott
9b9ceac657 Damnit, wrong variable name.. 2007-11-20 21:45:53 +00:00
Nicholas Marriott
f53b917367 Oops, mustn't forget this. 2007-11-20 21:45:26 +00:00
Nicholas Marriott
ceab127fac Mass screen.c rename/tidy. Add a actual size (ysize) as distinct from display size (now dx,dy). Move functions which work on the displayed area into screen-display.c and tidy. Use macros consistently when accessing screen data (may want to move everything about again later!). This the first step on the road to scrollback. 2007-11-20 21:42:29 +00:00
Nicholas Marriott
0be6a3041f Style: ry_* -> r* 2007-11-20 18:46:32 +00:00
Nicholas Marriott
514d6fa1ec Accept colours as strings. 2007-10-12 13:51:44 +00:00
Nicholas Marriott
1e252b9e9a Wrap lines properly. 2007-10-05 17:51:56 +00:00
Nicholas Marriott
f2b18ac417 Don't resize if sx AND sy haven't changed. Also tweak some logging, and reset attrs after clear. 2007-10-04 19:22:26 +00:00
Nicholas Marriott
1f9a8e70d9 Incomplete resize support. 2007-10-04 19:03:52 +00:00
Nicholas Marriott
872696f781 Pass attributes around as flags rather than as a list of escape codes. 2007-10-01 14:18:42 +00:00
Nicholas Marriott
9d563c340b Destroy screens properly. 2007-10-01 14:15:48 +00:00
Nicholas Marriott
34eb154617 Grr missed one. 2007-09-29 18:57:15 +00:00
Nicholas Marriott
e30a3478f5 Whoooops. lower not upper. 2007-09-29 18:51:26 +00:00
Nicholas Marriott
32f177038f Dl/Il should follow scrolling region. 2007-09-29 18:48:04 +00:00
Nicholas Marriott
3d6c324405 Spc fix. 2007-09-29 18:07:18 +00:00
Nicholas Marriott
a777c060dc Nuke CLEAR_SCREEN/ENDOFSCREEN and assert scroll region when drawing. These will be reqd for status line(s). 2007-09-29 10:57:39 +00:00
Nicholas Marriott
aafee17de6 New input parser via state machine. 2007-09-28 22:47:22 +00:00
Nicholas Marriott
1fefbb7a85 Pass through backspace for now. 2007-09-21 19:24:37 +00:00
Nicholas Marriott
24b978adb7 Don't resize unless size changed. 2007-09-21 18:00:58 +00:00
Nicholas Marriott
48ab20871b Tweak comment; use sizeof. 2007-08-28 09:26:07 +00:00
Nicholas Marriott
fc63750d30 Scrolling region. 2007-08-28 09:19:50 +00:00
Nicholas Marriott
565ba002e9 Don't scroll screen until trying to write beyond limits. 2007-08-27 11:21:05 +00:00
Nicholas Marriott
b9de906ad9 We use screen now, not ansi. 2007-08-27 10:08:44 +00:00
Nicholas Marriott
73d7b70479 Update to be more readable and hopefully lose memory problems. 2007-08-27 09:53:38 +00:00
Nicholas Marriott
98642e907a +. 2007-08-27 08:15:39 +00:00