QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Stuart on December 07, 2018, 09:48:43 am

Title: Blank lines appear sometimes when TAB is used.
Post by: Stuart on December 07, 2018, 09:48:43 am
This problem was first reported back in October of 2015 on the [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] forum, but I wanted to repost it here since [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] isn't available anymore and new users of QB64 may not be aware of it.


It seems that TAB is using the "remaining spaces" info (_in addition to the "current POSition" info_) to determine if it needs to move to the next line before actually tabbing and printing.

Sometimes an extra blank line appears -- it all depends on what the current print POSition is (_and_ how many spaces are remaining on the line) when TAB is used.


The demo program below can be used to see the problem when using QB64.

QB64 and QB4.5 screenshots show what each output screen looks like.

Code: QB64: [Select]
  1. '********** This "TAB_bug" demo assumes an 80-column screen width. **********
  2. PRINT TAB(1287); "one" '''''''''''''''''''''''''''''''''no problem here
  3. PRINT TAB(255); "two" ''''''''''''''''''''''''''''''''''no problem here
  4. PRINT TAB(-5); "three" '''''''''''''''''''''''''''''''''no problem here
  5.  
  6. PRINT "1234567890123456789"; TAB(20); "-four-" '''''''''no problem here
  7.  
  8. PRINT "12345678901234567890"; TAB(20); "five" ''''''''''no problem here
  9.  
  10. PRINT "123456789012345678901234567890123456789012345678901234567890"; TAB(20); "six" ''''''''no problem here
  11.  
  12. PRINT "1234567890123456789012345678901234567890123456789012345678901"; TAB(20); "seven" '''''An extra blank line is printed here!
  13.  
  14. PRINT "0        1         2         3         4         5         6         7         8"
  15. PRINT "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
  16.  
  17. PRINT "TAB(20) is used before the words '-four-', 'five', 'six', and 'seven'."
  18. PRINT "QB64 prints a blank line before the word 'seven', but QB4.5 doesn't..."
  19. PRINT "Note that the line before 'seven' has only 19 spaces remaining at the"
  20. PRINT "end -- so it seems that TAB is also using the 'remaining spaces' info"
  21. PRINT "in addition to the 'current POSition' info to determine if it needs to"
  22. PRINT "move to the next line (which it does 2 times instead of just 1 time)."
  23.  
  24.  

  [ This attachment cannot be displayed inline in 'Print Page' view ]  

  [ This attachment cannot be displayed inline in 'Print Page' view ]  
  [ This attachment cannot be displayed inline in 'Print Page' view ]