Commit ee39d57e authored by Adam Rogoyski's avatar Adam Rogoyski
Browse files

- do_wrap() spaces between words fix.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@36 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 15 additions and 11 deletions
+15 -11
...@@ -703,18 +703,22 @@ assert (strlenpt(inptr->data) >= fill); ...@@ -703,18 +703,22 @@ assert (strlenpt(inptr->data) >= fill);
else { else {
/* Case 2a: cursor before word at wrap point. */ /* Case 2a: cursor before word at wrap point. */
if (current_x < current_word_start) { if (current_x < current_word_start) {
temp->data = nmalloc(strlen(&inptr->data[current_word_start]) + 1); temp->data = nmalloc(strlen(&inptr->data[current_word_start]) + 1);
strcpy(temp->data, &inptr->data[current_word_start]); strcpy(temp->data, &inptr->data[current_word_start]);
/* Do this in either case, else words after current_x if (!isspace(input_char)) {
get chopped... */ i = current_word_start - 1;
i = current_word_start - 1; while (isspace(inptr->data[i])) {
while (isspace(inptr->data[i])) { i--;
i--; assert (i >= 0);
assert (i >= 0); }
} }
else if (current_x <= last_word_end)
i = last_word_end - 1;
else
i = current_x - 1;
inptr->data = nrealloc(inptr->data, i + 2); inptr->data = nrealloc(inptr->data, i + 2);
inptr->data[i + 1] = 0; inptr->data[i + 1] = 0;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment