From 3a305e2b1cec96a9aba65d2d895e65e06747406f Mon Sep 17 00:00:00 2001 From: cflip Date: Tue, 17 Jan 2023 20:52:50 -0700 Subject: Fix cursor rendering when view is scrolled horizontally --- window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window.c b/window.c index 74e2e10..cbb23b8 100644 --- a/window.c +++ b/window.c @@ -118,7 +118,7 @@ void window_redraw(struct editor_state *editor) draw_font_text(&buffer); SDL_Rect cursor_rect; - cursor_rect.x = editor->cursor_display_x * font.width; + cursor_rect.x = (editor->cursor_display_x - editor->col_offset) * font.width; cursor_rect.y = (editor->cursor_y - editor->line_offset) * font.height; cursor_rect.w = font.width; cursor_rect.h = font.height; -- cgit v1.2.3