1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:47:46 +00:00

LibVT: Implement find and scroll helper methods in TerminalWidget

This is mostly based on TextDocument's similar methods, these will
help implement searching within the terminal application.

The support for unicode code points is shaky at best, and should
probably be improved further.
This commit is contained in:
Idan Horowitz 2020-12-28 11:23:38 +02:00 committed by Andreas Kling
parent 6446135681
commit 0ddde46c19
2 changed files with 127 additions and 0 deletions

View file

@ -81,7 +81,11 @@ public:
void set_selection(const VT::Range& selection);
VT::Position buffer_position_at(const Gfx::IntPoint&) const;
VT::Range find_next(const StringView&, const VT::Position& start = {}, bool case_sensitivity = false, bool should_wrap = false);
VT::Range find_previous(const StringView&, const VT::Position& start = {}, bool case_sensitivity = false, bool should_wrap = false);
void scroll_to_bottom();
void scroll_to_row(int);
bool is_scrollable() const;
int scroll_length() const;
@ -145,6 +149,10 @@ private:
int first_selection_column_on_row(int row) const;
int last_selection_column_on_row(int row) const;
u32 code_point_at(const VT::Position&) const;
VT::Position next_position_after(const VT::Position&, bool should_wrap) const;
VT::Position previous_position_before(const VT::Position&, bool should_wrap) const;
VT::Terminal m_terminal;
VT::Range m_selection;