The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
cat vs head vs readline get variable from txt file unclecameron Shell Programming and Scripting 5 04-16-2009 03:07 AM
Howto get readline to work in shellscript (stdin) sentinel UNIX for Dummies Questions & Answers 3 09-15-2008 07:28 PM
awk problems Junes Shell Programming and Scripting 1 11-07-2005 09:17 PM
gcc problems AJA SUN Solaris 7 03-09-2004 10:44 AM
'make' problems (compliation problems?) xyyz UNIX for Advanced & Expert Users 5 11-05-2001 10:47 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-20-2009
CRGreathouse CRGreathouse is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 101
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 (permalink)  
Old 06-21-2009
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,859
What is the output for:

stty -a
echo $TERM
  #3 (permalink)  
Old 06-21-2009
CRGreathouse CRGreathouse is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 101
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 (permalink)  
Old 06-22-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,643
You mean COLUMNS, not ROWS, correct? Console I/O sees COLUMNS env variable.
  #5 (permalink)  
Old 06-22-2009
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,859
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.
Bits Awarded / Charged to fpmurphy for this Post
Date User Comment Amount
07-07-2009 CRGreathouse Fixed my problem as well! 1,000
06-23-2009 drl This "prompted" me to fix a problem withn my servers -- I like to use red, but then the history didn't always work correctly. 1,000
  #6 (permalink)  
Old 06-23-2009
CRGreathouse CRGreathouse is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 101
Thumbs up

Quote:
Originally Posted by fpmurphy View Post
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.
Sponsored Links
Reply

Bookmarks

Tags
libreadline, readline, redrawing, terminal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 04:39 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0