The branch, master has been updated via bd803e82e96512473036461ec3832c569768e535 (commit) via f9308bc244bb568fb678effbbb08f8fb277e7560 (commit) via 7697f5aa8feb11967e09d4933c2b11f487b6a535 (commit) via 44299416689d09e6dc1c68230be50ab1bf5c88ad (commit) via fc05bf255af2a39a8168320455f79e7e6d9e915a (commit) via 8f1302282b02f07e0868fbcdb79bb5404010ad4e (commit) via c6129f9c09ddc08d24640eeff1aa3082535f13c1 (commit) via 3c12b477d3563057a55026f4f4583f12537d9096 (commit) via 7445d303e0cbdcee7843a54634f7d3e897b3dec6 (commit) via e4bf1e5128a6981b47258e1865eb5416d59fe819 (commit) via 79f52825b58e89404b43cb8d466d04a520de4511 (commit) via d24c9d7d3efc3be0d4ba28616c3d5e3ef494258a (commit) from 747cab428158eada08a87a2c0e1ac917ba3293e1 (commit)
- Log ----------------------------------------------------------------- commit bd803e82e96512473036461ec3832c569768e535 Merge: fc05bf2 f9308bc Author: Thomas Adam <tho...@xteddy.org> Commit: Thomas Adam <tho...@xteddy.org> Merge branch 'obsd-master' grid-view.c | 4 ++-- resize.c | 4 ++-- window-copy.c | 20 +++++++++++++++----- 3 files changed, 19 insertions(+), 9 deletions(-) commit f9308bc244bb568fb678effbbb08f8fb277e7560 Author: nicm <nicm> Commit: nicm <nicm> Don't let force-width or force-height be < PANE_MINIMUM. --- resize.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resize.c b/resize.c index 7037942..73a728f 100644 --- a/resize.c +++ b/resize.c @@ -117,10 +117,10 @@ recalculate_sizes(void) continue; limit = options_get_number(&w->options, "force-width"); - if (limit != 0 && ssx > limit) + if (limit >= PANE_MINIMUM && ssx > limit) ssx = limit; limit = options_get_number(&w->options, "force-height"); - if (limit != 0 && ssy > limit) + if (limit >= PANE_MINIMUM && ssy > limit) ssy = limit; if (w->sx == ssx && w->sy == ssy) commit 7697f5aa8feb11967e09d4933c2b11f487b6a535 Author: nicm <nicm> Commit: nicm <nicm> Revert r1.17 as it breaks inserting in some cases. --- grid-view.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grid-view.c b/grid-view.c index f96a2d9..badabd5 100644 --- a/grid-view.c +++ b/grid-view.c @@ -184,7 +184,7 @@ grid_view_insert_cells(struct grid *gd, u_int px, u_int py, u_int nx) px = grid_view_x(gd, px); py = grid_view_y(gd, py); - sx = grid_view_x(gd, gd->linedata[py].cellsize); + sx = grid_view_x(gd, gd->sx); if (px == sx - 1) grid_clear(gd, px, py, 1, 1); @@ -201,7 +201,7 @@ grid_view_delete_cells(struct grid *gd, u_int px, u_int py, u_int nx) px = grid_view_x(gd, px); py = grid_view_y(gd, py); - sx = grid_view_x(gd, gd->linedata[py].cellsize); + sx = grid_view_x(gd, gd->sx); grid_move_cells(gd, px, px + nx, py, sx - px - nx); grid_clear(gd, sx - nx, py, px + nx - (sx - nx), 1); commit 44299416689d09e6dc1c68230be50ab1bf5c88ad Author: nicm <nicm> Commit: nicm <nicm> Expand formats in copy-pipe command, suggested by Suraj N Kurapati. --- window-copy.c | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/window-copy.c b/window-copy.c index 01b9824..f597332 100644 --- a/window-copy.c +++ b/window-copy.c @@ -1479,18 +1479,28 @@ void window_copy_copy_pipe(struct window_pane *wp, struct session *sess, const char *bufname, const char *arg) { - void *buf; - size_t len; - struct job *job; - + void *buf; + size_t len; + struct job *job; + struct format_tree *ft; + char *expanded; buf = window_copy_get_selection(wp, &len); if (buf == NULL) return; - job = job_run(arg, sess, NULL, NULL, NULL); + ft = format_create(); + format_window_pane(ft, wp); + if (sess != NULL) + format_session(ft, sess); + expanded = format_expand(ft, arg); + + job = job_run(expanded, sess, NULL, NULL, NULL); bufferevent_write(job->event, buf, len); + free(expanded); + format_free(ft); + window_copy_copy_buffer(wp, bufname, buf, len); } commit fc05bf255af2a39a8168320455f79e7e6d9e915a Merge: 747cab4 8f13022 Author: Thomas Adam <tho...@xteddy.org> Commit: Thomas Adam <tho...@xteddy.org> Merge branch 'obsd-master' cmd-paste-buffer.c | 4 +- format.c | 3 +- grid-view.c | 4 +- input-keys.c | 24 +++++----- mode-key.c | 1 + options-table.c | 4 +- paste.c | 4 +- screen-write.c | 2 - screen.c | 1 + status.c | 18 +++----- tmux.1 | 16 ++++--- tmux.h | 6 +++ window-copy.c | 127 ++++++++++++++++++++++++++++++--------------------- 13 files changed, 120 insertions(+), 94 deletions(-) commit 8f1302282b02f07e0868fbcdb79bb5404010ad4e Author: nicm <nicm> Commit: nicm <nicm> Two improvements to reflow from Balazs Kezes: - Don't extend the line to full width on insert/delete character which means leaves extra spaces when reflowing. - Only mark a line wrapped when the cursor actually goes off the end, not on newlines which can be used for positioning. --- grid-view.c | 4 ++-- screen-write.c | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/grid-view.c b/grid-view.c index badabd5..f96a2d9 100644 --- a/grid-view.c +++ b/grid-view.c @@ -184,7 +184,7 @@ grid_view_insert_cells(struct grid *gd, u_int px, u_int py, u_int nx) px = grid_view_x(gd, px); py = grid_view_y(gd, py); - sx = grid_view_x(gd, gd->sx); + sx = grid_view_x(gd, gd->linedata[py].cellsize); if (px == sx - 1) grid_clear(gd, px, py, 1, 1); @@ -201,7 +201,7 @@ grid_view_delete_cells(struct grid *gd, u_int px, u_int py, u_int nx) px = grid_view_x(gd, px); py = grid_view_y(gd, py); - sx = grid_view_x(gd, gd->sx); + sx = grid_view_x(gd, gd->linedata[py].cellsize); grid_move_cells(gd, px, px + nx, py, sx - px - nx); grid_clear(gd, sx - nx, py, px + nx - (sx - nx), 1); diff --git a/screen-write.c b/screen-write.c index 37e2b54..e38c9f5 100644 --- a/screen-write.c +++ b/screen-write.c @@ -795,8 +795,6 @@ screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped) gl = &s->grid->linedata[s->grid->hsize + s->cy]; if (wrapped) gl->flags |= GRID_LINE_WRAPPED; - else - gl->flags &= ~GRID_LINE_WRAPPED; if (s->cy == s->rlower) grid_view_scroll_region_up(s->grid, s->rupper, s->rlower); commit c6129f9c09ddc08d24640eeff1aa3082535f13c1 Author: nicm <nicm> Commit: nicm <nicm> Empty strings should be false too for #{?}, from Marc Finet. --- format.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/format.c b/format.c index 441e61b..7299104 100644 --- a/format.c +++ b/format.c @@ -236,7 +236,8 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen, *ptr = '\0'; value = format_find(ft, copy + 1); - if (value != NULL && (value[0] != '0' || value[1] != '\0')) { + if (value != NULL && *value != '\0' && + (value[0] != '0' || value[1] != '\0')) { value = ptr + 1; ptr = strchr(value, ','); if (ptr == NULL) commit 3c12b477d3563057a55026f4f4583f12537d9096 Author: nicm <nicm> Commit: nicm <nicm> V should be vi not emacs, also sort. From Theo Buehler. --- tmux.1 | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tmux.1 b/tmux.1 index 978cf54..f13bdf0 100644 --- a/tmux.1 +++ b/tmux.1 @@ -875,10 +875,10 @@ The following keys are supported as appropriate for the mode: .It Sy "Function" Ta Sy "vi" Ta Sy "emacs" .It Li "Append selection" Ta "A" Ta "" .It Li "Back to indentation" Ta "^" Ta "M-m" -.It Li "Copy to named buffer" Ta \&" Ta "" .It Li "Bottom of history" Ta "G" Ta "M-<" .It Li "Clear selection" Ta "Escape" Ta "C-g" .It Li "Copy selection" Ta "Enter" Ta "M-w" +.It Li "Copy to named buffer" Ta \&" Ta "" .It Li "Cursor down" Ta "j" Ta "Down" .It Li "Cursor left" Ta "h" Ta "Left" .It Li "Cursor right" Ta "l" Ta "Right" @@ -892,12 +892,12 @@ The following keys are supported as appropriate for the mode: .It Li "Go to line" Ta ":" Ta "g" .It Li "Half page down" Ta "C-d" Ta "M-Down" .It Li "Half page up" Ta "C-u" Ta "M-Up" -.It Li "Jump forward" Ta "f" Ta "f" -.It Li "Jump to forward" Ta "t" Ta "" -.It Li "Jump backward" Ta "F" Ta "F" -.It Li "Jump to backward" Ta "T" Ta "" .It Li "Jump again" Ta ";" Ta ";" .It Li "Jump again in reverse" Ta "," Ta "," +.It Li "Jump backward" Ta "F" Ta "F" +.It Li "Jump forward" Ta "f" Ta "f" +.It Li "Jump to backward" Ta "T" Ta "" +.It Li "Jump to forward" Ta "t" Ta "" .It Li "Next page" Ta "C-f" Ta "Page down" .It Li "Next space" Ta "W" Ta "" .It Li "Next space, end of word" Ta "E" Ta "" @@ -906,17 +906,17 @@ The following keys are supported as appropriate for the mode: .It Li "Other end of selection" Ta "o" Ta "" .It Li "Paste buffer" Ta "p" Ta "C-y" .It Li "Previous page" Ta "C-b" Ta "Page up" -.It Li "Previous word" Ta "b" Ta "M-b" .It Li "Previous space" Ta "B" Ta "" +.It Li "Previous word" Ta "b" Ta "M-b" .It Li "Quit mode" Ta "q" Ta "Escape" .It Li "Rectangle toggle" Ta "v" Ta "R" .It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down" .It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up" -.It Li "Select line" Ta "" Ta "V" .It Li "Search again" Ta "n" Ta "n" .It Li "Search again in reverse" Ta "N" Ta "N" .It Li "Search backward" Ta "?" Ta "C-r" .It Li "Search forward" Ta "/" Ta "C-s" +.It Li "Select line" Ta "V" Ta "" .It Li "Start of line" Ta "0" Ta "C-a" .It Li "Start selection" Ta "Space" Ta "C-Space" .It Li "Top of history" Ta "g" Ta "M->" commit 7445d303e0cbdcee7843a54634f7d3e897b3dec6 Author: nicm <nicm> Commit: nicm <nicm> Wrap when copy mode is used for output, from Balazs Kezes. --- window-copy.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/window-copy.c b/window-copy.c index 51710eb..01b9824 100644 --- a/window-copy.c +++ b/window-copy.c @@ -239,7 +239,6 @@ window_copy_init_for_output(struct window_pane *wp) data->backing = xmalloc(sizeof *data->backing); screen_init(data->backing, screen_size_x(&wp->base), screen_size_y(&wp->base), UINT_MAX); - data->backing->mode &= ~MODE_WRAP; } void @@ -280,7 +279,7 @@ window_copy_vadd(struct window_pane *wp, const char *fmt, va_list ap) struct screen_write_ctx back_ctx, ctx; struct grid_cell gc; int utf8flag; - u_int old_hsize; + u_int old_hsize, old_cy; if (backing == &wp->base) return; @@ -299,6 +298,7 @@ window_copy_vadd(struct window_pane *wp, const char *fmt, va_list ap) screen_write_linefeed(&back_ctx, 0); } else data->backing_written = 1; + old_cy = backing->cy; screen_write_vnputs(&back_ctx, 0, &gc, utf8flag, fmt, ap); screen_write_stop(&back_ctx); @@ -313,9 +313,8 @@ window_copy_vadd(struct window_pane *wp, const char *fmt, va_list ap) if (screen_hsize(data->backing)) window_copy_redraw_lines(wp, 0, 1); - /* Write the line, if it's visible. */ - if (backing->cy + data->oy < screen_size_y(backing)) - window_copy_redraw_lines(wp, backing->cy, 1); + /* Write the new lines. */ + window_copy_redraw_lines(wp, old_cy, backing->cy - old_cy + 1); screen_write_stop(&ctx); } @@ -345,9 +344,9 @@ window_copy_resize(struct window_pane *wp, u_int sx, u_int sy) struct screen *s = &data->screen; struct screen_write_ctx ctx; - screen_resize(s, sx, sy, 0); + screen_resize(s, sx, sy, 1); if (data->backing != &wp->base) - screen_resize(data->backing, sx, sy, 0); + screen_resize(data->backing, sx, sy, 1); if (data->cy > sy - 1) data->cy = sy - 1; commit e4bf1e5128a6981b47258e1865eb5416d59fe819 Author: nicm <nicm> Commit: nicm <nicm> Add V for select line with vi(1) keys. From Juho Pohjala. --- mode-key.c | 1 + screen.c | 1 + tmux.1 | 1 + tmux.h | 6 +++ window-copy.c | 114 ++++++++++++++++++++++++++++++++++---------------------- 5 files changed, 78 insertions(+), 45 deletions(-) diff --git a/mode-key.c b/mode-key.c index 77e7b69..72d66f3 100644 --- a/mode-key.c +++ b/mode-key.c @@ -289,6 +289,7 @@ const struct mode_key_entry mode_key_vi_copy[] = { { 'M', 0, MODEKEYCOPY_MIDDLELINE }, { 'N', 0, MODEKEYCOPY_SEARCHREVERSE }, { 'T', 0, MODEKEYCOPY_JUMPTOBACK }, + { 'V', 0, MODEKEYCOPY_SELECTLINE }, { 'W', 0, MODEKEYCOPY_NEXTSPACE }, { '\002' /* C-b */, 0, MODEKEYCOPY_PREVIOUSPAGE }, { '\003' /* C-c */, 0, MODEKEYCOPY_CANCEL }, diff --git a/screen.c b/screen.c index 5ef18a2..3e3cac5 100644 --- a/screen.c +++ b/screen.c @@ -269,6 +269,7 @@ screen_clear_selection(struct screen *s) struct screen_sel *sel = &s->sel; sel->flag = 0; + sel->lineflag = LINE_SEL_NONE; } /* Check if cell in selection. */ diff --git a/tmux.1 b/tmux.1 index 367536a..978cf54 100644 --- a/tmux.1 +++ b/tmux.1 @@ -912,6 +912,7 @@ The following keys are supported as appropriate for the mode: .It Li "Rectangle toggle" Ta "v" Ta "R" .It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down" .It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up" +.It Li "Select line" Ta "" Ta "V" .It Li "Search again" Ta "n" Ta "n" .It Li "Search again in reverse" Ta "N" Ta "N" .It Li "Search backward" Ta "?" Ta "C-r" diff --git a/tmux.h b/tmux.h index d310c7a..7e52064 100644 --- a/tmux.h +++ b/tmux.h @@ -712,6 +712,12 @@ LIST_HEAD(joblist, job); struct screen_sel { int flag; int rectflag; + enum { + LINE_SEL_NONE, + LINE_SEL_LEFT_RIGHT, + LINE_SEL_RIGHT_LEFT, + } lineflag; + int modekeys; u_int sx; diff --git a/window-copy.c b/window-copy.c index b130167..51710eb 100644 --- a/window-copy.c +++ b/window-copy.c @@ -30,23 +30,23 @@ void window_copy_resize(struct window_pane *, u_int, u_int); void window_copy_key(struct window_pane *, struct session *, int); int window_copy_key_input(struct window_pane *, int); int window_copy_key_numeric_prefix(struct window_pane *, int); -void window_copy_mouse( - struct window_pane *, struct session *, struct mouse_event *); +void window_copy_mouse(struct window_pane *, struct session *, + struct mouse_event *); void window_copy_redraw_lines(struct window_pane *, u_int, u_int); void window_copy_redraw_screen(struct window_pane *); -void window_copy_write_line( - struct window_pane *, struct screen_write_ctx *, u_int); -void window_copy_write_lines( - struct window_pane *, struct screen_write_ctx *, u_int, u_int); +void window_copy_write_line(struct window_pane *, struct screen_write_ctx *, + u_int); +void window_copy_write_lines(struct window_pane *, + struct screen_write_ctx *, u_int, u_int); void window_copy_scroll_to(struct window_pane *, u_int, u_int); -int window_copy_search_compare( - struct grid *, u_int, u_int, struct grid *, u_int, int); -int window_copy_search_lr( - struct grid *, struct grid *, u_int *, u_int, u_int, u_int, int); -int window_copy_search_rl( - struct grid *, struct grid *, u_int *, u_int, u_int, u_int, int); +int window_copy_search_compare(struct grid *, u_int, u_int, struct grid *, + u_int, int); +int window_copy_search_lr(struct grid *, struct grid *, u_int *, u_int, + u_int, u_int, int); +int window_copy_search_rl(struct grid *, struct grid *, u_int *, u_int, + u_int, u_int, int); void window_copy_search_up(struct window_pane *, const char *); void window_copy_search_down(struct window_pane *, const char *); void window_copy_goto_line(struct window_pane *, const char *); @@ -374,7 +374,7 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key) u_int n; int np, keys; enum mode_key_cmd cmd; - const char *arg; + const char *arg, *ss; np = data->numprefix; if (np <= 0) @@ -528,11 +528,15 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key) window_copy_redraw_screen(wp); break; case MODEKEYCOPY_STARTSELECTION: + s->sel.lineflag = LINE_SEL_NONE; window_copy_start_selection(wp); window_copy_redraw_screen(wp); break; - case MODEKEYCOPY_COPYLINE: case MODEKEYCOPY_SELECTLINE: + s->sel.lineflag = LINE_SEL_LEFT_RIGHT; + data->rectflag = 0; + /* FALLTHROUGH */ + case MODEKEYCOPY_COPYLINE: window_copy_cursor_start_of_line(wp); /* FALLTHROUGH */ case MODEKEYCOPY_COPYENDOFLINE: @@ -683,29 +687,23 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key) case WINDOW_COPY_NUMERICPREFIX: break; case WINDOW_COPY_SEARCHUP: + ss = data->searchstr; if (cmd == MODEKEYCOPY_SEARCHAGAIN) { - for (; np != 0; np--) { - window_copy_search_up( - wp, data->searchstr); - } + for (; np != 0; np--) + window_copy_search_up(wp, ss); } else { - for (; np != 0; np--) { - window_copy_search_down( - wp, data->searchstr); - } + for (; np != 0; np--) + window_copy_search_down(wp, ss); } break; case WINDOW_COPY_SEARCHDOWN: + ss = data->searchstr; if (cmd == MODEKEYCOPY_SEARCHAGAIN) { - for (; np != 0; np--) { - window_copy_search_down( - wp, data->searchstr); - } + for (; np != 0; np--) + window_copy_search_down(wp, ss); } else { - for (; np != 0; np--) { - window_copy_search_up( - wp, data->searchstr); - } + for (; np != 0; np--) + window_copy_search_up(wp, ss); } break; } @@ -730,6 +728,7 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key) } break; case MODEKEYCOPY_RECTANGLETOGGLE: + s->sel.lineflag = LINE_SEL_NONE; window_copy_rectangle_toggle(wp); break; default: @@ -871,8 +870,8 @@ window_copy_key_numeric_prefix(struct window_pane *wp, int key) } void -window_copy_mouse( - struct window_pane *wp, struct session *sess, struct mouse_event *m) +window_copy_mouse(struct window_pane *wp, struct session *sess, + struct mouse_event *m) { struct window_copy_mode_data *data = wp->modedata; struct screen *s = &data->screen; @@ -895,7 +894,8 @@ window_copy_mouse( * We reached the bottom, leave copy mode, but * only if no selection is in progress. */ - if (data->oy == 0 && !s->sel.flag) + if (data->oy == 0 && !s->sel.flag && + s->sel.lineflag == LINE_SEL_NONE) goto reset_mode; } } @@ -964,8 +964,8 @@ window_copy_scroll_to(struct window_pane *wp, u_int px, u_int py) } int -window_copy_search_compare( - struct grid *gd, u_int px, u_int py, struct grid *sgd, u_int spx, int cis) +window_copy_search_compare(struct grid *gd, u_int px, u_int py, + struct grid *sgd, u_int spx, int cis) { const struct grid_cell *gc, *sgc; struct utf8_data ud, sud; @@ -1186,8 +1186,8 @@ window_copy_goto_line(struct window_pane *wp, const char *linestr) } void -window_copy_write_line( - struct window_pane *wp, struct screen_write_ctx *ctx, u_int py) +window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx, + u_int py) { struct window_copy_mode_data *data = wp->modedata; struct screen *s = &data->screen; @@ -1237,8 +1237,8 @@ window_copy_write_line( } void -window_copy_write_lines( - struct window_pane *wp, struct screen_write_ctx *ctx, u_int py, u_int ny) +window_copy_write_lines(struct window_pane *wp, struct screen_write_ctx *ctx, + u_int py, u_int ny) { u_int yy; @@ -1311,7 +1311,7 @@ window_copy_update_selection(struct window_pane *wp, int may_redraw) struct grid_cell gc; u_int sx, sy, ty, cy; - if (!s->sel.flag) + if (!s->sel.flag && s->sel.lineflag == LINE_SEL_NONE) return (0); /* Set colours. */ @@ -1365,7 +1365,7 @@ window_copy_get_selection(struct window_pane *wp, size_t *len) u_int firstsx, lastex, restex, restsx; int keys; - if (!s->sel.flag) + if (!s->sel.flag && s->sel.lineflag == LINE_SEL_NONE) return (NULL); buf = xmalloc(1); @@ -1665,12 +1665,14 @@ window_copy_cursor_start_of_line(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; struct screen *back_s = data->backing; + struct screen *s = &data->screen; struct grid *gd = back_s->grid; u_int py; - if (data->cx == 0) { + if (data->cx == 0 && s->sel.lineflag == LINE_SEL_NONE) { py = screen_hsize(back_s) + data->cy - data->oy; - while (py > 0 && gd->linedata[py-1].flags & GRID_LINE_WRAPPED) { + while (py > 0 && + gd->linedata[py-1].flags & GRID_LINE_WRAPPED) { window_copy_cursor_up(wp, 0); py = screen_hsize(back_s) + data->cy - data->oy; } @@ -1710,13 +1712,14 @@ window_copy_cursor_end_of_line(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; struct screen *back_s = data->backing; + struct screen *s = &data->screen; struct grid *gd = back_s->grid; u_int px, py; py = screen_hsize(back_s) + data->cy - data->oy; px = window_copy_find_length(wp, py); - if (data->cx == px) { + if (data->cx == px && s->sel.lineflag == LINE_SEL_NONE) { if (data->screen.sel.flag && data->rectflag) px = screen_size_x(back_s); if (gd->linedata[py].flags & GRID_LINE_WRAPPED) { @@ -1742,9 +1745,14 @@ window_copy_other_end(struct window_pane *wp) struct screen *s = &data->screen; u_int selx, sely, cx, cy, yy; - if (!s->sel.flag) + if (!s->sel.flag && s->sel.lineflag == LINE_SEL_NONE) return; + if (s->sel.lineflag == LINE_SEL_LEFT_RIGHT) + s->sel.lineflag = LINE_SEL_RIGHT_LEFT; + else if (s->sel.lineflag == LINE_SEL_RIGHT_LEFT) + s->sel.lineflag = LINE_SEL_LEFT_RIGHT; + selx = data->selx; sely = data->sely; cx = data->cx; @@ -1820,6 +1828,9 @@ window_copy_cursor_up(struct window_pane *wp, int scroll_only) data->lastsx = ox; } + if (s->sel.lineflag == LINE_SEL_LEFT_RIGHT && oy == data->sely) + window_copy_other_end(wp); + data->cx = data->lastcx; if (scroll_only || data->cy == 0) { window_copy_scroll_down(wp, 1); @@ -1846,6 +1857,11 @@ window_copy_cursor_up(struct window_pane *wp, int scroll_only) data->cx > px) window_copy_cursor_end_of_line(wp); } + + if (s->sel.lineflag == LINE_SEL_LEFT_RIGHT) + window_copy_cursor_end_of_line(wp); + else if (s->sel.lineflag == LINE_SEL_RIGHT_LEFT) + window_copy_cursor_start_of_line(wp); } void @@ -1862,6 +1878,9 @@ window_copy_cursor_down(struct window_pane *wp, int scroll_only) data->lastsx = ox; } + if (s->sel.lineflag == LINE_SEL_RIGHT_LEFT && oy == data->sely) + window_copy_other_end(wp); + data->cx = data->lastcx; if (scroll_only || data->cy == screen_size_y(s) - 1) { window_copy_scroll_up(wp, 1); @@ -1880,6 +1899,11 @@ window_copy_cursor_down(struct window_pane *wp, int scroll_only) data->cx > px) window_copy_cursor_end_of_line(wp); } + + if (s->sel.lineflag == LINE_SEL_LEFT_RIGHT) + window_copy_cursor_end_of_line(wp); + else if (s->sel.lineflag == LINE_SEL_RIGHT_LEFT) + window_copy_cursor_start_of_line(wp); } void commit 79f52825b58e89404b43cb8d466d04a520de4511 Author: nicm <nicm> Commit: nicm <nicm> Tidy up mode-mouse check. --- cmd-paste-buffer.c | 4 +--- input-keys.c | 24 +++++++++++------------- paste.c | 4 ++-- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c index 08ac6fa..6d5fb9f 100644 --- a/cmd-paste-buffer.c +++ b/cmd-paste-buffer.c @@ -49,7 +49,6 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq) struct session *s; struct paste_buffer *pb; const char *sepstr, *bufname; - int pflag; if (cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp) == NULL) return (CMD_RETURN_ERROR); @@ -76,8 +75,7 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq) else sepstr = "\r"; } - pflag = (wp->screen->mode & MODE_BRACKETPASTE); - paste_send_pane(pb, wp, sepstr, args_has(args, 'p') && pflag); + paste_send_pane(pb, wp, sepstr, args_has(args, 'p')); } /* Delete the buffer if -d. */ diff --git a/input-keys.c b/input-keys.c index 7ce7193..040a060 100644 --- a/input-keys.c +++ b/input-keys.c @@ -205,6 +205,7 @@ input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m) char buf[40]; size_t len; struct paste_buffer *pb; + int event; if (wp->screen->mode & ALL_MOUSE_MODES) { /* @@ -238,19 +239,16 @@ input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m) return; } - if (m->button == 1 && (m->event & MOUSE_EVENT_CLICK) && - options_get_number(&wp->window->options, "mode-mouse") == 1) { + if (options_get_number(&wp->window->options, "mode-mouse") != 1) + return; + event = m->event & (MOUSE_EVENT_CLICK|MOUSE_EVENT_WHEEL); + if (wp->mode == NULL && m->button == 1 && event == MOUSE_EVENT_CLICK) { pb = paste_get_top(); - if (pb != NULL) { - paste_send_pane(pb, wp, "\r", - wp->screen->mode & MODE_BRACKETPASTE); - } - } else if (m->button != 1 && - options_get_number(&wp->window->options, "mode-mouse") == 1) { - if (window_pane_set_mode(wp, &window_copy_mode) == 0) { - window_copy_init_from_pane(wp); - if (wp->mode->mouse != NULL) - wp->mode->mouse(wp, s, m); - } + if (pb != NULL) + paste_send_pane(pb, wp, "\r", 1); + } else if (window_pane_set_mode(wp, &window_copy_mode) == 0) { + window_copy_init_from_pane(wp); + if (wp->mode->mouse != NULL) + wp->mode->mouse(wp, s, m); } } diff --git a/paste.c b/paste.c index 0332e60..de80115 100644 --- a/paste.c +++ b/paste.c @@ -301,7 +301,7 @@ paste_send_pane(struct paste_buffer *pb, struct window_pane *wp, if (wp->flags & PANE_INPUTOFF) return; - if (bracket) + if (bracket && (wp->screen->mode & MODE_BRACKETPASTE)) bufferevent_write(wp->event, "\033[200~", 6); seplen = strlen(sep); @@ -315,6 +315,6 @@ paste_send_pane(struct paste_buffer *pb, struct window_pane *wp, if (end != data) bufferevent_write(wp->event, data, end - data); - if (bracket) + if (bracket && (wp->screen->mode & MODE_BRACKETPASTE)) bufferevent_write(wp->event, "\033[201~", 6); } commit d24c9d7d3efc3be0d4ba28616c3d5e3ef494258a Author: nicm <nicm> Commit: nicm <nicm> Do not put a space between status-left/status-right and the window list, instead move the space into the defaults for the options (so status-left now defaults to "[#S] ". From Balazs Kezes. --- options-table.c | 4 ++-- status.c | 18 +++++++----------- tmux.1 | 3 +++ 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/options-table.c b/options-table.c index d68a41c..65b9122 100644 --- a/options-table.c +++ b/options-table.c @@ -390,7 +390,7 @@ const struct options_table_entry session_options_table[] = { { .name = "status-left", .type = OPTIONS_TABLE_STRING, - .default_str = "[#S]" + .default_str = "[#S] " }, { .name = "status-left-attr", @@ -431,7 +431,7 @@ const struct options_table_entry session_options_table[] = { { .name = "status-right", .type = OPTIONS_TABLE_STRING, - .default_str = "\"#{=22:pane_title}\" %H:%M %d-%b-%y" + .default_str = " \"#{=22:pane_title}\" %H:%M %d-%b-%y" }, { .name = "status-right-attr", diff --git a/status.c b/status.c index 287039e..ac248ba 100644 --- a/status.c +++ b/status.c @@ -193,9 +193,9 @@ status_redraw(struct client *c) */ needed = 0; if (llen != 0) - needed += llen + 1; + needed += llen; if (rlen != 0) - needed += rlen + 1; + needed += rlen; if (c->tty.sx == 0 || c->tty.sx <= needed) goto out; wlavailable = c->tty.sx - needed; @@ -300,10 +300,8 @@ draw: /* Draw the left string and arrow. */ screen_write_cursormove(&ctx, 0, 0); - if (llen != 0) { + if (llen != 0) screen_write_cnputs(&ctx, llen, &lgc, utf8flag, "%s", left); - screen_write_putc(&ctx, &stdgc, ' '); - } if (larrow != 0) { memcpy(&gc, &stdgc, sizeof gc); if (larrow == -1) @@ -313,21 +311,19 @@ draw: /* Draw the right string and arrow. */ if (rarrow != 0) { - screen_write_cursormove(&ctx, c->tty.sx - rlen - 2, 0); + screen_write_cursormove(&ctx, c->tty.sx - rlen - 1, 0); memcpy(&gc, &stdgc, sizeof gc); if (rarrow == -1) gc.attr ^= GRID_ATTR_REVERSE; screen_write_putc(&ctx, &gc, '>'); } else - screen_write_cursormove(&ctx, c->tty.sx - rlen - 1, 0); - if (rlen != 0) { - screen_write_putc(&ctx, &stdgc, ' '); + screen_write_cursormove(&ctx, c->tty.sx - rlen, 0); + if (rlen != 0) screen_write_cnputs(&ctx, rlen, &rgc, utf8flag, "%s", right); - } /* Figure out the offset for the window list. */ if (llen != 0) - wloffset = llen + 1; + wloffset = llen; else wloffset = 0; if (wlwidth < wlavailable) { diff --git a/tmux.1 b/tmux.1 index 9b853a1..367536a 100644 --- a/tmux.1 +++ b/tmux.1 @@ -2581,6 +2581,9 @@ By default, UTF-8 in is not interpreted, to enable UTF-8, use the .Ic status-utf8 option. +.Pp +The default is +.Ql "[#S] " . .It Ic status-left-length Ar length Set the maximum .Ar length ----------------------------------------------------------------------- Summary of changes: cmd-paste-buffer.c | 4 +- format.c | 3 +- input-keys.c | 24 ++++----- mode-key.c | 1 + options-table.c | 4 +- paste.c | 4 +- resize.c | 4 +- screen-write.c | 2 - screen.c | 1 + status.c | 18 +++---- tmux.1 | 16 ++++-- tmux.h | 6 ++ window-copy.c | 147 ++++++++++++++++++++++++++++++++-------------------- 13 files changed, 135 insertions(+), 99 deletions(-) hooks/post-receive -- tmux ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk _______________________________________________ tmux-cvs mailing list tmux-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-cvs