Commit Graph

175 Commits

Author SHA1 Message Date
Tiago Cunha
e2a18894b3 Sync OpenBSD patchset 246:
Have the client pass its stdin fd to the server when identifying itself and
have the server use that rather than reopening the tty. If the fd isn't given,
use the old behaviour (so no need for a version change).

This allows tmux to be used as the shell, so also change so that when working
out the command to execute if default-command is empty (the default), tmux will
try not execute itself.
2009-08-14 21:23:20 +00:00
Tiago Cunha
0714e41148 Sync OpenBSD patchset 245:
Add a TTY_OPENED flag and tidy a little.
2009-08-14 21:20:01 +00:00
Tiago Cunha
5cc971facd Sync OpenBSD patchset 244:
Drop the no_stop argument to tty_close and tty_free in favour of a flag in the
tty struct.
2009-08-14 21:17:54 +00:00
Tiago Cunha
37b0bcd7c1 Sync OpenBSD patchset 226:
Change the way the grid is stored, previously it was:

- a two-dimensional array of cells;
- a two-dimensional array of utf8 data;
- an array of line lengths.

Now it is a single array of a new struct grid_line each of which represents a
line and contains the length and an array of cells and an array of utf8 data.

This will make it easier to add additional per-line members, such as flags.
2009-08-09 17:28:24 +00:00
Tiago Cunha
88b83be07b Sync OpenBSD patchset 220:
If colours are not supported by the terminal, try to emulate a coloured
background by setting or clearing the reverse attribute.

This makes a few applications which don't use the reverse attribute themselves
a little happier, and allows the status, message and mode options to have
default attributes and fg/bg options that work as expected when set as reverse.
2009-08-09 16:50:57 +00:00
Tiago Cunha
15f6a41a75 Sync OpenBSD patchset 211:
Add a terminal-overrides session option allowing individual terminfo(5) entries
to be overridden. The 88col/256col checks are now moved into the default
setting and out of the code.

Also remove a couple of old workarounds for xterm and rxvt which are no longer
necessary (tmux can emulate them if missing).
2009-08-09 15:26:24 +00:00
Tiago Cunha
7562781c9d Sync OpenBSD patchset 186:
Draw UTF-8 characters under the selection correctly.
2009-07-28 22:41:38 +00:00
Tiago Cunha
c84145751a Sync OpenBSD patchset 164:
tty_write is relatively short and the only function left in tty-write.c so
move it into tty.c.
2009-07-23 12:57:45 +00:00
Tiago Cunha
b72f9bea43 Sync OpenBSD patchset 162:
More tty code tidying: move the saved cursor/region position (from before the
screen was updated) out of struct screen and into struct tty_ctx.
2009-07-23 12:48:18 +00:00
Tiago Cunha
9c6fa90857 Sync OpenBSD patchset 160:
enum tty_cmd is only used as an index into the array of command function
pointers, so remove it and use the function pointers directly to represent
themselves.
2009-07-23 12:38:01 +00:00
Tiago Cunha
b6afa30c39 Sync OpenBSD patchset 159:
There are relatively few arguments to tty_cmd_* functions now, so tidy them up
by using a struct rather than hiding everything with varargs.
2009-07-22 18:08:56 +00:00
Tiago Cunha
75a44d856e Sync OpenBSD patchset 158:
tty_cmd_raw is only used once, for raw UTF-8 output, so rename it to
tty_cmd_utf8character and eliminate the size argument.
2009-07-22 17:58:42 +00:00
Nicholas Marriott
fd0971542f Don't send initialisation strings is1/2/3 (barely anything else does) and move
smcup to the first and rmcup to the last sequences output to the terminal. This
allows tmux to use the alternate screen (smcup/rmcup) when available.
2009-07-12 17:08:37 +00:00
Nicholas Marriott
2ddcb51df3 Fix $Id$. 2009-07-08 18:03:03 +00:00
Nicholas Marriott
1825609d8d Handle empty or unset TERM correctly; also fix a fatal() message while here. 2009-07-08 17:58:32 +00:00
Nicholas Marriott
9f0653386b $Id$. 2009-07-01 23:06:32 +00:00
Nicholas Marriott
eed4f7600d Fix $Id$. 2009-06-29 22:04:51 +00:00
Nicholas Marriott
edc2e7da98 Copy the 256-colour flag into the tty saved cell as well as the actual colour,
otherwise colour 8 isn't reset.
2009-06-29 22:03:09 +00:00
Nicholas Marriott
bb459beb03 Whitespace and more syncing. 2009-06-25 16:34:50 +00:00
Nicholas Marriott
a5830b9603 Restore $Id$ and add script to do so. 2009-06-25 16:21:32 +00:00
Nicholas Marriott
582660bdf3 Miscellaneous unused functions, including one which was basically a
duplicate. Found by lint.
2009-06-25 16:09:11 +00:00
Nicholas Marriott
947fabc751 Unused variables. Found by lint, no binary change. 2009-06-25 16:05:39 +00:00
Nicholas Marriott
942ea4267d Trying to predict the cursor position for UTF-8 output in the same way as for
normal eight-bit output is wrong, separate it into a different function. Fixes
spacing when mixing UTF-8 with some escape sequences, notably the way w3m does
it.
2009-06-25 16:01:26 +00:00
Nicholas Marriott
93631b3ca7 Implement the DEC alignment test. With the last change this is enough for the
first cursor test in vttest (in ports) to pass; it still shops a few more
problems though.
2009-06-25 15:51:54 +00:00
Nicholas Marriott
49477de55c Fix some miscalculations when clearing to start of screen: the number of lines
to the cursor is cy not cy - 1, and the current cursor cell should be included.
2009-06-25 15:50:48 +00:00
Nicholas Marriott
0fdd47660a UTF-8 detection is broken on sparc64; disable until I get time to test it further. 2009-06-24 17:31:03 +00:00
Nicholas Marriott
6db7bd6791 Try to guess if the window is UTF-8 by outputting a three-byte UTF-8 wide character and seeing how much the cursor moves. Currently tries to figure out if this works by some stupid checks on the terminal, these need to be rethought. Also might be better using a width 1 character rather than width 2. 2009-05-19 16:08:35 +00:00
Nicholas Marriott
dd2f8d7d74 Don't force wrapping with \n when asked, let the cursor code figure it out. Should fix terminals which use this to detect line breaks. 2009-05-14 16:21:55 +00:00
Nicholas Marriott
143aa718e5 Space trimmage mega-diff. 2009-05-04 17:58:27 +00:00
Nicholas Marriott
54a5f82588 Region can reset cursor to 0,0 - bad if there is an offset. So sort out region before cursor. 2009-05-04 17:52:14 +00:00
Nicholas Marriott
fb543c7707 Use ACS for line drawing characters. 2009-05-04 13:20:02 +00:00
Nicholas Marriott
f0a716f484 Use a u_char so top-bit-set update the cursor as well. 2009-04-29 17:50:52 +00:00
Nicholas Marriott
7c5f1af26f Ignore del too. 2009-04-29 17:06:45 +00:00
Nicholas Marriott
dbf52facd2 Change scroll/pane redraws to only redraw the single pane affected rather than
the entire window.
2009-04-02 21:08:15 +00:00
Nicholas Marriott
84cde92c8f If redrawing the region would mean redrawing > half the pane, just schedule to
redraw the entire window. Also add a flag to skip updating the window any
further if it is scheduled to be redrawn. This has the effect of batching
multiple redraws together.
2009-04-02 20:30:23 +00:00
Nicholas Marriott
b6450b167b Basic horizontal splitting and layout management. Still some redraw and other
issues - particularly, don't mix with manual pane resizing and be careful when
viewing from multiple clients; generally cycling the layout a few times will
fix most problems. Getting this in for testing while I think about how to deal
with manual mode.

Split window as normal and cycle the layouts with C-b space. Some of the
layouts will work better when swap-pane comes along.
2009-04-01 18:21:42 +00:00
Nicholas Marriott
907bec675a FD_CLOEXEC more fds. Still one I can't find... 2009-03-31 22:20:42 +00:00
Nicholas Marriott
6c27f1c335 Draw vertical line on the right when window size is limited. 2009-03-31 18:39:45 +00:00
Nicholas Marriott
8a160f2d58 - Unbreak selection colouring.
- Get UTF-8 check the right way round...
2009-03-30 20:14:50 +00:00
Nicholas Marriott
23fef99009 8 -> UTF8_SIZE. 2009-03-29 11:18:28 +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
587badecdb Clear using ED when redrawing the screen. I foolishly assumed using spaces
would be equivalent and terminals would pick up on this, but apparently
not. This fixes copy and paste in xterm/rxvt.
2009-03-28 10:15:01 +00:00
Nicholas Marriott
f6001f9ffc Whoops. Didn't mean to commit this yet. 2009-03-27 16:44:51 +00:00
Nicholas Marriott
b97264bb70 Update TODO. 2009-03-27 16:44:00 +00:00
Nicholas Marriott
e6d35b6aa4 Support for 88 colour terminals. 2009-03-07 10:29:06 +00:00
Nicholas Marriott
546a9d5257 Don't die on any error from fd. 2009-02-17 18:53:10 +00:00
Nicholas Marriott
b03783efad strdup() not necessary here. 2009-02-16 19:01:16 +00:00
Nicholas Marriott
b2282f243b Use the right row when calling RI. 2009-02-13 19:45:16 +00:00
Nicholas Marriott
fdafe63004 Reset region before using CUD etc. 2009-02-13 17:09:55 +00:00
Nicholas Marriott
eb7d229bac Code tidying on my way to find tmux-in-tmux bug. 2009-02-13 16:53:14 +00:00
Nicholas Marriott
9d2697f78b Whoops. Build testing is a good idea... 2009-02-12 00:19:31 +00:00
Nicholas Marriott
e6ed1cc44f Never draw last character: stops stray scrolling sometimes should status line be disabled. 2009-02-12 00:18:05 +00:00
Nicholas Marriott
5a04f74d81 Only use RI at the top of the screen. 2009-02-12 00:03:58 +00:00
Nicholas Marriott
959eeef505 FreeBSD's console wraps lines at $COLUMNS - 1 rather than $COLUMNS (the cursor can never be beyond $COLUMNS - 1) and does not appear to support changing this behaviour, or any of the obvious possibilities (turning off right margin wrapping, insert mode). This is irritating, most notably because it impossible to write to the very bottom-right of the screen without scrolling. To work around this, if built on FreeBSD and run with a "cons" $TERM, the bottom-right cell on the screen is omitted. 2009-02-11 23:16:45 +00:00
Nicholas Marriott
d5eaf3a9f6 Emulate CSR with existing screen data on old/stupid terminals which don't support it. 2009-02-11 19:06:58 +00:00
Nicholas Marriott
6c76aaca92 Lose unnecessary cursor restores, fix a couple of placement bugs and remove unused CR. 2009-02-11 18:44:08 +00:00
Nicholas Marriott
514fe11727 We are going to need the updated screen data for emulating the scroll region,
which may involve changing the cursor position; however, the old (before
redraw) cursor position is necessary for writing to the tty. So, save it before
doing the redraw then update the internal screen then update the tty.

Not sure I like this solution but it does the job for now.
2009-02-11 17:04:39 +00:00
Nicholas Marriott
91c9d95279 Change tty_cmd_* to use a window_pane. 2009-02-11 07:02:34 +00:00
Nicholas Marriott
e444b0b92a Split most of tty_cmd_cell off to tty_cell. First step on making tty_cmd_* take
a window_pane for later use emulating scroll region.
2009-02-11 06:50:16 +00:00
Nicholas Marriott
c8e27271e2 Update cursor y on newline otherwise RI gets screwed up at y=0. 2009-02-07 00:05:23 +00:00
Nicholas Marriott
4428987e95 * Better support for at least the most common variant of mouse input: parse it and adjust for different panes. Also support mouse in window/session choice mode.
* Bring back the fancy window titles with session/window names: it is easy to work around problems with elinks (see FAQ).
2009-01-28 19:52:21 +00:00
Nicholas Marriott
c1726281c9 Handle cursor on/off better. 2009-01-27 21:39:15 +00:00
Nicholas Marriott
94471aab82 Use reverse rather than background which doesn't show up when terminal doesn't
support colours.
2009-01-19 19:01:11 +00:00
Nicholas Marriott
4cdc228353 Unbreak UTF-8. 2009-01-18 21:46:30 +00:00
Nicholas Marriott
7bc8be006e A couple of trivial optimisations. 2009-01-18 21:35:09 +00:00
Nicholas Marriott
8ea49712fd suspend-client command and suspend client when ^Z key binding is used. 2009-01-18 12:09:42 +00:00
Nicholas Marriott
162bacdcd9 Window splitting. Two vertical panes fixed 50% each. This is a huge diff, still a couple of bugs (notably heap corruption somewhere causing segfault on exit). 2009-01-11 23:31:46 +00:00
Nicholas Marriott
ee0a7cda88 Restore emulation of ich with insert mode. 2009-01-10 22:28:40 +00:00
Nicholas Marriott
a1b43faa43 Trim spaces. 2009-01-10 01:51:22 +00:00
Nicholas Marriott
3ed5aa3e72 Build array of codes, stop using ncurses global variables and push ncurses crap into tty-term.c. 2009-01-09 23:57:42 +00:00
Nicholas Marriott
75f043fedb Work around lack of dch. 2008-12-13 17:41:49 +00:00
Nicholas Marriott
f008d303e7 Kill warning. 2008-12-06 09:30:25 +00:00
Nicholas Marriott
8f163b8caa Support dfly, from joshe. 2008-11-27 18:55:47 +00:00
Nicholas Marriott
5ca710d9e3 Disable UTF-8 by default and add options to enable it. 2008-11-16 13:28:59 +00:00
Nicholas Marriott
46f5e42145 Keep stack of previous windows.
Check for op (orig_pair) for default colours.
2008-11-16 10:10:26 +00:00
Nicholas Marriott
4198a9c376 TAILQ -> SLIST. 2008-11-05 01:19:24 +00:00
Nicholas Marriott
08e615a03a Don't die if tcsetattr fails; fixes problems with cwm. 2008-10-27 20:13:37 +00:00
Nicholas Marriott
2aeb08a54b I don't like this... 2008-10-09 22:03:36 +00:00
Nicholas Marriott
0ba0fd389c Translate 256 colours to 16. 2008-10-09 22:00:33 +00:00
Nicholas Marriott
2a5d09f2f5 Don't scroll screen when redrawing it. 2008-09-26 07:23:21 +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
9edb4d4b85 Don't die on empty output strings, some terminfo entries have empty caps. 2008-09-23 17:54:35 +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
affc3c95c3 Get defaults the right way round. 2008-09-08 21:04:59 +00:00
Nicholas Marriott
4235ddb4e8 Initial 256 colour support, lightly tested. 2008-09-08 17:40:51 +00:00
Nicholas Marriott
97212771b5 Support keypad. Change cursor key output. 2008-07-23 23:44:50 +00:00
Nicholas Marriott
089f727f54 Rm UCLC LCUC which are unsupported on FBSD. 2008-07-02 16:18:24 +00:00
Nicholas Marriott
91f3165b2d IRIX fixes thanks to Elias Pipping. 2008-06-23 16:58:49 +00:00
Nicholas Marriott
46383e33f8 Don't be clever and translate default colour. 2008-06-22 16:54:08 +00:00
Nicholas Marriott
456ff329c3 Only set title if TERM looks vaguely okay. Also use newline for, er, newline rather than cursor_down. 2008-06-21 13:11:28 +00:00
Nicholas Marriott
91e5e9290d Whoops. Take out abort(). 2008-06-21 12:41:26 +00:00
Nicholas Marriott
a65238e98c Strip padding from terminfo strings. 2008-06-21 12:41:05 +00:00
Nicholas Marriott
17fde823a8 Freeze output when showing display line, fixes problems when no status line. 2008-06-20 06:36:01 +00:00
Nicholas Marriott
7cebf4768b Hide cursor with flag. 2008-06-19 23:07:11 +00:00
Nicholas Marriott
99df48d70f Trimify. 2008-06-18 22:21:51 +00:00
Nicholas Marriott
28aefe4162 Lose OFILL. 2008-06-18 22:18:08 +00:00
Nicholas Marriott
c2f40d9840 Better modes for Solaris. 2008-06-18 22:08:56 +00:00