diff options
-rw-r--r-- | smenu.1 | 9 | ||||
-rw-r--r-- | smenu.c | 23 | ||||
-rw-r--r-- | smenu.h | 3 | ||||
-rw-r--r-- | usage.c | 2 |
4 files changed, 32 insertions, 5 deletions
@@ -83,6 +83,7 @@ and outputs the selection to stdout. \fInew_button_3\fP] [\fB-dc\fP|\fB-dcd\fP|\fB-double_click\fP|\fB-double_click_delay\fP \ \fIdelay_in_ms\fP] + [\fB-sb\fP|\fB-sbw\fP|\fB-show_blank_words\fP] selectors ::= \fIcol1\fP[-\fIcol2\fP],...|\fIrow1\fP[-\fIrow2\fP],...|\ @@ -1959,6 +1960,14 @@ The double-click capability can also be disabled by setting This setting is also configurable in a configuration file, see the [mouse] section in the example in the configuration sub-section. +.IP "\fB-sb\fP|\fB-sbw\fP|\fB-show_blank_words\fP" +(Allowed in all contexts.) + +Normally, blank words (words containing only space:.!fmt +s) are only kept in column mode. +When this option is present, these words are converted into a sequence +of underscores so that they are visible and not ignored when not in +column mode. .SH NOTES If tabulators (\fI\\t\fP) are embedded in the input, there is no way to replace them with the original number of spaces. @@ -1791,7 +1791,10 @@ parse_selectors(char * str, filters_t * filter, char * unparsed, default: if (!isgraph(c)) + { + my_strcpy(unparsed, str); return; + } type = IN; *filter = INCLUDE_FILTER; @@ -2938,8 +2941,10 @@ expand(char * src, char * dest, langinfo_t * langinfo, toggle_t * toggles, default: if (my_isprint(c)) { - *(ptr++) = c; - all_spaces = 0; + if (c != ' ') + all_spaces = 0; + + *(ptr++) = c; } else { @@ -2958,8 +2963,8 @@ expand(char * src, char * dest, langinfo_t * langinfo, toggle_t * toggles, /* If the word contains only spaces, replace them */ /* by underscores so that it can be seen. */ /* """""""""""""""""""""""""""""""""""""""""""""" */ - if (all_spaces) - memset(dest, ' ', len); + if (toggles->show_blank_words && all_spaces) + memset(dest, '_', len); *ptr = '\0'; /* Ensure that dest has a nul terminator. */ @@ -5594,6 +5599,7 @@ init_main_ds(attrib_t * init_attr, win_t * win, limit_t * limits, toggles->visual_bell = 0; toggles->incremental_search = 0; toggles->no_mouse = 0; + toggles->show_blank_words = 0; /* Misc default values. */ /* """""""""""""""""""" */ @@ -5864,6 +5870,8 @@ toggle_action(char * ctx_name, char * opt_name, char * param, int nb_values, toggles->incremental_search = 1; else if (strcmp(opt_name, "no_mouse") == 0) toggles->no_mouse = 1; + else if (strcmp(opt_name, "show_blank_words") == 0) + toggles->show_blank_words = 1; } void @@ -7763,7 +7771,8 @@ main(int argc, char * argv[]) "[forgotten_timeout #timeout] " "[double_click_delay #delay] " "[button_remapping #mapping...] " - "[no_mouse] "; /* don't remove this space! */ + "[no_mouse] " + "[show_blank_words] "; /* don't remove this space! */ main_spec_options = "[*copyright] " "[*version] " @@ -7930,6 +7939,8 @@ main(int argc, char * argv[]) "-br -buttons -button_remapping"); ctxopt_add_opt_settings(parameters, "double_click_delay", "-dc -dcd -double_click -double_click_delay"); + ctxopt_add_opt_settings(parameters, "show_blank_words", + "-sb -sbw -show_blank_words"); /* ctxopt options incompatibilities. */ /* """"""""""""""""""""""""""""""""" */ @@ -8093,6 +8104,8 @@ main(int argc, char * argv[]) &mouse, &disable_double_click, (char *)0); ctxopt_add_opt_settings(actions, "no_mouse", toggle_action, &toggles, (char *)0); + ctxopt_add_opt_settings(actions, "show_blank_words", toggle_action, &toggles, + (char *)0); /* ctxopt constraints. */ /* """"""""""""""""""" */ @@ -199,6 +199,9 @@ struct toggle_s | 0 keeps it forgetful. */ int no_mouse; /* 1 to disable the possibly auto-detected * | mouse, 0 to let smenu auto-detect it. */ + int show_blank_words; /* 1 if blank words are allowed then they will * + | be filled by an underscore, 0 to leave them * + | blank. */ }; /* Structure to store the default or imposed smenu limits. */ @@ -106,6 +106,8 @@ common_help(void) printf(" Remaps the left and right mouse buttons, default is 1 and 3.\n"); printf("-dc|-dcd|-double_click|-double_click_delay\n"); printf(" Change the mouse double-click delay which is 150 ms by default.\n"); + printf("-sb|-sbw|-show_blank_words\n"); + printf(" Make blank words visible and usable even in non column mode.\n"); } void |