Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot remove text from previous line #2863

Closed
thbong opened this issue Apr 21, 2020 · 1 comment
Closed

Cannot remove text from previous line #2863

thbong opened this issue Apr 21, 2020 · 1 comment
Labels
type/question A question on how to use the library

Comments

@thbong
Copy link

thbong commented Apr 21, 2020

I'm using xterm 4.4 with Xamarin.Android and Xamarin.iOS. Confirmed that this still repros in version 4.5.

When there's more than 1 line of user input, the cursor is stuck at the 0 x position of the current line and the previous text cannot be removed, but the text-area element which takes in the actual input does respect the user keystrokes.

"What is this why is this happening" is typed in the user input, both the text area element and the displayed content(div class ="xterm-accessibility-tree") respect the input change. "What is this why is t" is the first line, and the text after that, "his happening" is on the second line.
image

When removing text by backspace key, the text on the line which the cursor is on is removed, but the cursor gets stuck in the 0 x position of the current line and does not move to previous line. Pressing the backspace key repeatedly does not remove the text that's displayed in the previous line, but the text-area which is the actual input does respect the backspace key and has the correct input. This is the screenshot after I removed some text and is only left with "what ".
You can see that the text area element has "what ", but the displayed content's last div still has "what is this why is t".
image

Expected behavior:
What is being displayed should behave the same way as the text area does. While the user is typing something in the input, the displayed content should respect the changes the user makes.

@Tyriar
Copy link
Member

Tyriar commented Apr 22, 2020

We cannot reliably sync the textarea with the prompt as xterm.js at its core is a component that just prints things and moves a cursor around, it doesn't have a concept of an input area. When you press backspace, it gets sent over to your server/shell, the shell responds by telling the terminal to move the cursor to the left one space and deleting the character. Expanding on this, when your shell prints its prompt, it looks exactly the same as any other text, just write blahblah@Azure:~$ as it would when responding to key events too.

This is a similar problem to pressing up/down doesn't reflect things in the textarea as discussed in microsoft/vscode#94708 (comment)

Now as for the problem where your cursor doesn't wrap back beyond x 0, this is the responsibility of a readline component on the server/shell side that when xterm.js tells it that backspace is hit, it changes it's model and sends back to move the cursor to the end of the previous line and delete the last character.

@Tyriar Tyriar closed this as completed Apr 22, 2020
@Tyriar Tyriar added the type/question A question on how to use the library label Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/question A question on how to use the library
Projects
None yet
Development

No branches or pull requests

2 participants