Skip to content

Commit

Permalink
Merge branch 'obsd-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasAdam committed Nov 9, 2014
2 parents 747cab4 + 8f13022 commit fc05bf2
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 94 deletions.
4 changes: 1 addition & 3 deletions cmd-paste-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,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);
Expand All @@ -75,8 +74,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. */
Expand Down
3 changes: 2 additions & 1 deletion format.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,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)
Expand Down
4 changes: 2 additions & 2 deletions grid-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
24 changes: 11 additions & 13 deletions input-keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,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) {
/*
Expand Down Expand Up @@ -237,19 +238,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);
}
}
1 change: 1 addition & 0 deletions mode-key.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
4 changes: 2 additions & 2 deletions options-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,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",
Expand Down Expand Up @@ -430,7 +430,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",
Expand Down
4 changes: 2 additions & 2 deletions paste.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,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);
Expand All @@ -314,6 +314,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);
}
2 changes: 0 additions & 2 deletions screen-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,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. */
Expand Down
18 changes: 7 additions & 11 deletions status.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -300,10 +300,8 @@ status_redraw(struct client *c)

/* 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)
Expand All @@ -313,21 +311,19 @@ status_redraw(struct client *c)

/* 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) {
Expand Down
16 changes: 10 additions & 6 deletions tmux.1
Original file line number Diff line number Diff line change
Expand Up @@ -879,10 +879,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"
Expand All @@ -896,12 +896,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 ""
Expand All @@ -910,8 +910,8 @@ 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"
Expand All @@ -920,6 +920,7 @@ The following keys are supported as appropriate for the mode:
.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->"
Expand Down Expand Up @@ -2585,6 +2586,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
Expand Down
6 changes: 6 additions & 0 deletions tmux.h
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,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;
Expand Down
Loading

0 comments on commit fc05bf2

Please sign in to comment.