From a68c1e1c9c79ab3a5b08c34fdbbfbd25f84be7cf Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Sat, 28 Jun 2025 08:39:03 +0100 Subject: [PATCH] tab with spaces --- nx/source/runtime/devices/console.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nx/source/runtime/devices/console.c b/nx/source/runtime/devices/console.c index 50e67ea8..fde12c30 100644 --- a/nx/source/runtime/devices/console.c +++ b/nx/source/runtime/devices/console.c @@ -695,6 +695,8 @@ void consoleDrawChar(int c) { //--------------------------------------------------------------------------------- void consolePrintChar(int c) { //--------------------------------------------------------------------------------- + int tabspaces; + if (c==0) return; switch(c) { @@ -723,7 +725,10 @@ void consolePrintChar(int c) { break; case '\t': - currentConsole->cursorX += currentConsole->tabSize - ((currentConsole->cursorX)%(currentConsole->tabSize)); + tabspaces = currentConsole->tabSize - ((currentConsole->cursorX - 1) % currentConsole->tabSize); + if (currentConsole->cursorX + tabspaces > currentConsole->windowWidth) + tabspaces = currentConsole->windowWidth - currentConsole->cursorX; + for(int i=0; i