Skip to content

Commit 1bcac54

Browse files
committed
print tabs with space chars
1 parent cf7dae0 commit 1bcac54

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

libogc/console.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ void newRow()
769769

770770
void consolePrintChar(int c)
771771
{
772+
int tabspaces;
773+
772774
if (c==0) return;
773775

774776
switch(c) {
@@ -786,7 +788,7 @@ void consolePrintChar(int c)
786788

787789
if(currentConsole->cursorX < 1) {
788790
if(currentConsole->cursorY > 1) {
789-
currentConsole->cursorX = currentConsole->windowWidth - 1;
791+
currentConsole->cursorX = currentConsole->windowWidth;
790792
currentConsole->cursorY--;
791793
} else {
792794
currentConsole->cursorX = 1;
@@ -797,7 +799,8 @@ void consolePrintChar(int c)
797799
break;
798800

799801
case 9:
800-
currentConsole->cursorX += currentConsole->tabSize - ((currentConsole->cursorX)%(currentConsole->tabSize));
802+
tabspaces = currentConsole->tabSize - ((currentConsole->cursorX - 1) % currentConsole->tabSize);
803+
for(int i=0; i<tabspaces; i++) consolePrintChar(' ');
801804
break;
802805
case 10:
803806
newRow();

0 commit comments

Comments
 (0)