Comments (6)
This seems to do it:
if (input.codeUnitAt(0) == 127) {
terminal.buffer.eraseCharacters(1);
terminal.buffer.backspace();
terminal.refresh();
return;
}
from xterm.dart.
This issue should be fixed now, right?
from xterm.dart.
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.
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.
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.
@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)
- The process exited with exit code 255 HOT 5
- ok
- Window doesn't close on "exit" HOT 1
- window 下 ctrl + c 无法退出当前命令程序 HOT 2
- Can I exec command in Terminal object? HOT 1
- Auto-correction on the software keyboard(e.g. Gboard) makes typing terminal keys difficult
- 关于对lrzsz的支持
- TerminalView.onTapUp not being called HOT 2
- When is it compatible with the latest version of flutter
- 求大佬出一个WebSocketChannel+xterm的例子! HOT 5
- example/suggestion.dart 怎么才能显示提示
- My flutter version is 3.7.12, but today I ran with an error and the xterm I use is 3.5.0
- Make links clickable (as an option)
- Cannot compile app on latest flutter version HOT 2
- Incompatible with flutter 3.19.0 HOT 5
- input lags
- Does not work on Flutter / Android
- Unhandled Exception: Converting object to an encodable object failed: NaN
- Possible open URL?
- Null check operator used on a null value
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xterm.dart.