Commit Graph

642 Commits (e0e9a54a325da2f5648fdb6f429f22a6c12a5fb3)

Author SHA1 Message Date
nicm 2e5c49a1fd Give each item on queue a name for better logging. 2016-10-18 08:46:43 +00:00
nicm fe106842c8 Use notifys for alerts too. 2016-10-16 22:18:04 +00:00
nicm 41e633acf5 Use the notify name string instead of going via an enum and change
existing hooks to use notifys instead.
2016-10-16 22:06:40 +00:00
nicm 3f35b5299f Provide a way for hooks to tag formats onto the commands they fire so
that the user can get at additional information - now used for the
"hook" format, more to come.
2016-10-16 19:36:37 +00:00
nicm 026ad08b56 Notifys can go via the command queue instead of using their own queue. 2016-10-16 19:15:02 +00:00
nicm b342bd0b46 Mass rename struct cmd_q to struct cmdq_item and related. 2016-10-16 19:04:05 +00:00
nicm ddc4512d2e Rewrite command queue handling. Each client still has a command queue,
but there is also now a global command queue. Instead of command queues
being dispatched on demand from wherever the command happens to be
added, they are now all dispatched from the top level server
loop. Command queues may now also include callbacks as well as commands,
and items may be inserted after the current command as well as at the end.

This all makes command queues significantly more predictable and easier
to use, and avoids the complex multiple nested command queues used by
source-file, if-shell and friends.

A mass rename of struct cmdq to a better name (cmdq_item probably) is
coming.
2016-10-16 17:55:14 +00:00
nicm e7990375cb Give window_create and window_create1 better names. 2016-10-15 09:27:52 +00:00
nicm 3f138dc40c Rename a function for consistency and some spacing nits. 2016-10-15 00:12:58 +00:00
nicm 63b2547a02 Fire hooks on the simple notifys (window-renamed and session-renamed),
the complicated ones get no hooks for now (more to come).
2016-10-15 00:09:30 +00:00
nicm 9b3ae84993 Drain notifys once at the end of the server loop instead of doing it
from the end of every command queue (which could be nested).
2016-10-15 00:01:01 +00:00
nicm 4289a1ebfa Trying to do hooks generically is way too complicated and unreliable and
confusing, particularly trying to automatically figure out what target
hooks should be using. So simplify it:

- drop before hooks entirely, they don't seem to be very useful;

- commands with special requirements now fire their own after hook (for
  example, if they change session or window, or if they have -t and -s
  and need to choose which one the hook uses as current target);

- commands with no special requirements can have the CMD_AFTERHOOK flag
  added and they will use the -t state.

At the moment new-session, new-window, split-window fire their own hook,
and display-message uses the flag. The remaining commands still need to
be looked at.
2016-10-13 22:48:51 +00:00
nicm 4179b42424 Add support for BCE (background colour erase). This makes various escape
sequences (notable EL and ED but also IL, DL, ICH, DCH) create blank
cells using the current background colour rather than the default
colour.

On modern systems BCE doesn't really have many benefits, but most other
terminals now support it, some (lazy) applications rely on it, and it is
not hard to include now that we have pane background colours anyway.

Mostly written by Sean Haugh.
2016-10-13 20:27:27 +00:00
nicm 4d9e6ea310 Some improvements and bug fixes for hooks:
- Prepare the state again before the "after" hooks are run, because the
  command may have killed or moved windows.

- Use the hooks list from the newly prepared target, not the old hooks
  list (only matters for new-session really).

- Correctly detect an invalid current state and ignore it in
  cmd_find_target ("killw; swapw").

- Change neww, new, killp, killw, splitw, swapp, swapw to update the
  current state (used if no explicit target is given) to something more
  useful after they have finished. For example, neww changes it to the
  newly created window.

Hooks are still relatively new and primitive so there are likely to be
more changes to come.

Parts based on bug reports from Uwe Werler and Iblis Lin.
2016-10-13 10:01:49 +00:00
nicm 40253048ca bind-key -c has gone, remove from man page, and unused table declarations. 2016-10-12 15:26:37 +00:00
nicm c484c5a2a1 Drop the edit mode key tables and just use fixed key bindings for the
command prompt.
2016-10-12 14:50:14 +00:00
nicm 4160df4ca4 Redraw selection in tty_draw_line, so it appears when redrawing whole
pane. Reported by Theo Buehler.
2016-10-12 13:24:07 +00:00
nicm 68bebe1fb7 The repeat prompt in both emacs and vi (and the old one in tmux) doesn't
support line editing and instead executes a command as soon as a
non-number key is pressed. Add a -N flag to command-prompt for the same
in copy mode. Reported by Theo Buehler.
2016-10-12 13:03:27 +00:00
nicm 5c49e1d0c1 Some other stuff that can be local to one file. 2016-10-11 13:45:47 +00:00
nicm e45401846f Add static in window-*.c and move some internal functions out of tmux.h. 2016-10-11 13:21:59 +00:00
nicm 85d7afaefc Support double and triple clicks (they are cumulative, so double is
fired then triple), and use for select-word and select-line in copy
mode. Inspired by a different solution from Omar Sandoval.
2016-10-11 09:30:36 +00:00
nicm 76d6d3641f Fundamental change to how copy mode key bindings work:
The vi-copy and emacs-copy mode key tables are gone, and instead copy
mode commands are bound in one of two normal key tables ("copy-mode" or
"copy-mode-vi"). Keys are bound to "send-keys -X copy-mode-command". So:

    bind -temacs-copy C-Up scroll-up
    bind -temacs-copy -R5 WheelUpPane scroll-up

Becomes:

    bind -Tcopy-mode C-Up send -X scroll-up
    bind -Tcopy-mode WheelUpPane send -N5 -X scroll-up

This allows the full command parser and command set to be used - for
example, we can use the normal command prompt for searching, jumping,
and so on instead of a custom one:

    bind -Tcopy-mode C-r command-prompt -p'search up' "send -X search-backward '%%'"

command-prompt also gets a -1 option to only require on key press, which
is needed for jumping.

The plan is to get rid of mode keys entirely, so more to come eventually.
2016-10-11 07:23:34 +00:00
nicm 8b804fb589 Support UTF-8 entry into the command prompt. 2016-10-11 07:11:40 +00:00
nicm 66b5477cc1 Do not allow the opposite pane to resize when dragging with the mouse
because it is not possible to keep the mouse on the border when the
minimum size is reached.
2016-10-10 17:28:30 +00:00
nicm 7d4b416fe6 Some more static. 2016-10-10 13:54:47 +00:00
nicm b8f2dd8237 Make the CLIENT_STATUS flag imply that pane status lines are redrawn if
they are enabled and break the actual screen generation code into a
separate function. Fixes problems reported by Romain Francoise.
2016-10-09 16:24:34 +00:00
nicm 4117a7ed19 Keep buffer creation time and add accessors for it and the order number. 2016-10-05 12:34:05 +00:00
nicm acacb718e5 Rate limit TIOCSWINSZ on a timer to avoid programs getting hammered with
SIGWINCH when the size changes rapidly. To help a problem reported by
Rui Pinheiro.
2016-09-28 08:30:44 +00:00
nicm eb50e7a2c8 Swap watermarks from high (4096) to low (128) when we get full buffers
into the read callback several times in succession; swap back when we
see empty buffers several times. This hopefully limits how much programs
that print a lot for a long period can monopolize tmux (like large, fast
compiling), without penalizing programs that print a lot briefly (like
most curses applications). Helps a lot for me, the actual numbers may
need tweaking later.
2016-09-16 13:43:41 +00:00
nicm 2e5584c2b4 Allow repeat count to be specified in mode key tables with bind-key -R,
and set the default repeat count to 5 for WheelUp and WheelDown in
copy-mode.
2016-09-12 15:40:58 +00:00
nicm fed1e384ad Add support for performing a full width split (with splitw -f), rather
than splitting the current cell. From Stephen Kent.
2016-09-04 17:37:06 +00:00
nicm 2627ab322e Remember the number of lines scrolled into the history (versus cleared
into the history) and when resizing only use scrolled lines and not
cleared lines (which are probably not intended to reappear). From
Chaoren Lin.
2016-09-02 20:57:20 +00:00
nicm f8cc48a43f Fix minimum size when pane status line is enabled, reported by Y Petremann. 2016-08-03 09:07:02 +00:00
nicm 9436a31603 Tweak output of environment logging. 2016-07-15 09:52:34 +00:00
nicm 1718420c48 Log environment to new panes. 2016-07-15 09:28:32 +00:00
nicm 0f73af876f Don't update cells in each block of data read from a pane immediately,
instead track them as change (dirty) and update them once at the end,
saves much time if repeatedly writing the same cell. Also fix comparison
of cells being equal in a few places (memcmp is not enough).
2016-07-15 00:49:08 +00:00
nicm 325cbe90d9 Allow a command to be specified to display-panes, similar to
command-prompt, rather than always just selecting the pane.
2016-06-16 10:55:47 +00:00
nicm bee3e3e28d Copy mode needs to keep the original grid intact so it can copy from it
if needed, so it disables reading from the pane. This can be problem
with some programs. So make tmux automatically exit all modes after 180
seconds of inactivity and if there is pending output.
2016-06-15 09:13:46 +00:00
nicm aba4438013 Cache selected state so that cells going from selected to unselected are not
skipped, reported by Omar Sandoval.
2016-06-06 07:28:52 +00:00
nicm 00cf5fbde6 Insert new panes after the pane being split in the list rather than
always after the active pane. This is more sensible when doing it with
commands rather than keys.
2016-06-06 07:24:31 +00:00
nicm 1921fac814 Cache the window styles and do not look up the window-style options
unless they have changed.
2016-05-30 09:50:20 +00:00
nicm fcb00a4161 Use getprogname() instead of __progname to make portability easier. 2016-05-27 17:05:42 +00:00
tim fdd368a294 - Rework load_cfg() error handling a little.
- Add -q to source-file to suppress errors about nonexistent files.

Input and OK nicm@
2016-05-12 16:05:33 +00:00
nicm 4a6eca5bd7 Use the same code for half page scrolling as full, from Michal Mazurek. 2016-05-01 13:39:05 +00:00
nicm 88bd5b15ff tty_client_ready can not be internal to tty.c again. 2016-04-30 18:59:02 +00:00
nicm 0509be0740 Add option to include status text in the pane borders. If
pane-border-status is set to "top" or "bottom" (rather than "off"),
every pane has a permanent top or bottom border containing the text from
pane-border-format.

Based on a diff sent long ago by Jonathan Slenders, mostly rewritten and
simplified by me.
2016-04-29 15:00:48 +00:00
nicm c5443da2d3 The backoff timer is causing no end of trouble with disconnected clients
stopping data in attached ones. So get rid of it and see how we get on
with just a high watermark on each pane.
2016-04-29 13:36:10 +00:00
nicm 5f2bfd9807 Make the grid_cell passed into screen_write_* const. 2016-04-29 13:21:33 +00:00
nicm 1cedf78284 Add next/previous paragraph, from J Raynor. 2016-04-27 09:39:09 +00:00
nicm fa97b0a95b Instead of reusing MouseUp at the finish of a drag, add a new key
MouseDragEnd. It can be useful to bind them separately in copy mode.
2016-03-18 07:28:27 +00:00