Window CMD scroll lines

New to FreeBASIC? Post your questions here.
Post Reply
Flyzone
Posts: 109
Joined: Nov 17, 2017 17:39

Window CMD scroll lines

Post by Flyzone »

Is there something in FreeBasic or FBide that prevents my scrolling back to see previous lines printed? It seems I used to be able to do this but along the way something must have changed (Windows 11, new ver of FB, or ...). I can only go back 3 or 4 lines of scroll history now. I set the scroll line count for CMD to 9001 but no juice. For example, the simple program below only permits me to view the last 50 lines or so. It seems there is some kind of reset for each screen page going on. If I do this for a series of command lines like DIR, I am able to see as much history as I want.

Code: Select all

#lang "fblite"
for i=1 to 10000
  print i
next i
sleep
Last edited by Flyzone on Mar 20, 2023 16:15, edited 1 time in total.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Window CMD scroll lines

Post by fxm »

You must change a property of the Command Prompt Window (the one which is opened for the code execution):
- To do this, you will simply need to right-click on the top portion of the Command Prompt Window and hit the “Properties” link that is located on the right-click menu that appears.
- Open the Layout tab, and adjust the height of the buffer size as you want (>1000 for your above example).
- Click OK to save the change.
Re-execute your code.
Flyzone
Posts: 109
Joined: Nov 17, 2017 17:39

Re: Window CMD scroll lines

Post by Flyzone »

As I mentioned, I did this and set to 9001 but it made no difference.

The default "history size" is 9001. Resetting it to same and rerunning the program has no effect.

Obviously, it works for other buffering like CMD lines such as DIR and others.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Window CMD scroll lines

Post by fxm »

fxm wrote: Mar 20, 2023 16:14 You must change a property of the Command Prompt Window (the one which is opened for the code execution)
Flyzone
Posts: 109
Joined: Nov 17, 2017 17:39

Re: Window CMD scroll lines

Post by Flyzone »

Yes, did that too - at least I thought so. Not sure why that is so but I did that as well - unless I need to change it WHILE executing.

Update: did that too, no go. Changes another setting on rendering engine. That had no effect.

I'm missing something ... or it is something else.

Funny thing is that is that the scroll window will show previous command line entries with output but shows only the last 50 or so of the FB display. Clearly there is some screen wrapping going on by FB.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Window CMD scroll lines

Post by fxm »

Otherwise, can you test this?

Code: Select all

#lang "fblite"
Width , 10100
for i=1 to 10000
  print i
next i
sleep
mrminecrafttnt
Posts: 131
Joined: Feb 11, 2013 12:23

Re: Window CMD scroll lines

Post by mrminecrafttnt »

fxm wrote: Mar 20, 2023 18:58 Otherwise, can you test this?

Code: Select all

#lang "fblite"
Width , 10100
for i=1 to 10000
  print i
next i
sleep
Nope

Code: Select all

#lang "fblite"
Width 10100 , 10100
for i=1 to 10000
  print i
next i
sleep
works better for me
Here is a little sure not that want but more smart :)

Code: Select all

type logger
    Redim s(any) as string
    declare sub openlogger
    declare operator let (byval xs as string)
end type

operator logger.let(byval xs as string)
    redim preserve s(ubound(s)+1)
    s(ubound(s))= xs
end operator

sub logger.openlogger
    locate 1
    Print "**Logger**"
    for i as integer = lbound(s) to ubound(s)
        if csrlin mod 25 = 24 then
            Print "press any key to continue"
            sleep
            cls
            Print "**Logger**"
            else
            print s(i)
        end if
    next
end sub

    
'Mainprogramm here
dim as logger logg
for i as integer = 1 to 100
    print "I = ";I
    logg = "I= "+str(i)
next

print "done. Press a key to open the logger"
sleep
cls
logg.openlogger
Print "A key to exit."
sleep
Flyzone
Posts: 109
Joined: Nov 17, 2017 17:39

Re: Window CMD scroll lines

Post by Flyzone »

Yes, width 10100,10100 works. I'm not sure why fxm's version doesn't, however.

I know there is a 2 sec. pause on the latter version at the beginning of the program I guess to go grab a bunch of storage. It seems extreme to have to do that for what has been up to now a typical system response (i.e. ability to scroll back more than 4 lines). I'm not sure why the system scroll spec doesn't work.

Anyway, thanks to both of you for the help. Although interesting, I won't be going the TYPE route with this since it's a bit above my pay grade and this is often for brief testing and other quickie results uses.
Flyzone
Posts: 109
Joined: Nov 17, 2017 17:39

Re: Window CMD scroll lines

Post by Flyzone »

The result of the below program shows that the spec I have in the Windows command line parameters of 9100 is not being seen by FreeBasic. I'm not sure if this is some timing issue or something else. Also, somehow, no matter what I provide in the WIDTH command, the first 200 or so lines (plus the WIDTH displays) get truncated (i.e. I can't review them). Going in and changing it to a pre-execution window makes no difference. All pretty funky.

Code: Select all

#lang "fblite"
Dim As Long w
w = Width
Print "rows: " & HiWord(w)
Print "cols: " & LoWord(w)
sleep

width 10100,10100
for i=1 to 10000
    ?i
next
sleep
Results:
rows: 30
cols: 120

After sleep, above display is wiped out and display then begins with ...
195
196
197
198
199
343
344
345 ....
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: Window CMD scroll lines

Post by Lothar Schirm »

Do you use the windows terminal? I use the console host instead, that works for me (windows 11).
Flyzone
Posts: 109
Joined: Nov 17, 2017 17:39

Re: Window CMD scroll lines

Post by Flyzone »

Lothar Schirm wrote: Mar 29, 2023 10:41 Do you use the windows terminal? I use the console host instead, that works for me (windows 11).
I know this is an old post but my problem came back. The solutions that seemed to get me by above did not seem to work consistently or function correctly (or at least as I wanted them to). I tried all kinds of things, but I believe your solution may have work best. That is, to select "Legacy console" in the Properties section of the CMD line window and things are back to the way I've been familiar. I believe I'm getting what you refer to as the "console host" but not sure. I had tried this selection (i.e. Console Host as default) in another Window Properties selection (Terminal window, I think) and that didn't work. Anyway, it works now. I'm able to scroll back "forever" without the WIDTH spec (which really didn't work all that well). The font was small but I'm able to change that. Tnx.
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: Window CMD scroll lines

Post by Lothar Schirm »

Happy scrolling! :D
Post Reply