diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-05-06 22:20:02 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-05-06 22:20:02 +0200 |
commit | 4f5d1717992ea726bc38edf88407d0512adfacf9 (patch) | |
tree | ad49bb172539fe45ca5a954aba08b85e555f6f47 | |
parent | 894c45bef4de37d2f035ba064c9b2d57c7820255 (diff) | |
download | xK-4f5d1717992ea726bc38edf88407d0512adfacf9.tar.gz xK-4f5d1717992ea726bc38edf88407d0512adfacf9.tar.xz xK-4f5d1717992ea726bc38edf88407d0512adfacf9.zip |
degesch: add constant for word breaking characters
-rw-r--r-- | degesch.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -17,9 +17,6 @@ * */ -/// Some arbitrary limit for the history file -#define HISTORY_LIMIT 10000 - // A table of all attributes we use for output #define ATTR_TABLE(XX) \ XX( PROMPT, "prompt", "Terminal attributes for the prompt" ) \ @@ -78,6 +75,12 @@ enum #include <histedit.h> #endif // HAVE_EDITLINE +/// Some arbitrary limit for the history file +#define HISTORY_LIMIT 10000 + +/// Characters that separate words +#define WORD_BREAKING_CHARS " \f\n\r\t\v" + // --- User interface ---------------------------------------------------------- // I'm not sure which one of these backends is worse: whether it's GNU Readline @@ -229,8 +232,7 @@ input_start (struct input *self, const char *program_name) rl_startup_hook = app_readline_init; rl_catch_sigwinch = false; - // TODO: global constant - rl_basic_word_break_characters = " \t"; + rl_basic_word_break_characters = WORD_BREAKING_CHARS; rl_completer_word_break_characters = NULL; rl_attempted_completion_function = app_readline_completion; @@ -3923,9 +3925,9 @@ static char * cut_word (char **s) { char *start = *s; - size_t word_len = strcspn (*s, " \t"); + size_t word_len = strcspn (*s, WORD_BREAKING_CHARS); char *end = start + word_len; - *s = end + strspn (end, " \t"); + *s = end + strspn (end, WORD_BREAKING_CHARS); *end = '\0'; return start; } |