mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:18:13 +00:00
GTextEditor: Add Home/End and Ctrl+Home/Ctrl+End navigation shortcuts.
For start/end of line and start/end of document respectively.
This commit is contained in:
parent
8dcec749ed
commit
6a6bcc5daf
2 changed files with 36 additions and 18 deletions
|
@ -55,16 +55,6 @@ private:
|
|||
virtual void timer_event(GTimerEvent&) override;
|
||||
virtual bool accepts_focus() const override { return true; }
|
||||
|
||||
void update_scrollbar_ranges();
|
||||
Rect line_content_rect(int item_index) const;
|
||||
Rect line_widget_rect(int line_index) const;
|
||||
Rect cursor_content_rect() const;
|
||||
void update_cursor();
|
||||
void set_cursor(int line, int column);
|
||||
|
||||
GScrollBar* m_vertical_scrollbar { nullptr };
|
||||
GScrollBar* m_horizontal_scrollbar { nullptr };
|
||||
|
||||
class Line {
|
||||
public:
|
||||
Line() { }
|
||||
|
@ -78,6 +68,19 @@ private:
|
|||
String m_text;
|
||||
mutable int m_cached_width { -1 };
|
||||
};
|
||||
|
||||
void update_scrollbar_ranges();
|
||||
Rect line_content_rect(int item_index) const;
|
||||
Rect line_widget_rect(int line_index) const;
|
||||
Rect cursor_content_rect() const;
|
||||
void update_cursor();
|
||||
void set_cursor(int line, int column);
|
||||
Line& current_line() { return m_lines[m_cursor.line()]; }
|
||||
const Line& current_line() const { return m_lines[m_cursor.line()]; }
|
||||
|
||||
GScrollBar* m_vertical_scrollbar { nullptr };
|
||||
GScrollBar* m_horizontal_scrollbar { nullptr };
|
||||
|
||||
Vector<Line> m_lines;
|
||||
GTextPosition m_cursor;
|
||||
bool m_cursor_state { true };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue