Skip to content

Commit e030b05

Browse files
committed
- Implemented V-centering caret at CodeMap navigation
- Forced showing the whole suggestion list at startup of explicitly triggered auto-completion.
1 parent ab6e520 commit e030b05

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/CSScriptIntellisense/Plugin.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,8 +941,11 @@ static void ShowSuggestionList(bool snippetsOnly, bool memberInfoWasShowing = fa
941941

942942
var document = Npp.GetCurrentDocument();
943943
Action<ICompletionData> OnAccepted = data => OnAutocompletionAccepted(data, snippetsOnly);
944-
945-
autocompleteForm = new AutocompleteForm(OnAccepted, items, NppEditor.GetSuggestionHint());
944+
945+
// no need to pass initial SuggestionHint as it may swallow (auto accept) the whole autocompletion window
946+
// in case of the hint to be the full match of one of the items. Just do it for a better UX
947+
948+
autocompleteForm = new AutocompleteForm(OnAccepted, items, null);
946949
autocompleteForm.Left = point.X;
947950
autocompleteForm.Top = point.Y + document.TextHeight(document.GetCurrentLineNumber());
948951
autocompleteForm.FormClosed += (sender, e) =>

src/CSScriptNpp/Dialogs/CodeMapPanel.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,15 @@ void MembersList_MouseDoubleClick(object sender, MouseEventArgs e)
7474
int prevLineEnd = document.PositionFromLine(currentLineNum) - Environment.NewLine.Length;
7575
int topScrollOffset = currentLineNum - document.GetFirstVisibleLine();
7676

77-
document.GotoLine(info.Line);
78-
document.SetFirstVisibleLine(info.Line - topScrollOffset);
77+
document.GotoLine(info.Line - 1); // document counts line as 0-based
78+
document.VerticalCentreCaret();
79+
80+
//// GetLineVisible just does not work, it returns true always
81+
// var caretIsVisible = document.GetLineVisible(currentLineNum);
82+
// if (caretIsVisible)
83+
// document.SetFirstVisibleLine(info.Line - topScrollOffset);
84+
// else
85+
// document.EnsureVisible(info.Line - 1);
7986
}
8087
}
8188
catch { } //it is expected to fail if the line does not contain the file content position spec. This is also the reason for not validating any "IndexOf" results.

src/Deploy_64.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ md "%plugin_root%\CSScriptNpp"
1010
md "%plugin_root%\CSScriptNpp\Mdbg"
1111

1212
echo -------------------
13-
copy "output\plugins\CSScriptNpp.x64.dll" "%plugin_root%\CSScriptNpp.x64.dll"
13+
copy "output\plugins\CSScriptNpp.x64.dll" "%plugin_root%\CSScriptNpp.dll"
1414
xcopy output\plugins\CSScriptNpp\*.* "%plugin_root%\CSScriptNpp" /Y
1515
xcopy output\plugins\CSScriptNpp\Mdbg\*.* "%plugin_root%\CSScriptNpp\Mdbg" /Y
1616

0 commit comments

Comments
 (0)