1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:28:11 +00:00

LibLine: Expose actual_rendered_string_length & accept newlines in prompt

This commit is contained in:
AnotherTest 2020-05-10 11:30:38 +04:30 committed by Andreas Kling
parent 1d0d0e9d00
commit ccdef5a675
2 changed files with 6 additions and 2 deletions

View file

@ -1031,6 +1031,11 @@ size_t Editor::actual_rendered_string_length(const StringView& string) const
state = Escape;
continue;
}
if (c == '\r' || c == '\n') {
// reset length to 0, since we either overwrite, or are on a newline
length = 0;
continue;
}
// FIXME: This will not support anything sophisticated
++length;
break;

View file

@ -130,6 +130,7 @@ public:
const Vector<String>& history() const { return m_history; }
void register_character_input_callback(char ch, Function<bool(Editor&)> callback);
size_t actual_rendered_string_length(const StringView& string) const;
Function<Vector<CompletionSuggestion>(const String&)> on_tab_complete_first_token;
Function<Vector<CompletionSuggestion>(const String&)> on_tab_complete_other_token;
@ -252,8 +253,6 @@ private:
return (m_drawn_cursor + current_prompt_length()) % m_num_columns;
}
size_t actual_rendered_string_length(const StringView& string) const;
void set_origin()
{
auto position = vt_dsr();