Closed NickRimmer closed 5 months ago
I looked at the code and found this TODO:
Shouldn't be too hard to fix. Preparing a PR now...
What is the expected behavior? Do we want to insert the item on a single-click or a double-click? Most modern editors insert items with a single-click. IIRC, the original AvalonEdit used a double-click. I am going to implement single-click for now.
Thank you so much for quick review @danipen. @MarchingCube thank you for great fix 🎉
Apologies for being difficult, resurrecting an old issue, but it would be great if the single/double click was configurable somehow. There doesn't seem to be a particularly clean way of overloading these classes to change the behaviour, as the AddHandler(...)
is embedded in the class constructor, so an option would be great.
What would be the motivation for using double-click instead of single-click?
The motivation for me would be that the ListBox is a SelectingItemsControl, and the fact that the selection works with the arrow keys but not the mouse pointer breaks the affordance (had to look up the technical term there) of the control. It also doesn't seem consistent across the various interactions. And, as the action now triggers on PointerPressed rather than PointerReleased or DoubleTapped, the action occurs sooner than expected, which slightly diminishes recoverability for user input.
As an example, Visual Studio uses a single-click for selecting items in the autocomplete dropdown, and double-click for activating a given autocomplete option.
I'll look into it.
@gebodal I don't see a simple way to support DoubleTapped
. The ListBoxItem
consumes the first click when it is not selected. The DoubleTapped
event (or PointerPressedEvent
with ClickCount == 2
) only fires when the ListBoxItem
is already selected. That means, you would need to triple-click in most cases.
The current implementation (PointerPressed
) behaves the same as ReSharper or VS Code. Perhaps there is an simple way to make DoubleTapped
work as well, but I am not aware of it.
After further digging: I was wrong about the ListBoxItem
. It does not prevent the DoubleTapped
event from being fired. Showing the completion item's tool-tip prevents the DoubleTapped
event from being fired. (Opening the PopupWithCustomPosition
seems to reset the double-click logic.)
Had some time today to look at this again and found a solution. There is now an option to choose whether to insert the completion item on PointerPressed
, PointerReleased
, or DoubleTapped
.
@gebodal Can you test #451?
Hey community,
I found strange behavior. When
CompletionWindow
opened, you can select variants by keyboard up/down and press enter - everything working as expected. But if you will open it and select option by mouse - it will just closeCompletionWindow
and do nothing.How can we make it works by mouse selection as well?
How to reproduce
AvalolinaEdit.Demo
projectasd.
to showCompletionWindow