mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:47:34 +00:00
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.
This commit is contained in:
parent
b823f3d29f
commit
2eb2207f50
2 changed files with 24 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue