in break_line(), fix problem where tab widths in columns are always
calculated as tabsize
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3523 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
diff --git a/src/text.c b/src/text.c
index 1c1727e..4f26237 100644
--- a/src/text.c
+++ b/src/text.c
@@ -779,14 +779,14 @@
* found with short enough display width. */
ssize_t cur_loc = 0;
/* Current index in line. */
+ size_t cur_pos = 0;
+ /* Current column position in line. */
int line_len;
assert(line != NULL);
- while (*line != '\0' && goal >= 0) {
- size_t pos = 0;
-
- line_len = parse_mbchar(line, NULL, &pos);
+ while (*line != '\0' && goal >= cur_pos) {
+ line_len = parse_mbchar(line, NULL, &cur_pos);
if (is_blank_mbchar(line)
#ifndef DISABLE_HELP
@@ -801,12 +801,11 @@
#endif
}
- goal -= pos;
line += line_len;
cur_loc += line_len;
}
- if (goal >= 0)
+ if (goal >= cur_pos)
/* In fact, the whole line displays shorter than goal. */
return cur_loc;