mirror of
https://github.com/tmux/tmux.git
synced 2026-06-22 13:26:58 +00:00
Can work out active pane itself.
This commit is contained in:
@@ -935,20 +935,6 @@ screen_redraw_draw_get_style_pane(struct redraw_scene *scene,
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Should this span use the active style? */
|
|
||||||
static int
|
|
||||||
screen_redraw_draw_border_active(struct redraw_scene *scene,
|
|
||||||
struct redraw_span *span)
|
|
||||||
{
|
|
||||||
struct window_pane *active = server_client_get_pane(scene->c);
|
|
||||||
|
|
||||||
if (span->data.type != REDRAW_SPAN_BORDER || active == NULL)
|
|
||||||
return (0);
|
|
||||||
if (span->data.b.style_wp != NULL)
|
|
||||||
return (span->data.b.style_wp == active);
|
|
||||||
return (screen_redraw_span_has_pane(span, active));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Draw arrow indicator if this border span is an arrow cell. */
|
/* Draw arrow indicator if this border span is an arrow cell. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_draw_border_arrow(struct redraw_scene *scene,
|
screen_redraw_draw_border_arrow(struct redraw_scene *scene,
|
||||||
@@ -991,7 +977,7 @@ screen_redraw_draw_border_span(struct redraw_scene *scene,
|
|||||||
struct grid_cell gc;
|
struct grid_cell gc;
|
||||||
enum pane_lines pane_lines;
|
enum pane_lines pane_lines;
|
||||||
u_int i, cell_type;
|
u_int i, cell_type;
|
||||||
int isolates = 0, active;
|
int isolates = 0;
|
||||||
|
|
||||||
if (span->data.type != REDRAW_SPAN_BORDER)
|
if (span->data.type != REDRAW_SPAN_BORDER)
|
||||||
cell_type = CELL_OUTSIDE;
|
cell_type = CELL_OUTSIDE;
|
||||||
@@ -1002,11 +988,10 @@ screen_redraw_draw_border_span(struct redraw_scene *scene,
|
|||||||
|
|
||||||
if (wp == NULL) {
|
if (wp == NULL) {
|
||||||
pane_lines = options_get_number(oo, "pane-border-lines");
|
pane_lines = options_get_number(oo, "pane-border-lines");
|
||||||
window_get_border_cell(w, NULL, pane_lines, cell_type, &gc);
|
|
||||||
screen_redraw_draw_get_default_style(scene, &gc);
|
screen_redraw_draw_get_default_style(scene, &gc);
|
||||||
|
window_get_border_cell(w, NULL, pane_lines, cell_type, &gc);
|
||||||
} else {
|
} else {
|
||||||
active = screen_redraw_draw_border_active(scene, span);
|
window_pane_get_border_style(wp, c, &gc);
|
||||||
window_pane_get_border_style(wp, c, active, &gc);
|
|
||||||
window_pane_get_border_cell(wp, cell_type, &gc);
|
window_pane_get_border_cell(wp, cell_type, &gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1353,11 +1338,16 @@ screen_redraw_draw(struct client *c, struct window_pane *wp, int flags)
|
|||||||
int
|
int
|
||||||
screen_redraw_get_span_cell_type(struct redraw_span *span, u_int x)
|
screen_redraw_get_span_cell_type(struct redraw_span *span, u_int x)
|
||||||
{
|
{
|
||||||
|
struct window_pane *wp = span->data.st.wp;
|
||||||
u_int start, end;
|
u_int start, end;
|
||||||
|
|
||||||
|
if (span->data.type != REDRAW_SPAN_STATUS)
|
||||||
|
return (CELL_LEFTRIGHT);
|
||||||
for (; span != NULL; span = TAILQ_NEXT(span, entry)) {
|
for (; span != NULL; span = TAILQ_NEXT(span, entry)) {
|
||||||
if (span->data.type != REDRAW_SPAN_STATUS)
|
if (span->data.type != REDRAW_SPAN_STATUS)
|
||||||
continue;
|
continue;
|
||||||
|
if (span->data.st.wp != wp)
|
||||||
|
continue;
|
||||||
|
|
||||||
start = span->data.st.offset;
|
start = span->data.st.offset;
|
||||||
end = start + span->width;
|
end = start + span->width;
|
||||||
|
|||||||
2
tmux.h
2
tmux.h
@@ -3540,7 +3540,7 @@ void window_get_border_cell(struct window *, struct window_pane *,
|
|||||||
void window_pane_get_border_cell(struct window_pane *, int,
|
void window_pane_get_border_cell(struct window_pane *, int,
|
||||||
struct grid_cell *);
|
struct grid_cell *);
|
||||||
void window_pane_get_border_style(struct window_pane *,
|
void window_pane_get_border_style(struct window_pane *,
|
||||||
struct client *, int, struct grid_cell *);
|
struct client *, struct grid_cell *);
|
||||||
void window_make_pane_status(struct window_pane *, struct client *,
|
void window_make_pane_status(struct window_pane *, struct client *,
|
||||||
u_int, struct redraw_span *);
|
u_int, struct redraw_span *);
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
|
|
||||||
/* Get border cell. */
|
/* Get border cell. */
|
||||||
@@ -82,7 +84,7 @@ window_pane_get_border_cell(struct window_pane *wp, int cell_type,
|
|||||||
/* Get pane border style. */
|
/* Get pane border style. */
|
||||||
void
|
void
|
||||||
window_pane_get_border_style(struct window_pane *wp, struct client *c,
|
window_pane_get_border_style(struct window_pane *wp, struct client *c,
|
||||||
int active, struct grid_cell *gc)
|
struct grid_cell *gc)
|
||||||
{
|
{
|
||||||
struct session *s = c->session;
|
struct session *s = c->session;
|
||||||
struct format_tree *ft;
|
struct format_tree *ft;
|
||||||
@@ -90,7 +92,7 @@ window_pane_get_border_style(struct window_pane *wp, struct client *c,
|
|||||||
struct grid_cell *saved;
|
struct grid_cell *saved;
|
||||||
int *flag;
|
int *flag;
|
||||||
|
|
||||||
if (active) {
|
if (wp == server_client_get_pane(c)) {
|
||||||
flag = &wp->active_border_gc_set;
|
flag = &wp->active_border_gc_set;
|
||||||
saved = &wp->active_border_gc;
|
saved = &wp->active_border_gc;
|
||||||
option = "pane-active-border-style";
|
option = "pane-active-border-style";
|
||||||
@@ -115,7 +117,7 @@ window_make_pane_status(struct window_pane *wp, struct client *c, u_int width,
|
|||||||
struct redraw_span *span)
|
struct redraw_span *span)
|
||||||
{
|
{
|
||||||
struct grid_cell gc;
|
struct grid_cell gc;
|
||||||
const char *fmt, *border_option;
|
const char *fmt;
|
||||||
struct format_tree *ft;
|
struct format_tree *ft;
|
||||||
struct style_line_entry *sle = &wp->border_status_line;
|
struct style_line_entry *sle = &wp->border_status_line;
|
||||||
struct screen_write_ctx ctx;
|
struct screen_write_ctx ctx;
|
||||||
@@ -130,20 +132,17 @@ window_make_pane_status(struct window_pane *wp, struct client *c, u_int width,
|
|||||||
ft = format_create(c, NULL, FORMAT_PANE|wp->id, FORMAT_STATUS);
|
ft = format_create(c, NULL, FORMAT_PANE|wp->id, FORMAT_STATUS);
|
||||||
format_defaults(ft, c, c->session, c->session->curw, wp);
|
format_defaults(ft, c, c->session, c->session->curw, wp);
|
||||||
|
|
||||||
if (wp == server_client_get_pane(c))
|
|
||||||
border_option = "pane-active-border-style";
|
|
||||||
else
|
|
||||||
border_option = "pane-border-style";
|
|
||||||
style_apply(&gc, wp->options, border_option, ft);
|
|
||||||
|
|
||||||
fmt = options_get_string(wp->options, "pane-border-format");
|
fmt = options_get_string(wp->options, "pane-border-format");
|
||||||
expanded = format_expand_time(ft, fmt);
|
expanded = format_expand_time(ft, fmt);
|
||||||
|
|
||||||
|
screen_free(&wp->status_screen);
|
||||||
screen_init(&wp->status_screen, width, 1, 0);
|
screen_init(&wp->status_screen, width, 1, 0);
|
||||||
wp->status_screen.mode = 0;
|
wp->status_screen.mode = 0;
|
||||||
|
|
||||||
screen_write_start(&ctx, &wp->status_screen);
|
screen_write_start(&ctx, &wp->status_screen);
|
||||||
|
|
||||||
|
window_pane_get_border_style(wp, c, &gc);
|
||||||
for (i = 0; i < width; i++) {
|
for (i = 0; i < width; i++) {
|
||||||
cell_type = screen_redraw_get_span_cell_type(span, i);
|
cell_type = screen_redraw_get_span_cell_type(span, i);
|
||||||
window_pane_get_border_cell(wp, cell_type, &gc);
|
window_pane_get_border_cell(wp, cell_type, &gc);
|
||||||
|
|||||||
Reference in New Issue
Block a user