November 28, 2020, 02:10:32 AM

Author Topic: Scroll output page?  (Read 505 times)

Offline lettersquash

  • Jr. Member
  • **
  • Posts: 73
    • Lettersquash Blog
Scroll output page?
« on: April 13, 2020, 11:51:13 PM »
Hi, is there a way to scroll the output page while still under program control? If you print more text than fits on a page, the first part seems to be lost to view until you end the program, and then you can scroll up. I see chr(11) doesn't shift the cursor up, which might have done it, (nor 8 back, but 10 does a newline and 9 inserts a tab).

Offline chrisws

  • Jr. Member
  • **
  • Posts: 61
    • SmallBASIC
Re: Scroll output page?
« Reply #1 on: April 15, 2020, 09:49:15 AM »
Hi, is there a way to scroll the output page while still under program control? If you print more text than fits on a page, the first part seems to be lost to view until you end the program, and then you can scroll up. I see chr(11) doesn't shift the cursor up, which might have done it, (nor 8 back, but 10 does a newline and 9 inserts a tab).

escape-m will scroll back to the top. not sure if this is standard ansi.

try this:

Code: [Select]
for i = 0 to 100
  print i
next i
print "\033m"
pause

Offline lettersquash

  • Jr. Member
  • **
  • Posts: 73
    • Lettersquash Blog
Re: Scroll output page?
« Reply #2 on: April 16, 2020, 10:33:20 PM »
Yes, that does scroll to the top, thanks. The Escape Codes page is a bit confusing. I gather from other script examples that "\e" in things like "\e[3m" is meant to stand for chr(27)+"["... (the CSI). Those CSI ones I've tried do work as expected. However, I'm not sure what "\xC" indicates, or "\n" or "\r". I tried various things including just "\n\r" etc., or starting with chr(27), or with CSI, but they print literally, other than the escape itself. Most tested on Win 7, but also my Android phone does the same.

The code for scrolling to the top you gave as "\033m", which works, but the Escape Codes page has "\m" (which prints literally). I don't know what the others in that paragraph are: frontscreen and backscreen 1 and 2 (there's also probably a typo in there, since two are the same). "\003" - "end of text (flush buffer)" also prints literally. Colours, bold, italic, etc. all work fine, as they're CSI.

I'll keep researching, although I've found I can do without scrolling up the page after all! Cheers,
¬~

Offline lettersquash

  • Jr. Member
  • **
  • Posts: 73
    • Lettersquash Blog
Re: Scroll output page?
« Reply #3 on: April 17, 2020, 12:47:14 AM »
One other thing. I've just realised that a semi-colon doesn't work between escape and bracket, where plus does. So
? chr(27)+"[1m"
selects bold text, but
? chr(27);"[1m"
prints "[1m" on screen.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal