How to use the xterm-addon-search.SearchAddon function in xterm-addon-search

To help you get started, we’ve selected a few xterm-addon-search examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spyder-ide / spyder-terminal / spyder_terminal / server / static / js / main.js View on Github external
function createTerminal(){
  // Clean terminal
  while (terminalContainer.children.length) {
      terminalContainer.removeChild(terminalContainer.children[0]);
  }

  term = new Terminal({
      cursorBlink: true,
      scrollback: 10000,
      tabStopWidth: 10,
      windowsMode: isWindows
      });

  term.loadAddon(new WebLinksAddon());
  searchAddon = new SearchAddon();
  term.loadAddon(searchAddon);
  fitAddon = new FitAddon();
  term.loadAddon(fitAddon);

  term.onResize((size) => {
      if (!pid) {
          return;
      }
      const cols = size.cols;
      const rows = size.rows;
      const url = '/api/terminals/' + pid + '/size?cols=' + cols + '&rows=' + rows;

      fetch(url, {method: 'POST', headers: myHeaders});
      term.setOption('theme', curTheme);
      term.setOption('fontFamily', curFont);
  });
github CyanSalt / commas / src / store / modules / terminal.js View on Github external
mount({state, commit, dispatch, rootState}, {tab, element}) {
      let observer = state.observer
      if (!observer) {
        observer = new ResizeObserver(debounce(() => {
          dispatch('resize')
        }, 250))
        commit('setObserver', observer)
      }
      const settings = rootState.settings.settings
      const xterm = tab.xterm
      xterm.open(element)
      xterm.$.fit = new FitAddon()
      xterm.loadAddon(xterm.$.fit)
      xterm.$.search = new SearchAddon()
      xterm.loadAddon(xterm.$.search)
      xterm.loadAddon(new WebLinksAddon((event, uri) => {
        if (event.altKey) shell.openExternal(uri)
      }))
      if (settings['terminal.style.fontLigatures']) {
        xterm.$.ligatures = new LigaturesAddon()
        xterm.loadAddon(xterm.$.ligatures)
      }
      observer.observe(element)
      xterm.$.fit.fit()
      xterm.focus()
    },
    interact({state, commit}, tab) {
github zeit / hyper / lib / components / term.js View on Github external
constructor(props) {
    super(props);
    props.ref_(props.uid, this);
    this.termRef = null;
    this.termWrapperRef = null;
    this.termRect = null;
    this.termOptions = {};
    this.disposableListeners = [];
    this.termDefaultBellSound = null;
    this.fitAddon = new FitAddon();
    this.searchAddon = new SearchAddon();
  }
github felixse / FluentTerminal / FluentTerminal.Client / src / index.ts View on Github external
fontSize: options.fontSize,
    fontWeight: options.boldText ? 'bold' : 'normal',
    fontWeightBold: options.boldText ? '400' : 'bold',
    cursorStyle: options.cursorStyle,
    cursorBlink: options.cursorBlink,
    bellStyle: options.bellStyle,
    scrollback: options.scrollBackLimit,
    allowTransparency: true,
    theme: theme,
    windowsMode: true,
    wordSeparator: ' ()[]{}\'":;'
  };

  term = new Terminal(terminalOptions);

  searchAddon = new SearchAddon();
  term.loadAddon(searchAddon);
  fitAddon = new FitAddon();
  term.loadAddon(fitAddon);

  window.term = term;

  term.onResize(({ cols, rows }) => {
    window.terminalBridge.notifySizeChanged(cols, rows);
  });

  term.onTitleChange((title: string) => {
    window.terminalBridge.notifyTitleChanged(title);
  });

  term.onSelectionChange(() => {
    window.terminalBridge.notifySelectionChanged(term.getSelection());
github npezza93 / archipelago / app / renderer / sessions / session.js View on Github external
constructor(type, branch) {
    this.branch = branch
    this.currentProfile = new CurrentProfile()
    this.id = Math.random()
    this.subscriptions = new CompositeDisposable()
    this.title = ''
    this.ptyId = ipc.callMain('pty-create', {sessionId: this.id, sessionWindowId: activeWindow().id})
    this.type = type || 'default'
    this.fitAddon = new FitAddon()
    this.searchAddon = new SearchAddon()
    this.webglAddon = new WebglAddon()
    this.xterm = new Terminal(this.settings())
    this.xterm.loadAddon(this.fitAddon)
    this.xterm.loadAddon(this.searchAddon)

    this.resetKeymaps()
    autoBind(this)

    this.bindListeners()
  }
github JunoLab / atom-ink / lib / console / console.js View on Github external
opts.windowsMode = true
    }

    this.persistentState = {}
    this.persistentState.opts = opts

    if (opts.rendererType === 'webgl') {
      this.isWebgl = true
      opts.rendererType = 'canvas'
    }

    this.terminal = new Terminal(opts)
    const webLinksAddon = new WebLinksAddon((ev, uri) => openExternal(uri))
    this.terminal.loadAddon(webLinksAddon)

    this.searchAddon = new SearchAddon()
    this.terminal.loadAddon(this.searchAddon)

    this.fitAddon = new FitAddon()
    this.terminal.loadAddon(this.fitAddon)

    this.setTitle('Terminal')

    this.classname = ''

    this.enterhandler = (e) => {
      if (!this.ty && e.keyCode == 13) {
        if (this.startRequested) {
          this.startRequested()
        }
        return false
      }
github felixse / FluentTerminal / FluentTerminal.Client / src / index.ts View on Github external
const mouseRow: number = mouseY / lineHeight;
    let col: number, row: number = (mouseRow === Math.ceil(mouseRow) ? mouseRow : Math.floor(mouseRow)) - 1;
    let line = window.term.buffer.getLine(row);

    if(line === undefined) return;
    
    col = line.translateToString().indexOf(str);
    if (col === -1) return;
    
    return {
      col: col, 
      row: row
    };
  }

  searchAddon = new SearchAddon();
  term.loadAddon(searchAddon);
  fitAddon = new FitAddon();
  term.loadAddon(fitAddon);
  serializeAddon = new SerializeAddon();
  term.loadAddon(serializeAddon);
  webLinksAddon = new WebLinksAddon((_, u) => window.open(u), linkMatcherOptions);
  term.loadAddon(webLinksAddon);

  window.term = term;

  window.terminalBridge.onoutput = (data => {
    term.writeUtf8(data);
  });

  term.onData(data => {
    window.terminalBridge.inputReceived(data);
github kalmhq / kalm / frontend / src / pages / Application / Xterm.tsx View on Github external
constructor(props: any) {
    super(props);
    this.myRef = React.createRef();
    this.xterm = new Terminal(props.terminalOptions || {});

    this.fitAddon = new FitAddon();
    this.searchAddon = new SearchAddon();
    this.xterm.loadAddon(this.fitAddon);
    this.xterm.loadAddon(this.searchAddon);

    if (props.terminalOnResize) {
      this.xterm.onResize(props.terminalOnResize);
    }

    if (props.termianlOnData) {
      this.xterm.onData(props.termianlOnData);
    }

    if (props.termianlOnBinary) {
      this.xterm.onBinary(props.termianlOnBinary);
    }

    this.state = {
github inspursoft / board / src / ui / src / app / service / step0-list-service / service-control / console / console.component.ts View on Github external
constructor(private appInitService: AppInitService,
              private k8sService: K8sService,
              private messageService: MessageService,
              private changeRef: ChangeDetectorRef,
              private translateService: TranslateService) {
    this.fitAddon = new FitAddon();
    this.searchAddon = new SearchAddon();
    this.webLinkAddon = new WebLinksAddon(this.webLinksHandle);
    this.serviceDetailInfo = new ServiceDetailInfo();
    this.actionIsEnabledEvent = new EventEmitter();
    this.updateProgressEvent = new EventEmitter();
    this.isActionInWIPChange = new EventEmitter();
  }

xterm-addon-search

An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables searching the buffer. This addon requires xterm.js v4+.

MIT
Latest version published 1 year ago

Package Health Score

67 / 100
Full package analysis

Popular xterm-addon-search functions