Closed jaskaran0001 closed 5 years ago
Can you perhaps make a gif of the issue so that I can better understand what's going on? This repository is no longer being maintained btw, so any code changes will most likely just be merged on my fork of the project.
In the below situation want to set the cursor position inside the brackets instead of the caret. How can I auto-set the cursor position upon inserting a value from popup? Using the above mentioned code.
Following method needs to be added in MethodAutocompleteItem class
I can add it the repository. Do you allow users to contribute?
public override void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e) { e.Tb.BeginUpdate(); e.Tb.Selection.BeginUpdate(); //remember places var p1 = popupMenu.Fragment.Start; var p2 = e.Tb.Selection.Start; //do auto indent if (e.Tb.AutoIndent) { for (int iLine = p1.iLine + 1; iLine <= p2.iLine; iLine++) { e.Tb.Selection.Start = new Place(0, iLine); e.Tb.DoAutoIndent(iLine); } } e.Tb.Selection.Start = p1; //move caret position right and find char ^ while (e.Tb.Selection.CharBeforeStart != '^') if (!e.Tb.Selection.GoRightThroughFolded()) break; //remove char ^ e.Tb.Selection.GoLeft(true); if (e.Tb.SelectedText == "^") { e.Tb.InsertText(""); } else { e.Tb.Selection.GoRight(true); } // e.Tb.Selection.EndUpdate(); e.Tb.EndUpdate();
Sorry for the late response, yes, users can create a PR which I will then test and review. Here is a link to my fork: https://github.com/Hexman768/FastColoredTextBox
I am using the autocomplete after dot method as below to generate popup menu, It is working fine. The only issue I am facing is that it is not replacing ^ with the cursor position.
How can I automatically set the cursor position after a popup menu item is inserted in IDE?
Eg. com.examples() instead of com.examples(^)
Using the below code:
` namespace Tester { public partial class AutocompleteSample4 : Form { AutocompleteMenu popupMenu;
} `