Files
xterm.js/addons/addon-search
Daniel ImmsandCursor 5ff85db4f3 Refactor SearchAddon state/navigation helpers for readability.
Consolidate duplicated search-state and index-stepping logic into small private helpers, and centralize decoration width/render setup to reduce drift between active/inactive paths. Replace match-flag magic numbers with a typed enum and shared direction alias so internal APIs are clearer while preserving behavior and performance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 22:11:00 -07:00
..
2024-07-07 09:15:25 -07:00
2023-11-01 10:35:10 -07:00
2026-05-25 16:34:58 -07:00
2024-07-14 08:52:15 -07:00

An addon for xterm.js that enables searching the buffer. This addon requires xterm.js v4+.

Install

npm install --save @xterm/addon-search

Usage

import { Terminal } from '@xterm/xterm';
import { SearchAddon } from '@xterm/addon-search';

const terminal = new Terminal();
const searchAddon = new SearchAddon();
terminal.loadAddon(searchAddon);
searchAddon.findNext('foo');

Search options

  • decorations (ISearchDecorationOptions): Enables match highlighting and result tracking; pass a decoration options object (colors may be omitted).
  • highlightLimit (constructor option): Caps how many matches are tracked/highlighted (default 1000).
  • incremental: Expands the current selection when the term still matches.
  • wholeWord, regex, caseSensitive: Control match semantics.

onDidChangeResults fires after findNext/findPrevious when decorations is set. clearDecorations() clears highlights and tracked results but does not emit this event.

See the full API for more advanced usage.