mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 08:17:34 +00:00
LibLine+Shell: Remove unused split_mechanism
It was only read in should_break_token(), which had no callers. should_break_token() also got `foo\\ bar` and `"foo bar"` wrong.
This commit is contained in:
parent
7f7dd3cf9c
commit
3cc9e8ba41
3 changed files with 2 additions and 23 deletions
|
@ -919,7 +919,7 @@ void Editor::handle_read_event()
|
||||||
// Disable our own notifier so as to avoid interfering with the search editor.
|
// Disable our own notifier so as to avoid interfering with the search editor.
|
||||||
m_notifier->set_enabled(false);
|
m_notifier->set_enabled(false);
|
||||||
|
|
||||||
m_search_editor = Editor::construct(Configuration { Configuration::Eager, m_configuration.split_mechanism }); // Has anyone seen 'Inception'?
|
m_search_editor = Editor::construct(Configuration { Configuration::Eager }); // Has anyone seen 'Inception'?
|
||||||
add_child(*m_search_editor);
|
add_child(*m_search_editor);
|
||||||
|
|
||||||
m_search_editor->on_display_refresh = [this](Editor& search_editor) {
|
m_search_editor->on_display_refresh = [this](Editor& search_editor) {
|
||||||
|
@ -1638,19 +1638,6 @@ String Editor::line(size_t up_to_index) const
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Editor::should_break_token(Vector<u32, 1024>& buffer, size_t index)
|
|
||||||
{
|
|
||||||
switch (m_configuration.split_mechanism) {
|
|
||||||
case Configuration::TokenSplitMechanism::Spaces:
|
|
||||||
return buffer[index] == ' ';
|
|
||||||
case Configuration::TokenSplitMechanism::UnescapedSpaces:
|
|
||||||
return buffer[index] == ' ' && (index == 0 || buffer[index - 1] != '\\');
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT_NOT_REACHED();
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
void Editor::remove_at_index(size_t index)
|
void Editor::remove_at_index(size_t index)
|
||||||
{
|
{
|
||||||
// See if we have any anchored styles, and reposition them if needed.
|
// See if we have any anchored styles, and reposition them if needed.
|
||||||
|
|
|
@ -52,10 +52,6 @@
|
||||||
namespace Line {
|
namespace Line {
|
||||||
|
|
||||||
struct Configuration {
|
struct Configuration {
|
||||||
enum TokenSplitMechanism {
|
|
||||||
Spaces,
|
|
||||||
UnescapedSpaces,
|
|
||||||
};
|
|
||||||
enum RefreshBehaviour {
|
enum RefreshBehaviour {
|
||||||
Lazy,
|
Lazy,
|
||||||
Eager,
|
Eager,
|
||||||
|
@ -79,11 +75,9 @@ struct Configuration {
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(RefreshBehaviour refresh) { refresh_behaviour = refresh; }
|
void set(RefreshBehaviour refresh) { refresh_behaviour = refresh; }
|
||||||
void set(TokenSplitMechanism split) { split_mechanism = split; }
|
|
||||||
void set(OperationMode mode) { operation_mode = mode; }
|
void set(OperationMode mode) { operation_mode = mode; }
|
||||||
|
|
||||||
RefreshBehaviour refresh_behaviour { RefreshBehaviour::Lazy };
|
RefreshBehaviour refresh_behaviour { RefreshBehaviour::Lazy };
|
||||||
TokenSplitMechanism split_mechanism { TokenSplitMechanism::Spaces };
|
|
||||||
OperationMode operation_mode { OperationMode::Unset };
|
OperationMode operation_mode { OperationMode::Unset };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -302,8 +296,6 @@ private:
|
||||||
m_suggestion_display->set_origin(row, col, {});
|
m_suggestion_display->set_origin(row, col, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool should_break_token(Vector<u32, 1024>& buffer, size_t index);
|
|
||||||
|
|
||||||
void recalculate_origin();
|
void recalculate_origin();
|
||||||
void reposition_cursor(bool to_end = false);
|
void reposition_cursor(bool to_end = false);
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
editor = Line::Editor::construct(Line::Configuration { Line::Configuration::UnescapedSpaces });
|
editor = Line::Editor::construct(Line::Configuration {});
|
||||||
|
|
||||||
auto shell = Shell::construct();
|
auto shell = Shell::construct();
|
||||||
s_shell = shell.ptr();
|
s_shell = shell.ptr();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue