[PB 6.21] Regresion in console output behaviour

Post bugreports for the Linux version here
ColeopterusMaximus
User
User
Posts: 66
Joined: Fri Oct 29, 2010 11:29 am

[PB 6.21] Regresion in console output behaviour

Post by ColeopterusMaximus »

There has been some kind of regresion/bug in how the output to the console is handled in PB6.21

The following code in PB6.20 allows you (using the arrow keys) to move the console's cursor inside the console window without filling it with garbage:

Code: Select all

EnableExplicit

#CONSOLE_CODE_CURSOR_UP    = Chr(27) + "[1A"
#CONSOLE_CODE_CURSOR_DOWN  = Chr(27) + "[1B"
#CONSOLE_CODE_CURSOR_RIGHT = Chr(27) + "[1C"
#CONSOLE_CODE_CURSOR_LEFT  = Chr(27) + "[1D"

Define str_keypress.s = ""
Define int_keycode.i  = 0

If OpenConsole()
    Repeat
        str_keypress = Inkey()
        int_keycode  = RawKey()

        If int_keycode
            Select int_keycode
                 Case 65
                    Print(#CONSOLE_CODE_CURSOR_UP)
                 Case 66
                    Print(#CONSOLE_CODE_CURSOR_DOWN)
                 Case 67
                    Print(#CONSOLE_CODE_CURSOR_RIGHT)
                 Case 68
                    Print(#CONSOLE_CODE_CURSOR_LEFT)
            EndSelect
        EndIf
        Delay(10) ; Removing the delay reduces the problem but that's not a valid solution.
    ForEver
EndIf
In PB6.21 this happens: (incorrect)

https://freeimage.host/i/FCSsXUu

This is in PB6.20 (correct)

https://freeimage.host/i/FCStx7n
Last edited by ColeopterusMaximus on Thu Jun 19, 2025 2:37 pm, edited 1 time in total.
User avatar
mk-soft
Always Here
Always Here
Posts: 6201
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Regresion in console output behaviour - PB6.21

Post by mk-soft »

Same on macOS
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
benubi
Enthusiast
Enthusiast
Posts: 215
Joined: Tue Mar 29, 2005 4:01 pm

Re: [PB 6.21] Regresion in console output behaviour

Post by benubi »

Yes, I was also surprised. The escape sequences get somehow debugged/echoed, without the leading escape character.

Happens on x64 and arm64 Linux, PB 6.21. The code demonstrates the problem when you press cursor keys and other "special" keys, including return/newline. It also appears when using Input().

Code: Select all

Procedure KeyLoop()
  Protected a$,rk
  Repeat 
    a$=Inkey()
    rk = RawKey()
    If rk=0 And a$=#Empty$
      Delay(1)
    EndIf 
  Until a$=Chr(13) Or a$=Chr(10)
EndProcedure


OpenConsole()
PrintN("Default mode console")
PrintN("Enter Cursor Keys and hit return")
KeyLoop()
PrintN("Graphical console")
EnableGraphicalConsole(1)
PrintN("Enter Cursor Keys, and hit return")
KeyLoop()
EnableGraphicalConsole(0)
PrintN("Text mode, press cursor keys, enter return to exit")
Input()
CloseConsole()
Post Reply