aboutsummaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-05-06 22:20:02 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-05-06 22:20:02 +0200
commit4f5d1717992ea726bc38edf88407d0512adfacf9 (patch)
treead49bb172539fe45ca5a954aba08b85e555f6f47 /degesch.c
parent894c45bef4de37d2f035ba064c9b2d57c7820255 (diff)
downloadxK-4f5d1717992ea726bc38edf88407d0512adfacf9.tar.gz
xK-4f5d1717992ea726bc38edf88407d0512adfacf9.tar.xz
xK-4f5d1717992ea726bc38edf88407d0512adfacf9.zip
degesch: add constant for word breaking characters
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c16
1 files changed, 9 insertions, 7 deletions
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 <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;
}