aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES4
-rw-r--r--cmd-capture-pane.c9
-rw-r--r--configure.ac2
-rw-r--r--grid.c4
-rw-r--r--tmux.190
-rw-r--r--window-copy.c86
6 files changed, 110 insertions, 85 deletions
diff --git a/CHANGES b/CHANGES
index ad50d54c..0c75108c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+CHANGES FROM 3.0 to X.X
+
+XXX
+
CHANGES FROM 2.9 to 3.0
* Expand arguments to C and s format modifiers to match the m modifier.
diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c
index a3ec066c..fc6c26e4 100644
--- a/cmd-capture-pane.c
+++ b/cmd-capture-pane.c
@@ -39,8 +39,8 @@ const struct cmd_entry cmd_capture_pane_entry = {
.name = "capture-pane",
.alias = "capturep",
- .args = { "ab:CeE:JpPqS:t:", 0, 0 },
- .usage = "[-aCeJpPq] " CMD_BUFFER_USAGE " [-E end-line] "
+ .args = { "ab:CeE:JNpPqS:t:", 0, 0 },
+ .usage = "[-aCeJNpPq] " CMD_BUFFER_USAGE " [-E end-line] "
"[-S start-line] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
@@ -110,7 +110,7 @@ cmd_capture_pane_history(struct args *args, struct cmdq_item *item,
struct grid *gd;
const struct grid_line *gl;
struct grid_cell *gc = NULL;
- int n, with_codes, escape_c0, join_lines;
+ int n, with_codes, escape_c0, join_lines, no_trim;
u_int i, sx, top, bottom, tmp;
char *cause, *buf, *line;
const char *Sflag, *Eflag;
@@ -170,11 +170,12 @@ cmd_capture_pane_history(struct args *args, struct cmdq_item *item,
with_codes = args_has(args, 'e');
escape_c0 = args_has(args, 'C');
join_lines = args_has(args, 'J');
+ no_trim = args_has(args, 'N');
buf = NULL;
for (i = top; i <= bottom; i++) {
line = grid_string_cells(gd, 0, i, sx, &gc, with_codes,
- escape_c0, !join_lines);
+ escape_c0, !join_lines && !no_trim);
linelen = strlen(line);
buf = cmd_capture_pane_append(buf, len, line, linelen);
diff --git a/configure.ac b/configure.ac
index 21e8926d..5fba1eaf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
# configure.ac
-AC_INIT([tmux], 3.0-rc4)
+AC_INIT([tmux], next-3.1)
AC_PREREQ([2.60])
AC_CONFIG_AUX_DIR(etc)
diff --git a/grid.c b/grid.c
index f33eef72..2f1e9b59 100644
--- a/grid.c
+++ b/grid.c
@@ -1220,10 +1220,6 @@ grid_reflow(struct grid *gd, u_int sx)
struct grid_cell gc;
u_int yy, width, i, at, first;
- /* Do not reflow to the same size. */
- if (sx == gd->sx)
- return;
-
/*
* Create a destination grid. This is just used as a container for the
* line data and may not be fully valid.
diff --git a/tmux.1 b/tmux.1
index 227ed36b..394bd284 100644
--- a/tmux.1
+++ b/tmux.1
@@ -1349,11 +1349,41 @@ bind-key -Troot a switch-client -Ttable1
.Ed
.El
.Sh WINDOWS AND PANES
-A
+Each window displayed by
+.Nm
+may be split into one or more
+.Em panes ;
+each pane takes up a certain area of the display and is a separate terminal.
+A window may be split into panes using the
+.Ic split-window
+command.
+Windows may be split horizontally (with the
+.Fl h
+flag) or vertically.
+Panes may be resized with the
+.Ic resize-pane
+command (bound to
+.Ql C-Up ,
+.Ql C-Down
+.Ql C-Left
+and
+.Ql C-Right
+by default), the current pane may be changed with the
+.Ic select-pane
+command and the
+.Ic rotate-window
+and
+.Ic swap-pane
+commands may be used to swap panes without changing their position.
+Panes are numbered beginning from zero in the order they are created.
+.Pp
+By default, a
.Nm
-window may be in one of two modes.
-The default permits direct access to the terminal attached to the window.
-The other is copy mode, which permits a section of a window or its
+pane permits direct access to the terminal contained in the pane.
+A pane may also be put into one of several modes:
+.Bl -dash -offset indent
+.It
+Copy mode, which permits a section of a window or its
history to be copied to a
.Em paste buffer
for later insertion into another window.
@@ -1362,9 +1392,21 @@ This mode is entered with the
command, bound to
.Ql \&[
by default.
-It is also entered when a command that produces output, such as
+.It
+View mode, which is like copy mode but is entered when a command that produces
+output, such as
.Ic list-keys ,
is executed from a key binding.
+.It
+Choose mode, which allows an item to be chosen from a list.
+This may be a client, a session or window or pane, or a buffer.
+This mode is entered with the
+.Ic choose-buffer ,
+.Ic choose-client
+and
+.Ic choose-tree
+commands.
+.El
.Pp
In copy mode an indicator is displayed in the top-right corner of the pane with
the current position and the number of lines in the history.
@@ -1526,37 +1568,7 @@ bind PageUp copy-mode -eu
.Ed
.El
.Pp
-Each window displayed by
-.Nm
-may be split into one or more
-.Em panes ;
-each pane takes up a certain area of the display and is a separate terminal.
-A window may be split into panes using the
-.Ic split-window
-command.
-Windows may be split horizontally (with the
-.Fl h
-flag) or vertically.
-Panes may be resized with the
-.Ic resize-pane
-command (bound to
-.Ql C-Up ,
-.Ql C-Down
-.Ql C-Left
-and
-.Ql C-Right
-by default), the current pane may be changed with the
-.Ic select-pane
-command and the
-.Ic rotate-window
-and
-.Ic swap-pane
-commands may be used to swap panes without changing their position.
-Panes are numbered beginning from zero in the order they are created.
-.Pp
-A number of preset
-.Em layouts
-are available.
+A number of preset arrangements of panes are available, these are called layouts.
These may be selected with the
.Ic select-layout
command or cycled with
@@ -1635,7 +1647,7 @@ By default, it uses the format
but a different format may be specified with
.Fl F .
.It Xo Ic capture-pane
-.Op Fl aepPqCJ
+.Op Fl aepPqCJN
.Op Fl b Ar buffer-name
.Op Fl E Ar end-line
.Op Fl S Ar start-line
@@ -1660,8 +1672,10 @@ is given, the output includes escape sequences for text and background
attributes.
.Fl C
also escapes non-printable characters as octal \exxx.
+.Fl N
+preserves trailing spaces at each line's end and
.Fl J
-joins wrapped lines and preserves trailing spaces at each line's end.
+preserves trailing spaces and joins any wrapped lines.
.Fl P
captures only any output that the pane has received that is the beginning of an
as-yet incomplete escape sequence.
diff --git a/window-copy.c b/window-copy.c
index d868631c..5b197e65 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -60,8 +60,8 @@ static int window_copy_search_rl(struct grid *, struct grid *, u_int *,
static int window_copy_search_marks(struct window_mode_entry *,
struct screen *);
static void window_copy_clear_marks(struct window_mode_entry *);
-static void window_copy_move_left(struct screen *, u_int *, u_int *);
-static void window_copy_move_right(struct screen *, u_int *, u_int *);
+static void window_copy_move_left(struct screen *, u_int *, u_int *, int);
+static void window_copy_move_right(struct screen *, u_int *, u_int *, int);
static int window_copy_is_lowercase(const char *);
static int window_copy_search_jump(struct window_mode_entry *,
struct grid *, struct grid *, u_int, u_int, u_int, int, int,
@@ -110,7 +110,7 @@ static void window_copy_cursor_next_word(struct window_mode_entry *,
static void window_copy_cursor_next_word_end(struct window_mode_entry *,
const char *);
static void window_copy_cursor_previous_word(struct window_mode_entry *,
- const char *);
+ const char *, int);
static void window_copy_scroll_up(struct window_mode_entry *, u_int);
static void window_copy_scroll_down(struct window_mode_entry *, u_int);
static void window_copy_rectangle_toggle(struct window_mode_entry *);
@@ -1048,7 +1048,7 @@ window_copy_cmd_previous_matching_bracket(struct window_copy_cmd_state *cs)
tried = 1;
goto retry;
}
- window_copy_cursor_previous_word(wme, "}]) ");
+ window_copy_cursor_previous_word(wme, "}]) ", 1);
}
continue;
}
@@ -1343,7 +1343,7 @@ window_copy_cmd_previous_space(struct window_copy_cmd_state *cs)
u_int np = wme->prefix;
for (; np != 0; np--)
- window_copy_cursor_previous_word(wme, " ");
+ window_copy_cursor_previous_word(wme, " ", 1);
return (WINDOW_COPY_CMD_NOTHING);
}
@@ -1357,7 +1357,7 @@ window_copy_cmd_previous_word(struct window_copy_cmd_state *cs)
ws = options_get_string(s->options, "word-separators");
for (; np != 0; np--)
- window_copy_cursor_previous_word(wme, ws);
+ window_copy_cursor_previous_word(wme, ws, 1);
return (WINDOW_COPY_CMD_NOTHING);
}
@@ -1477,7 +1477,7 @@ window_copy_cmd_select_word(struct window_copy_cmd_state *cs)
data->rectflag = 0;
ws = options_get_string(s->options, "word-separators");
- window_copy_cursor_previous_word(wme, ws);
+ window_copy_cursor_previous_word(wme, ws, 0);
window_copy_start_selection(wme);
window_copy_cursor_next_word_end(wme, ws);
@@ -2047,11 +2047,16 @@ window_copy_search_rl(struct grid *gd,
}
static void
-window_copy_move_left(struct screen *s, u_int *fx, u_int *fy)
+window_copy_move_left(struct screen *s, u_int *fx, u_int *fy, int wrapflag)
{
if (*fx == 0) { /* left */
- if (*fy == 0) /* top */
+ if (*fy == 0) { /* top */
+ if (wrapflag) {
+ *fx = screen_size_x(s) - 1;
+ *fy = screen_hsize(s) + screen_size_y(s);
+ }
return;
+ }
*fx = screen_size_x(s) - 1;
*fy = *fy - 1;
} else
@@ -2059,11 +2064,16 @@ window_copy_move_left(struct screen *s, u_int *fx, u_int *fy)
}
static void
-window_copy_move_right(struct screen *s, u_int *fx, u_int *fy)
+window_copy_move_right(struct screen *s, u_int *fx, u_int *fy, int wrapflag)
{
if (*fx == screen_size_x(s) - 1) { /* right */
- if (*fy == screen_hsize(s) + screen_size_y(s)) /* bottom */
+ if (*fy == screen_hsize(s) + screen_size_y(s)) { /* bottom */
+ if (wrapflag) {
+ *fx = 0;
+ *fy = 0;
+ }
return;
+ }
*fx = 0;
*fy = *fy + 1;
} else
@@ -2155,18 +2165,16 @@ window_copy_search(struct window_mode_entry *wme, int direction)
screen_write_nputs(&ctx, -1, &grid_default_cell, "%s", data->searchstr);
screen_write_stop(&ctx);
- if (direction)
- window_copy_move_right(s, &fx, &fy);
- else
- window_copy_move_left(s, &fx, &fy);
-
wrapflag = options_get_number(wp->window->options, "wrap-search");
cis = window_copy_is_lowercase(data->searchstr);
- if (direction)
+ if (direction) {
+ window_copy_move_right(s, &fx, &fy, wrapflag);
endline = gd->hsize + gd->sy - 1;
- else
+ } else {
+ window_copy_move_left(s, &fx, &fy, wrapflag);
endline = 0;
+ }
found = window_copy_search_jump(wme, gd, ss.grid, fx, fy, endline, cis,
wrapflag, direction);
@@ -3314,7 +3322,7 @@ window_copy_cursor_next_word_end(struct window_mode_entry *wme,
/* Move to the previous place where a word begins. */
static void
window_copy_cursor_previous_word(struct window_mode_entry *wme,
- const char *separators)
+ const char *separators, int already)
{
struct window_copy_mode_data *data = wme->data;
u_int px, py;
@@ -3323,25 +3331,27 @@ window_copy_cursor_previous_word(struct window_mode_entry *wme,
py = screen_hsize(data->backing) + data->cy - data->oy;
/* Move back to the previous word character. */
- for (;;) {
- if (px > 0) {
- px--;
- if (!window_copy_in_set(wme, px, py, separators))
- break;
- } else {
- if (data->cy == 0 &&
- (screen_hsize(data->backing) == 0 ||
- data->oy >= screen_hsize(data->backing) - 1))
- goto out;
- window_copy_cursor_up(wme, 0);
-
- py = screen_hsize(data->backing) + data->cy - data->oy;
- px = window_copy_find_length(wme, py);
-
- /* Stop if separator at EOL. */
- if (px > 0 &&
- window_copy_in_set(wme, px - 1, py, separators))
- break;
+ if (already || window_copy_in_set(wme, px, py, separators)) {
+ for (;;) {
+ if (px > 0) {
+ px--;
+ if (!window_copy_in_set(wme, px, py, separators))
+ break;
+ } else {
+ if (data->cy == 0 &&
+ (screen_hsize(data->backing) == 0 ||
+ data->oy >= screen_hsize(data->backing) - 1))
+ goto out;
+ window_copy_cursor_up(wme, 0);
+
+ py = screen_hsize(data->backing) + data->cy - data->oy;
+ px = window_copy_find_length(wme, py);
+
+ /* Stop if separator at EOL. */
+ if (px > 0 &&
+ window_copy_in_set(wme, px - 1, py, separators))
+ break;
+ }
}
}