Closed mtangoo closed 10 years ago
A more fully-functional example can be found at https://code.google.com/p/wxbfide/ .
However, it does seem like you have found some bugs. TerminalWx is supposed to emulate a vt100 terminal. In this sense, backspace and delete might not do what you expect them to do (http://www.ibb.net/~anne/keyboard.html). However, backspace, delete, and CTRL+H are not even doing what they are supposed to do. Likewise, the linefeed mode (which should cause return to go to the next line) is not working either. I'm pretty sure these are bugs in GTerm or tatelnet, the code that terminalwx is based on. I will look into it when I have time. Thanks for the interest!
I have in fact suspended the plugin I was writing due to that. So I will appreciate the fix, if you get time to fix it. Thanks a lot.
So looking into VT100 documentation, it looks like the proper way to delete a character is to issue the command sequence ESC [ P
http://www.vt100.net/docs/vt102-ug/chapter5.html
The GTerm code seems to handle this properly, but the display is not updated. A similar problem occurs for the delete line sequence
ESC [ M
My guess is that the underlying line is deleted, but the display is not updated. I'll keep you updated
I have committed a change which fixed the bug preventing the
ESC [ P
sequence from working. you should be able to delete a character using this sequence now. I am still working on the other parts
The New Line issue is simply a matter of your keyboard not having the appropriate key to generate a line feed.
The terminal will respond appropriately to both carraige returns (character code 13) and line feeds (character code 10). Additionally it supports CRLF functionality which can be enabled with
ESC [ 20 h
Which will cause all line feeds to be processed as a line feed followed by a carriage return.
Thanks @jeremysalwen , especially for VT100 Manual and the fixes. I'm updating my repo and hope to get my plugin up again!
Hi mtangoo,
The latest patch reverts a lot of the GTerm code to the TaTelnet version. This fixes a lot of the issues with deleting characters. (Chameleon retrofitted the code with a simple scrolling system different than a virtual terminal.) I also looked into the code and found that there was a minor bug in GTerm where it forgot that the DEL character is a control character. I fixed this in TerminalWx, but GTerm was last updated 13 years ago, so I don't see much point in reporting a bug. This should make TerminalWx handle the delete key properly (i.e. ignoring it). .
As for the CR/LF issue... it's a bit more subtle. Here are the keys on the VT100 terminal we're trying to emulate: http://www.vt100.net/docs/vt102-ug/chapter1.html#S1.3.3 As you can see, there are separate keys for return and linefeed. taTelnet is hardcoded to treat both "return" and "enter" keys as carriage returns "\r". This is what's causing the NEWLINE (CRLF) mode of the virtual terminal to not work when you feed the input to the output. I will have to think about it more and look at it more closely to see what's the best way of handling this, but I think it should probably output linefeed "\n" instead. In any case, this isn't really a problem for displaying anything on the terminal, as the terminal display properly handles both newlines and linefeeds.
So I've found that pressing CTRL+j will generate a linefeed keypress. (I think it might be CTRL+ENTER on windows). I think this is a good enough workaround if you don't have a linefeed key on your keyboard. (as we basically have to choose whether the ENTER key will generate a carriage return or a line feed, and which ever one it doesn't generate, we need to manually enter.). you can also turn on the NEWLINE (CRLF) mode as i mentioned above
ESC [ 20 h
in combination with the CTRL+j shortcut. I'm marking this bug as closed.
Hi @jeremysalwen , I was offline for a while. Its ok to close it since the bug is fixed :) Sometimes is hard to decide options but I think the issue is put to rest!
Sample does not show how to write new line (with return key) or delete the typed letters (with backspace).
http://forums.wxwidgets.org/viewtopic.php?f=1&t=33939