{"action":"created","issue":{"url":"https://api.github.com/repos/zsh-users/zsh-syntax-highlighting/issues/295","repository_url":"https://api.github.com/repos/zsh-users/zsh-syntax-highlighting","labels_url":"https://api.github.com/repos/zsh-users/zsh-syntax-highlighting/issues/295/labels{/name}","comments_url":"https://api.github.com/repos/zsh-users/zsh-syntax-highlighting/issues/295/comments","events_url":"https://api.github.com/repos/zsh-users/zsh-syntax-highlighting/issues/295/events","html_url":"https://github.com/zsh-users/zsh-syntax-highlighting/issues/295","id":150351406,"number":295,"title":"Pasting commands from clipboard are slow, same as using zle -U","user":{"login":"doubleloop","id":2602750,"avatar_url":"https://avatars.githubusercontent.com/u/2602750?v=3","gravatar_id":"","url":"https://api.github.com/users/doubleloop","html_url":"https://github.com/doubleloop","followers_url":"https://api.github.com/users/doubleloop/followers","following_url":"https://api.github.com/users/doubleloop/following{/other_user}","gists_url":"https://api.github.com/users/doubleloop/gists{/gist_id}","starred_url":"https://api.github.com/users/doubleloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doubleloop/subscriptions","organizations_url":"https://api.github.com/users/doubleloop/orgs","repos_url":"https://api.github.com/users/doubleloop/repos","events_url":"https://api.github.com/users/doubleloop/events{/privacy}","received_events_url":"https://api.github.com/users/doubleloop/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/zsh-users/zsh-syntax-highlighting/labels/Bug","name":"Bug","color":"d62727"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":23,"created_at":"2016-04-22T12:07:56Z","updated_at":"2016-04-29T23:49:49Z","closed_at":null,"body":"I have string copied from my text editor:\r\n\r\n```bash\r\necho aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n```\r\n* when I paste it to my local machine (zsh 5.2) it will run for more then 10 minutes with 100% cpu usage\r\n* when I disable zsh-syntax-highlighting, it is pasted instantly\r\n* when I ssh to my remote machine (zsh 5.0.2), it is also pasted almost instantly with zsh-syntax-highlighting enabled.. (I have exactly the same configuration of zsh on my remote)\r\n* when I use ctrl+r wpapper (zsh-navigation-tools) wich uses `zle -U` to paste command from history (https://github.com/psprint/zsh-navigation-tools/blob/master/n-history#L46) it works very long (10m+) both on local and remote.\r\n\r\nOf course I do not use such extreme commands like in this example, but commands I use when I am pasting are long enough to make the lagging of 5-10 seconds."},"comment":{"url":"https://api.github.com/repos/zsh-users/zsh-syntax-highlighting/issues/comments/215909410","html_url":"https://github.com/zsh-users/zsh-syntax-highlighting/issues/295#issuecomment-215909410","issue_url":"https://api.github.com/repos/zsh-users/zsh-syntax-highlighting/issues/295","id":215909410,"user":{"login":"danielshahaf","id":2141904,"avatar_url":"https://avatars.githubusercontent.com/u/2141904?v=3","gravatar_id":"","url":"https://api.github.com/users/danielshahaf","html_url":"https://github.com/danielshahaf","followers_url":"https://api.github.com/users/danielshahaf/followers","following_url":"https://api.github.com/users/danielshahaf/following{/other_user}","gists_url":"https://api.github.com/users/danielshahaf/gists{/gist_id}","starred_url":"https://api.github.com/users/danielshahaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielshahaf/subscriptions","organizations_url":"https://api.github.com/users/danielshahaf/orgs","repos_url":"https://api.github.com/users/danielshahaf/repos","events_url":"https://api.github.com/users/danielshahaf/events{/privacy}","received_events_url":"https://api.github.com/users/danielshahaf/received_events","type":"User","site_admin":false},"created_at":"2016-04-29T23:49:49Z","updated_at":"2016-04-29T23:49:49Z","body":"@ericfreese \r\n> Bpm works by intercepting the paste action and calling self-insert for each character. The fix is to only fetch suggestions for the first invocation of the widget functions, and skip fetching suggestions for subsequent recursions.\r\n\r\nI see...  so if widget A calls widget B, only the wrapper for A does any work, and it does it after both A and B have finished.  I'll keep this issue open to track adding this optimization to z-sy-h. :-)\r\n\r\n(I might use a global push/pop counter to avoid relying on $funcstack: should be a simple patch to [the wrapper function](https://github.com/zsh-users/zsh-syntax-highlighting/blob/341a3ae1f015fc366edfa7d31d0f96c693c9343c/zsh-syntax-highlighting.zsh#L221-L227).)\r\n\r\n> Nope! I've just gotten relatively practiced at typing it. Would be nice though. How about \"z-asug\"?\r\n\r\nLGTM, it doesn't seem to be a word or an existing trademark."}}