Set cursor types

This commit is contained in:
2025-12-13 15:35:42 +00:00
parent d9ebf83588
commit d8c281d7d7
5 changed files with 43 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ extern "C" {
#include "../libs/libgrapheme/grapheme.h"
}
#include "../include/editor.h"
#include "../include/main.h"
#include "../include/ts.h"
#include "../include/utils.h"
@@ -197,8 +198,21 @@ void render_editor(Editor *editor) {
line_index++;
free(line);
}
if (cursor.row != UINT32_MAX && cursor.col != UINT32_MAX)
set_cursor(cursor.row, cursor.col, 1);
if (cursor.row != UINT32_MAX && cursor.col != UINT32_MAX) {
int type = 0;
switch (mode) {
case NORMAL:
type = BLOCK;
break;
case INSERT:
type = CURSOR;
break;
case SELECT:
type = UNDERLINE;
break;
}
set_cursor(cursor.row, cursor.col, type, true);
}
while (rendered_rows < editor->size.row) {
for (uint32_t col = 0; col < editor->size.col; col++)
update(editor->position.row + rendered_rows, editor->position.col + col,