revert previous changes, as lines are broken on tabs regardless of goal

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3027 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-09-20 19:44:19 +00:00
parent 9c4488bf0c
commit 95ef337b1a
2 changed files with 4 additions and 9 deletions

View File

@ -317,9 +317,8 @@ CVS code -
do_enter() do_enter()
- Don't update the edit window until we set placewewant. (DLR) - Don't update the edit window until we set placewewant. (DLR)
break_line() break_line()
- Fix problems where a line could be broken in the middle of - Fix a problem where a line could be broken in the middle of a
a multibyte character, and goal could be miscalculated on lines multibyte character. (DLR)
containing tabs. (DLR)
do_word_count() do_word_count()
- Rename to do_wordlinechar_count(), and expand to also count - Rename to do_wordlinechar_count(), and expand to also count
the number of lines and characters in the file or selection, the number of lines and characters in the file or selection,

View File

@ -570,16 +570,12 @@ ssize_t break_line(const char *line, ssize_t goal, bool newline)
* found with short enough display width. */ * found with short enough display width. */
ssize_t cur_loc = 0; ssize_t cur_loc = 0;
/* Current index in line. */ /* Current index in line. */
size_t pos = 0;
/* Current column position in line. */
size_t old_pos;
/* Previous column position in line. */
int line_len; int line_len;
assert(line != NULL); assert(line != NULL);
while (*line != '\0' && goal >= 0) { while (*line != '\0' && goal >= 0) {
old_pos = pos; size_t pos = 0;
line_len = parse_mbchar(line, NULL, &pos); line_len = parse_mbchar(line, NULL, &pos);
@ -590,7 +586,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool newline)
break; break;
} }
goal -= pos - old_pos; goal -= pos;
line += line_len; line += line_len;
cur_loc += line_len; cur_loc += line_len;
} }