diff --git a/src/code.c b/src/code.c index aeb31b8..2839cb4 100644 --- a/src/code.c +++ b/src/code.c @@ -143,9 +143,9 @@ static s32 getLinesCount(Code* code) static void removeInvalidChars(char* code) { - // remove \r symbol - char* s; char* d; - for(s = d = code; (*d = *s); d += (*s++ != '\r')); + // remove \r symbol + char* s; char* d; + for(s = d = code; (*d = *s); d += (*s++ != '\r')); } static void updateEditor(Code* code) @@ -647,7 +647,7 @@ static void pageDown(Code* code) s32 line = 0; getCursorPosition(code, &column, &line); s32 lines = getLinesCount(code); - setCursorPosition(code, column, line < lines - TEXT_BUFFER_HEIGHT ? line + TEXT_BUFFER_HEIGHT : lines); + setCursorPosition(code, column, line < lines - TEXT_BUFFER_HEIGHT ? line + TEXT_BUFFER_HEIGHT : lines); } static bool replaceSelection(Code* code) diff --git a/src/console.c b/src/console.c index fe42a1c..eb7b18f 100644 --- a/src/console.c +++ b/src/console.c @@ -1815,6 +1815,12 @@ static bool loadProject(Console* console, const char* data, s32 size) SDL_memcpy(project, data, size); project[size] = '\0'; + // remove all the '\r' chars + { + char *s, *d; + for(s = d = project; (*d = *s); d += (*s++ != '\r')); + } + tic_cartridge* cart = (tic_cartridge*)SDL_malloc(sizeof(tic_cartridge)); if(cart)