-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Performance problem with pasting. fish_wcwidth at fault? #5866
Comments
No. That's like asking "numbers are getting big. Is addition at fault?". fish_wcwidth is a low-level function that we need to figure out how wide a string is. Terminal paste is really quite crappy, as it just inserts one character at a time, as if you've pressed them, so we redo the highlighting after every character. If you enter them manually, that's not an issue, as you can't press the keys fast enough. But if you paste a bunch, it is. Now, there is "bracketed paste", which most terminals support. That sends a sequence when a paste begins, and another when it ends, so we can distinguish between pasting and entering text manually (which is important so that e.g. pasted text doesn't automatically execute). We already support that, but we don't hook into the highlighter to disable it. I'm inclined to just disable the highlighter if the binding system is in "paste" mode. For now, instead of using your terminal's crappy paste, use our |
This does not seem to happen with a bash shell though. Can't really use xsel since I'm on wayland, this can perhaps be configured in the fish config? |
Yes, because bash doesn't do highlighting or suggestions or... in fact, in a very real sense bash doesn't handle output at all. It leaves displaying the characters you entered to the terminal - try
I'm pretty sure you actually can, because xwayland. But anyway, good news: It also supports wl-paste (in the next release)!
It's a function. See |
No, that didn't really fix it (though it did improve the situation). The next PR will. |
This adds a new pair of bind functions {en,dis}able-highlighting, that en/dis-able highlighting, respectively. We use these to turn off highlighting when we start bracketed paste, and we turn it on again when we stop it. This is by far the simplest solution to the issue of bracketed paste being slow. Fixes fish-shell#5866.
I've seem to run into a performance problem with fish shell upon pasting a large amount of text.
Steps to reproduce: Copy about a pages worth of dmesg output, paste into terminal a couple of times, shell turns to a grinding halt, unable to CTRL+C while text is being pasted and sometimes afterwards I am also unable to escape.
I've investigated with perf and found the following results: https://paste.sr.ht/%7Ekeli/c99256cfc926a7f7d7b6aa869c6884c94f2403c1
I can supply the entire perf record file if needed.
Perf reports that fish_wcwidth is using about half the cpu-time, this is evident when looking at htop while the text is being pasted, the cpu tends to go to 100%.
Fish version: 3.0.2
Terminal emulator: Alacritty 0.3.2
Kernel 5.0.13-arch1-1-ARCH
The text was updated successfully, but these errors were encountered: