Git Product home page Git Product logo

Comments (6)

dnfield avatar dnfield commented on June 6, 2024 1

This seems to do it:

    if (input.codeUnitAt(0) == 127) {
      terminal.buffer.eraseCharacters(1);
      terminal.buffer.backspace();
      terminal.refresh();
      return;
    }

from xterm.dart.

devmil avatar devmil commented on June 6, 2024 1

This issue should be fixed now, right?

from xterm.dart.

devmil avatar devmil commented on June 6, 2024

The same happens here on a Mac (macOS Big Sur), Flutter 2.0.1
Arrow Keys (Left, Right) also don't work for me.

Not sure if this is the same "root cause" but CTRL+C is printed as ^C but has no effect

from xterm.dart.

devmil avatar devmil commented on June 6, 2024

On a Mac: When I don't launch the app via flutter run or the App Bundle but by executing the executable inside the script then Backspace and the Arrow keys are working.

Also interesting: The keys get transferred correctly to the shell only the output is wrong:
If I type ls bb, then two times <backspace>, then -al and <enter> then it outputs the list correctly but shows garbage on the prompt.

CTRL+C doesn't work even in that case

from xterm.dart.

dnfield avatar dnfield commented on June 6, 2024

The example definitely doesn't handle backspace. It looks like there's some attempt to have backspace support, but it doesn't seem to work like I'd expect. For example, changing the handler to this:

  void _onInput(String input) {
    if (input.isEmpty) {
      return;
    }
    if (input.codeUnitAt(0) == 127) {
      terminal.buffer.backspace();
      // terminal.writeChar(127); // Doesn't work.
      return;
    }
    if (input == '\r') {
      terminal.write('\r\n');
      terminal.write('\$ ');
    } else {
      terminal.write(input);
    }
  }

Kind of works on the first character but not on more. I've tried messing with the setCursorX a bit but that only seems to make things worse :) It seems to erase in the buffer but not on screen. Still missing something.

from xterm.dart.

devmil avatar devmil commented on June 6, 2024

@dnfield I think your problem is a specific problem of the provided sample that is not connected to any backend.

Normally handling the backspace is done by the backend (local shell or ssh) and this results in new update commands for the terminal to reflect the new state.

There was an issue in the way the local shell is started (missing terminal type) that also led to strange behavior regarding the backspace (and other keys) which should now be fixed (not here in the example but in the studio application that uses the pty package)

I think I mixed this up as the OP seems also to refer to the sample app without backend. So 👍 for your suggestion

from xterm.dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.