-
Notifications
You must be signed in to change notification settings - Fork 1.6k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Typing in the character 'f' displays an extra space #5153
Comments
I have literally the same OS and browser here, but cannot repro with our demo. My guess is, that somehow your project setup makes things up. Isnt nextjs used for serverside rendering? If you use serverside rendering - this never gonna work properly with xtermjs, unless those serverside DOM shims implement an almost fully working DOM abstraction. |
I'm skeptical it's a nextjs thing because I'm using client side code to render it with UseEffect. That being said I'll be doing some further testing on this to confirm, especially looking into hydration. I'll also test on a vite react app (I should really have done this instead of next since I'm not really utilizing the server side rendering features of next) to see if I get the same effect. Will post updates as I get through these tests. |
Same code fails in a react vite app. For reproduction, I did the following steps:
Code for App.tsx:
Same result occurs. Only happens to the character 'f' (not even 'F'). I feel like this test probably means that it's not a result of the other packages I had in my nextjs project or next itself. It could also be I am not properly writing to the terminal - I just picked up this library, so it's very possible there's just something wrong with my code above. I will still look into hydration to be extra sure, but to me this is looking like something going wrong with xterm. Unless React framework variants aren't supported? Edit: |
Yup, so in my nextjs project I am can confirm I am using client side rendering as my page.tsx file (which is the parent of all components) utilizes client side code like UseState and UseEffect. Furthermore, I have marked this file with 'use client'. If I remove this marking, I am met with the following error:
And from my understanding of nextjs, this means that no server side rendering is taking place. So, ignore my hydration point earlier, as that's not even occurring here. |
Can you check on xtermjs.org, if it happens there too for you? Also maybe use newest version of xtermjs, which is 5.5.0. Beside that - I have no clue, whats going on. Can you step-debug things from 'f' input down to terminal output? |
The strange behavior does not happen on the site for me. I'll try updating the version and see what happens. If that's still not working I can looking into step-debugging. |
We're not experts in react so if you can't provide a repro case using the plain API it's not very actionable on our end. Chances are, like in the past with similar issues, this is probably related to one of the framework lifecycle events messing with things. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
When I type the character 'f' into the terminal it displays 'f '. So, when I type 'asdfh', for example, I expect to see 'asdfh'. Unfortunately, I instead see 'asdf h'.
However, when console logging the 'f' character before it is written, I do not see the extra space. I also tried hard coding the write, via
terminal.current?.write('f')
and the same issue occurred. I am logging the buffer below and it does not show any spaces b/w 'f' and characters that come after 'f'. I also logged the followingconsole.log(key.includes('\x00'))
, which appears asfalse
for 'f'. I cannot find any null characters here that might cause this issue.This is only happening to me with the letter 'f' so far.
Here is the code I am working with:
Details
Also note that I have the following versions for react/next:
Steps to reproduce
The text was updated successfully, but these errors were encountered: