LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-21-2011, 05:58 AM   #1
somlinux
LQ Newbie
 
Registered: Aug 2008
Distribution: fedora & ubuntu
Posts: 18

Rep: Reputation: 0
scrolling clears all previous data


Hi, how can i prevent erase of screen data while scrolling. When i use the ANSI cursor movement commands(\027[PnS , \027[PnT etc) say for scroll down the top lines get erased. i.e. if i scroll up after scroll down, i am unable to view top lines again.
 
Old 07-22-2011, 04:12 PM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Where are you scrolling? In a virtual terminal? In a console? In another program?
 
Old 07-24-2011, 11:51 PM   #3
somlinux
LQ Newbie
 
Registered: Aug 2008
Distribution: fedora & ubuntu
Posts: 18

Original Poster
Rep: Reputation: 0
in a console
 
Old 07-25-2011, 12:02 AM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
You can always use "less"

Quote:
EXAMPLES:
less mybigfile
<= Allows you to scroll up and down multiple screens worth of text

myprog | less
<= Allows you to scroll up and down through a program that writes to "stdout"
 
Old 07-25-2011, 12:23 AM   #5
somlinux
LQ Newbie
 
Registered: Aug 2008
Distribution: fedora & ubuntu
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by paulsm4 View Post
You can always use "less"
Actually it is a c program and uses ansi command set to scroll (\027[PnS & \027[PnT ).
 
Old 07-25-2011, 12:57 AM   #6
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
OK - there's your answer. It's the program's fault

Think about it: who's supposed to "remember" the text that scrolls off the screen?

If it's an X terminal with scrollbars, it's the "xterm" executable that buffers the unseen text. Similarly, "less", "vi", "emacs" et al each have their own strategies for saving, displaying and retrieving text.

It sounds like all your program does is "read" and "scroll". You can probably scroll forward just because the text that comes next is still waiting to be read. But you can't scroll backward - because the program never saved (and cannot retrieve) what it already read.

I'd forget the ANSI character sequences, if you have any choice in the matter.

Two better alternatives:
1. Use your program in conjunction with an external scrolling tool (like "less")
2. Use a more robust screen control library (like "ncurses").
 
Old 07-25-2011, 01:12 AM   #7
somlinux
LQ Newbie
 
Registered: Aug 2008
Distribution: fedora & ubuntu
Posts: 18

Original Poster
Rep: Reputation: 0
thanks, it means we need to save and display( by own logic) while scroll back, console is not doing it for us....
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to add new HDD (with previous data) in CentOS aq_mishu Linux - Server 3 05-13-2011 01:45 PM
LXer: Shuttleworth Clears Ubuntu 10.04 for Liftoff LXer Syndicated Linux News 0 04-29-2010 12:21 AM
MRTG didn't show previous data spice_prash Linux - Software 0 01-29-2008 03:59 AM
slow scrolling on one machine, fast scrolling of same files on another rblampain Debian 5 01-22-2008 03:20 AM
hard scrolling vs soft scrolling (console) haxcess Linux - General 2 08-30-2004 12:17 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration