File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1-
21#include <stdlib.h>
32#include <string.h>
43#include <reent.h>
@@ -769,6 +768,8 @@ void newRow()
769768
770769void consolePrintChar (int c )
771770{
771+ int tabspaces ;
772+
772773 if (c == 0 ) return ;
773774
774775 switch (c ) {
@@ -786,7 +787,7 @@ void consolePrintChar(int c)
786787
787788 if (currentConsole -> cursorX < 1 ) {
788789 if (currentConsole -> cursorY > 1 ) {
789- currentConsole -> cursorX = currentConsole -> windowWidth - 1 ;
790+ currentConsole -> cursorX = currentConsole -> windowWidth ;
790791 currentConsole -> cursorY -- ;
791792 } else {
792793 currentConsole -> cursorX = 1 ;
@@ -797,7 +798,10 @@ void consolePrintChar(int c)
797798 break ;
798799
799800 case 9 :
800- currentConsole -> cursorX += currentConsole -> tabSize - ((currentConsole -> cursorX )%(currentConsole -> tabSize ));
801+ tabspaces = currentConsole -> tabSize - ((currentConsole -> cursorX - 1 ) % currentConsole -> tabSize );
802+ if (currentConsole -> cursorX + tabspaces > currentConsole -> windowWidth )
803+ tabspaces = currentConsole -> windowWidth - currentConsole -> cursorX ;
804+ for (int i = 0 ; i < tabspaces ; i ++ ) consolePrintChar (' ' );
801805 break ;
802806 case 10 :
803807 newRow ();
You can’t perform that action at this time.
0 commit comments