diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-02-20 12:31:48 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-02-22 10:14:36 +0100 |
commit | 2eb2207f5049e6b154e3601faca1b7d69b62bf8a (patch) | |
tree | 539f10f6f3ae81b4c45c5c8af9eb6e509b5cc48d /Userland/Libraries/LibGUI/TextEditor.h | |
parent | b823f3d29f746fe49192f862aa50e0b6af2a751a (diff) | |
download | serenity-2eb2207f5049e6b154e3601faca1b7d69b62bf8a.zip |
LibGUI: Convert mouse events from a visual to a physical position
When clicking a position within a TextEditor, we should interpret that
position as a visual location. That location should be converted to a
"physical" location before using it to set the physical cursor position.
For example, consider a document with 2 emoji, each consisting of 3 code
points. Visually, these will occupy 2 columns. When a mouse click occurs
between these columns, we need to convert the visual column number 1 to
the physical column number 3 when storing the new cursor location.
Diffstat (limited to 'Userland/Libraries/LibGUI/TextEditor.h')
-rw-r--r-- | Userland/Libraries/LibGUI/TextEditor.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/TextEditor.h b/Userland/Libraries/LibGUI/TextEditor.h index 903dbd9046..4892794f29 100644 --- a/Userland/Libraries/LibGUI/TextEditor.h +++ b/Userland/Libraries/LibGUI/TextEditor.h @@ -190,6 +190,7 @@ public: void set_cursor_and_focus_line(size_t line, size_t column); void set_cursor(size_t line, size_t column); virtual void set_cursor(TextPosition const&); + void set_cursor_to_text_position(Gfx::IntPoint); Syntax::Highlighter* syntax_highlighter(); Syntax::Highlighter const* syntax_highlighter() const; |