[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-readline] Pasting long lines is slow
From: |
Chet Ramey |
Subject: |
Re: [Bug-readline] Pasting long lines is slow |
Date: |
Wed, 27 May 2015 09:08:03 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
On 5/27/15 5:26 AM, Ole Laursen wrote:
> 2015-05-26 22:43 GMT+02:00 Chet Ramey <address@hidden>:
>> I did a couple of things. I added an inline _rl_wcwidth function that
>> returns 1 for all printable ASCII characters and calls the system wcwidth
>> for the rest. That should help, though it doesn't do anything for
>> characters between 128 and 256.
>>
>> The second thing is this experimental patch to text.c that uses the
>> heuristic you suggested: it assumes that a call to rl_insert will be
>> followed by other calls to rl_insert and tries to read ahead in the
>> input stream as long as the character read maps to self-insert. I've
>> attached that for folks to experiment with.
>
> I tested it with "åååå " x 50000 (so 250k characters, but perhaps 450k
> bytes) and it takes about a second now compared to several minutes
> before. Awesome! Thanks!
Good. Ultimately, the solution is bracketed paste mode. The terminal
(or emulator), knowing whether or not a particular stream of characters
is the result of a paste, can indicate the boundaries of the set of
pasted text, and readline can treat it as a simple block of characters
to insert. Readline won't have to guess.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/