Skip to content

Commit

Permalink
Fix selection join
Browse files Browse the repository at this point in the history
Number of characters isn't same as number of bytes.
  • Loading branch information
tihirvon committed Apr 6, 2014
1 parent 0b12d3a commit 990e12d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions edit.c
Expand Up @@ -395,11 +395,11 @@ static void join_selection(void)
bi = view->cursor;

begin_change_chain();
while (count) {
while (count > 0) {
if (!len)
view->cursor = bi;

buffer_next_char(&bi, &ch);
count -= buffer_next_char(&bi, &ch);
if (ch == '\t' || ch == ' ') {
len++;
} else if (ch == '\n') {
Expand All @@ -416,7 +416,6 @@ static void join_selection(void)
len = 0;
join = 0;
}
count--;
}

/* don't replace last \n which is at end of the selection */
Expand Down

0 comments on commit 990e12d

Please sign in to comment.