--- examples/tmux.vim | 2 +- options-table.c | 5 +++++ screen-redraw.c | 38 +++++++++++++++++++++++++++----------- tmux.1 | 4 ++++ tty-term.c | 2 +- 5 files changed, 38 insertions(+), 13 deletions(-)
diff --git a/examples/tmux.vim b/examples/tmux.vim index 2e27d12..8a66c00 100644 --- a/examples/tmux.vim +++ b/examples/tmux.vim @@ -45,7 +45,7 @@ syn keyword tmuxCmds syn keyword tmuxOptsSet \ buffer-limit escape-time exit-unattached exit-unattached quiet - \ set-clipboard + \ set-clipboard pane-active-border-mark \ base-index bell-action bell-on-alert default-command default-path \ default-shell default-terminal destroy-unattached detach-on-destroy \ display-panes-[active-]colour display-[panes-]time history-limit diff --git a/options-table.c b/options-table.c index e3e4362..2762f8f 100644 --- a/options-table.c +++ b/options-table.c @@ -248,6 +248,11 @@ const struct options_table_entry session_options_table[] = { .default_num = 8 }, + { .name = "pane-active-border-mark", + .type = OPTIONS_TABLE_FLAG, + .default_num = 0 + }, + { .name = "pane-active-border-fg", .type = OPTIONS_TABLE_COLOUR, .default_num = 2 diff --git a/screen-redraw.c b/screen-redraw.c index 899f741..75f7238 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -42,6 +42,13 @@ void screen_redraw_draw_number(struct client *, struct window_pane *); #define CELL_OUTSIDE 12 #define CELL_BORDERS " xqlkmjwvtun~" +#define CELL_MARKERS " +, . -" + +#define BORDER_NONE 0 +#define BORDER_LEFT 1 +#define BORDER_RIGHT 2 +#define BORDER_TOP 4 +#define BORDER_BOTTOM 8 /* Check if cell is on the border of a particular pane. */ int @@ -55,21 +62,21 @@ screen_redraw_cell_border1(struct window_pane *wp, u_int px, u_int py) /* Left/right borders. */ if ((wp->yoff == 0 || py >= wp->yoff - 1) && py <= wp->yoff + wp->sy) { if (wp->xoff != 0 && px == wp->xoff - 1) - return (1); + return (BORDER_LEFT); if (px == wp->xoff + wp->sx) - return (1); + return (BORDER_RIGHT); } /* Top/bottom borders. */ if ((wp->xoff == 0 || px >= wp->xoff - 1) && px <= wp->xoff + wp->sx) { if (wp->yoff != 0 && py == wp->yoff - 1) - return (1); + return (BORDER_TOP); if (py == wp->yoff + wp->sy) - return (1); + return (BORDER_BOTTOM); } /* Outside pane. */ - return (-1); + return (BORDER_NONE); } /* Check if a cell is on the pane border. */ @@ -78,14 +85,13 @@ screen_redraw_cell_border(struct client *c, u_int px, u_int py) { struct window *w = c->session->curw->window; struct window_pane *wp; - int retval; /* Check all the panes. */ TAILQ_FOREACH(wp, &w->panes, entry) { if (!window_pane_visible(wp)) continue; - if ((retval = screen_redraw_cell_border1(wp, px, py)) != -1) - return (retval); + if (screen_redraw_cell_border1(wp, px, py) != BORDER_NONE) + return (1); } return (0); @@ -175,7 +181,7 @@ screen_redraw_screen(struct client *c, int status_only, int borders_only) struct window_pane *wp; struct grid_cell active_gc, other_gc; u_int i, j, type, top; - int status, spos, fg, bg; + int status, spos, fg, bg, border, marks; /* Suspended clients should not be updated. */ if (c->flags & CLIENT_SUSPENDED) @@ -215,6 +221,8 @@ screen_redraw_screen(struct client *c, int status_only, int borders_only) colour_set_bg(&active_gc, bg); /* Draw background and borders. */ + marks = options_get_number(oo, "pane-active-border-mark") ? + BORDER_LEFT|BORDER_RIGHT|BORDER_TOP|BORDER_BOTTOM : BORDER_NONE; for (j = 0; j < tty->sy - status; j++) { if (status_only) { if (spos == 1 && j != tty->sy - 1) @@ -226,12 +234,20 @@ screen_redraw_screen(struct client *c, int status_only, int borders_only) type = screen_redraw_check_cell(c, i, j); if (type == CELL_INSIDE) continue; - if (screen_redraw_cell_border1(w->active, i, j) == 1) + border = screen_redraw_cell_border1(w->active, i, j); + if (border != BORDER_NONE) tty_attributes(tty, &active_gc); else tty_attributes(tty, &other_gc); tty_cursor(tty, i, top + j); - tty_putc(tty, CELL_BORDERS[type]); + + if (border != BORDER_NONE && + (type == CELL_LEFTRIGHT || type == CELL_TOPBOTTOM) && + (marks & border) && i > 0 && top + j > 0) { + tty_putc(tty, CELL_MARKERS[border]); + marks &= ~border; + } else + tty_putc(tty, CELL_BORDERS[type]); } } diff --git a/tmux.1 b/tmux.1 index 28baf6c..15702c6 100644 --- a/tmux.1 +++ b/tmux.1 @@ -2242,6 +2242,10 @@ If enabled, request mouse input as UTF-8 on UTF-8 terminals. .It Ic pane-active-border-bg Ar colour .It Ic pane-active-border-fg Ar colour Set the pane border colour for the currently active pane. +.It Xo Ic pane-active-mark +.Op Ic on | off +.Xc +If on, the current pane will be indicated by arrow marks on its border. .It Ic pane-border-bg Ar colour .It Ic pane-border-fg Ar colour Set the pane border colour for panes aside from the active pane. diff --git a/tty-term.c b/tty-term.c index 0935b36..b9ddf72 100644 --- a/tty-term.c +++ b/tty-term.c @@ -432,7 +432,7 @@ tty_term_find(char *name, int fd, const char *overrides, char **cause) if (tty_term_has(term, TTYC_ACSC)) acs = tty_term_string(term, TTYC_ACSC); else - acs = "a#j+k+l+m+n+o-p-q-r-s-t+u+v+w+x|y<z>~."; + acs = "+>,<-^.va#j+k+l+m+n+o-p-q-r-s-t+u+v+w+x|y<z>~."; for (; acs[0] != '\0' && acs[1] != '\0'; acs += 2) term->acs[(u_char) acs[0]][0] = acs[1]; -- 1.7.10.4 ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://ad.doubleclick.net/clk;258768047;13503038;j? http://info.appdynamics.com/FreeJavaPerformanceDownload.html _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users