The characters used in choice-mode are hardcoded. This option allows one to use
custom characters (and order) based on one's preference. Also, added description
to the man page.

Signed-off-by: Raghavendra D Prabhu <rpra...@wnohang.net>
---
 options-table.c |  7 +++++++
 tmux.1          |  2 ++
 window-choose.c | 13 ++++++-------
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/options-table.c b/options-table.c
index 8ce838a..c2ef30c 100644
--- a/options-table.c
+++ b/options-table.c
@@ -108,6 +108,13 @@ const struct options_table_entry session_options_table[] = 
{
          .default_num = 0
        },
 
+       { .name = "choice-characters",
+         .type = OPTIONS_TABLE_STRING,
+         .default_str = "0123456789"
+                        "abcdefghijklmnopqrstuvwxyz"
+                        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+       },
+
        { .name = "default-command",
          .type = OPTIONS_TABLE_STRING,
          .default_str = ""
diff --git a/tmux.1 b/tmux.1
index 7f081c0..adb2a27 100644
--- a/tmux.1
+++ b/tmux.1
@@ -2046,6 +2046,8 @@ window of that session,
 means all bells are ignored and
 .Ic current
 means only bells in windows other than the current window are ignored.
+.It Ic choice-characters Ar string
+String of characters which will be used for selecting in choice-mode.
 .It Xo Ic bell-on-alert
 .Op Ic on | off
 .Xc
diff --git a/window-choose.c b/window-choose.c
index 5bcca17..3368c66 100644
--- a/window-choose.c
+++ b/window-choose.c
@@ -702,10 +702,9 @@ window_choose_write_line(
 int
 window_choose_key_index(struct window_choose_mode_data *data, u_int idx)
 {
-       static const char       keys[] = "0123456789"
-                                        "abcdefghijklmnopqrstuvwxyz"
-                                        "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-       const char             *ptr;
+       struct options          *oo = &global_s_options;
+       char                    *keys = options_get_string(oo, 
"choice-characters");
+       const char              *ptr;
        int                     mkey;
 
        for (ptr = keys; *ptr != '\0'; ptr++) {
@@ -721,9 +720,9 @@ window_choose_key_index(struct window_choose_mode_data 
*data, u_int idx)
 int
 window_choose_index_key(struct window_choose_mode_data *data, int key)
 {
-       static const char       keys[] = "0123456789"
-                                        "abcdefghijklmnopqrstuvwxyz"
-                                        "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+       struct options          *oo = &global_s_options;
+       char                    *keys = options_get_string(oo, 
"choice-characters");
+
        const char             *ptr;
        int                     mkey;
        u_int                   idx = 0;
-- 
1.8.0


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to