LibVT: Make inject_string() a public API so clients can use it

This API allows you to add arbitrary input at the current cursor
position. You can even do escape sequences! :^)
This commit is contained in:
Andreas Kling 2019-10-22 22:14:36 +02:00
parent cd1eee6604
commit 5a83e053b3
Notes: sideshowbarker 2024-07-19 11:35:08 +09:00
3 changed files with 8 additions and 2 deletions

View File

@ -833,7 +833,7 @@ void Terminal::on_char(u8 ch)
}
}
void Terminal::inject_string(const String& str)
void Terminal::inject_string(const StringView& str)
{
for (int i = 0; i < str.length(); ++i)
on_char(str[i]);

View File

@ -104,6 +104,8 @@ public:
int max_history_size() const { return 500; }
const NonnullOwnPtrVector<Line>& history() const { return m_history; }
void inject_string(const StringView&);
private:
typedef Vector<unsigned, 4> ParamVector;
@ -114,7 +116,6 @@ private:
void put_character_at(unsigned row, unsigned column, u8 ch);
void set_window_title(const String&);
void inject_string(const String&);
void unimplemented_escape();
void unimplemented_xterm_escape();

View File

@ -19,6 +19,11 @@ public:
virtual ~TerminalWidget() override;
void set_pty_master_fd(int fd);
void inject_string(const StringView& string)
{
m_terminal.inject_string(string);
flush_dirty_lines();
}
void create_window();