summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordx <dx@dxzone.com.ar>2015-11-23 13:08:13 -0300
committerdx <dx@dxzone.com.ar>2015-11-23 13:08:13 -0300
commit0ca0c882a578a6b82b9bad648b831da7b44421f1 (patch)
treefe58f3178e6e7c4b4a80ffece9819da286aa53f8 /src
parentf9654a7e0c0db48514e2b678a2f0ee4c61da39d9 (diff)
parent50fae4212ec5fbb9931093b1c31bbeda97ddfbb3 (diff)
downloadirssi-0ca0c882a578a6b82b9bad648b831da7b44421f1.zip
Merge pull request #360 from LemonBoy/backport-patch
Save a patch from the Flyspray oblivion, plus a nice unrelated commit to make everyone (un)happy
Diffstat (limited to 'src')
-rw-r--r--src/fe-text/gui-readline.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c
index dc7185e7..a8f3ba99 100644
--- a/src/fe-text/gui-readline.c
+++ b/src/fe-text/gui-readline.c
@@ -147,7 +147,6 @@ static void window_next_page(void)
static void paste_buffer_join_lines(GArray *buf)
{
-#define IS_WHITE(c) ((c) == ' ' || (c) == '\t')
unsigned int i, count, indent, line_len;
unichar *arr, *dest, *last_lf_pos;
int last_lf;
@@ -177,15 +176,15 @@ static void paste_buffer_join_lines(GArray *buf)
if (buf->len == 0)
return;
- arr = (unichar *) paste_buffer->data;
+ arr = (unichar *)buf->data;
/* first line */
- if (IS_WHITE(arr[0]))
+ if (isblank(arr[0]))
return;
/* find the first beginning of indented line */
for (i = 1; i < buf->len; i++) {
- if (arr[i-1] == '\n' && IS_WHITE(arr[i]))
+ if (arr[i-1] == '\n' && isblank(arr[i]))
break;
}
if (i == buf->len)
@@ -193,7 +192,7 @@ static void paste_buffer_join_lines(GArray *buf)
/* get how much indentation we have.. */
for (indent = 0; i < buf->len; i++, indent++) {
- if (!IS_WHITE(arr[i]))
+ if (!isblank(arr[i]))
break;
}
if (i == buf->len)
@@ -203,7 +202,7 @@ static void paste_buffer_join_lines(GArray *buf)
count = indent; last_lf = TRUE;
for (; i < buf->len; i++) {
if (last_lf) {
- if (IS_WHITE(arr[i]))
+ if (isblank(arr[i]))
count++;
else {
last_lf = FALSE;
@@ -220,11 +219,11 @@ static void paste_buffer_join_lines(GArray *buf)
get longer than 400 chars */
dest = arr; last_lf = TRUE; last_lf_pos = NULL; line_len = 0;
for (i = 0; i < buf->len; i++) {
- if (last_lf && IS_WHITE(arr[i])) {
+ if (last_lf && isblank(arr[i])) {
/* whitespace, ignore */
} else if (arr[i] == '\n') {
if (!last_lf && i+1 != buf->len &&
- IS_WHITE(arr[i+1])) {
+ isblank(arr[i+1])) {
last_lf_pos = dest;
*dest++ = ' ';
} else {