Skip to content

SearchAddon matches fall out of sync on some multiline inputs when over the scrollback limit. #4994

@tabarra

Description

@tabarra

If you have a search and your buffer is already at the scrollback limit (so that older lines are dropped), any multi-line term.write() and any term.writeln() ending in \n causes the march decorations to fall out of sync with the buffer and mark the wrong lines.
Video:

xtermjs_search_bug.mp4

Details

Versions:

"xterm": "5.4.0-beta.20",
"xterm-addon-search": "0.14.0-beta.20"

Repro sandbox: https://codesandbox.io/p/sandbox/xtermjs-demo-forked-2jpjsz
It looks like every multi-line .write() will cause this bug, and only the .writeln() that ends with new lines.
In the sandbox I provided a bunch of example combinations where it breaks or doesn't.
This only works when the buffer is already at the scrollback limit, so I changed the options to have 0 scrollback to facilitate testing.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions