mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
TextEditor: Change cursor when reaching the ruler area
Noticed that mouse-overing the ruler area in the TextEditor does not change the cursor to the default cursor, instead, the beam cursor is used, which does not look nice. This PR extends the mousemove event and introduces a new set_editing_cursor() function that takes care of setting the cursor for the editor area.
This commit is contained in:
parent
299cebbbcb
commit
03e9697975
Notes:
sideshowbarker
2024-07-19 17:04:13 +09:00
Author: https://github.com/tsymalla
Commit: 03e9697975
Pull-request: https://github.com/SerenityOS/serenity/pull/14912
2 changed files with 14 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
|||
#include <LibGfx/Font/Font.h>
|
||||
#include <LibGfx/Font/FontDatabase.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibGfx/StandardCursor.h>
|
||||
#include <LibSyntax/Highlighter.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
@ -310,6 +311,12 @@ void TextEditor::mousemove_event(MouseEvent& event)
|
|||
update();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_ruler_visible && (ruler_rect_in_inner_coordinates().contains(event.position()))) {
|
||||
set_override_cursor(Gfx::StandardCursor::None);
|
||||
} else {
|
||||
set_editing_cursor();
|
||||
}
|
||||
}
|
||||
|
||||
void TextEditor::select_current_line()
|
||||
|
@ -1672,6 +1679,11 @@ void TextEditor::set_mode(const Mode mode)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
set_editing_cursor();
|
||||
}
|
||||
|
||||
void TextEditor::set_editing_cursor()
|
||||
{
|
||||
if (!is_displayonly())
|
||||
set_override_cursor(Gfx::StandardCursor::IBeam);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue