summaryrefslogtreecommitdiffstats
path: root/options-table.c
diff options
context:
space:
mode:
authornicm <nicm>2019-03-18 20:53:33 +0000
committernicm <nicm>2019-03-18 20:53:33 +0000
commit979313832ce1d5f6cdc2c512e8524d6c517422e0 (patch)
tree13768e951adacd7c96b493a84fb5e65838ef94ed /options-table.c
parentd738d5168804405240a3f36b6f410baee39cd9e0 (diff)
Extend the #[] style syntax and use that together with previous format
changes to allow the status line to be entirely configured with a single option. Now that it is possible to configure their content, enable the existing code that lets the status line be multiple lines in height. The status option can now take a value of 2, 3, 4 or 5 (as well as the previous on or off) to configure more than one line. The new status-format array option configures the format of each line, the default just references the existing status-* options, although some of the more obscure status options may be eliminated in time. Additions to the #[] syntax are: "align" to specify alignment (left, centre, right), "list" for the window list and "range" to configure ranges of text for the mouse bindings. The "align" keyword can also be used to specify alignment of entries in tree mode and the pane status lines.
Diffstat (limited to 'options-table.c')
-rw-r--r--options-table.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/options-table.c b/options-table.c
index 73d22b0a..a2a3ffe6 100644
--- a/options-table.c
+++ b/options-table.c
@@ -39,6 +39,9 @@ static const char *options_table_mode_keys_list[] = {
static const char *options_table_clock_mode_style_list[] = {
"12", "24", NULL
};
+static const char *options_table_status_list[] = {
+ "off", "on", "2", "3", "4", "5", NULL
+};
static const char *options_table_status_keys_list[] = {
"emacs", "vi", NULL
};
@@ -64,6 +67,46 @@ static const char *options_table_window_size_list[] = {
"largest", "smallest", "manual", NULL
};
+/* Status line format. */
+#define OPTIONS_TABLE_STATUS_FORMAT1 \
+ "#[align=left range=left #{status-left-style}]" \
+ "#{T;=/#{status-left-length}:status-left}#[norange default]" \
+ "#[list=on align=#{status-justify}]" \
+ "#[list=left-marker]<#[list=right-marker]>#[list=on]" \
+ "#{W:" \
+ "#[range=window|#{window_index}" \
+ "#{?window_last_flag, #{window-status-last-style},}" \
+ "#{?window_bell_flag," \
+ " #{window-status-bell-style}," \
+ "#{?window_activity_flag," \
+ " #{window-status-activity-style},}" \
+ "}" \
+ "]" \
+ "#{T:window-status-format}" \
+ "#[norange default]" \
+ "#{?window_end_flag,,#{window-status-separator}}" \
+ "," \
+ "#[range=window|#{window_index} list=focus" \
+ "#{?window_last_flag, #{window-status-last-style},}" \
+ "#{?window_bell_flag," \
+ " #{window-status-bell-style}," \
+ "#{?window_activity_flag," \
+ " #{window-status-activity-style},}" \
+ "}" \
+ "]" \
+ "#{T:window-status-current-format}" \
+ "#[norange list=on default]" \
+ "#{?window_end_flag,,#{window-status-separator}}" \
+ "}" \
+ "#[nolist align=right range=right #{status-right-style}]" \
+ "#{T;=/#{status-right-length}:status-right}#[norange default]"
+#define OPTIONS_TABLE_STATUS_FORMAT2 \
+ "#[align=centre]#{P:#{?pane_active,#[reverse],}" \
+ "#{pane_index}[#{pane_width}x#{pane_height}]#[default] }"
+static const char *options_table_status_format_default[] = {
+ OPTIONS_TABLE_STATUS_FORMAT1, OPTIONS_TABLE_STATUS_FORMAT2, NULL
+};
+
/* Top-level options. */
const struct options_table_entry options_table[] = {
{ .name = "buffer-limit",
@@ -378,8 +421,9 @@ const struct options_table_entry options_table[] = {
},
{ .name = "status",
- .type = OPTIONS_TABLE_FLAG,
+ .type = OPTIONS_TABLE_CHOICE,
.scope = OPTIONS_TABLE_SESSION,
+ .choices = options_table_status_list,
.default_num = 1
},
@@ -404,6 +448,12 @@ const struct options_table_entry options_table[] = {
.style = "status-style"
},
+ { .name = "status-format",
+ .type = OPTIONS_TABLE_ARRAY,
+ .scope = OPTIONS_TABLE_SESSION,
+ .default_arr = options_table_status_format_default,
+ },
+
{ .name = "status-interval",
.type = OPTIONS_TABLE_NUMBER,
.scope = OPTIONS_TABLE_SESSION,