Skip to content

Search addon overflows wrapped text matches to the right #5336

@PadowYT2

Description

@PadowYT2

Details

  • Browser and browser version: Chrome 125.0.6422.76
  • OS version: Zorin OS 17.2 (Ubuntu 22.04)
  • xterm.js version: v5.5.0

Steps to reproduce

  1. Create a vite example app (or anything you want really)
  2. Implement the addon-search

https://cdn.padow.ru/nl3GT

Minimal example

import { useEffect, useMemo, useRef } from "react";
import { Terminal } from "@xterm/xterm";
import { SearchAddon } from "@xterm/addon-search";
import "@xterm/xterm/css/xterm.css";

function App() {
  const terminalRef = useRef<HTMLDivElement>(null);
  const xterm = useMemo(() => new Terminal({ allowProposedApi: true }), []);
  const searchAddon = useMemo(() => new SearchAddon(), []);

  useEffect(() => {
    if (terminalRef.current && !xterm.element) {
      xterm.loadAddon(searchAddon);
      xterm.open(terminalRef.current);

      for (let i = 0; i < 5; i++) {
        xterm.writeln(
          "1. hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello"
        );
      }
    }
  }, [xterm, searchAddon]);

  useEffect(() => {
    if (xterm.element) {
      searchAddon.findNext("hello", {
        caseSensitive: false,
        wholeWord: false,
        decorations: {
          matchBackground: "#ffff00",
          matchBorder: "#ffff00",
          matchOverviewRuler: "#ffff00",
          activeMatchBackground: "#ffff00",
          activeMatchBorder: "#ffff00",
          activeMatchColorOverviewRuler: "#ffff00",
        },
        incremental: false,
      });
    }
  }, [searchAddon, xterm.element]);

  return <div ref={terminalRef} />;
}

export default App;

(this is somehow fixed in vscode by just not having the overflowing word in the results)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions