Procházet zdrojové kódy

LibLine: Make actual_rendered_string_metrics() static

This function didn't depend on the editor itself.
AnotherTest před 5 roky
rodič
revize
ae9211037e
2 změnil soubory, kde provedl 6 přidání a 6 odebrání
  1. 3 3
      Libraries/LibLine/Editor.cpp
  2. 3 3
      Libraries/LibLine/Editor.h

+ 3 - 3
Libraries/LibLine/Editor.cpp

@@ -1227,7 +1227,7 @@ void VT::clear_to_end_of_line()
     fflush(stderr);
     fflush(stderr);
 }
 }
 
 
-StringMetrics Editor::actual_rendered_string_metrics(const StringView& string) const
+StringMetrics Editor::actual_rendered_string_metrics(const StringView& string)
 {
 {
     size_t length { 0 };
     size_t length { 0 };
     StringMetrics metrics;
     StringMetrics metrics;
@@ -1251,7 +1251,7 @@ StringMetrics Editor::actual_rendered_string_metrics(const StringView& string) c
     return metrics;
     return metrics;
 }
 }
 
 
-StringMetrics Editor::actual_rendered_string_metrics(const Utf32View& view) const
+StringMetrics Editor::actual_rendered_string_metrics(const Utf32View& view)
 {
 {
     size_t length { 0 };
     size_t length { 0 };
     StringMetrics metrics;
     StringMetrics metrics;
@@ -1271,7 +1271,7 @@ StringMetrics Editor::actual_rendered_string_metrics(const Utf32View& view) cons
     return metrics;
     return metrics;
 }
 }
 
 
-Editor::VTState Editor::actual_rendered_string_length_step(StringMetrics& metrics, size_t& length, u32 c, u32 next_c, VTState state) const
+Editor::VTState Editor::actual_rendered_string_length_step(StringMetrics& metrics, size_t& length, u32 c, u32 next_c, VTState state)
 {
 {
     switch (state) {
     switch (state) {
     case Free:
     case Free:

+ 3 - 3
Libraries/LibLine/Editor.h

@@ -173,8 +173,8 @@ public:
     void register_key_input_callback(const KeyBinding&);
     void register_key_input_callback(const KeyBinding&);
     void register_key_input_callback(Key, Function<bool(Editor&)> callback);
     void register_key_input_callback(Key, Function<bool(Editor&)> callback);
 
 
-    StringMetrics actual_rendered_string_metrics(const StringView&) const;
-    StringMetrics actual_rendered_string_metrics(const Utf32View&) const;
+    static StringMetrics actual_rendered_string_metrics(const StringView&);
+    static StringMetrics actual_rendered_string_metrics(const Utf32View&);
 
 
     Function<Vector<CompletionSuggestion>(const Editor&)> on_tab_complete;
     Function<Vector<CompletionSuggestion>(const Editor&)> on_tab_complete;
     Function<void()> on_interrupt_handled;
     Function<void()> on_interrupt_handled;
@@ -275,7 +275,7 @@ private:
         Title = 9,
         Title = 9,
     };
     };
 
 
-    VTState actual_rendered_string_length_step(StringMetrics&, size_t& length, u32, u32, VTState) const;
+    static VTState actual_rendered_string_length_step(StringMetrics&, size_t& length, u32, u32, VTState);
 
 
     // ^Core::Object
     // ^Core::Object
     virtual void save_to(JsonObject&) override;
     virtual void save_to(JsonObject&) override;