MichalStrehovsky / SeeSharpSnake

Self-contained C# game in 8 kB
607 stars 63 forks source link

Fix crash in SetCursorPosition #19

Closed AntonLapounov closed 3 years ago

AntonLapounov commented 3 years ago

Fixes #17. The issue was introduced by #15, which started to call Console.SetCursorPosition(0, 20) after printing the bottom-right character. That position is just outside the buffer area. I changed the code to call Console.SetCursorPosition(0, ...) at the beginning of each line instead. That fixed the crash; however, I started to see the window scrolled up one line after the bottom-right character is printed. It seems the simplest fix to avoid scrolling is to add an extra (unused) line at the bottom of the window.