mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
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:
parent
cd1eee6604
commit
5a83e053b3
Notes:
sideshowbarker
2024-07-19 11:35:08 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/5a83e053b34
3 changed files with 8 additions and 2 deletions
|
@ -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]);
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue