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

Prompt / Newline Bug in Firefox #6

Closed
chani opened this issue Sep 19, 2014 · 7 comments
Closed

Prompt / Newline Bug in Firefox #6

chani opened this issue Sep 19, 2014 · 7 comments
Assignees
Labels
type/bug Something is misbehaving

Comments

@chani
Copy link
Contributor

chani commented Sep 19, 2014

If you open up the demo page in Firefox (32.0 in Linux Mint) and you hit the enter key there is no newline, instead everything is written on the same line. In Chrome it does work as expected, though.

@chani
Copy link
Contributor Author

chani commented Sep 19, 2014

I just noticed the following:

  1. The demo page adds a "> " to the prompt (which is fine) but you're able to remove this just by using backspace (tested in chrome) - I do not think this is expected behavior, is it?
  2. You cannot type in ` (at least I cannot - german keyboard, german layout)
  3. Typing in a ' or a " should (correct me if I'm wrong - my "xterm" does exactly that) open a new line with a > and wait for the closing ' respective ". That is not the case here, though.
  4. \ is not working as expected (see 3.)

@parisk
Copy link
Contributor

parisk commented Sep 21, 2014

xterm.js is just an xterm clone in JavaScript. That means that there is no underlying logic, like a Bash or Zsh interpreter — it just receives and prints characters with some additional functionalities (like cursor displaying, column and rows resizing etc.). It's demo page just showcases some of its basic functionalities.

The demo page adds a "> " to the prompt (which is fine) but you're able to remove this just by using backspace (tested in chrome) - I do not think this is expected behavior, is it?

No this is not the expected behavior, despite the fundamental nature of the demo page, so this will be fixed ASAP.

You cannot type in ` (at least I cannot - german keyboard, german layout)

The ` character works fine in USA and UK layout in ISO keyboard. I will investigate this further for the german layout, but I do not own a German keyboard to test this out.

Typing in a ' or a " should (correct me if I'm wrong - my "xterm" does exactly that) open a new line with a > and wait for the closing ' respective ". That is not the case here, though.

This would introduce additional logic, that is relevant to the underlying interpreter. There is no reason such logic should exist in the demo page.

\ is not working as expected (see 3.)

The same thing applies here as well.

@parisk parisk closed this as completed in 567b39d Sep 22, 2014
@chani
Copy link
Contributor Author

chani commented Sep 22, 2014

Hey,

thanks. Can I help somehow with the german keyboard layout?

@chani
Copy link
Contributor Author

chani commented Sep 22, 2014

Output of xev when pressing ´ once. To appear in Linux I have to press the key twice. Does that help?

KeyPress event, serial 37, synthetic NO, window 0x3200001,
root 0x93, subw 0x0, time 3334704, (463,419), root:(466,515),
state 0x0, keycode 21 (keysym 0xfe51, dead_acute), same_screen YES,
XLookupString gives 2 bytes: (c2 b4) "´"
XmbLookupString gives 0 bytes:
XFilterEvent returns: True

KeyRelease event, serial 37, synthetic NO, window 0x3200001,
root 0x93, subw 0x0, time 3334856, (463,419), root:(466,515),
state 0x0, keycode 21 (keysym 0xfe51, dead_acute), same_screen YES,
XLookupString gives 2 bytes: (c2 b4) "´"
XFilterEvent returns: False

@chani
Copy link
Contributor Author

chani commented Sep 22, 2014

ah sorry, and the inverse (which is the key that i need - I have to press shift+´ (so hold shift and press ´ twice. that's in xev:

KeyPress event, serial 37, synthetic NO, window 0x3200001,
root 0x93, subw 0x0, time 3507839, (703,394), root:(706,490),
state 0x0, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x3200001,
root 0x93, subw 0x0, time 3508415, (703,394), root:(706,490),
state 0x1, keycode 21 (keysym 0xfe50, dead_grave), same_screen YES,
XLookupString gives 1 bytes: (60) "`"
XmbLookupString gives 0 bytes:
XFilterEvent returns: True

@parisk
Copy link
Contributor

parisk commented Sep 22, 2014

Can you run the following line of JavaScript in the console of your browser (when viewing the demo page) and tell me the number printed, when entering the "`" character?

term.on('key', function (key, e) {console.log(e.keyCode)})

P.S. Operating System, browser and browser version would be extremely helpful as well.

@parisk parisk added the type/bug Something is misbehaving label Sep 22, 2014
@parisk parisk self-assigned this Sep 22, 2014
@chani
Copy link
Contributor Author

chani commented Sep 23, 2014

Hey,

Linux Mint, Firefox 32.0 as stated above. You might consider changing the following line in your demo

if (ev.keyIdentifier == 'Enter') {

to

if (ev.key == 'Enter') {

keyIdentifier is empty/does not exist there (at least not in firefox). See: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent hence that if is never used. You might as well, consider to use ev.which instead of ev.keyCode because for some keys keyCode will be 0 and charCode would return something (that is the case if I for example type in qwertz - e.keyCode is 0, while e.which shows the correct number).

However, back to the problem: That returns nothing. As if it was never reached; that might be related to something else (I tried using which, keyCode, charCode - I also tried without xterm.js in an input field. It seems that key is not identifiable using javascript) - I'll investigate further and will let you know.

juancampa added a commit to juancampa/xterm.js that referenced this issue Jan 21, 2019
Eugeny referenced this issue in Eugeny/xterm.js Jun 3, 2019
Only apply the selection hack for the WebGL renderer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something is misbehaving
Projects
None yet
Development

No branches or pull requests

2 participants