diff --git a/src/text_editor/commands_window.cpp b/src/text_editor/commands_window.cpp index 9523f84..7d6a494 100644 --- a/src/text_editor/commands_window.cpp +++ b/src/text_editor/commands_window.cpp @@ -585,10 +585,22 @@ void WindowCommand(Event event, Window *window, View *view) { { - Vec2 mouse_vec2 = MouseVec2(); - Vec2I mouse = MouseVec2I(); - bool mouse_in_document = CheckCollisionPointRec(mouse, window->document_rect); - bool mouse_in_scrollbar = CheckCollisionPointRec(mouse, window->scrollbar_rect); + Vec2 mouse_vec2 = MouseVec2(); + Vec2I mouse = MouseVec2I(); + + // Special case for full-screen where we can have document + // aligned with monitor screen in which case mouse cursor cannot + // be smaller then 0 which means we cannot scroll + if (mouse.y == 0 && window->document_rect.min.y == 0) { + float x, y; + SDL_GetGlobalMouseState(&x, &y); + if (y == 0) { + mouse.y = -10; + } + } + + bool mouse_in_document = CheckCollisionPointRec(mouse, window->document_rect); + bool mouse_in_scrollbar = CheckCollisionPointRec(mouse, window->scrollbar_rect); bool scrollbar_action = mouse_in_scrollbar || window->mouse_selecting_scrollbar; bool document_action = false; diff --git a/src/text_editor/title_bar.cpp b/src/text_editor/title_bar.cpp index efa856d..2e64d5a 100644 --- a/src/text_editor/title_bar.cpp +++ b/src/text_editor/title_bar.cpp @@ -39,12 +39,16 @@ void ReplaceDebugData() { String16 string = ToString16(scratch, s); ReplaceText(buffer, GetRange(*buffer), string); - String view_list = DebugViewList(scratch); - Append(buffer, ToString16(scratch, view_list)); - Append(buffer, L"\n"); + float xmouse, ymouse; + SDL_GetMouseState(&xmouse, &ymouse); + Appendf(buffer, "mouse: [%f, %f]", xmouse, ymouse); - String window_list = DebugWindowList(scratch); - Append(buffer, ToString16(scratch, window_list)); + // String view_list = DebugViewList(scratch); + // Append(buffer, ToString16(scratch, view_list)); + // Append(buffer, L"\n"); + + // String window_list = DebugWindowList(scratch); + // Append(buffer, ToString16(scratch, window_list)); } void ApplyTitleBarChangesToWindow(Window *window, View *view, Buffer *buffer) { diff --git a/src/text_editor/todo.txt b/src/text_editor/todo.txt index bf72563..4c37c40 100644 --- a/src/text_editor/todo.txt +++ b/src/text_editor/todo.txt @@ -2,7 +2,6 @@ - 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 - - something about mouse stuff is busted and it randomly does big selections and stuff like that - 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