Commit Graph

350 Commits

Author SHA1 Message Date
Nicholas Marriott
7bc3f5dd8a Permit keys in copy mode to be prefixed by a repeat count, entered with
[1-9] in vi mode, or M-[1-9] in emacs mode.

From Micah Cowan, tweaked a little by me.
2010-03-02 00:32:41 +00:00
Nicholas Marriott
56a33b157b Extend the end-of-line key so that in normal mode a second press moves
the cursor to the end of a wrapped line (if present) and in rectangle
mode it toggles between the end of the text and the last cell on the
line.

From Micah Cowan.
2010-03-01 23:53:27 +00:00
Nicholas Marriott
6767072c9d Option to set the characters considered word separators in copy mode, from
Micah Cowan.
2010-02-22 20:41:16 +00:00
Nicholas Marriott
73b8c3ebf3 Another copy mode fix from Micah Cowan: in rectangle copy mode, the cursor
should not wrap at the end of the text on the line but should be allowed to
move freely.
2010-02-22 20:28:21 +00:00
Nicholas Marriott
3a89d1ef7f copy mode uses the real screen as backing and if it is updated while copying,
strange things can happen. So, freeze reading from the pty while in copy mode.
2010-02-19 00:03:21 +00:00
Nicholas Marriott
a61b8a2033 Make next-word stop at beginning of word even if it is at the start of the
line, from Micah Cowan.
2010-02-17 21:27:18 +00:00
Nicholas Marriott
d285f7fd4d Don't strip add newline if only copying part of wrapped line. Problem spotted
by and fix from Micah Cowan.
2010-02-17 20:58:24 +00:00
Nicholas Marriott
44ded35d5d Add "N" key to search the opposite way from the last search (reverse of "n"),
from Micah Cowan.
2010-02-11 20:39:40 +00:00
Nicholas Marriott
3ef3802629 Rectangle copy support, from Robin Lee Powell. 2010-02-06 17:35:01 +00:00
Nicholas Marriott
5e6a7c85cc vi-style B, W and E keys in copy mode to navigate between words treating only
spaces as word separators. Also add . to the list of word separators for
standard word navigation.

From Micah Cowan, tweaked slightly by me.
2010-02-04 20:00:26 +00:00
Nicholas Marriott
3e2cc2d2c4 Alter next-word to have vi-like movement behaviour, and add next-word-end with
the existing emacs behaviour. From Micah Cowan.
2010-01-27 20:18:52 +00:00
Nicholas Marriott
f26312ffbf Hugely simplify window_copy_cursor_next_word, which was way overcomplicated. 2010-01-25 22:34:11 +00:00
Nicholas Marriott
e31480cf44 Update the selection properly after goto line or searching. 2010-01-25 21:37:40 +00:00
Nicholas Marriott
1e5a94fdb5 Top/bottom of history mode keys, diff from Micah Cowan, tweaked by me. 2010-01-25 21:33:39 +00:00
Nicholas Marriott
75e13c8977 Redraw properly when scrolling backward and the cursor is on the last
line. Based on a fix from Micah Cowan.
2010-01-24 21:05:12 +00:00
Nicholas Marriott
15a64b805e Massive spaces->tabs and trailing whitespace cleanup, hopefully for the last
time now I've configured emacs to make them displayed in really annoying
colours...
2009-12-03 22:50:09 +00:00
Nicholas Marriott
4ca857e0e9 Remove a couple of unused arguments where possible, and add /* ARGSUSED */ to
the rest to reduce lint output.
2009-11-26 21:37:13 +00:00
Nicholas Marriott
8d4eae5662 Missed an unused variable :-/. 2009-11-18 17:03:16 +00:00
Nicholas Marriott
a78cc98c8b Cleanup by moving various (mostly horrible) little bits handling UTF-8 grid
data into functions in a new file, grid-utf8.c, and use sizeof intead of
UTF8_DATA.

Also nuke trailing whitespace from tmux.1, reminded by jmc.
2009-11-18 17:02:17 +00:00
Nicholas Marriott
480f5d3184 Correctly nuke the EOL $ marker when scrolling, reported by martynas@, thanks. 2009-10-20 21:35:25 +00:00
Nicholas Marriott
38df960e68 Add mode keys to move the cursor to the top, middle and bottom of the screen.
H/M/L in vi mode and M-R/M-r in emacs (bottom of screen not bound in emacs).
2009-10-13 13:45:56 +00:00
Nicholas Marriott
4bc0f6e7e9 Clean up by introducing a wrapper struct for mouse clicks rather than passing
three u_chars around.

As a side-effect this fixes incorrectly rejecting high cursor positions
(because it was comparing them as signed char), reported by Tom Doherty.
2009-10-11 07:01:10 +00:00
Nicholas Marriott
9400fdac77 Make C-Up and C-Down in copy mode scroll the screen up and down one line
without moving the cursor, like Up and Down in scroll mode (which will shortly
disappear).
2009-10-06 07:09:00 +00:00
Nicholas Marriott
372a8cb1d9 Permit options such as status-bg to be configured using the entire 256 colour
palette by setting "colour0" to "colour255".
2009-09-10 17:16:24 +00:00
Nicholas Marriott
ccba613e5b Give each paste buffer a size member instead of requiring them to be
zero-terminated.
2009-09-07 18:50:45 +00:00
Nicholas Marriott
f817a338d0 When moving up or down in copy mode, save the cursor position and size of the
last line with content (width != 0) and use it to determine if the cursor
should be at the end of the line. Fixes problem of the cursor always jumping to
the end of the line when scrolling past a blank line.
2009-08-21 07:33:58 +00:00
Nicholas Marriott
55336657d4 Don't read beyond the edge of the screen when searching (dies with debug
enabled).
2009-08-19 14:46:56 +00:00
Nicholas Marriott
406fc209ac Nuke unnecessary assignment. 2009-08-18 09:51:51 +00:00
Nicholas Marriott
feaf91ab93 Add a "delete line" key when editing in the status line or the search up/down
prompt. C-u with emacs keys, d with vi.
2009-08-18 07:23:43 +00:00
Nicholas Marriott
c828c2f366 Add (naive) searching and goto line in copy mode. Searching is C-r and C-s with
emacs keys, / and ? with vi; n repeats the search again with either key
set. All searching wraps the top/bottom. Goto line is g for both emacs and vi.

The search prompts don't have full line editing, just simple append and delete
characters.

Also sort the mode keys list in tmux.1.
2009-08-18 07:08:26 +00:00
Nicholas Marriott
7a359c00ac vi(1)-style half page scroll in copy and scroll modes. Move the vi full page
scroll key to C-b instead of C-u and use C-u/C-d for half page scrolling with
vi keys. In emacs mode, half page scrolling is bound to M-Up and M-Down.

Suggested by merdely (about a year ago :-)).
2009-08-13 22:32:18 +00:00
Nicholas Marriott
39154402e5 Scroll by two less than the number of lines in the screen, like emacs, rather
than by the entire screen, to make it easier to pull things out from under the
line indicator. Suggested by claudio.
2009-08-13 22:11:43 +00:00
Nicholas Marriott
3026118c70 Allowing copy mode to scroll left and right is annoying, so limit it to the
real screen width. To indicate the cursor is at the end of the line rather than
the cell before, put a '$' in the last cell.

Also clear the selection when the terminal is resized to avoid tmux getting
confused.
2009-08-13 19:35:20 +00:00
Nicholas Marriott
2e3bb5a511 Redraw the screen after resizing. 2009-08-13 16:48:43 +00:00
Nicholas Marriott
06ddd3dcf8 Add a flags member to the grid_line struct and use it to differentiate lines
wrapped at the screen edge from those terminated by a newline. Then use this
when copying to combine wrapped lines together into one.
2009-08-08 15:57:49 +00:00
Nicholas Marriott
5e01b6d663 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 containts 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-08 13:29:27 +00:00
Nicholas Marriott
bcddddf98d 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-05 16:26:38 +00:00
Nicholas Marriott
a419e73f7a Add a mode-mouse option to prevent tmux taking over the mouse in choice or copy
modes.
2009-07-30 07:04:50 +00:00
Nicholas Marriott
86785004ba Next step towards customisable mode keys: build each default table of keys into
a named tree on start and use that for lookups. Also add command to string
translation tables and modify list-keys to show the the mode key bindings (new
-t argument).
2009-07-28 07:03:32 +00:00
Nicholas Marriott
309b76fb32 Remove an unused entry in the mode keys command enum and rename
MODEKEYCOPY_QUIT to _CANCEL to match the others.
2009-07-27 20:36:13 +00:00
Nicholas Marriott
d95274c5f2 Change mode key bindings from big switches into a set of tables. Rather than
lumping them all together, split editing keys from those used in choice/more
mode and those for copy/scroll mode.

Tidier and clearer, and the first step towards customisable mode keys.
2009-07-27 19:29:35 +00:00
Nicholas Marriott
13e29dd7b5 Get rid of empty mode_key_free function. 2009-07-27 18:51:46 +00:00
Nicholas Marriott
584eda8339 Change previous-word behavior to move to the beginning of the word (matches
emacs and vi). From Kalle Olavi Niemitalo.
2009-07-27 07:42:45 +00:00
Nicholas Marriott
ba84ddcf8e Redraw after starting selection to correctly remove any existing selection. 2009-07-23 17:03:47 +00:00
Nicholas Marriott
22d51ec1ea Add a "back to indentation" key in copy mode to move the cursor to the first
non-whitespace character. ^ with vi and M-m with emacs key bindings. Another
from Kalle Olavi Niemitalo, thanks.
2009-07-12 16:15:34 +00:00
Nicholas Marriott
fa8333eddb Merge three copies of identical code to move the cursor x position into a
single function, from Kalle Olavi Niemitalo.
2009-07-12 16:12:34 +00:00
Nicholas Marriott
289320a9b1 Copy was using the real line length which after resize can be larger than the
screen width. When built with -DDEBUG, this made the grid bounds checking code
kill the server. Restrict copying to the actual width.

From Kalle Olavi Niemitalo, thanks.
2009-07-11 19:09:24 +00:00
Nicholas Marriott
24e1327d0d Stop in the right place so all the lines selected are copied. Reported by Kalle
Olavi Niemitalo, thanks.
2009-07-09 15:02:00 +00:00
Nicholas Marriott
fe5edad1fc Fix two copy/paste bugs: forbid zero-length buffers to prevent a fatal error
when trying to paste them, found by me, and miscalculation of the start/end
causing random fatal errors when copying in copy-mode, reported by sthen.

ok sthen "put it in" deraadt
2009-07-02 16:15:43 +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