xterm.dart icon indicating copy to clipboard operation
xterm.dart copied to clipboard

TerminalView.onTapUp not being called

Open maxhis opened this issue 1 year ago • 2 comments

What I want to achieve is to get the current selected text on TerminalView, and I set a onTapUp callback which never been fired.

TerminalView(
  terminal,
  theme: draculaTheme,
  keyboardType: TextInputType.text,
  autofocus: true,
  controller: _terminalController,
  onTapUp: _onTapUp,
)

Thanks for the great library!

maxhis avatar Jul 09 '23 03:07 maxhis

How do you get the currently selected text? I can't find the relevant api

git-xiaomy avatar Aug 16 '23 01:08 git-xiaomy

@git-xiaomy try this:

  String? get terminalSelected {
    final range = _terminalController.selection;
    if (range == null) {
      return null;
    }
    return terminal.buffer.getText(range);
  }

maxhis avatar Aug 21 '23 02:08 maxhis