bug-readline
[Top][All Lists]
Advanced

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

Re: [Bug-readline] Unexpected ^@ in input


From: Chet Ramey
Subject: Re: [Bug-readline] Unexpected ^@ in input
Date: Tue, 28 Apr 2009 11:47:52 -0400
User-agent: Thunderbird 2.0.0.21 (Macintosh/20090302)

Zoltan Kovacs wrote:
> Hi,
> 
> I'm using libreadline in my project. The underlying terminal driver
> that readline uses is also my own implementation.
> 
> My problem is that when I type a few characters (e.g. 'hello') and I
> press the left arrow key twice, then I should insert the next
> character right after 'hel'. This is what I'm expecting, but the
> result will be 'address@hidden' after pressing the 'a' key. Not to mention
> that the returned line by the readline() call will be 'hela' only, the
> remaining will be truncated.
> 
> What did I do wrong? Is this a problem on my side or this is a readline issue?

I can't say for sure that it's not a problem with readline, but I
can't reproduce it.  What is happening is that there is a NUL being
inserted into the readline line buffer (probably as the result of
read(2) returning it), and it's being displayed as ^@, its printable
equivalent.  The reason that more of the line is displayed is that
rl_end, which readline uses to mark the end of the line, is beyond the
NUL.  The line is truncated upon return because the NUL terminates the
returned string.

I'm not sure what else to tell you other than to check for read(2)
returning a NUL to readline.

Chet

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

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




reply via email to

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