Author Topic: Tag Suggestions and multiple cursors  (Read 520 times)

tchrismadden

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Tag Suggestions and multiple cursors
« on: August 15, 2019, 10:02:24 pm »
While using multiple cursors in C++ to change a bunch of integers to enum class values I encountered an interesting issue.

Starting with an enum class or enum (I verified that as well):

Code: [Select]
enum class TestEnumClass
{
FirstValue,
SecondValue,
ThirdValue
};

And a set of integer values to be converted to enum constants:

Code: [Select]
auto x = 0;
auto x2 = 0;
auto x3 = 0;


I set cursors before each of the "0"'s, deleted the "0", and typed TestEnumClass::F. The editor suggested "FirstValue" so I arrowed down to select and enter that.  Only the last cursor inserted the text, resulting in:

Code: [Select]
auto x = TestEnumClass::F;
auto x2 = TestEnumClass::F;
auto x3 = TestEnumClass::FirstValue;

I have verified that this is an issue in both the osX and windows versions of the beta but have not gone to older versions to see if this was an issue before.


Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2713
  • Hero Points: 413
Re: Tag Suggestions and multiple cursors
« Reply #1 on: August 16, 2019, 07:21:44 pm »
It is tricky, though.  In your case, yeah, it would have been perfectly valid to insert the completion for all the cursors, but in another case it might not be good.  There is no guarantee that all the cursors are in the same context.

The completion happened to be suggested for the last cursor, so that is where it was processed.  There are really only two solutions (1) disable auto-complete when we have multiple cursors or (2) do a lot of work to do the same insertion for all cursors, potentially creating a real mess in the process.

Graeme

  • Senior Community Member
  • Posts: 2323
  • Hero Points: 305
Re: Tag Suggestions and multiple cursors
« Reply #2 on: August 17, 2019, 12:27:03 am »
I vote for not doing lots of work...  but I never use multiple cursors  - I do use block mode editing quite a lot which has the same issues.

I was going to suggest copy paste as a workaround  - it does work  - but in the process I discovered a case where auto complete works for all cursors.  In the text below, search for he<space> - there's four of them - then use "set multiple cursors" from mini find.  Then type "he" (no quotes) then the shortcut for autocomplete and choose "hello"  - it gets inserted at all cursors - in beta 2

Code: [Select]
hellabco abc
hellabco xyzhehabc hello
hellabco abc
hellabco xyzhehabc he
hello abc
hello xyzhehabc he
hello abc
hello xyzhehabc he
hello abc
hello xyzhehabc he
hello abc
hello xyzhehabc he