Readline problems


 
Thread Tools Search this Thread
Top Forums Programming Readline problems
# 1  
Old 06-20-2009
Readline problems

I'm having problems with libreadline. When I write text longer than the current line, the text wraps back to the beginning of the line rather than to the next line. Also, when I use the arrow keys to edit something in that beginning part, it won't display at all (so I can edit only if I remember the order of the characters, most inconvenient).

It won't even work under xterm. Changing ROWS and LINES doesn't help. Upgrading to readline v. 6 didn't help, either.

Using Ctrl+R to redraw didn't quite work as it should have; picture here:
mersenneforum.org - View Single Post - Readline problems

How can I fix this?
# 2  
Old 06-21-2009
What is the output for:

stty -a
echo $TERM
# 3  
Old 06-21-2009
Code:
charles@zed:~$ stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
charles@zed:~$ echo $TERM
xterm

Note: I'm having the problem with a program using readline (Pari), not the terminal itself. I'm not sure whether this applies or not. There are no problems with readline in the terminal itself.
# 4  
Old 06-22-2009
You mean COLUMNS, not ROWS, correct? Console I/O sees COLUMNS env variable.
# 5  
Old 06-22-2009
Are you using escape sequences to create your prompt? If so they will interfer with readline unless you use the \[ escape to begin a sequence of non-printing characters,
and the \] escape to signal the end of such a sequence.
# 6  
Old 06-23-2009
MySQL

Quote:
Originally Posted by fpmurphy
Are you using escape sequences to create your prompt? If so they will interfer with readline unless you use the \[ escape to begin a sequence of non-printing characters,
and the \] escape to signal the end of such a sequence.
That's it!

I wasn't able to fix the escape sequences by adding \]: the program actually displays a ] and readline fails all the same. But if I remove the escape sequences entirely (giving up on bolding text and such) the editing works!

Thanks a lot -- this is really going to make using this program much easier.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Trouble compiling program using the readline library.

Hi: in the info page for readline library I read -- Function: void rl_variable_dumper (int readable) Print the readline variable names and their current values to `rl_outstream'. If READABLE is non-zero, the list is formatted in such a way that it can be made part of an... (1 Reply)
Discussion started by: stf92
1 Replies

2. Shell Programming and Scripting

How do I get my shell back to normal readline?

I just ran an application that crashed... but before it did, it managed to set readline echo off, and probably a bunch of other settings. Is there any way I can just tell my shell to re-initialize? To get back to whatever state existed before my shell got messed up by this evil program? (2 Replies)
Discussion started by: jjinno
2 Replies

3. Shell Programming and Scripting

using readline with parameter

dear all, i have code shell like this but i want to using parameter for this shell how i can do that :ex ./sample.sh 100 500sample.sh START=${1} LAST=${2} for (( a=${START}; a<=${LAST}; a++ )) do { echo $a } donethx for your advice (5 Replies)
Discussion started by: zvtral
5 Replies

4. Programming

Error:readline() on closed filehandle Perl

Hi, i have run the below perl code and i am getting an error Error:readline() on closed filehandle OR at run.pl line 31. CODE: =========================================== open OR,$ARGV; while (<OR>) { # find the batch date next if length $_ < 3; # BLANK LINE # last if $. > 120; #... (3 Replies)
Discussion started by: pspriyanka
3 Replies

5. Programming

Readline programming

Hi, I am new to using readline library to my application. Please I want to no how to write code for command line switches(options), i.e when i press tab the option of command as to change. eg: ls -a ls -d ...so on ls as many options, here i want options to be completed using tab ... (9 Replies)
Discussion started by: vanid
9 Replies

6. Shell Programming and Scripting

Readline Formatting

Hi All, I have a function that loops through an XML file line by line and spits it the content out to a new file (sometimes certain lines need changing). This all works fine, however the formatting of the original XML is not kept. for example:- <?xml version="1.0"?> <mysqldump>... (3 Replies)
Discussion started by: robfwauk
3 Replies

7. UNIX for Dummies Questions & Answers

Problems with using less

Hello, I am having problems with using less on Linux version 2.6.18-92.1.17.el5 (brewbuilder@hs20-bc1-7.build.redhat.com) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)). I am using csh but have the same problems on bash. If I pipe something to less it works perfectly i.e. cat file | less... (9 Replies)
Discussion started by: z1dane
9 Replies

8. Shell Programming and Scripting

cat vs head vs readline get variable from txt file

I have a file with a single filename in it, which I want to assign to a BASH variable, so I've been trying: c=$(head -1 somefile) echo $c which outputs correctly, but them when I do ... somecommand $c it says it can't find the file, is that because it's grabbing the whole line, and... (5 Replies)
Discussion started by: unclecameron
5 Replies

9. UNIX for Dummies Questions & Answers

Few problems

Hi how can i do this? 1) shell script which writes data and time on to a file if filesystem exceeds 70% of space. 2) make entry to cron table to run a script every 15 mins. and can anyone expplain or demonstrate the difference between variables used in inside a function and outside a... (3 Replies)
Discussion started by: vivekshankar
3 Replies

10. UNIX for Advanced & Expert Users

'make' problems (compliation problems?)

I'm trying to compile and install both most recent version of 'make' and the most recent version of 'openssh' on my Sparc20. I've run into the following problems... and I don't know what they mean. Can someone please help me resolve these issues? I'm using the 'make' version that was... (5 Replies)
Discussion started by: xyyz
5 Replies
Login or Register to Ask a Question