this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

added ability to change the size of tabs

+22 -2
+22 -2
src/studio/editors/code.c
··· 213 213 tic_api_print(tic, (char[]){symbol, '\0'}, x, y, color, true, 1, alt); 214 214 } 215 215 216 + static int drawTab(Code* code, s32 x, s32 y, u8 color) 217 + { 218 + tic_mem* tic = code->tic; 219 + s32 tab_size = getConfig(code->studio)->options.tabSize; 220 + 221 + s32 count = 0; 222 + while (count < tab_size) { 223 + drawChar(tic, ' ', x, y, color, code->altFont); 224 + count++; 225 + if (x / getFontWidth(code) % tab_size == 0) 226 + break; 227 + x += getFontWidth(code); 228 + } 229 + return getFontWidth(code) * count; 230 + } 231 + 216 232 static void drawCursor(Code* code, s32 x, s32 y, char symbol) 217 233 { 218 234 bool inverse = code->cursor.delay || code->tickCounter % TEXT_CURSOR_BLINK_PERIOD < TEXT_CURSOR_BLINK_PERIOD / 2; ··· 265 281 while(*pointer) 266 282 { 267 283 char symbol = *pointer; 284 + s32 x_offset = getFontWidth(code); 268 285 269 286 if(x >= -getFontWidth(code) && x < TIC80_WIDTH && y >= -TIC_FONT_HEIGHT && y < TIC80_HEIGHT ) 270 287 { ··· 281 298 if(code->shadowText) 282 299 drawChar(code->tic, symbol, x+1, y+1, 0, code->altFont); 283 300 284 - drawChar(code->tic, symbol, x, y, colors[syntaxPointer->syntax], code->altFont); 301 + if (symbol == '\t') 302 + x_offset = drawTab(code, x, y, colors[syntaxPointer->syntax]); 303 + else 304 + drawChar(code->tic, symbol, x, y, colors[syntaxPointer->syntax], code->altFont); 285 305 } 286 306 } 287 307 ··· 299 319 x = xStart; 300 320 y += STUDIO_TEXT_HEIGHT; 301 321 } 302 - else x += getFontWidth(code); 322 + else x += x_offset; 303 323 304 324 pointer++; 305 325 syntaxPointer++;