diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-08-13 19:35:05 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-13 19:35:05 +0100 |
commit | 8f369fb1ab7debeeda0fec69c379c528d162d9c5 (patch) | |
tree | 8bac22fd9b0178208bc8365845f43380b6bb0856 /src/textprop.c | |
parent | f0ccfa474a5c4940d03bfc6084e896dc8ac2d791 (diff) | |
download | vim-git-8f369fb1ab7debeeda0fec69c379c528d162d9c5.tar.gz |
patch 9.0.0200: cursor wrong if 'nowrap' and two right aligned text propsv9.0.0200
Problem: cursor in a wrong positoin if 'wrap' is off and using two right
aligned text props in one line.
Solution: Count an extra line for a right aligned text property after a
below or right aligned text property. (issue #10909)
Diffstat (limited to 'src/textprop.c')
-rw-r--r-- | src/textprop.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/textprop.c b/src/textprop.c index 7d594da16..88156c272 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -590,6 +590,8 @@ get_text_props(buf_T *buf, linenr_T lnum, char_u **props, int will_change) /* * Return the number of text properties with "below" alignment in line "lnum". + * A "right" aligned property also goes below after a "below" or other "right" + * aligned property. */ int prop_count_below(buf_T *buf, linenr_T lnum) @@ -599,14 +601,25 @@ prop_count_below(buf_T *buf, linenr_T lnum) int result = 0; textprop_T prop; int i; + int next_right_goes_below = FALSE; if (count == 0) return 0; for (i = 0; i < count; ++i) { mch_memmove(&prop, props + i * sizeof(prop), sizeof(prop)); - if (prop.tp_col == MAXCOL && (prop.tp_flags & TP_FLAG_ALIGN_BELOW)) - ++result; + if (prop.tp_col == MAXCOL) + { + if ((prop.tp_flags & TP_FLAG_ALIGN_BELOW) + || (next_right_goes_below + && (prop.tp_flags & TP_FLAG_ALIGN_RIGHT))) + { + next_right_goes_below = TRUE; + ++result; + } + else if (prop.tp_flags & TP_FLAG_ALIGN_RIGHT) + next_right_goes_below = TRUE; + } } return result; } |