mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.0290 vim-patch:8.0.0394
vim-patch:8.0.0290: cursor positioning wrong if wide character wraps
Problem: If a wide character doesn't fit at the end of the screen line, and
the line doesn't fit on the screen, then the cursor position may
be wrong. (anliting)
Solution: Don't skip over wide character. (Christian Brabandt, closes vim/1408)
vim-patch:8.0.0394
Problem: Tabs are not aligned when scrolling horizontally and a Tab doesn't
fit. (Axel Bender)
Solution: Handle a Tab as a not fitting character. (Christian Brabandt)
Also fix that ":redraw" does not scroll horizontally to show the
cursor. And fix the test that depended on the old behavior.
abc39ab642
This commit is contained in:
parent
c747b53f84
commit
49b671f8f1
@ -7690,6 +7690,7 @@ static void ex_redraw(exarg_T *eap)
|
|||||||
|
|
||||||
RedrawingDisabled = 0;
|
RedrawingDisabled = 0;
|
||||||
p_lz = FALSE;
|
p_lz = FALSE;
|
||||||
|
validate_cursor();
|
||||||
update_topline();
|
update_topline();
|
||||||
update_screen(eap->forceit ? CLEAR :
|
update_screen(eap->forceit ? CLEAR :
|
||||||
VIsual_active ? INVERTED :
|
VIsual_active ? INVERTED :
|
||||||
|
@ -2112,16 +2112,16 @@ win_line (
|
|||||||
bool nochange /* not updating for changed text */
|
bool nochange /* not updating for changed text */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int col; /* visual column on screen */
|
int col = 0; // visual column on screen
|
||||||
unsigned off; /* offset in ScreenLines/ScreenAttrs */
|
unsigned off; // offset in ScreenLines/ScreenAttrs
|
||||||
int c = 0; /* init for GCC */
|
int c = 0; // init for GCC
|
||||||
long vcol = 0; /* virtual column (for tabs) */
|
long vcol = 0; // virtual column (for tabs)
|
||||||
long vcol_sbr = -1; // virtual column after showbreak
|
long vcol_sbr = -1; // virtual column after showbreak
|
||||||
long vcol_prev = -1; /* "vcol" of previous character */
|
long vcol_prev = -1; // "vcol" of previous character
|
||||||
char_u *line; /* current line */
|
char_u *line; // current line
|
||||||
char_u *ptr; /* current position in "line" */
|
char_u *ptr; // current position in "line"
|
||||||
int row; /* row in the window, excl w_winrow */
|
int row; // row in the window, excl w_winrow
|
||||||
int screen_row; /* row on the screen, incl w_winrow */
|
int screen_row; // row on the screen, incl w_winrow
|
||||||
|
|
||||||
char_u extra[18]; /* line number and 'fdc' must fit in here */
|
char_u extra[18]; /* line number and 'fdc' must fit in here */
|
||||||
int n_extra = 0; /* number of extra chars */
|
int n_extra = 0; /* number of extra chars */
|
||||||
@ -2522,7 +2522,11 @@ win_line (
|
|||||||
if (vcol > v) {
|
if (vcol > v) {
|
||||||
vcol -= c;
|
vcol -= c;
|
||||||
ptr = prev_ptr;
|
ptr = prev_ptr;
|
||||||
n_skip = v - vcol;
|
// If the character fits on the screen, don't need to skip it.
|
||||||
|
// Except for a TAB.
|
||||||
|
if (((*mb_ptr2cells)(ptr) >= c || *ptr == TAB) && col == 0) {
|
||||||
|
n_skip = v - vcol;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -274,7 +274,6 @@ endfunction
|
|||||||
|
|
||||||
function Test_breakindent16()
|
function Test_breakindent16()
|
||||||
" Check that overlong lines are indented correctly.
|
" Check that overlong lines are indented correctly.
|
||||||
" TODO: currently it does not fail even when the bug is not fixed.
|
|
||||||
let s:input=""
|
let s:input=""
|
||||||
call s:test_windows('setl breakindent briopt=min:0 ts=4')
|
call s:test_windows('setl breakindent briopt=min:0 ts=4')
|
||||||
call setline(1, "\t".repeat("1234567890", 10))
|
call setline(1, "\t".repeat("1234567890", 10))
|
||||||
@ -283,16 +282,16 @@ function Test_breakindent16()
|
|||||||
redraw!
|
redraw!
|
||||||
let lines=s:screen_lines(1,10)
|
let lines=s:screen_lines(1,10)
|
||||||
let expect=[
|
let expect=[
|
||||||
\ " 123456",
|
|
||||||
\ " 789012",
|
\ " 789012",
|
||||||
\ " 345678",
|
\ " 345678",
|
||||||
|
\ " 901234",
|
||||||
\ ]
|
\ ]
|
||||||
call s:compare_lines(expect, lines)
|
call s:compare_lines(expect, lines)
|
||||||
let lines=s:screen_lines(4,10)
|
let lines=s:screen_lines(4,10)
|
||||||
let expect=[
|
let expect=[
|
||||||
\ " 901234",
|
|
||||||
\ " 567890",
|
\ " 567890",
|
||||||
\ " 123456",
|
\ " 123456",
|
||||||
|
\ " 7890 ",
|
||||||
\ ]
|
\ ]
|
||||||
call s:compare_lines(expect, lines)
|
call s:compare_lines(expect, lines)
|
||||||
call s:close_windows()
|
call s:close_windows()
|
||||||
|
@ -217,3 +217,19 @@ func Test_list_with_listchars()
|
|||||||
call s:compare_lines(expect, lines)
|
call s:compare_lines(expect, lines)
|
||||||
call s:close_windows()
|
call s:close_windows()
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_list_with_tab_and_skipping_first_chars()
|
||||||
|
call s:test_windows('setl list listchars=tab:>- ts=70 nowrap')
|
||||||
|
call setline(1, ["iiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa"])
|
||||||
|
call cursor(4,64)
|
||||||
|
norm! 2zl
|
||||||
|
let lines = s:screen_lines([1, 4], winwidth(0))
|
||||||
|
let expect = [
|
||||||
|
\ "---------------aaaaa",
|
||||||
|
\ "---------------aaaaa",
|
||||||
|
\ "---------------aaaaa",
|
||||||
|
\ "iiiiiiiii>-----aaaaa",
|
||||||
|
\ ]
|
||||||
|
call s:compare_lines(expect, lines)
|
||||||
|
call s:close_windows()
|
||||||
|
endfu
|
||||||
|
@ -193,3 +193,37 @@ func Test_multibyte_sign_and_colorcolumn()
|
|||||||
call s:compare_lines(expect, lines)
|
call s:compare_lines(expect, lines)
|
||||||
call s:close_windows()
|
call s:close_windows()
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_chinese_char_on_wrap_column()
|
||||||
|
call s:test_windows("setl nolbr wrap sbr=")
|
||||||
|
syntax off
|
||||||
|
call setline(1, [
|
||||||
|
\ 'aaaaaaaaaaaaaaaaaaa中'.
|
||||||
|
\ 'aaaaaaaaaaaaaaaaa中'.
|
||||||
|
\ 'aaaaaaaaaaaaaaaaa中'.
|
||||||
|
\ 'aaaaaaaaaaaaaaaaa中'.
|
||||||
|
\ 'aaaaaaaaaaaaaaaaa中'.
|
||||||
|
\ 'aaaaaaaaaaaaaaaaa中'.
|
||||||
|
\ 'aaaaaaaaaaaaaaaaa中'.
|
||||||
|
\ 'aaaaaaaaaaaaaaaaa中'.
|
||||||
|
\ 'aaaaaaaaaaaaaaaaa中'.
|
||||||
|
\ 'aaaaaaaaaaaaaaaaa中'.
|
||||||
|
\ 'hello'])
|
||||||
|
call cursor(1,1)
|
||||||
|
norm! $
|
||||||
|
redraw!
|
||||||
|
let expect=[
|
||||||
|
\ '中aaaaaaaaaaaaaaaaa>',
|
||||||
|
\ '中aaaaaaaaaaaaaaaaa>',
|
||||||
|
\ '中aaaaaaaaaaaaaaaaa>',
|
||||||
|
\ '中aaaaaaaaaaaaaaaaa>',
|
||||||
|
\ '中aaaaaaaaaaaaaaaaa>',
|
||||||
|
\ '中aaaaaaaaaaaaaaaaa>',
|
||||||
|
\ '中aaaaaaaaaaaaaaaaa>',
|
||||||
|
\ '中aaaaaaaaaaaaaaaaa>',
|
||||||
|
\ '中aaaaaaaaaaaaaaaaa>',
|
||||||
|
\ '中hello ']
|
||||||
|
let lines = s:screen_lines([1, 10], winwidth(0))
|
||||||
|
call s:compare_lines(expect, lines)
|
||||||
|
call s:close_windows()
|
||||||
|
endfu
|
||||||
|
@ -558,7 +558,7 @@ static const int included_patches[] = {
|
|||||||
// 397,
|
// 397,
|
||||||
// 396,
|
// 396,
|
||||||
// 395,
|
// 395,
|
||||||
// 394,
|
394,
|
||||||
393,
|
393,
|
||||||
// 392,
|
// 392,
|
||||||
// 391,
|
// 391,
|
||||||
@ -662,7 +662,7 @@ static const int included_patches[] = {
|
|||||||
// 293,
|
// 293,
|
||||||
// 292,
|
// 292,
|
||||||
// 291,
|
// 291,
|
||||||
// 290,
|
290,
|
||||||
// 289,
|
// 289,
|
||||||
// 288 NA
|
// 288 NA
|
||||||
// 287,
|
// 287,
|
||||||
|
Loading…
Reference in New Issue
Block a user