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

Very slow paste with zsh-autosuggestions enabled #1276

Closed
caesar opened this issue Dec 20, 2016 · 21 comments
Closed

Very slow paste with zsh-autosuggestions enabled #1276

caesar opened this issue Dec 20, 2016 · 21 comments
Labels
📊 Type: Performance Issue contains information about a performance issue in Hyper

Comments

@caesar
Copy link

caesar commented Dec 20, 2016

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

@albinekb albinekb added the 📊 Type: Performance Issue contains information about a performance issue in Hyper label Jan 4, 2017
@xvalentino
Copy link

xvalentino commented Jan 30, 2017

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

@vvo
Copy link
Member

vvo commented Jan 30, 2017

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?

@xvalentino
Copy link

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

@xvalentino
Copy link

xvalentino commented Jan 30, 2017

zsh-users/zsh-autosuggestions#141

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

@balta2ar
Copy link

balta2ar commented Feb 18, 2017

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: zsh-users/zsh-autosuggestions#136 (comment). Maybe similar technique could be employed here?

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

@quantumgolem
Copy link

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!

@timothyis
Copy link
Contributor

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

@mportela
Copy link

mportela commented Aug 7, 2018

echo $ZSH_VERSION
5.3

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

@quantumgolem
Copy link

Same.

$ echo $ZSH_VERSION
5.3

@fmeng
Copy link

fmeng commented Jan 20, 2019

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

@hriddhidey
Copy link

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

@ostli
Copy link

ostli commented Apr 16, 2019

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

@fredleger
Copy link

fredleger commented Jul 12, 2019

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

@polaroidkidd
Copy link

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

@huwllewellyn
Copy link

This worked for me: https://gist.github.com/magicdude4eva/2d4748f8ef3e6bf7b1591964c201c1ab

@williamclot
Copy link

Thanks @huwllewellyn, this fix worked for me.

@adamdoescode
Copy link

@uv-w's suggestion worked for me where DISABLE_MAGIC_FUNCTIONS=true failed to fix the problem. I am using iterm with zsh 5.8 on a 2020 13' mac intel processor.

@AmjadHussainSyed
Copy link

you need to surround true with double quotes

@kohane27
Copy link

@adamdoescode @AmjadHussainSyed

You don't need to manually add it; it's an option in the default. You just need to uncomment the following line in .zshrc:

# Uncomment the following line if pasting URLs and other text is messed up.
DISABLE_MAGIC_FUNCTIONS="true"

@adamdoescode
Copy link

@adamdoescode @AmjadHussainSyed

You don't need to manually add it; it's an option in the default. You just need to uncomment the following line in .zshrc:

# Uncomment the following line if pasting URLs and other text is messed up.
DISABLE_MAGIC_FUNCTIONS="true"

My experience is that this does not work. I don't know why, but only the other solution proposed by @uv-w works for me. Interestingly, I've had this problem on both iTerm in MacOS and on Windows in WSL2 Terminal.

@timhae
Copy link

timhae commented Aug 30, 2022

@adamdoescode @AmjadHussainSyed
You don't need to manually add it; it's an option in the default. You just need to uncomment the following line in .zshrc:

# Uncomment the following line if pasting URLs and other text is messed up.
DISABLE_MAGIC_FUNCTIONS="true"

My experience is that this does not work. I don't know why, but only the other solution proposed by @uv-w works for me. Interestingly, I've had this problem on both iTerm in MacOS and on Windows in WSL2 Terminal.

What was the suggestion by @uv-w ? It seems like they removed it/changed their name.

edit: I found something that worked for me

autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
zstyle ':bracketed-paste-magic' active-widgets '.self-*'

from zsh-users/zsh-autosuggestions#102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📊 Type: Performance Issue contains information about a performance issue in Hyper
Projects
None yet
Development

No branches or pull requests