summaryrefslogtreecommitdiff
path: root/src/fe-text
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-02-24 00:35:27 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-02-24 00:42:35 +0530
commit9f0e5da208f9ee775b82d50ff959d8599d1e1151 (patch)
tree526f2ae13c84824f468a4c34f9e6aa0e7d5e351f /src/fe-text
parent4650665ee482d4d7c3a44948070076d4fa2c745a (diff)
downloadirssi-9f0e5da208f9ee775b82d50ff959d8599d1e1151.zip
use a #define'd LINE_SPLIT_LIMIT instead of hardcoding 400
Diffstat (limited to 'src/fe-text')
-rw-r--r--src/fe-text/gui-readline.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c
index 0dd17394..51ccab5e 100644
--- a/src/fe-text/gui-readline.c
+++ b/src/fe-text/gui-readline.c
@@ -40,6 +40,9 @@
#include <string.h>
#include <signal.h>
+/* After LINE_SPLIT_LIMIT characters, the message will be split into multiple lines */
+#define LINE_SPLIT_LIMIT 400
+
typedef void (*ENTRY_REDIRECT_KEY_FUNC) (int key, void *data, SERVER_REC *server, WI_ITEM_REC *item);
typedef void (*ENTRY_REDIRECT_ENTRY_FUNC) (const char *line, void *data, SERVER_REC *server, WI_ITEM_REC *item);
@@ -227,7 +230,7 @@ static void paste_buffer_join_lines(GArray *buf)
}
/* all looks fine - now remove the whitespace, but don't let lines
- get longer than 400 chars */
+ get longer than LINE_SPLIT_LIMIT chars */
dest = arr; last_lf = TRUE; last_lf_pos = NULL; line_len = 0;
for (i = 0; i < buf->len; i++) {
if (last_lf && isblank(arr[i])) {
@@ -245,7 +248,7 @@ static void paste_buffer_join_lines(GArray *buf)
last_lf = TRUE;
} else {
last_lf = FALSE;
- if (++line_len >= 400 && last_lf_pos != NULL) {
+ if (++line_len >= LINE_SPLIT_LIMIT && last_lf_pos != NULL) {
memmove(last_lf_pos+1, last_lf_pos,
(dest - last_lf_pos) * sizeof(unichar));
*last_lf_pos = '\n'; last_lf_pos = NULL;