Scroll output page?

Started by lettersquash, April 13, 2020, 23:51:13

Previous topic - Next topic

lettersquash

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).
I'll have you know, I'm coding all the right commands, just not necessarily in the right order.

chrisws

Quote from: lettersquash on April 13, 2020, 23:51:13
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:


for i = 0 to 100
  print i
next i
print "\033m"
pause


lettersquash

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,
¬~
I'll have you know, I'm coding all the right commands, just not necessarily in the right order.

lettersquash

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.
I'll have you know, I'm coding all the right commands, just not necessarily in the right order.