diff --git a/degesch.c b/degesch.c index 0b7ee9c..98e4713 100644 --- a/degesch.c +++ b/degesch.c @@ -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 #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; }