Discussion:
[PATCH 1/2] Move pane-{active, }-border-{style, fg, bg} options to window
Marc Finet
2014-11-08 10:40:51 UTC
Permalink
It could be useful to configure pane border style per window,
especially when linked to synchronise-pane feature. Even if entries
are not exactly sorted (i.e. after pane-base-index), they are at
least grouped together.
---
options-table.c | 68 ++++++++++++++++++++++++++++-----------------------------
screen-redraw.c | 2 +-
tmux.1 | 34 +++++++++++++++--------------
3 files changed, 53 insertions(+), 51 deletions(-)

diff --git a/options-table.c b/options-table.c
index 8d680b3..c3c5957 100644
--- a/options-table.c
+++ b/options-table.c
@@ -274,40 +274,6 @@ const struct options_table_entry session_options_table[] = {
.default_num = 0
},

- { .name = "pane-active-border-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 8,
- .style = "pane-active-border-style"
- },
-
- { .name = "pane-active-border-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 2,
- .style = "pane-active-border-style"
- },
-
- { .name = "pane-active-border-style",
- .type = OPTIONS_TABLE_STYLE,
- .default_str = "fg=green"
- },
-
- { .name = "pane-border-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 8,
- .style = "pane-border-style"
- },
-
- { .name = "pane-border-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 8,
- .style = "pane-border-style"
- },
-
- { .name = "pane-border-style",
- .type = OPTIONS_TABLE_STYLE,
- .default_str = "default"
- },
-
{ .name = "prefix",
.type = OPTIONS_TABLE_KEY,
.default_num = '\002',
@@ -652,6 +618,40 @@ const struct options_table_entry window_options_table[] = {
.default_num = 0
},

+ { .name = "pane-active-border-bg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8,
+ .style = "pane-active-border-style"
+ },
+
+ { .name = "pane-active-border-fg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 2,
+ .style = "pane-active-border-style"
+ },
+
+ { .name = "pane-active-border-style",
+ .type = OPTIONS_TABLE_STYLE,
+ .default_str = "fg=green"
+ },
+
+ { .name = "pane-border-bg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8,
+ .style = "pane-border-style"
+ },
+
+ { .name = "pane-border-fg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8,
+ .style = "pane-border-style"
+ },
+
+ { .name = "pane-border-style",
+ .type = OPTIONS_TABLE_STYLE,
+ .default_str = "default"
+ },
+
{ .name = "remain-on-exit",
.type = OPTIONS_TABLE_FLAG,
.default_num = 0
diff --git a/screen-redraw.c b/screen-redraw.c
index 6438034..e087dc6 100644
--- a/screen-redraw.c
+++ b/screen-redraw.c
@@ -275,7 +275,7 @@ void
screen_redraw_draw_borders(struct client *c, int status, u_int top)
{
struct window *w = c->session->curw->window;
- struct options *oo = &c->session->options;
+ struct options *oo = &w->options;
struct tty *tty = &c->tty;
struct window_pane *wp;
struct grid_cell active_gc, other_gc;
diff --git a/tmux.1 b/tmux.1
index 032e5be..b2bd330 100644
--- a/tmux.1
+++ b/tmux.1
@@ -2432,22 +2432,6 @@ window.
.Op Ic on | off
.Xc
If enabled, request mouse input as UTF-8 on UTF-8 terminals.
-.It Ic pane-active-border-style Ar style
-Set the pane border style for the currently active pane.
-For how to specify
-.Ar style ,
-see the
-.Ic message-command-style
-option.
-Attributes are ignored.
-.It Ic pane-border-style Ar style
-Set the pane border style for panes aside from the active pane.
-For how to specify
-.Ar style ,
-see the
-.Ic message-command-style
-option.
-Attributes are ignored.
.It Ic prefix Ar key
Set the key accepted as a prefix key.
.It Ic prefix2 Ar key
@@ -2888,6 +2872,24 @@ Like
.Ic base-index ,
but set the starting index for pane numbers.
.Pp
+.It Ic pane-active-border-style Ar style
+Set the pane border style for the currently active pane.
+For how to specify
+.Ar style ,
+see the
+.Ic message-command-style
+option.
+Attributes are ignored.
+.Pp
+.It Ic pane-border-style Ar style
+Set the pane border style for panes aside from the active pane.
+For how to specify
+.Ar style ,
+see the
+.Ic message-command-style
+option.
+Attributes are ignored.
+.Pp
.It Xo Ic remain-on-exit
.Op Ic on | off
.Xc
--
2.1.1


------------------------------------------------------------------------------
Marc Finet
2014-11-08 10:40:52 UTC
Permalink
This could be useful to have string for conditional e.g.
automatic-rename-format #{?pane_title,pane_title,pane_current_command}
This patch makes such an emptry string trigger the second value.
---
format.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/format.c b/format.c
index ba014b2..edced66 100644
--- a/format.c
+++ b/format.c
@@ -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] != '\0' &&
+ (value[0] != '0' || value[1] != '\0')) {
value = ptr + 1;
ptr = strchr(value, ',');
if (ptr == NULL)
--
2.1.1


------------------------------------------------------------------------------
Nicholas Marriott
2014-11-08 12:50:49 UTC
Permalink
Yes, applied, thanks
Post by Marc Finet
This could be useful to have string for conditional e.g.
automatic-rename-format #{?pane_title,pane_title,pane_current_command}
This patch makes such an emptry string trigger the second value.
---
format.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/format.c b/format.c
index ba014b2..edced66 100644
--- a/format.c
+++ b/format.c
@@ -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] != '\0' &&
+ (value[0] != '0' || value[1] != '\0')) {
value = ptr + 1;
ptr = strchr(value, ',');
if (ptr == NULL)
--
2.1.1
------------------------------------------------------------------------------
_______________________________________________
tmux-users mailing list
https://lists.sourceforge.net/lists/listinfo/tmux-users
------------------------------------------------------------------------------
Nicholas Marriott
2014-11-08 12:44:39 UTC
Permalink
Post by Marc Finet
It could be useful to configure pane border style per window,
Well, it could be useful but is it actually useful? Do you want to do
this or are you just doing it speculatively?
Post by Marc Finet
especially when linked to synchronise-pane feature. Even if entries
are not exactly sorted (i.e. after pane-base-index), they are at
least grouped together.
Yes, these should be sorted.
Post by Marc Finet
---
options-table.c | 68 ++++++++++++++++++++++++++++-----------------------------
screen-redraw.c | 2 +-
tmux.1 | 34 +++++++++++++++--------------
3 files changed, 53 insertions(+), 51 deletions(-)
diff --git a/options-table.c b/options-table.c
index 8d680b3..c3c5957 100644
--- a/options-table.c
+++ b/options-table.c
@@ -274,40 +274,6 @@ const struct options_table_entry session_options_table[] = {
.default_num = 0
},
- { .name = "pane-active-border-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 8,
- .style = "pane-active-border-style"
- },
-
- { .name = "pane-active-border-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 2,
- .style = "pane-active-border-style"
- },
-
- { .name = "pane-active-border-style",
- .type = OPTIONS_TABLE_STYLE,
- .default_str = "fg=green"
- },
-
- { .name = "pane-border-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 8,
- .style = "pane-border-style"
- },
-
- { .name = "pane-border-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 8,
- .style = "pane-border-style"
- },
-
- { .name = "pane-border-style",
- .type = OPTIONS_TABLE_STYLE,
- .default_str = "default"
- },
-
{ .name = "prefix",
.type = OPTIONS_TABLE_KEY,
.default_num = '\002',
@@ -652,6 +618,40 @@ const struct options_table_entry window_options_table[] = {
.default_num = 0
},
+ { .name = "pane-active-border-bg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8,
+ .style = "pane-active-border-style"
+ },
+
+ { .name = "pane-active-border-fg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 2,
+ .style = "pane-active-border-style"
+ },
+
+ { .name = "pane-active-border-style",
+ .type = OPTIONS_TABLE_STYLE,
+ .default_str = "fg=green"
+ },
+
+ { .name = "pane-border-bg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8,
+ .style = "pane-border-style"
+ },
+
+ { .name = "pane-border-fg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8,
+ .style = "pane-border-style"
+ },
+
+ { .name = "pane-border-style",
+ .type = OPTIONS_TABLE_STYLE,
+ .default_str = "default"
+ },
+
{ .name = "remain-on-exit",
.type = OPTIONS_TABLE_FLAG,
.default_num = 0
diff --git a/screen-redraw.c b/screen-redraw.c
index 6438034..e087dc6 100644
--- a/screen-redraw.c
+++ b/screen-redraw.c
@@ -275,7 +275,7 @@ void
screen_redraw_draw_borders(struct client *c, int status, u_int top)
{
struct window *w = c->session->curw->window;
- struct options *oo = &c->session->options;
+ struct options *oo = &w->options;
struct tty *tty = &c->tty;
struct window_pane *wp;
struct grid_cell active_gc, other_gc;
diff --git a/tmux.1 b/tmux.1
index 032e5be..b2bd330 100644
--- a/tmux.1
+++ b/tmux.1
@@ -2432,22 +2432,6 @@ window.
.Op Ic on | off
.Xc
If enabled, request mouse input as UTF-8 on UTF-8 terminals.
-.It Ic pane-active-border-style Ar style
-Set the pane border style for the currently active pane.
-For how to specify
-.Ar style ,
-see the
-.Ic message-command-style
-option.
-Attributes are ignored.
-.It Ic pane-border-style Ar style
-Set the pane border style for panes aside from the active pane.
-For how to specify
-.Ar style ,
-see the
-.Ic message-command-style
-option.
-Attributes are ignored.
.It Ic prefix Ar key
Set the key accepted as a prefix key.
.It Ic prefix2 Ar key
@@ -2888,6 +2872,24 @@ Like
.Ic base-index ,
but set the starting index for pane numbers.
.Pp
+.It Ic pane-active-border-style Ar style
+Set the pane border style for the currently active pane.
+For how to specify
+.Ar style ,
+see the
+.Ic message-command-style
+option.
+Attributes are ignored.
+.Pp
+.It Ic pane-border-style Ar style
+Set the pane border style for panes aside from the active pane.
+For how to specify
+.Ar style ,
+see the
+.Ic message-command-style
+option.
+Attributes are ignored.
+.Pp
.It Xo Ic remain-on-exit
.Op Ic on | off
.Xc
--
2.1.1
------------------------------------------------------------------------------
_______________________________________________
tmux-users mailing list
https://lists.sourceforge.net/lists/listinfo/tmux-users
------------------------------------------------------------------------------
Marc Finet
2014-11-08 14:38:13 UTC
Permalink
Post by Nicholas Marriott
Post by Marc Finet
It could be useful to configure pane border style per window,
Well, it could be useful but is it actually useful? Do you want to do
this or are you just doing it speculatively?
I use it for pane synchronization; i bound a key to activate pane-synchronization
and change pane border colors to better visualize that panes are synchronized.
While writing this I realize that I also change the window-status-current-bg but
it seems that it's applied to all the windows. I'll have a look at this later on.
Post by Nicholas Marriott
Post by Marc Finet
especially when linked to synchronise-pane feature. Even if entries
are not exactly sorted (i.e. after pane-base-index), they are at
least grouped together.
Yes, these should be sorted.
Ok, I'll rework that.
Post by Nicholas Marriott
Post by Marc Finet
---
options-table.c | 68
++++++++++++++++++++++++++++-----------------------------
screen-redraw.c | 2 +- tmux.1 | 34
+++++++++++++++-------------- 3 files changed, 53 insertions(+), 51
deletions(-)
diff --git a/options-table.c b/options-table.c
index 8d680b3..c3c5957 100644
--- a/options-table.c
+++ b/options-table.c
@@ -274,40 +274,6 @@ const struct options_table_entry
session_options_table[] = { .default_num = 0
},
- { .name = "pane-active-border-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 8,
- .style = "pane-active-border-style"
- },
-
- { .name = "pane-active-border-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 2,
- .style = "pane-active-border-style"
- },
-
- { .name = "pane-active-border-style",
- .type = OPTIONS_TABLE_STYLE,
- .default_str = "fg=green"
- },
-
- { .name = "pane-border-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 8,
- .style = "pane-border-style"
- },
-
- { .name = "pane-border-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 8,
- .style = "pane-border-style"
- },
-
- { .name = "pane-border-style",
- .type = OPTIONS_TABLE_STYLE,
- .default_str = "default"
- },
-
{ .name = "prefix",
.type = OPTIONS_TABLE_KEY,
.default_num = '\002',
@@ -652,6 +618,40 @@ const struct options_table_entry
window_options_table[] = { .default_num = 0
},
+ { .name = "pane-active-border-bg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8,
+ .style = "pane-active-border-style"
+ },
+
+ { .name = "pane-active-border-fg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 2,
+ .style = "pane-active-border-style"
+ },
+
+ { .name = "pane-active-border-style",
+ .type = OPTIONS_TABLE_STYLE,
+ .default_str = "fg=green"
+ },
+
+ { .name = "pane-border-bg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8,
+ .style = "pane-border-style"
+ },
+
+ { .name = "pane-border-fg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8,
+ .style = "pane-border-style"
+ },
+
+ { .name = "pane-border-style",
+ .type = OPTIONS_TABLE_STYLE,
+ .default_str = "default"
+ },
+
{ .name = "remain-on-exit",
.type = OPTIONS_TABLE_FLAG,
.default_num = 0
diff --git a/screen-redraw.c b/screen-redraw.c
index 6438034..e087dc6 100644
--- a/screen-redraw.c
+++ b/screen-redraw.c
@@ -275,7 +275,7 @@ void
screen_redraw_draw_borders(struct client *c, int status, u_int top)
{
struct window *w = c->session->curw->window;
- struct options *oo = &c->session->options;
+ struct options *oo = &w->options;
struct tty *tty = &c->tty;
struct window_pane *wp;
struct grid_cell active_gc, other_gc;
diff --git a/tmux.1 b/tmux.1
index 032e5be..b2bd330 100644
--- a/tmux.1
+++ b/tmux.1
@@ -2432,22 +2432,6 @@ window.
.Op Ic on | off
.Xc
If enabled, request mouse input as UTF-8 on UTF-8 terminals.
-.It Ic pane-active-border-style Ar style
-Set the pane border style for the currently active pane.
-For how to specify
-.Ar style ,
-see the
-.Ic message-command-style
-option.
-Attributes are ignored.
-.It Ic pane-border-style Ar style
-Set the pane border style for panes aside from the active pane.
-For how to specify
-.Ar style ,
-see the
-.Ic message-command-style
-option.
-Attributes are ignored.
.It Ic prefix Ar key
Set the key accepted as a prefix key.
.It Ic prefix2 Ar key
@@ -2888,6 +2872,24 @@ Like
.Ic base-index ,
but set the starting index for pane numbers.
.Pp
+.It Ic pane-active-border-style Ar style
+Set the pane border style for the currently active pane.
+For how to specify
+.Ar style ,
+see the
+.Ic message-command-style
+option.
+Attributes are ignored.
+.Pp
+.It Ic pane-border-style Ar style
+Set the pane border style for panes aside from the active pane.
+For how to specify
+.Ar style ,
+see the
+.Ic message-command-style
+option.
+Attributes are ignored.
+.Pp
.It Xo Ic remain-on-exit
.Op Ic on | off
.Xc
--
2.1.1
------------------------------------------------------------------------------
_______________________________________________
tmux-users mailing list
https://lists.sourceforge.net/lists/listinfo/tmux-users
------------------------------------------------------------------------------
Marc Finet
2014-11-11 09:03:40 UTC
Permalink
v2: keep entries alphabetically sorted both in code and in tmux.1

It is useful to configure pane border style per window,
especially to reflect a setting linked to a window such as pane
synchronization.
---
options-table.c | 68 ++++++++++++++++++++++++++++-----------------------------
screen-redraw.c | 2 +-
tmux.1 | 34 +++++++++++++++--------------
3 files changed, 53 insertions(+), 51 deletions(-)

diff --git a/options-table.c b/options-table.c
index 8d680b3..a9baa31 100644
--- a/options-table.c
+++ b/options-table.c
@@ -274,40 +274,6 @@ const struct options_table_entry session_options_table[] = {
.default_num = 0
},

- { .name = "pane-active-border-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 8,
- .style = "pane-active-border-style"
- },
-
- { .name = "pane-active-border-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 2,
- .style = "pane-active-border-style"
- },
-
- { .name = "pane-active-border-style",
- .type = OPTIONS_TABLE_STYLE,
- .default_str = "fg=green"
- },
-
- { .name = "pane-border-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 8,
- .style = "pane-border-style"
- },
-
- { .name = "pane-border-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .default_num = 8,
- .style = "pane-border-style"
- },
-
- { .name = "pane-border-style",
- .type = OPTIONS_TABLE_STYLE,
- .default_str = "default"
- },
-
{ .name = "prefix",
.type = OPTIONS_TABLE_KEY,
.default_num = '\002',
@@ -645,6 +611,23 @@ const struct options_table_entry window_options_table[] = {
.default_num = 0
},

+ { .name = "pane-active-border-bg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8,
+ .style = "pane-active-border-style"
+ },
+
+ { .name = "pane-active-border-fg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 2,
+ .style = "pane-active-border-style"
+ },
+
+ { .name = "pane-active-border-style",
+ .type = OPTIONS_TABLE_STYLE,
+ .default_str = "fg=green"
+ },
+
{ .name = "pane-base-index",
.type = OPTIONS_TABLE_NUMBER,
.minimum = 0,
@@ -652,6 +635,23 @@ const struct options_table_entry window_options_table[] = {
.default_num = 0
},

+ { .name = "pane-border-bg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8,
+ .style = "pane-border-style"
+ },
+
+ { .name = "pane-border-fg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8,
+ .style = "pane-border-style"
+ },
+
+ { .name = "pane-border-style",
+ .type = OPTIONS_TABLE_STYLE,
+ .default_str = "default"
+ },
+
{ .name = "remain-on-exit",
.type = OPTIONS_TABLE_FLAG,
.default_num = 0
diff --git a/screen-redraw.c b/screen-redraw.c
index 6438034..e087dc6 100644
--- a/screen-redraw.c
+++ b/screen-redraw.c
@@ -275,7 +275,7 @@ void
screen_redraw_draw_borders(struct client *c, int status, u_int top)
{
struct window *w = c->session->curw->window;
- struct options *oo = &c->session->options;
+ struct options *oo = &w->options;
struct tty *tty = &c->tty;
struct window_pane *wp;
struct grid_cell active_gc, other_gc;
diff --git a/tmux.1 b/tmux.1
index 032e5be..63d5fe3 100644
--- a/tmux.1
+++ b/tmux.1
@@ -2432,22 +2432,6 @@ window.
.Op Ic on | off
.Xc
If enabled, request mouse input as UTF-8 on UTF-8 terminals.
-.It Ic pane-active-border-style Ar style
-Set the pane border style for the currently active pane.
-For how to specify
-.Ar style ,
-see the
-.Ic message-command-style
-option.
-Attributes are ignored.
-.It Ic pane-border-style Ar style
-Set the pane border style for panes aside from the active pane.
-For how to specify
-.Ar style ,
-see the
-.Ic message-command-style
-option.
-Attributes are ignored.
.It Ic prefix Ar key
Set the key accepted as a prefix key.
.It Ic prefix2 Ar key
@@ -2883,11 +2867,29 @@ but set the width of other panes in the
.Ic main-vertical
layout.
.Pp
+.It Ic pane-active-border-style Ar style
+Set the pane border style for the currently active pane.
+For how to specify
+.Ar style ,
+see the
+.Ic message-command-style
+option.
+Attributes are ignored.
+.Pp
.It Ic pane-base-index Ar index
Like
.Ic base-index ,
but set the starting index for pane numbers.
.Pp
+.It Ic pane-border-style Ar style
+Set the pane border style for panes aside from the active pane.
+For how to specify
+.Ar style ,
+see the
+.Ic message-command-style
+option.
+Attributes are ignored.
+.Pp
.It Xo Ic remain-on-exit
.Op Ic on | off
.Xc
--
2.1.1
Loading...