Fix wrong cursor on line numbers and scroll

This commit is contained in:
Krzosa Karol
2024-08-03 08:27:42 +02:00
parent d382735b80
commit e4a248bb60
3 changed files with 9 additions and 11 deletions

View File

@@ -261,16 +261,17 @@ bool GlobalCommand(Event event) {
Window *window = GetActiveWindow(); Window *window = GetActiveWindow();
bool mouse_in_document = CheckCollisionPointRec(mouse, window->document_rect); bool mouse_in_document = CheckCollisionPointRec(mouse, window->document_rect);
bool mouse_in_total = CheckCollisionPointRec(mouse, window->total_rect); bool mouse_in_total = CheckCollisionPointRec(mouse, window->total_rect);
bool mouse_in_line_numbers = CheckCollisionPointRec(mouse, window->line_numbers_rect);
bool mouse_in_scrollbar = CheckCollisionPointRec(mouse, window->scrollbar_rect); bool mouse_in_scrollbar = CheckCollisionPointRec(mouse, window->scrollbar_rect);
window->mouse_in_scrollbar = mouse_in_scrollbar; window->mouse_in_scrollbar = mouse_in_scrollbar;
static SDL_Cursor *SDL_MouseCursor; static SDL_Cursor *SDL_MouseCursor;
if (SDL_MouseCursor) SDL_DestroyCursor(SDL_MouseCursor); if (SDL_MouseCursor) SDL_DestroyCursor(SDL_MouseCursor);
if (window->mouse_selecting || mouse_in_total) { if (window->mouse_selecting || mouse_in_document) {
SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_TEXT); SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_TEXT);
SDL_SetCursor(SDL_MouseCursor); SDL_SetCursor(SDL_MouseCursor);
} else if (mouse_in_scrollbar || window->mouse_selecting_scrollbar) { } else if (mouse_in_scrollbar || window->mouse_selecting_scrollbar || mouse_in_line_numbers) {
SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_DEFAULT); SDL_MouseCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_DEFAULT);
SDL_SetCursor(SDL_MouseCursor); SDL_SetCursor(SDL_MouseCursor);
} else { } else {

View File

@@ -319,7 +319,6 @@ int main()
// This is here to render changes in title bar size without a frame of delay // This is here to render changes in title bar size without a frame of delay
LayoutWindows(); LayoutWindows();
BeginFrameRender(); BeginFrameRender();
Scratch scratch; Scratch scratch;
Array<Int> order = GetWindowZOrder(scratch); Array<Int> order = GetWindowZOrder(scratch);

View File

@@ -1,6 +1,4 @@
- bugs: - bugs:
- scrolling in fullscreen is busted because no space outside of window
- scrolling when clicking on scroller is busted
- page up and down should also scroll and leave you in exactly same scroll - page up and down should also scroll and leave you in exactly same scroll
- I think the way sublime text and we display line highlights is confusing with multiple cursors (line highlight can be confused with selection) - I think the way sublime text and we display line highlights is confusing with multiple cursors (line highlight can be confused with selection)
- don't trim lines with cursor or selection on it - don't trim lines with cursor or selection on it