mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #27201 from zeertzjq/vim-9.1.0054
vim-patch:9.1.{0054,0056}
This commit is contained in:
commit
6116495e6e
@ -277,22 +277,20 @@ CharSize charsize_regular(CharsizeArg *csarg, char *const cur, colnr_T const vco
|
|||||||
size += added;
|
size += added;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *s = cur;
|
bool need_lbr = false;
|
||||||
colnr_T vcol_start = 0; // start from where to consider linebreak
|
|
||||||
// If 'linebreak' set check at a blank before a non-blank if the line
|
// If 'linebreak' set check at a blank before a non-blank if the line
|
||||||
// needs a break here
|
// needs a break here.
|
||||||
if (wp->w_p_lbr && wp->w_p_wrap && wp->w_width_inner != 0) {
|
if (wp->w_p_lbr && wp->w_p_wrap && wp->w_width_inner != 0
|
||||||
|
&& vim_isbreak((uint8_t)cur[0]) && !vim_isbreak((uint8_t)cur[1])) {
|
||||||
char *t = csarg->line;
|
char *t = csarg->line;
|
||||||
while (vim_isbreak((uint8_t)t[0])) {
|
while (vim_isbreak((uint8_t)t[0])) {
|
||||||
t++;
|
t++;
|
||||||
}
|
}
|
||||||
vcol_start = (colnr_T)(t - csarg->line);
|
// 'linebreak' is only needed when not in leading whitespace.
|
||||||
|
need_lbr = cur >= t;
|
||||||
}
|
}
|
||||||
if (wp->w_p_lbr && vcol_start <= vcol
|
if (need_lbr) {
|
||||||
&& vim_isbreak((uint8_t)s[0])
|
char *s = cur;
|
||||||
&& !vim_isbreak((uint8_t)s[1])
|
|
||||||
&& wp->w_p_wrap
|
|
||||||
&& wp->w_width_inner != 0) {
|
|
||||||
// Count all characters from first non-blank after a blank up to next
|
// Count all characters from first non-blank after a blank up to next
|
||||||
// non-blank after a blank.
|
// non-blank after a blank.
|
||||||
int numberextra = win_col_off(wp);
|
int numberextra = win_col_off(wp);
|
||||||
|
@ -379,9 +379,9 @@ func Test_linebreak_no_break_after_whitespace_only()
|
|||||||
\ "abcdefghijklmnopqrstuvwxyz")
|
\ "abcdefghijklmnopqrstuvwxyz")
|
||||||
let lines = s:screen_lines([1, 4], winwidth(0))
|
let lines = s:screen_lines([1, 4], winwidth(0))
|
||||||
let expect = [
|
let expect = [
|
||||||
\ " abcdefghijklmnop",
|
\ " abcdefghijklmn",
|
||||||
\ "qrstuvwxyzabcdefghij",
|
\ "opqrstuvwxyzabcdefgh",
|
||||||
\ "klmnopqrstuvwxyz ",
|
\ "ijklmnopqrstuvwxyz ",
|
||||||
\ "~ ",
|
\ "~ ",
|
||||||
\ ]
|
\ ]
|
||||||
call s:compare_lines(expect, lines)
|
call s:compare_lines(expect, lines)
|
||||||
|
@ -12,6 +12,16 @@ func Test_put_block()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_put_block_unicode()
|
||||||
|
new
|
||||||
|
call setreg('a', "À\nÀÀ\naaaaaaaaaaaa", "\<C-V>")
|
||||||
|
call setline(1, [' 1', ' 2', ' 3'])
|
||||||
|
exe "norm! \<C-V>jj\"ap"
|
||||||
|
let expected = ['À 1', 'ÀÀ 2', 'aaaaaaaaaaaa3']
|
||||||
|
call assert_equal(expected, getline(1, 3))
|
||||||
|
bw!
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_put_char_block()
|
func Test_put_char_block()
|
||||||
new
|
new
|
||||||
call setline(1, ['Line 1', 'Line 2'])
|
call setline(1, ['Line 1', 'Line 2'])
|
||||||
|
Loading…
Reference in New Issue
Block a user