Commit Graph

187 Commits (7fe8edc3962d5c30bf87677ecb2cf8633404f63c)

Author SHA1 Message Date
nicm 577c0e3e5a Use __unused rather than rolling our own. 2015-11-18 14:27:44 +00:00
nicm c5689a5a40 Long overdue change to the way we store cells in the grid: now, instead
of storing a full grid_cell with UTF-8 data and everything, store a new
type grid_cell_entry. This can either be the cell itself (for ASCII
cells), or an offset into an extended array (per line) for UTF-8
data.

This avoid a large (8 byte) overhead on non-UTF-8 cells (by far the
majority for most users) without the complexity of the shadow array we
had before. Grid memory without any UTF-8 is about half.

The disadvantage that cells can no longer be modified in place and need
to be copied out of the grid and back but it turned out to be lot less
complicated than I expected.
2015-11-13 08:09:28 +00:00
nicm abb4e9e2fa The output log is only useful once and it means creating a file, so open
it once at startup instead of in every call to tty_open.
2015-10-31 13:12:03 +00:00
nicm 44657bf932 Move struct options into options.c. 2015-10-27 15:58:42 +00:00
nicm 26a55ddcf9 Remove some unnecessary checks before free(). 2015-10-23 16:30:15 +00:00
nicm 63a3fd3c0f Use tty_term_flag not _has for XT, and make -2 force direct use of
256-colour escape sequences (so setaf/setab can be bypassed if needed).
2015-10-23 15:52:54 +00:00
nicm 03d7dba5d8 If the terminal has colors=256, only try to use setaf/setab if they
exist, reported by Filipe Brandenburger.
2015-09-25 23:30:12 +00:00
nicm 38e3baab2a A one line helper function is a little silly. 2015-09-02 17:43:25 +00:00
nicm 8121127606 We no longer need the terminal service class, so don't bother asking for it. 2015-09-02 17:37:54 +00:00
nicm e45d624df2 Fix line endings. 2015-07-13 15:51:31 +00:00
nicm c7374c31c4 Initialize cwd fd to -1 so that we don't close fd 0 if the client is
destroyed before it is changed. Also allow ttyname() to fail. Fixes
problems when running out of file descriptors reported by Bruno Sutic.
2015-07-13 15:49:31 +00:00
nicm 2c53b23d59 In terminfo, sometimes cvvis implies cnorm and sometimes it doesn't, so
don't assume it does. Fixes missing cursor with emacs-in-tmux-in-tmux.
2015-05-19 08:48:37 +00:00
nicm 3f4ee98162 To replace c0-*, add a high watermark to the pty event, and also backoff
when the any of the ttys the pane is going to write to has buffered
enough data.
2015-05-12 22:40:38 +00:00
nicm 33a585c47f Turn cursor off during redraw, pointed out by George Nachman. 2015-05-06 07:52:06 +00:00
nicm 7382ba82c5 If default-terminal is set to "screen" or "screen-*", emulate screen's
historical (incorrect) behaviour for SGR 3 and send smso
(standout). Previously, we would send sitm (italics) if the terminal
outside had it and smso otherwise. This was acceptably until recently
because xterm's terminfo entry lacked sitm, so most users got smso.

People who want italics should set default-terminal to the forthcoming
"tmux" entry (and be prepared to deal with it being missing on older
hosts).

As a side-effect this changes default-terminal to be a server rather
than a session option.

suggested by and ok naddy
2015-04-29 15:59:08 +00:00
nicm d23af6cca0 Explicitly cancel mouse "button" mode, this happens implicitly with some
one of the other things we send with xterm, but not with urxvt. Reported
by sthen@.
2015-04-25 15:57:48 +00:00
nicm aeedb464a6 Convert clients list into a TAILQ. 2015-04-24 23:17:11 +00:00
nicm bf635e7741 Rewrite of tmux mouse support which was a mess. Instead of having
options for "mouse-this" and "mouse-that", mouse events may be bound as
keys and there is one option "mouse" that turns on mouse support
entirely (set -g mouse on).

See the new MOUSE SUPPORT section of the man page for description of the
key names and new flags (-t= to specify the pane or window under mouse
as a target, and send-keys -M to pass through a mouse event).

The default builtin bindings for the mouse are:

    bind -n   MouseDown1Pane select-pane -t=; send-keys -M
    bind -n MouseDown1Status select-window -t=
    bind -n   MouseDrag1Pane copy-mode -M
    bind -n MouseDrag1Border resize-pane -M

To get the effect of turning mode-mouse off, do:

    unbind -n MouseDrag1Pane
    unbind -temacs-copy MouseDrag1Pane

The old mouse options are now gone, set-option -q may be used to
suppress warnings if mixing configuration files.
2015-04-19 21:34:21 +00:00
nicm ee123c2489 Support setting the default window and pane background colours (window
and active pane via window-style and window-active-style options, an
individual pane by a new select-pane -P flag). From J Raynor.
2015-04-19 21:05:27 +00:00
nicm 4a7587931c Fix some issues in bright colour handling. Bold background doesn't exist
so there is no reason for tty_check_bg to mess with the BRIGHT flag at
all, ever. Also use aixterm colours for 256-to-16 translation if the
terminal supports them. And there is no reason for tty_colours_bg to
worry about whether the terminal supports them - tty_check_bg has
already taken care of it.
2015-04-15 22:34:46 +00:00
nicm eec27f9257 Use tty_term_flag not _has for flags, also fix a typo (position not
permission).
2015-04-15 22:10:13 +00:00
nicm 90bf7026f6 Reset bracket paste mode on detach. 2015-02-05 11:46:57 +00:00
nicm 144025e3e6 Focus off needs to be sent with tty_raw, reported by Geoff Nixon. 2015-01-30 12:33:03 +00:00
nicm 16bdd970dc Support blinking cursor mode, both the xterm CSI ?12 h/l and (the
backwards) screen CSI 34 h/l. From Guanpeng Xu.
2015-01-20 08:18:04 +00:00
nicm 1ac96200a7 Remove support for the continuous reporting "any" mouse mode which never
really worked properly and is rarely used.
2014-08-09 07:33:37 +00:00
jsg 40cb4cb086 specifying ECHOCTL once is enough
ok nicm@
2014-04-25 12:45:16 +00:00
nicm a5d4b7f3d9 Some more long lines. 2014-04-17 14:45:49 +00:00
nicm c3b2e5eed3 Wrap some long lines. 2014-04-17 12:57:28 +00:00
nicm f1828921df Change terminal-overrides to a server option (now that we have them), it
doesn't make much sense as a session option.
2014-02-23 00:53:06 +00:00
nicm f2e54e1e2f If the terminfo entry has colors#256, assume that setaf and setab work
and use them for the 256 colour set. If the terminfo entry doesn't have
colors#256 and the user gives -2 to the client, use a \033[38;5;Xm
sequence as before. Should allow fbterm to work with it's weird setaf
and setab.
2014-02-14 14:37:08 +00:00
nicm 945339b443 Allow replacing each of the many sets of separate foo-{fg,bg,attr}
options with a single foo-style option. For example:

    set -g status-fg yellow
    set -g status-bg red
    set -g status-attr blink

Becomes:

    set -g status-style fg=yellow,bg=red,blink

The -a flag to set can be used to add to rather than replace a style. So:

    set -g status-bg red

Becomes:

    set -ag status-style bg=red

Currently this is fully backwards compatible (all *-{fg,bg,attr} options
remain) but the plan is to deprecate them over time.

From Tiago Cunha.
2014-01-28 23:07:09 +00:00
nicm f52eac6225 Don't turn on modifyOtherKeys by default, it is annoying if tmux is
killed and it's left on and we can't turn it on and off like we do for
attributes. It's not hard to enable in .Xresources or .Xdefaults anyway.
2013-10-20 09:37:50 +00:00
Nicholas Marriott 3977dba761 Focus events can cause trouble if left on and they can't be turned off
during idle periods (like the other states are) because we'd miss
events. So add a server option to control them. Defaults to off.
2013-06-23 13:10:46 +00:00
Stuart Henderson d6debc21c7 revert r1.156 "Add support for focus notifications when tmux pane changes"
beck@ found annoying beeps if a machine was shutdown while tmux is running
and you then focus in/out of an xterm; kettenis tracked it down to 1.156.
2013-06-11 19:18:02 +00:00
Nicholas Marriott 13441e8cb8 The actual terminfo entries we ended up with for cursor changes are Cs,
Ce, Ss and Se (not Cc, Ce, Cs, Csr). So use and document these instead
of the ones we were using earlier.
2013-06-02 07:52:15 +00:00
Nicholas Marriott cbee283c26 Send an SGR0 after turning on modifyOtherKeys to fix Terminal.app which
treats \033[>4;1m and \033[4;1m (bold+underline). Reported & tested by
otto@.
2013-04-11 07:27:27 +00:00
Nicholas Marriott 982354765b Remove tmux's (already minimal) 88 colour support. Such terminals are
few and unnecessary.
2013-03-27 11:17:12 +00:00
Nicholas Marriott a60687f9ba Handle focus events from the terminal, from Aaron Jensen. 2013-03-24 09:28:59 +00:00
Nicholas Marriott 79f5fe6f5b Use tty_raw on stop, not tty_puts. 2013-03-22 10:40:22 +00:00
Nicholas Marriott 22a2949bd2 Correctly handle UTF8 mouse option being toggled, from Egmont Koblinger. 2013-03-22 10:34:46 +00:00
Nicholas Marriott 3d24c75d0f Include the \033 in the key tree and adjust key matching for this change. 2013-03-21 18:44:47 +00:00
Nicholas Marriott 3665be7c44 Tidy by splitting default key tables into two. 2013-03-21 16:50:22 +00:00
Nicholas Marriott fdbfc7e349 Rather than having two grids for each pane, one for ASCII and one for
UTF-8, collapse the two together. Simplifies the code at the expense of
more memory (which can probably be reduced again later).
2013-01-18 02:16:21 +00:00
Nicholas Marriott 44f8e1caff Implement ECH (erase character, CSI X). Reported by Christian Neukirchen. 2013-01-15 23:18:55 +00:00
Nicholas Marriott 260419f48e Put helper function back, will be needed in a bit. 2012-11-22 14:41:11 +00:00
Nicholas Marriott 44dccf7ea2 Do not test client flags against TTY_FREEZE bit, reported by Tom Ryder. 2012-09-29 06:57:56 +00:00
Nicholas Marriott b433886840 We can't tell what the terminal has done with a DCS string, so reset the
cursor and attributes afterwards.
2012-09-05 09:59:41 +00:00
Nicholas Marriott 6307d63715 Remove xterm CRA support - support is patchy and it will be done better
using margins.
2012-09-03 15:47:40 +00:00
Nicholas Marriott f61fc576d9 Tidy up tty_write, from Sean Estabrooks. 2012-08-14 08:58:25 +00:00
Nicholas Marriott df912e3540 xfree is not particularly helpful, remove it. From Thomas Adam. 2012-07-10 11:53:01 +00:00