A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/commit/c83fedf0bd0cb39ed4706113029b3e358f141707 below:

return early if there are no invalid rows · neovim/neovim@c83fedf · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+44

-1

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+44

-1

lines changed Original file line number Diff line number Diff line change

@@ -1508,6 +1508,13 @@ static void refresh_screen(Terminal *term, buf_T *buf)

1508 1508

// Terminal height may have decreased before `invalid_end` reflects it.

1509 1509

term->invalid_end = MIN(term->invalid_end, height);

1510 1510 1511 +

// There are no invalid rows.

1512 +

if (term->invalid_start >= term->invalid_end) {

1513 +

term->invalid_start = INT_MAX;

1514 +

term->invalid_end = -1;

1515 +

return;

1516 +

}

1517 + 1511 1518

for (int r = term->invalid_start, linenr = row_to_linenr(term, r);

1512 1519

r < term->invalid_end; r++, linenr++) {

1513 1520

fetch_row(term, r, width);

Original file line number Diff line number Diff line change

@@ -6,9 +6,11 @@ local poke_eventloop = helpers.poke_eventloop

6 6

local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.source

7 7

local eq, neq = helpers.eq, helpers.neq

8 8

local write_file = helpers.write_file

9 -

local command= helpers.command

9 +

local command = helpers.command

10 10

local exc_exec = helpers.exc_exec

11 11

local matches = helpers.matches

12 +

local exec_lua = helpers.exec_lua

13 +

local sleep = helpers.sleep

12 14 13 15

describe(':terminal buffer', function()

14 16

local screen

@@ -328,3 +330,37 @@ describe('No heap-buffer-overflow when', function()

328 330

assert_alive()

329 331

end)

330 332

end)

333 + 334 +

describe('on_lines does not emit out-of-bounds line indexes when', function()

335 +

before_each(function()

336 +

clear()

337 +

exec_lua([[

338 +

function _G.register_callback(bufnr)

339 +

_G.cb_error = ''

340 +

vim.api.nvim_buf_attach(bufnr, false, {

341 +

on_lines = function(_, bufnr, _, firstline, _, _)

342 +

local status, msg = pcall(vim.api.nvim_buf_get_offset, bufnr, firstline)

343 +

if not status then

344 +

_G.cb_error = msg

345 +

end

346 +

end

347 +

})

348 +

end

349 +

]])

350 +

end)

351 + 352 +

it('creating a terminal buffer #16394', function()

353 +

feed_command([[autocmd TermOpen * ++once call v:lua.register_callback(expand("<abuf>"))]])

354 +

feed_command('terminal')

355 +

sleep(500)

356 +

eq('', exec_lua([[return _G.cb_error]]))

357 +

end)

358 + 359 +

it('deleting a terminal buffer #16394', function()

360 +

feed_command('terminal')

361 +

sleep(500)

362 +

feed_command('lua _G.register_callback(0)')

363 +

feed_command('bdelete!')

364 +

eq('', exec_lua([[return _G.cb_error]]))

365 +

end)

366 +

end)

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4