From 26b3fc916db08fc5e5a9738e84f830d239111787 Mon Sep 17 00:00:00 2001 From: Tig Date: Fri, 21 Nov 2025 15:59:40 -0700 Subject: [PATCH] Extract TextViewAutocomplete to separate file Move TextViewAutocomplete class from TextView.cs to TextViewAutocomplete.cs Build and all 163 tests pass --- .../Views/TextInput/TextView/TextView.cs | 22 +------------------ .../TextView/TextViewAutocomplete.cs | 21 ++++++++++++++++++ 2 files changed, 22 insertions(+), 21 deletions(-) create mode 100644 Terminal.Gui/Views/TextInput/TextView/TextViewAutocomplete.cs diff --git a/Terminal.Gui/Views/TextInput/TextView/TextView.cs b/Terminal.Gui/Views/TextInput/TextView/TextView.cs index 4e70f2e46..0864a6672 100644 --- a/Terminal.Gui/Views/TextInput/TextView/TextView.cs +++ b/Terminal.Gui/Views/TextInput/TextView/TextView.cs @@ -4884,24 +4884,4 @@ public class TextView : View, IDesignable base.Dispose (disposing); } -} - -/// -/// Renders an overlay on another view at a given point that allows selecting from a range of 'autocomplete' -/// options. An implementation on a TextView. -/// -public class TextViewAutocomplete : PopupAutocomplete -{ - /// - protected override void DeleteTextBackwards () { ((TextView)HostControl!).DeleteCharLeft (); } - - /// - protected override void InsertText (string accepted) { ((TextView)HostControl!).InsertText (accepted); } - - /// - protected override void SetCursorPosition (int column) - { - ((TextView)HostControl!).CursorPosition = - new (column, ((TextView)HostControl).CurrentRow); - } -} +} \ No newline at end of file diff --git a/Terminal.Gui/Views/TextInput/TextView/TextViewAutocomplete.cs b/Terminal.Gui/Views/TextInput/TextView/TextViewAutocomplete.cs new file mode 100644 index 000000000..5e5a67244 --- /dev/null +++ b/Terminal.Gui/Views/TextInput/TextView/TextViewAutocomplete.cs @@ -0,0 +1,21 @@ +namespace Terminal.Gui.Views; + +/// +/// Renders an overlay on another view at a given point that allows selecting from a range of 'autocomplete' +/// options. An implementation on a TextView. +/// +public class TextViewAutocomplete : PopupAutocomplete +{ + /// + protected override void DeleteTextBackwards () { ((TextView)HostControl!).DeleteCharLeft (); } + + /// + protected override void InsertText (string accepted) { ((TextView)HostControl!).InsertText (accepted); } + + /// + protected override void SetCursorPosition (int column) + { + ((TextView)HostControl!).CursorPosition = + new (column, ((TextView)HostControl).CurrentRow); + } +}