Skip to content

Commit

Permalink
Upgrade Terminal.Gui to 1.10.0 and updated Autocomplete overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
halvarsson committed Apr 30, 2024
1 parent 2a6fbb9 commit 7ad3256
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions Autocomplete/PowershellAutocomplete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void Force()
}
}

private void TryGenerateSuggestions()
private void TryGenerateSuggestions(int columnOffset = 0)
{
var host = (EditorTextView)HostControl;
var offset = 0;
Expand Down Expand Up @@ -80,7 +80,7 @@ private void TryGenerateSuggestions()
{
if (_suggestions != null)
{
var word = GetCurrentWord();
var word = GetCurrentWord(columnOffset);
if (!System.String.IsNullOrEmpty(word))
{
Suggestions = _suggestions.Where(m => m.StartsWith(word, StringComparison.OrdinalIgnoreCase)).ToList().AsReadOnly();
Expand All @@ -103,11 +103,11 @@ private void TryGenerateSuggestions()
}
}

public override void GenerateSuggestions()
public override void GenerateSuggestions(int columnOffset = 0)
{
try
{
TryGenerateSuggestions();
TryGenerateSuggestions(columnOffset);
}
catch { }
}
Expand All @@ -119,12 +119,12 @@ public override bool IsWordChar(Rune rune)
}

///<inheritdoc/>
protected override string GetCurrentWord()
protected override string GetCurrentWord(int columnOffset = 0)
{
var host = (TextView)HostControl;
var currentLine = host.GetCurrentLine();
var cursorPosition = Math.Min(host.CurrentColumn, currentLine.Count);
return IdxToWord(currentLine, cursorPosition);
return IdxToWord(currentLine, cursorPosition, columnOffset);
}

/// <inheritdoc/>
Expand Down
2 changes: 1 addition & 1 deletion psedit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ItemGroup>
<PackageReference Include="PowerShellStandard.Library" Version="5.1.1" />
<PackageReference Include="Terminal.Gui" Version="1.9.0" />
<PackageReference Include="Terminal.Gui" Version="1.10.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

Expand Down

0 comments on commit 7ad3256

Please sign in to comment.