[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting READLINE_POINT isn't always applied (4.0.24)

From: Chet Ramey
Subject: Re: Setting READLINE_POINT isn't always applied (4.0.24)
Date: Sun, 19 Jul 2009 21:33:50 -0400
User-agent: Thunderbird (Macintosh/20090605)

Henning Bekel wrote:
> Hello,
> If I try to change READLINE_LINE and READLINE_POINT from a 
> function bound via bind -x, then setting READLINE_POINT is not 
> applied every second time I invoke the function. Instead, the 
> cursor is placed at the end of the line.
> Simple test case:
> test_rl () {
> }
> bind -x '"\ew": test_rl'
> And keep hitting \ew... every first time the cursor is placed at 
> position 3, every second time it ends up at the end of the line.
> Is this the intended behavior or is it a bug?

It's a bug.  A fix will appear as a patch to bash-4.0.

> Also, is it intended that the modified line is drawn on a new 
> line? For example, if I wrote a function that increments the word 
> at READLINE_POINT if it contains only digits, and i wanted to 
> increase a value by hitting a keyseq five times, I'd end up with 
> five lines being printed in my terminal. I'd love to see this work 
> like readline's own editing functions (e.g. upcase-word) or macros 
> that edit the line without printing it again on a new line. But 
> maybe I just misinterpreted the purpose of this new feature. If 
> so, could you explain it's intended purpose?

It's intended.  Since the command executed as a result of `bind -x'
is an arbitrary one that can do anything it wants to the display,
it's better to completely redraw the line.

I wonder if we could specify whether or not to completely redraw the
line with a return status.

``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]