From d24c9d7d3efc3be0d4ba28616c3d5e3ef494258a Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 5 Nov 2014 23:15:11 +0000 Subject: [PATCH 1/7] 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 d68a41c3..65b91226 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 287039ed..ac248ba4 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 9b853a1f..367536a1 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 From 79f52825b58e89404b43cb8d466d04a520de4511 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 5 Nov 2014 23:25:02 +0000 Subject: [PATCH 2/7] 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 08ac6fa2..6d5fb9fd 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 7ce71931..040a0605 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 0332e60e..de80115e 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); } From e4bf1e5128a6981b47258e1865eb5416d59fe819 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 6 Nov 2014 09:17:25 +0000 Subject: [PATCH 3/7] 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 77e7b695..72d66f37 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 5ef18a27..3e3cac53 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 367536a1..978cf548 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 d310c7af..7e520641 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 b1301676..51710eb2 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 From 7445d303e0cbdcee7843a54634f7d3e897b3dec6 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 6 Nov 2014 10:56:44 +0000 Subject: [PATCH 4/7] Wrap when copy mode is used for output, from Balazs Kezes. --- window-copy.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/window-copy.c b/window-copy.c index 51710eb2..01b98241 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; From 3c12b477d3563057a55026f4f4583f12537d9096 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 7 Nov 2014 12:28:28 +0000 Subject: [PATCH 5/7] V should be vi not emacs, also sort. From Theo Buehler. --- tmux.1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tmux.1 b/tmux.1 index 978cf548..f13bdf06 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->" From c6129f9c09ddc08d24640eeff1aa3082535f13c1 Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 8 Nov 2014 12:50:38 +0000 Subject: [PATCH 6/7] Empty strings should be false too for #{?}, from Marc Finet. --- format.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/format.c b/format.c index 441e61be..72991047 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) From 8f1302282b02f07e0868fbcdb79bb5404010ad4e Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 8 Nov 2014 12:58:31 +0000 Subject: [PATCH 7/7] 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 badabd56..f96a2d9e 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 37e2b548..e38c9f53 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);