fix(screen): do not draw filler lines post eof if already at last row

This commit is contained in:
zeertzjq 2021-12-07 23:00:03 +08:00
parent afaad8b54e
commit b326bf5f41
3 changed files with 90 additions and 1 deletions

View File

@ -1692,7 +1692,7 @@ static void win_update(win_T *wp, Providers *providers)
if (eof) { // we hit the end of the file
wp->w_botline = buf->b_ml.ml_line_count + 1;
j = win_get_fill(wp, wp->w_botline);
if (j > 0 && !wp->w_botfill) {
if (j > 0 && !wp->w_botfill && row < wp->w_grid.Rows) {
// Display filler text below last line. win_line() will check
// for ml_line_count+1 and only draw filler lines
foldinfo_T info = FOLDINFO_INIT;

View File

@ -1031,6 +1031,69 @@ if (h->n_buckets < new_n_buckets) { // expand
|
]]}
screen:try_resize(50, 11)
feed('gg')
screen:expect{grid=[[
^if (h->n_buckets < new_n_buckets) { // expand |
khkey_t *new_keys = (khkey_t *)krealloc((void *)|
h->keys, new_n_buckets * sizeof(khkey_t)); |
h->keys = new_keys; |
if (kh_is_map && val_size) { |
char *new_vals = krealloc( h->vals_buf, new_n_|
buckets * val_size); |
h->vals_buf = new_vals; |
} |
} |
|
]]}
feed('G<C-E>')
screen:expect{grid=[[
khkey_t *new_keys = (khkey_t *)krealloc((void *)|
h->keys, new_n_buckets * sizeof(khkey_t)); |
h->keys = new_keys; |
if (kh_is_map && val_size) { |
char *new_vals = krealloc( h->vals_buf, new_n_|
buckets * val_size); |
h->vals_buf = new_vals; |
} |
^} |
Grugg |
|
]]}
feed('gg')
screen:expect{grid=[[
^if (h->n_buckets < new_n_buckets) { // expand |
khkey_t *new_keys = (khkey_t *)krealloc((void *)|
h->keys, new_n_buckets * sizeof(khkey_t)); |
h->keys = new_keys; |
if (kh_is_map && val_size) { |
char *new_vals = krealloc( h->vals_buf, new_n_|
buckets * val_size); |
h->vals_buf = new_vals; |
} |
} |
|
]]}
screen:try_resize(50, 12)
feed('G')
screen:expect{grid=[[
if (h->n_buckets < new_n_buckets) { // expand |
khkey_t *new_keys = (khkey_t *)krealloc((void *)|
h->keys, new_n_buckets * sizeof(khkey_t)); |
h->keys = new_keys; |
if (kh_is_map && val_size) { |
char *new_vals = krealloc( h->vals_buf, new_n_|
buckets * val_size); |
h->vals_buf = new_vals; |
} |
^} |
Grugg |
|
]]}
meths.buf_del_extmark(0, ns, id)
screen:expect{grid=[[
if (h->n_buckets < new_n_buckets) { // expand |

View File

@ -186,6 +186,19 @@ describe('Diff mode screen', function()
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt+=internal |
]])
screen:try_resize(40, 9)
screen:expect([[
{1:+ }{5:^+-- 4 lines: 1···}{3:}{1:+ }{5:+-- 4 lines: 1··}|
{1: }5 {3:}{1: }5 |
{1: }6 {3:}{1: }6 |
{1: }7 {3:}{1: }7 |
{1: }8 {3:}{1: }8 |
{1: }9 {3:}{1: }9 |
{1: }10 {3:}{1: }10 |
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
|
]])
end)
it('Add a line at the end of file 1', function()
@ -232,6 +245,19 @@ describe('Diff mode screen', function()
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt+=internal |
]])
screen:try_resize(40, 9)
screen:expect([[
{1:+ }{5:^+-- 4 lines: 1···}{3:}{1:+ }{5:+-- 4 lines: 1··}|
{1: }5 {3:}{1: }5 |
{1: }6 {3:}{1: }6 |
{1: }7 {3:}{1: }7 |
{1: }8 {3:}{1: }8 |
{1: }9 {3:}{1: }9 |
{1: }10 {3:}{1: }10 |
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
|
]])
end)
it('Add a line in the middle of file 2, remove on at the end of file 1', function()