Commit 2d3d1e93 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

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
Showing with 8 additions and 6 deletions
+8 -6
...@@ -221,6 +221,9 @@ CVS code - ...@@ -221,6 +221,9 @@ CVS code -
- Change all rcfile error messages to refer to commands instead - Change all rcfile error messages to refer to commands instead
of directives, for consistency with nanorc.5. (DLR) of directives, for consistency with nanorc.5. (DLR)
- text.c: - text.c:
break_line()
- Fix problem where tab widths in columns are always calculated
as tabsize. (DLR, found by Alexey Toptygin)
do_justify() do_justify()
- Remove redundant key checks. (DLR) - Remove redundant key checks. (DLR)
do_spell() do_spell()
......
...@@ -779,14 +779,14 @@ ssize_t break_line(const char *line, ssize_t goal ...@@ -779,14 +779,14 @@ ssize_t break_line(const char *line, ssize_t goal
* 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 cur_pos = 0;
/* Current 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 >= cur_pos) {
size_t pos = 0; line_len = parse_mbchar(line, NULL, &cur_pos);
line_len = parse_mbchar(line, NULL, &pos);
if (is_blank_mbchar(line) if (is_blank_mbchar(line)
#ifndef DISABLE_HELP #ifndef DISABLE_HELP
...@@ -801,12 +801,11 @@ ssize_t break_line(const char *line, ssize_t goal ...@@ -801,12 +801,11 @@ ssize_t break_line(const char *line, ssize_t goal
#endif #endif
} }
goal -= pos;
line += line_len; line += line_len;
cur_loc += line_len; cur_loc += line_len;
} }
if (goal >= 0) if (goal >= cur_pos)
/* In fact, the whole line displays shorter than goal. */ /* In fact, the whole line displays shorter than goal. */
return cur_loc; return cur_loc;
......
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