hyper icon indicating copy to clipboard operation
hyper copied to clipboard

Strange behavior when scrolling through past commands

Open rmreq opened this issue 9 years ago • 8 comments

  • [x] I am on the latest Hyper.app version
  • [x] I have searched the issues of this repo and believe that this is not a duplicate
  • OS version and name: WSL (Ubuntu 16.04) on Windows 10 (Creators)
  • Hyper.app version:
  • Link of a Gist with the contents of your .hyper.js:
  • Relevant information from devtools (CMD+ALT+I on Mac OS, CTRL+SHIFT+I elsewhere):
  • The issue is reproducible in vanilla Hyper.app: Is Vanilla

Issue

Sometimes when using the up-key to retrieve previous commands, the cursor moves up a line with each press, overwriting that line with the one retrieved from history. For example: 1$ cd dir1 2$ ls -a 3$ mv file1 ../ 4$ [enter] 5$ [up-key] When pressing up on line 5, the cursor moves to line 4 and displays "mv ..." on 4; up again, and the mv file1 on line 3 is replaced by "ls -a" (Enter on line 4 is just to show that the retrieved command doesn't necessarily appear on the line where it was originally invoked) If then I try to edit ls -a on line 3, each delete key press moves the cursor up, and back one character, resulting in something like this: hyper_delete I've also experienced some problems with line wrap, where new characters are printed at the start of the current line after reaching the window edge rather than carrying over to a new line below. This occurs more frequently but not exclusively, at the bottom of the buffer (so it fails to automatically scroll down). But I'll create a separate issue for that since I suspect they are unrelated (this is new, while the line wrap issue has been occurring for weeks).

rmreq avatar May 13 '17 22:05 rmreq

I also experienced the same issue.

gkivanov avatar May 16 '17 15:05 gkivanov

https://github.com/zeit/hyper/issues/1790#issuecomment-302015252 this is windows being 💩 , this will be fixed by an update "coming soon" 😢

albinekb avatar May 19 '17 19:05 albinekb

I am with a Mac though.

gkivanov avatar May 19 '17 22:05 gkivanov

Exactly the same or similar? @georgekrasenov This is something else then 🤔

albinekb avatar May 19 '17 23:05 albinekb

Ahh, I tried recreating it but I am failing to. It looked very similar to what rmreq described. It happened after cating the hyper json file:

screen shot 2017-05-20 at 00 48 49

Then doing ls, but now I am failing to recreate it. However, the cursor always seems to be one or two places ahead, instead of where I am supposed to be typing:

screen shot 2017-05-20 at 00 50 23

There are no spaces after the end of the file name. Also sometimes it removes some of the last characters of the command prompt, which I am also failing to recreate now.

gkivanov avatar May 19 '17 23:05 gkivanov

Maybe an emoji issue @georgekrasenov, can you try removing that from your prompt and try if it's still there? if yes, then it will be fixed by: #1847 (soon)

albinekb avatar May 19 '17 23:05 albinekb

I had this issue for the longest time until I removed colors from my prompt.

uipoet avatar May 21 '17 21:05 uipoet

Using windows, reporting the same issue. Running WSL on windows 10, hyper 2.0.0. I have uninstalled all plugins and reset all settings to default, and the issue goes away. After adding in even a single color code back to PS1 prompt, the issue manifests again, I've managed 100% replication with any color additions.

The issue manifests as: -Parts of the history gets stuck as you scroll up and down in command history. When stuck, your cursor now starts to the right of the stuck letters. -When reaching the end of the window, instead of wrapping to the next line, text wraps into the start of the prompt. -With some PS1 color combos, the text starts to wrap to the start of the prompt (not next line) before it even reaches the end of the window.

No colors (default), no issues, even scrolling back and forth through hundreds of lines of history: image

Single color added ( PS1="\e[36m[\W]\$\e[0m " ) image Here, ssh -i ~/ is stuck in front of the cursor, and scrolling to history item . ~/.bash_profile causes it to appear in front of ssh -i ~/. Note the command still works as expected, it is just some sort of display issue.

Let me know if any further details may be of help.

Edit Fixed: @albinekb This is caused by incorrectly formatted color modifiers in the bash prompt rather than anything with the terminal. Have to make sure to wrap non-printing characters like color codes in \[ and \] or bash prompt can't properly keep track of the prompt's length which causes these funky issues.

See: http://tldp.org/HOWTO/Bash-Prompt-HOWTO/nonprintingchars.html https://superuser.com/questions/382456/why-does-this-bash-prompt-sometimes-keep-part-of-previous-commands-when-scrollin

Daynil avatar Apr 21 '18 04:04 Daynil