mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-30 08:33:17 +03:00
softwrap: break before multi-column Unicode blanks when they overshoot
In atblanks mode, if a softwrapped chunk ends with a double-width space character (say, Unicode 003000, Ideographic Space), and that would put half of the character past the edge of the screen, break before it. This fixes https://savannah.gnu.org/bugs/?51671.
This commit is contained in:
parent
3f35e9670f
commit
504a97256b
@ -3054,12 +3054,11 @@ size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
|
|||||||
* the pointer back to the last blank, step beyond it, and we're done. */
|
* the pointer back to the last blank, step beyond it, and we're done. */
|
||||||
if (found_blank) {
|
if (found_blank) {
|
||||||
text = text - index + lastblank_index;
|
text = text - index + lastblank_index;
|
||||||
parse_mbchar(text, NULL, &lastblank_column);
|
char_len = parse_mbchar(text, NULL, &lastblank_column);
|
||||||
|
text += char_len;
|
||||||
/* If we've now overshot the screen's edge, then break there. */
|
|
||||||
if (lastblank_column > goal_column)
|
|
||||||
return goal_column;
|
|
||||||
|
|
||||||
|
/* If we haven't overshot the screen's edge, break after the blank. */
|
||||||
|
if (lastblank_column <= goal_column)
|
||||||
return lastblank_column;
|
return lastblank_column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user