summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2011-11-05 09:06:32 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2011-11-05 09:06:32 +0000
commit006e44c46ea1a99a1e718d5382935c95617af23f (patch)
tree5adda9ac11eb4fc2166d739e64950559f8b1ad48 /usr.bin
parent9efa6517925c71a132a557fa65dc037aec41b8b5 (diff)
Option to change status line (message) background when using vi keys and
in command mode. From Ben Boeckel.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/options-table.c17
-rw-r--r--usr.bin/tmux/status.c20
-rw-r--r--usr.bin/tmux/tmux.110
3 files changed, 40 insertions, 7 deletions
diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c
index 9c26a7282a1..6ee9fe434cc 100644
--- a/usr.bin/tmux/options-table.c
+++ b/usr.bin/tmux/options-table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options-table.c,v 1.14 2011/10/27 22:54:06 nicm Exp $ */
+/* $OpenBSD: options-table.c,v 1.15 2011/11/05 09:06:31 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -194,6 +194,21 @@ const struct options_table_entry session_options_table[] = {
.default_num = 3
},
+ { .name = "message-command-attr",
+ .type = OPTIONS_TABLE_ATTRIBUTES,
+ .default_num = 0
+ },
+
+ { .name = "message-command-bg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 0
+ },
+
+ { .name = "message-command-fg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 3
+ },
+
{ .name = "message-fg",
.type = OPTIONS_TABLE_COLOUR,
.default_num = 0
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c
index 1507b4a63a8..e1590cfe7ca 100644
--- a/usr.bin/tmux/status.c
+++ b/usr.bin/tmux/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.78 2011/08/20 20:37:31 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.79 2011/11/05 09:06:31 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -919,9 +919,16 @@ status_prompt_redraw(struct client *c)
off = 0;
memcpy(&gc, &grid_default_cell, sizeof gc);
- colour_set_fg(&gc, options_get_number(&s->options, "message-fg"));
- colour_set_bg(&gc, options_get_number(&s->options, "message-bg"));
- gc.attr |= options_get_number(&s->options, "message-attr");
+ /* Change colours for command mode. */
+ if (c->prompt_mdata.mode == 1) {
+ colour_set_fg(&gc, options_get_number(&s->options, "message-command-fg"));
+ colour_set_bg(&gc, options_get_number(&s->options, "message-command-bg"));
+ gc.attr |= options_get_number(&s->options, "message-command-attr");
+ } else {
+ colour_set_fg(&gc, options_get_number(&s->options, "message-fg"));
+ colour_set_bg(&gc, options_get_number(&s->options, "message-bg"));
+ gc.attr |= options_get_number(&s->options, "message-attr");
+ }
screen_write_start(&ctx, NULL, &c->status);
@@ -977,7 +984,12 @@ status_prompt_key(struct client *c, int key)
c->flags |= CLIENT_STATUS;
}
break;
+ case MODEKEYEDIT_SWITCHMODE:
+ c->flags |= CLIENT_STATUS;
+ break;
case MODEKEYEDIT_SWITCHMODEAPPEND:
+ c->flags |= CLIENT_STATUS;
+ /* FALLTHROUGH */
case MODEKEYEDIT_CURSORRIGHT:
if (c->prompt_index < size) {
c->prompt_index++;
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 0db60b9a476..7611b242ef2 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.252 2011/10/27 23:33:35 jmc Exp $
+.\" $OpenBSD: tmux.1,v 1.253 2011/11/05 09:06:31 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 27 2011 $
+.Dd $Mdocdate: November 5 2011 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -1967,6 +1967,12 @@ from the 256-colour set,
or a hexadecimal RGB string such as
.Ql #ffffff ,
which chooses the closest match from the default 256-colour set.
+.It Ic message-command-attr Ar attributes
+Set status line message attributes when in command mode.
+.It Ic message-command-bg Ar colour
+Set status line message background colour when in command mode.
+.It Ic message-command-fg Ar colour
+Set status line message foreground colour when in command mode.
.It Ic message-fg Ar colour
Set status line message foreground colour.
.It Ic message-limit Ar number