Commit Graph

70 Commits

Author SHA1 Message Date
Nicholas Marriott
fb527c1bad Use button mouse mode not any for copy mode, fixes issues with
putty. From Ailin Nemui.
2011-05-18 08:04:47 +00:00
Nicholas Marriott
dc8fb9fb23 Tweak copy behaviour slightly in vi mode to be closer to real vi. From
Tiago Resende.
2011-04-24 21:06:12 +00:00
Nicholas Marriott
8738141913 When mode-mouse is on (it is off by default), automatically enter copy
mode when the mouse is dragged or the mouse wheel is used. Also exit
copy mode when the mouse wheel is scrolled off the bottom. Discussed
with and written by hsim at gmx dot li.
2011-04-19 21:31:33 +00:00
Nicholas Marriott
fa6abac98d Style: uint -> u_int and a missing else. 2011-03-28 19:44:31 +00:00
Nicholas Marriott
cc42614fa9 Change from a per-session stack of buffers to one global stack which is
much more convenient and also simplifies lot of code. This renders
copy-buffer useless and makes buffer-limit now a server option.

By Tiago Cunha.
2010-12-30 23:16:18 +00:00
Nicholas Marriott
f7c42c21ba Support all four of the xterm mouse modes. Based on a diff from hsim at
gmx.li.
2010-12-29 21:49:06 +00:00
Nicholas Marriott
20ed20ea1e Fix rectangle copy to behave like emacs - the cursor is not part of the
selection on the right edge but on the left it is.
2010-12-11 17:56:01 +00:00
Nicholas Marriott
c1c5f43a01 When resizing the copy mode screen, don't allow it to end up with the
viewable position beyond the size of the history.
2010-09-11 15:39:55 +00:00
Nicholas Marriott
bbf743769b Do not crash if the screen size is too small for the indicator in copy mode. 2010-09-08 20:36:42 +00:00
Nicholas Marriott
a97b7ad11c Fix a crash: if remain-on-exit is set and the pane has exited, the
buffers may not be valid, so do not try to disable/enable them when
switching to copy mode.
2010-07-22 21:10:51 +00:00
Ted Unangst
b4b9b831ee replace some magic mouse constants with defines for clarity. ok nicm 2010-06-29 05:24:49 +00:00
Nicholas Marriott
dcc100f165 Use a macro-based mask for obtaining a key or modifier-set from the
combination. Display C-@, etc, as C-Space, in list-keys. By Micah Cowan.
2010-06-06 19:00:13 +00:00
Nicholas Marriott
cc724f327a Make start-of-line work the same as end-of-line on wrapped lines (jump
to real start if at edge of screen). By Micah Cowan.
2010-06-05 15:49:48 +00:00
Nicholas Marriott
43fa9a9ba6 When the mode-mouse option is on, support dragging to make a selection
in copy mode.

Also support the scroll wheel, although xterm strangely does not ignore
it in application mouse mode, causing redraw artifacts when scrolling up
(other terminals appear to be better behaved).
2010-05-31 19:51:29 +00:00
Nicholas Marriott
4f5c5b37b8 Pass in the session, rather than the client, to window modes' key()
function. We were only ever using the client to find the session anyway.

This allows send-key to work properly for manipulating copy mode from
outside tmux.

From Micah Cowan.
2010-05-23 19:42:19 +00:00
Nicholas Marriott
2240199dbf Fix crash when resizing in copy mode, when cursor can end up outside screen.
Reported by Romain Francois, fixed by Micah Cowan.
2010-04-28 18:19:16 +00:00
Nicholas Marriott
ac9daf92d7 Merge copy mode and output mode, dropping the latter. Idea and code from
Micah Cowan.
2010-04-06 21:35:44 +00:00
Nicholas Marriott
9abbe349af paste-buffer should be per pane, from C. Coutinho. 2010-03-22 19:13:28 +00:00
Nicholas Marriott
0ac6efa6d5 Add vi-style "jump" commands for copy mode, from Micah Cowan. 2010-03-22 19:10:42 +00:00
Nicholas Marriott
48dd72005e Fix a use-after-free when cancelling copy mode, or trying to repeat cancel.
ok kettenis
2010-03-14 23:31:23 +00:00
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