Merge branch 'master' into styling-adjustments
This commit is contained in:
Коммит
8a397df7e1
|
@ -38,6 +38,12 @@ namespace AvaloniaEdit.CodeCompletion
|
|||
public CompletionList()
|
||||
{
|
||||
DoubleTapped += OnDoubleTapped;
|
||||
|
||||
CompletionAcceptKeys = new[]
|
||||
{
|
||||
Key.Enter,
|
||||
Key.Tab,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,6 +109,11 @@ namespace AvaloniaEdit.CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the array of keys that are supposed to request insertation of the completion
|
||||
/// </summary>
|
||||
public Key[] CompletionAcceptKeys { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the scroll viewer used in this list box.
|
||||
/// </summary>
|
||||
|
@ -163,13 +174,13 @@ namespace AvaloniaEdit.CodeCompletion
|
|||
e.Handled = true;
|
||||
_listBox.SelectIndex(_listBox.ItemCount - 1);
|
||||
break;
|
||||
case Key.Tab:
|
||||
case Key.Enter:
|
||||
if(CurrentList.Count > 0)
|
||||
default:
|
||||
if (CompletionAcceptKeys.Contains(e.Key) && CurrentList.Count > 0)
|
||||
{
|
||||
e.Handled = true;
|
||||
RequestInsertion(e);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1192,7 +1192,12 @@ namespace AvaloniaEdit.Editing
|
|||
|
||||
public override TextSelection Selection
|
||||
{
|
||||
get => new TextSelection(_textArea.Caret.Position.Column, _textArea.Caret.Position.Column + _textArea.Selection.Length);
|
||||
get
|
||||
{
|
||||
if (_textArea == null)
|
||||
return new TextSelection(0, 0);
|
||||
return new TextSelection(_textArea.Caret.Position.Column, _textArea.Caret.Position.Column + _textArea.Selection.Length);
|
||||
}
|
||||
set
|
||||
{
|
||||
var selection = _textArea.Selection;
|
||||
|
|
Загрузка…
Ссылка в новой задаче