summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-25 14:30:27 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-25 14:30:27 -0500
commit6d77e94b652ab4b8070b5acf1c6febfe77fc41c3 (patch)
tree371459fb5c1eb323959c365f8b39fe5a53631681 /buffer.c
parent047764ebab345a2bcb3a856c1f1956e849f52354 (diff)
change cursor
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index 0c226ea..c14389b 100644
--- a/buffer.c
+++ b/buffer.c
@@ -2072,7 +2072,7 @@ void buffer_render(TextBuffer *buffer, Rect r) {
rect_coords(r, &x1, &y1, &x2, &y2);
// Correct the scroll, because the window size might have changed
buffer_correct_scroll(buffer);
-
+
Font *font = buffer_font(buffer);
u32 nlines = buffer->nlines;
Line *lines = buffer->lines;
@@ -2123,6 +2123,11 @@ void buffer_render(TextBuffer *buffer, Rect r) {
buffer->x1 = x1; buffer->y1 = y1; buffer->x2 = x2; buffer->y2 = y2;
+ // change cursor to ibeam when it's hovering over the buffer
+ if ((!ted->menu || buffer == &ted->line_buffer) && rect_contains_point(rect4(x1, y1, x2, y2), ted->mouse_pos)) {
+ ted->cursor = ted->cursor_ibeam;
+ }
+
if (buffer->center_cursor_next_frame) {
buffer_center_cursor(buffer);