Hyper: Very slow paste with `zsh-autosuggestions` enabled

Created on 20 Dec 2016  Â·  16Comments  Â·  Source: vercel/hyper

With zsh-autosuggestions enabled, pasting is very slow – I see each character appear, one character every few ms. The same applies to opening the config file with Cmd+, – I see each line of the message "typed" and then executed, over a period of about 2 seconds, before the file opens.

Without zsh-autosuggestions I don't notice this, so obviously that software is partly to blame, but Hyper is also a factor here because pasting is instant in iTerm even with zsh-autosuggestions.

I believe this is because Hyper sends each character of a pasted string individually, whereas iTerm must be sending the whole string at once.


Hyper 1.0.0
Electron 1.4.7
darwin x64 15.6.0

Performance

Most helpful comment

Seems that since some recent version the same workaround than the one suggested by @uv-w can be achieved by setting : DISABLE_MAGIC_FUNCTIONS=true in .zshrc

All 16 comments

Anyone have any ideas of how this can be done?

From poking around it looks like the problem could be here https://github.com/zeit/hyper/blob/b4943a05e9a614d00f4bf7203e4146efa47d1adb/lib/hterm.js#L365

onVTKeystroke may be typing the content in letter by letter

Quick note, on the standard terminal app on osx we have the same issue so I would say any time we use zsh-autosuggestions we are screwed and this is not a specific issue of hyper?

oh, you're very right. I didn't think I ran into this in iTerm, but I also do there.

https://github.com/zsh-users/zsh-autosuggestions/issues/141

Seeing as this is an issue here, we can probably close this.

Fixing delays on zsh-autosuggestions is, of course, necessary to do, but on the other hand, I believe https://github.com/zsh-users/zsh/blob/master/Functions/Zle/bracketed-paste-magic could be of great help here. In fact, I've experienced the same issue with Midnight Commander for a really long time. I described my unsuccessful hacking attempts here: https://github.com/zsh-users/zsh-autosuggestions/issues/136#issuecomment-220615998. Maybe similar technique could be employed here?

EDIT: Just for the reference, mc's issue: https://midnight-commander.org/ticket/2072#comment:21

I'm experiencing this and I'm fairly sure that I don't have zsh-autosuggestions enabled. This does however only occur with zsh – with bash it pastes much faster. I'm unsure how to diagnose my issue. Any pointers would be appreciated!

I'm pretty sure this should be okay with the latest version! Please let us know if it's not fixed.

echo $ZSH_VERSION
5.3

still very slow when pasting a large string.... :(

Same.

$ echo $ZSH_VERSION
5.3

very slow when pasting a large string
$ echo $ZSH_VERSION
5.3

Same here. Excruciatingly slow while pasting long cURLs in zsh with zsh-autosuggestions enabled.
I really don't know why this issue is closed. It's very much still open.
$ echo $ZSH_VERSION
5.3

mkdir $ZSH_CUSTOM/lib/
cp $ZSH/lib/misc.zsh $ZSH_CUSTOM/lib/.
vi $ZSH_CUSTOM/lib/misc.zsh

I commented the following lines, but you can remove it or change the if condition.

image

from:
https://apple.stackexchange.com/questions/312795/zsh-paste-from-the-clipboard-a-command-takes-a-few-second-to-be-write-in-the-ter

Seems that since some recent version the same workaround than the one suggested by @uv-w can be achieved by setting : DISABLE_MAGIC_FUNCTIONS=true in .zshrc

Seems that since some recent version the same workaround than the one suggested by @uv-w can be achieved by setting : DISABLE_MAGIC_FUNCTIONS=true in .zshrc

works perfectly. Thank you @fredleger

Thanks @huwllewellyn, this fix worked for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

0x80 picture 0x80  Â·  45Comments

BrysonR picture BrysonR  Â·  91Comments

deepsweet picture deepsweet  Â·  47Comments

rofazayn picture rofazayn  Â·  65Comments

xscheiner picture xscheiner  Â·  73Comments