aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/screen.c
diff options
context:
space:
mode:
authorckelsel <ckelsel@hotmail.com>2018-01-14 20:50:05 +0800
committerckelsel <ckelsel@hotmail.com>2018-01-14 20:50:35 +0800
commit4b8d6caf48e28730767ae87a985a345ed6f0d2b3 (patch)
tree0c2fa5e2a6131b398d572910b15e097b8eac74a6 /src/nvim/screen.c
parent9ddeb6e187e6ef6045bf037e4225dc46c8efb693 (diff)
downloadrneovim-4b8d6caf48e28730767ae87a985a345ed6f0d2b3.tar.gz
rneovim-4b8d6caf48e28730767ae87a985a345ed6f0d2b3.tar.bz2
rneovim-4b8d6caf48e28730767ae87a985a345ed6f0d2b3.zip
vim-patch:8.0.0380: with 'linebreak' double wide char wraps badly
Problem: With 'linebreak' set and 'breakat' includes ">" a double-wide character results in "<<" displayed. Solution: Check for the character not to be replaced. (Ozaki Kiichi, closes vim/vim#1456) https://github.com/vim/vim/commit/38632faf635f6434441827e136bceb5a930c59ad
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r--src/nvim/screen.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index ed96e98d32..8a29734025 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -3143,14 +3143,15 @@ win_line (
}
--n_extra;
} else {
+ int c0;
+
if (p_extra_free != NULL) {
xfree(p_extra_free);
p_extra_free = NULL;
}
- /*
- * Get a character from the line itself.
- */
- c = *ptr;
+
+ // Get a character from the line itself.
+ c0 = c = *ptr;
if (has_mbyte) {
mb_c = c;
if (enc_utf8) {
@@ -3160,11 +3161,12 @@ win_line (
mb_utf8 = FALSE;
if (mb_l > 1) {
mb_c = utfc_ptr2char(ptr, u8cc);
- /* Overlong encoded ASCII or ASCII with composing char
- * is displayed normally, except a NUL. */
- if (mb_c < 0x80)
- c = mb_c;
- mb_utf8 = TRUE;
+ // Overlong encoded ASCII or ASCII with composing char
+ // is displayed normally, except a NUL.
+ if (mb_c < 0x80) {
+ c0 = c = mb_c;
+ }
+ mb_utf8 = true;
/* At start of the line we can have a composing char.
* Draw it as a space with a composing char. */
@@ -3428,10 +3430,8 @@ win_line (
char_attr = hl_combine_attr(char_attr, term_attrs[vcol]);
}
- /*
- * Found last space before word: check for line break.
- */
- if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)) {
+ // Found last space before word: check for line break.
+ if (wp->w_p_lbr && c0 == c && vim_isbreak(c) && !vim_isbreak(*ptr)) {
int mb_off = has_mbyte ? (*mb_head_off)(line, ptr - 1) : 0;
char_u *p = ptr - (mb_off + 1);
// TODO: is passing p for start of the line OK?