robhagemans / pcbasic

PC-BASIC - A free, cross-platform emulator for the GW-BASIC family of interpreters
http://www.pc-basic.org
Other
393 stars 48 forks source link

Issues relating to the overflow position on the screen #190

Closed robhagemans closed 2 years ago

robhagemans commented 2 years ago

This documents a few issues relating to the behaviour of screen overflow position-- the situation where text is entered to fill exactly the screen width. At this stage, the screen will not yet scroll, and the visible cursor will remain on the last typed character, rather than moving to the next position as would happen elsewhere. If a character is entered, however, the screen scrolls (if applicable), the character is printed on the next row and the lines are joined by wrapping -- they form one single logical line for input purposes or e.g. for the effects of the ESC key.

There are a number of issues relating to this where PC-BASIC behaves incorrectly, I'll try to document and ideally fix these as I go along.

1. Incorrect left-key behaviour from overflow

Problem Left-key from overflow position goes to the second-last column, instead of the last column as in GW-BASIC.

Steps

  1. Assuming 80-column mode, press the 1 key 80 times.
  2. We now have a row of 1s and the cursor is in the overflow position, appearing visually on column 80 under the rightmost 1.
  3. Press the left-arrow key once.

What happens The cursor moves left to column 79 (where the leftmost is 1 and the rightmost is 80).

What was expected to happen The cursor should remain in column 80 - we have left the overflow position but that has no visible effect.

Notes

PC-BASIC version: 2.0.4 Operating system version: all

robhagemans commented 2 years ago

2. Overflow should not happen on a wrapped line (continuing logical line)

Cursor should move to next position on the logical line, i.e. first char of next row, instead remains in overflow position.

Should continue to overwrite, instead scrolls.

robhagemans commented 2 years ago

3. Printing the right-arrow control code on the bottom right cell should not scroll

locate 24,80: print chr$(&h1c);: locate 20,1

This causes the screen to scroll up a line in PC-BASIC, in GW-BASIC it remains static. The scroll does not happen if we print e.g. chr$(32).

Note chr$(&h1c) is used a s control code for right-arrow in PRINT statements, see the table at https://robhagemans.github.io/pcbasic/doc/2.0/#PRINT

robhagemans commented 2 years ago

4. Printing the down-arrow control code on the bottom row should not scroll

locate 24,79: print "a" chr$(&h1f) "b";: locate 20,1

Similar to previous comment, this causes a scroll in PC-BASIC and not in GW-BASIC.

chr$(&h1f) is the control code for down-arrow in PRINT statements.

robhagemans commented 2 years ago

All fixed