Commit 65d16551 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey Committed by Benno Schulenberg
Browse files

softwrap: don't push a straddling tab to the next chunk

Tabs are of variable length depending on position, so allow them
to be displayed partially on one chunk and partially on another.

This fixes http://savannah.gnu.org/bugs/?51621.
parent 8e779b6e
Showing with 11 additions and 2 deletions
+11 -2
......@@ -2982,8 +2982,8 @@ size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
while (*text != '\0' && column < leftedge)
text += parse_mbchar(text, NULL, &column);
/* Use a full screen row for text. */
goal_column = column + editwincols;
/* The intention is to use the entire available width. */
goal_column = leftedge + editwincols;
while (*text != '\0' && column <= goal_column) {
/* When breaking at blanks, do it *before* the target column. */
......@@ -3011,9 +3011,18 @@ size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
if (found_blank) {
text = text - index + lastblank_index;
parse_mbchar(text, NULL, &lastblank_column);
/* If we've now overshot the screen's edge, then break there. */
if (lastblank_column > goal_column)
return goal_column;
return lastblank_column;
}
/* If a tab is split over two chunks, break at the screen's edge. */
if (*(text - char_len) == '\t')
prev_column = goal_column;
/* Otherwise, return the column of the last character that doesn't
* overshoot the target, since we can't break the text anywhere else. */
return (editwincols > 1) ? prev_column : column - 1;
......
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