Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete feature moves cursor to the end and erases last char of the text #257

Open
DCxDemo opened this issue Mar 8, 2023 · 0 comments

Comments

@DCxDemo
Copy link

DCxDemo commented Mar 8, 2023

I guess the control isn't actively maintained anymore, but in case someone will face this same issue in the future:

  1. it isn't possible to drag drop the autocomplete component in VS2022, throws a "no required constructor found" exception, so we have to resort to manual creation, which is not hard though. I tested both NuGet and source directly.

  2. autocomplete sample seems to be outdated, sample suggests autocomplete.SetAutocompleteItems(items); while it should be autocomplete.Items.SetAutocompleteItems(items); now
    https://www.codeproject.com/Articles/365974/Autocomplete-Menu

  3. and the actual bug why I am opening this:
    when the autocomplete value is inserted, the very last char of the document gets erased.

from what it looks, it kinda feels like this code shouldn't even be there, once commented you get the expected "cursor stays at the end of inserted text" behavior.

it happens in this call:

item.OnSelected(Menu, args2);

item.OnSelected(Menu, args2);

particularly here:

            //move caret position right and find char ^
            while (e.Tb.Selection.CharBeforeStart != '^')
                if (!e.Tb.Selection.GoRightThroughFolded())
                    break;

public override void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant