Open kvokka opened 8 years ago
Same problem over here :)
But I think that \e[5D
or \e[5C
are not really a word-wise movements (see this or e.g.:
[8] pry(main)> print "12345\e[1D"
1234=> nil
[9] pry(main)> print "123456\e[5D"
1=> nil
This fix will not be enough, you can see in my pull request. With it it works not bad at all, but not good enough (i use this gem only as a part of pry-coolline), and if I paste more than 500 bytes of data i got too much lag.
But better look into m first commit, there is CORRECT solution, your one will not works correcnt in case of buffer length.
@kvokka Do you mean that your fix or the fix in #23 is not good enough? @arlimus 's fix seems to work for me, and is a less invasive change. It seems undesirable to insert delays into the input process, especially since coolline itself also adds some delay for syntax highlighting. Could you explain why your fix is necessary/better? Thanks!
I've done it because ih @arlimus implementation you will get bug outpt with long press. Try to paste 300-500 symbols snippet od text (with spaces of course) and nav it with his method, holdind the cthl+arrow buttons and you will get '5D' and '5E' symbols as artifact, that was not readed from buffer and pushed to console input. I tried to add the delay for preventing this artifacts, but got too slow working with bigger parts of code.
Now I had to cut coolline, but I'll be very happy to use it againg (if it will works ;)
Hmm I don't experience that actually, though pasting in long strings of text is generally pretty slow with coolline enabled, even without the extra delay. But I haven't seen the 5D/5E artifacts with @arlimus 's fix even with a long string of text.
Bug will be raided not after insert, but after navigating on the string. Copy this message(maybe twice), for example, and then try to go back and forward on it with ctrl+arrows. after few times you'll get the bug. And it is really annoying, is you have to deal will long sql queries.
In pry you get 5D or 5C symbols, when try move over the line by ctrl+arrow keys.
This will fix it