A RetroSearch Logo

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

Search Query:

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

fix resize crash with pending scrollback (#14891) · neovim/neovim@0a1391f · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+82

-1

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+82

-1

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

@@ -1466,6 +1466,17 @@ static void refresh_scrollback(Terminal *term, buf_T *buf)

1466 1466

int width, height;

1467 1467

vterm_get_size(term->vt, &height, &width);

1468 1468 1469 +

// May still have pending scrollback after increase in terminal height if the

1470 +

// scrollback wasn't refreshed in time; append these to the top of the buffer.

1471 +

int row_offset = term->sb_pending;

1472 +

while (term->sb_pending > 0 && buf->b_ml.ml_line_count < height) {

1473 +

fetch_row(term, term->sb_pending - row_offset - 1, width);

1474 +

ml_append(0, (uint8_t *)term->textbuf, 0, false);

1475 +

appended_lines(0, 1);

1476 +

term->sb_pending--;

1477 +

}

1478 + 1479 +

row_offset -= term->sb_pending;

1469 1480

while (term->sb_pending > 0) {

1470 1481

// This means that either the window height has decreased or the screen

1471 1482

// became full and libvterm had to push all rows up. Convert the first

@@ -1476,7 +1487,7 @@ static void refresh_scrollback(Terminal *term, buf_T *buf)

1476 1487

ml_delete(1, false);

1477 1488

deleted_lines(1, 1);

1478 1489

}

1479 -

fetch_row(term, -term->sb_pending, width);

1490 +

fetch_row(term, -term->sb_pending - row_offset, width);

1480 1491

int buf_index = (int)buf->b_ml.ml_line_count - height;

1481 1492

ml_append(buf_index, (uint8_t *)term->textbuf, 0, false);

1482 1493

appended_lines(buf_index, 1);

Original file line number Diff line number Diff line change

@@ -12,6 +12,8 @@ local curbufmeths = helpers.curbufmeths

12 12

local nvim = helpers.nvim

13 13

local feed_data = thelpers.feed_data

14 14

local pcall_err = helpers.pcall_err

15 +

local exec_lua = helpers.exec_lua

16 +

local assert_alive = helpers.assert_alive

15 17 16 18

describe(':terminal scrollback', function()

17 19

local screen

@@ -527,3 +529,71 @@ describe("'scrollback' option", function()

527 529

end)

528 530 529 531

end)

532 + 533 +

describe("pending scrollback line handling", function()

534 +

local screen

535 + 536 +

before_each(function()

537 +

clear()

538 +

screen = Screen.new(30, 7)

539 +

screen:attach()

540 +

screen:set_default_attr_ids {

541 +

[1] = {foreground = Screen.colors.Brown},

542 +

[2] = {reverse = true},

543 +

[3] = {bold = true},

544 +

}

545 +

end)

546 + 547 +

it("does not crash after setting 'number' #14891", function()

548 +

exec_lua [[

549 +

local a = vim.api

550 +

local buf = a.nvim_create_buf(true, true)

551 +

local chan = a.nvim_open_term(buf, {})

552 +

a.nvim_win_set_option(0, "number", true)

553 +

a.nvim_chan_send(chan, ("a\n"):rep(11) .. "a")

554 +

a.nvim_win_set_buf(0, buf)

555 +

]]

556 +

screen:expect [[

557 +

{1: 1 }^a |

558 +

{1: 2 } a |

559 +

{1: 3 } a |

560 +

{1: 4 } a |

561 +

{1: 5 } a |

562 +

{1: 6 } a |

563 +

|

564 +

]]

565 +

feed('G')

566 +

screen:expect [[

567 +

{1: 7 } a |

568 +

{1: 8 } a |

569 +

{1: 9 } a |

570 +

{1: 10 } a |

571 +

{1: 11 } a |

572 +

{1: 12 } ^a |

573 +

|

574 +

]]

575 +

assert_alive()

576 +

end)

577 + 578 +

it("does not crash after nvim_buf_call #14891", function()

579 +

exec_lua [[

580 +

local a = vim.api

581 +

local bufnr = a.nvim_create_buf(false, true)

582 +

a.nvim_buf_call(bufnr, function()

583 +

vim.fn.termopen({"echo", ("hi\n"):rep(11)})

584 +

end)

585 +

a.nvim_win_set_buf(0, bufnr)

586 +

vim.cmd("startinsert")

587 +

]]

588 +

screen:expect [[

589 +

hi |

590 +

hi |

591 +

hi |

592 +

|

593 +

|

594 +

[Process exited 0]{2: } |

595 +

{3:-- TERMINAL --} |

596 +

]]

597 +

assert_alive()

598 +

end)

599 +

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