nicm
28e0658fa9
Some tidying of copy mode search functions, based on a diff from Lukasz
...
Piatkowski (initial changes to help some more to come).
2016-05-03 13:40:50 +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
1cedf78284
Add next/previous paragraph, from J Raynor.
2016-04-27 09:39:09 +00:00
nicm
312a7a1e62
Make scrolling behaviour more sensible and maintain cursor position, as
...
if the same had been done line-by-line. From Michal Mazurek.
2016-03-18 14:27:24 +00:00
nicm
54ea8f74ae
When a mouse drag is finished, fire a MouseUp key press, instead of
...
doing the drag end in code. From Stephen Coakley.
2016-03-01 12:04:43 +00:00
nicm
bc0c9c7920
Do not wrap cursor at start or end of history, from Michal Mazurek.
2016-02-05 10:20:06 +00:00
nicm
995af0e2b7
I no longer use my SourceForge address so replace it.
2016-01-19 15:59:12 +00:00
nicm
01831da5f5
Add cmdq as an argument to format_create and add a format for the
...
command name (will also be used for more later).
2015-12-11 12:27:36 +00:00
nicm
e0f26dcda3
Remove format_create_flags and just pass flags to format_create.
2015-12-08 08:34:18 +00:00
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
1b86f520ea
Nuke the utf8 and status-utf8 options and make tmux only a UTF-8
...
terminal. We still support non-UTF-8 terminals outside tmux, but inside
it is always UTF-8 (as when the utf8 and status-utf8 options were on).
2015-11-12 11:09:11 +00:00
nicm
69e0b8326a
Support UTF-8 key bindings by expanding the key type from int to
...
uint64_t and converting UTF-8 to Unicode on input and the reverse on
output. (This allows key bindings, there are still omissions - the
largest being that the various prompts do not accept UTF-8.)
2015-11-12 11:05:34 +00:00
nicm
01defc9f49
Because pledge(2) does not allow us to pass directory file descriptors
...
around, we can't use file descriptors for the working directory because
we will be unable to pass it to a privileged process to tell it where to
read or write files or spawn children. So move tmux back to using
strings for the current working directory. We try to check it exists
with access() when it is set but ultimately fall back to ~ if it fails
at time of use (or / if that fails too).
2015-10-31 08:13:58 +00:00
nicm
44657bf932
Move struct options into options.c.
2015-10-27 15:58:42 +00:00
nicm
14da999408
Format for scroll position, from Jorge Morante.
2015-10-23 16:02:21 +00:00
nicm
8da6de3e66
Style nit, int for flags not u_int.
2015-09-14 11:57:22 +00:00
nicm
901c2eb20a
Add copy-mode -e to exit copy mode when scrolling off the bottom, useful
...
for quick view of history, from Cam Hutchison.
2015-09-13 13:31:40 +00:00
nicm
b569585000
Move struct paste_buffer out of tmux.h.
2015-08-29 09:25:00 +00:00
nicm
6419f66523
Give clock mode its own timer.
2015-08-28 12:25:42 +00:00
nicm
583b4ab72b
Set working directory for run-shell and if-shell.
2015-04-24 22:19:36 +00:00
nicm
0610f44380
cmd_mouse_pane can return NULL, check for that.
2015-04-21 15:16:06 +00:00
nicm
07d93db427
Remove unused-but-set variables, from Thomas Adam.
2015-04-20 15:41:32 +00:00
nicm
0fd9a97202
Make jump-to-backward/jump-to-forward repeatable with
...
jump-reverse/jump-again, from Jacob Niehus.
2015-04-20 09:39:21 +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
0cd55eb1e7
Add a -x flag to copy-selection, append-selection and start-named-buffer
...
to prevent it exiting copy mode after copying. From J Raynor with a few
tweaks by me.
2015-04-10 16:00:08 +00:00
nicm
02df86079b
Fix some format specifier nits, from Ben Boeckel.
2015-03-31 17:45:10 +00:00
nicm
4946f74253
Wrap all the individual format_* calls in a single format_defaults
...
functions.
2015-02-05 10:29:43 +00:00
nicm
86207ee676
Shorten some long lines.
2015-01-15 13:35:13 +00:00
nicm
d88c381ce9
Only redraw affected lines when selection changes with mouse. From
...
Michael Graczyk.
2014-12-15 10:02:55 +00:00
nicm
4429941668
Expand formats in copy-pipe command, suggested by Suraj N Kurapati.
2014-11-09 15:13:01 +00:00
nicm
7445d303e0
Wrap when copy mode is used for output, from Balazs Kezes.
2014-11-06 10:56:44 +00:00
nicm
e4bf1e5128
Add V for select line with vi(1) keys. From Juho Pohjala.
2014-11-06 09:17:25 +00:00
nicm
abfb9656ef
Fix some spacing nits.
2014-10-22 23:18:53 +00:00
nicm
a27ba6e380
Add xreallocarray and remove nmemb argument from xrealloc.
2014-10-08 17:35:58 +00:00
nicm
2f19df09b1
Copy ACS characters as UTF-8, from Balazs Kezes.
2014-10-02 08:36:26 +00:00
nicm
4e956d545a
Various minor style and spacing nits.
2014-09-01 21:50:18 +00:00
nicm
2b79d36652
No need to repeat other-end more than once, from Juho Pohjala. Also add
...
it to the commands list while here.
2014-08-11 22:39:57 +00:00
nicm
29d20a55b6
Fix two copy mode problems:
...
1. In vi mode the selection doesn't include the last character if you
moved the cursor up or left.
2. In emacs mode the selection includes the last character if you moved
the cursor to the left.
From Balazs Kezes.
2014-08-11 22:18:16 +00:00
nicm
00ac1af43f
Copy newline when at EOL in vi(1) mode, from Balazs Kezes.
2014-06-19 07:37:59 +00:00
nicm
58c97695c9
Simplify copy lines, from Keith Amling.
2014-05-14 06:39:58 +00:00
nicm
b1a06ef22e
Add a copy mode key binding to copy to a named buffer. From J Raynor.
2014-05-13 07:54:20 +00:00
nicm
3dbacbb62b
Add support for named buffers. If you don't name a buffer, things work
...
much as before - buffers are automatically named "buffer0000",
"buffer0001" and so on and ordered as a stack. Buffers can be named
explicitly when creating ("loadb -b foo" etc) or renamed ("setb -b
buffer0000 -n foo"). If buffers are named explicitly, they are not
deleted when buffer-limit is reached. Diff from J Raynor.
2014-05-13 07:34:35 +00:00
nicm
bec6c807cd
There is no longer a need for a paste_stack struct or for global_buffers
...
to be global. Move to paste.c.
2014-04-24 09:14:43 +00:00
nicm
a5d4b7f3d9
Some more long lines.
2014-04-17 14:45:49 +00:00
nicm
b8bda67f30
Don't blindly increase offsets by the return value of snprintf, if there
...
wasn't enough space this will go off the end. Instead clamp to the
available space. Fixes crash reported by Julien Rebetez.
2014-04-11 19:35:54 +00:00
nicm
acef311fe3
Work out mouse scroll wheel effect when the mouse is first detected and
...
store it in struct mouse_event, reduce the scroll size the 3 but allow
shift to reduce it to 1 and meta and ctrl to multiply by 3 if the
terminal supports them, also support wheel in choose mode. From Marcel
Partap.
2014-04-03 08:20:29 +00:00
nicm
0e4d1d8493
Add setb -a to append and a copy mode append command, from J Raynor with
...
minor changes.
2014-03-31 21:39:31 +00:00
nicm
6daf06b1ad
Fix memory leaks with paste_replace, based on changes from J Raynor.
2014-02-17 23:07:03 +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
7d3d996383
Support paste key in copy mode input (for search etc). Also clamp length
...
to screen width.
2014-01-22 22:32:15 +00:00
nicm
df680d7257
Only exit copy mode at the bottom if no selection in progress, from
...
Benoit Pierre.
2014-01-22 13:57:49 +00:00
deraadt
72a4602b88
missing unsigned char casts areound tolower()
...
ok nicm
2013-11-20 17:01:23 +00:00
nicm
f0ed61f53c
Support case insensitive searching in the same manner as emacs - all
...
lowercase means case insensitive, any uppercase means case
sensitive. From J Raynor.
2013-11-09 00:48:57 +00:00
nicm
a6cd84869e
Correctly redraw the top two lines in copy mode when they are selected -
...
the selection was being updated before the redraw so the markings were
lost. Based on a fix from J Raynor.
2013-11-08 12:39:20 +00:00
nicm
7fa55b0419
Key to swap to other end of selection (bound to o with vi keys), from J
...
Raynor.
2013-10-23 11:31:03 +00:00
Nicholas Marriott
a9ebb62d54
Make next-word-end work properly with vi(1) keys, reported by patrick
...
keshishian.
2013-07-12 09:52:36 +00:00
Nicholas Marriott
7af5fec038
Whitespace nits, from Ben Boeckel.
2013-07-05 14:44:06 +00:00
Nicholas Marriott
599dd2a560
Create a new context when copying instead of using the input
...
context. The input context may not exist yet. Fixes crash when copying
from config file errors.
2013-03-25 11:43:33 +00:00
Nicholas Marriott
58932295fc
Add copy-pipe mode command to copy selection and also pipe to a command.
2013-03-22 15:52:40 +00:00
Nicholas Marriott
8d59b189cc
No more lint means no more ARGSUSED.
2013-03-22 10:31:22 +00:00
Nicholas Marriott
8903c1f167
Automatically reflow wrapped lines when a pane is resized, requested by
...
many over the years and finally implemented by Richard Woodbury.
2013-02-05 11:08:59 +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
1fcc7f50ac
When scrolling in copy mode with the mouse, scroll screen rather than
...
moving cursor. This change from Ailin Nemui, alternative to a change
from Stephen Hicks.
2012-11-27 14:42:56 +00:00
Nicholas Marriott
d210d99cce
Make mouse event structure clearer by defining events (up, click, drag)
...
and simplifying how buttons and wheels are represented, from Ailin
Nemui. Should be no functional changes.
2012-10-26 14:35:42 +00:00
Nicholas Marriott
0d0b3cf9a4
Fix search forward so it can match strings on the last line, SF bug
...
3571114 from "LiJunLe".
2012-09-25 07:39:28 +00:00
Nicholas Marriott
a3dec6bece
Instead of numbering choose mode items 0-9a-z and then nothing, number
...
them all and if there are more than 10 use a prompt when 0-9 is
pressed. From Thomas Adam.
2012-08-11 06:45:33 +00:00
Nicholas Marriott
df912e3540
xfree is not particularly helpful, remove it. From Thomas Adam.
2012-07-10 11:53:01 +00:00
Nicholas Marriott
c829bdf537
Minor style nits - return ().
2012-04-01 20:53:47 +00:00
Nicholas Marriott
c11da7ca88
Only exit mouse mode on scroll wheel when actually reaching the end of
...
the history, from James Nylen.
2012-04-01 09:23:31 +00:00
Nicholas Marriott
95f48a219a
Add a wrap-search option to turn off wrapping of searches in copy
...
mode. From Jacobo de Vera.
2012-03-17 21:40:53 +00:00
Nicholas Marriott
1bbb793263
Always remember last cursor position when moving up or down, not just
...
for if crossing zero length lines. From Itay Perl.
2012-03-11 23:01:19 +00:00
Nicholas Marriott
e04d13f6a6
Support "jump to" like vi in copy mode using t and T keys. Also add x
...
and X for delete in edit mode.
From Ben Boeckel, thanks.
2011-12-04 16:18:01 +00:00
Nicholas Marriott
fd25d35868
Move word-separators to be a session rather than window option, from Ben
...
Boeckel.
2011-11-15 23:24:04 +00:00
Nicholas Marriott
f5a73c5433
When copying, make repeat count indicate buffer to replace if used.
2011-10-23 23:38:16 +00:00
Nicholas Marriott
1202284f37
PANE_FREEZE doesn't do anything anymore, so remove it.
2011-06-27 00:04:49 +00:00
Nicholas Marriott
96e7f33da3
Support setting the xterm clipboard when copying from copy mode using
...
the xterm escape sequence for the purpose (if xterm is configured to
allow it).
Written by and much discussed Ailin Nemui, guidance on
xterm/termcap/terminfo from Thomas Dickey.
2011-05-18 20:24:29 +00:00
Nicholas Marriott
58908fd8c5
Add three new copy-mode commands - select-line, copy-line,
...
copy-end-of-line. From Dave Disser and Randy Stauner a while back.
2011-05-18 18:06:36 +00:00
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