mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
fix(diff): filler lines for hunks bigger than linematch limit
Apply linematch filler computation only if the hunk is actually
linematched.
Fixes #24580
(cherry picked from commit ed1da3ac24
)
This commit is contained in:
parent
211db74a31
commit
52669b5c69
@ -2383,7 +2383,7 @@ void diff_set_topline(win_T *fromwin, win_T *towin)
|
||||
towin->w_topline = lnum + (dp->df_lnum[toidx] - dp->df_lnum[fromidx]);
|
||||
|
||||
if (lnum >= dp->df_lnum[fromidx]) {
|
||||
if (diff_flags & DIFF_LINEMATCH) {
|
||||
if (dp->is_linematched) {
|
||||
calculate_topfill_and_topline(fromidx, toidx, fromwin->w_topline,
|
||||
fromwin->w_topfill, &towin->w_topfill, &towin->w_topline);
|
||||
} else {
|
||||
|
@ -992,4 +992,48 @@ describe('regressions', function()
|
||||
helpers.curbufmeths.set_lines(0, -1, false, { string.rep('a', 1010)..'world' })
|
||||
helpers.exec 'windo diffthis'
|
||||
end)
|
||||
|
||||
it("properly computes filler lines for hunks bigger than linematch limit", function()
|
||||
clear()
|
||||
feed(':set diffopt+=linematch:10<cr>')
|
||||
screen = Screen.new(100, 20)
|
||||
screen:attach()
|
||||
local lines = {}
|
||||
for i = 0, 29 do
|
||||
lines[#lines + 1] = tostring(i)
|
||||
end
|
||||
helpers.curbufmeths.set_lines(0, -1, false, lines)
|
||||
helpers.exec 'vnew'
|
||||
helpers.curbufmeths.set_lines(0, -1, false, { '00', '29' })
|
||||
helpers.exec 'windo diffthis'
|
||||
feed('<C-e>')
|
||||
screen:expect{grid=[[
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:^1 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:2 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:3 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:4 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:5 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:6 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:7 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:8 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:9 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:10 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:11 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:12 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:13 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:14 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:15 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:16 }|
|
||||
{1: }{2:------------------------------------------------}│{1: }{3:17 }|
|
||||
{1: }29 │{1: }{3:18 }|
|
||||
{4:[No Name] [+] }{5:[No Name] [+] }|
|
||||
|
|
||||
]], attr_ids={
|
||||
[1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.Grey};
|
||||
[2] = {bold = true, background = Screen.colors.LightCyan, foreground = Screen.colors.Blue1};
|
||||
[3] = {background = Screen.colors.LightBlue};
|
||||
[4] = {reverse = true};
|
||||
[5] = {reverse = true, bold = true};
|
||||
}}
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user