Author Topic: Beta1: Extra 'a' character inserted after '<' in C++ streaming statements  (Read 3059 times)

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Attached is a sample project.

Follow the instructions in the comments to see SE insert an 'a' character after the '<':

Code: [Select]
#include <iostream>

int main(int argc, char **argv)
{
    // Put cursor just after the t in std::cout
    // press <space> then a single '<' character
    // SE inserts an 'a' character after the <
    //  such as: std::cout <a
    // If you don't see it right away, try closing/re-opening SE a few times
    // If you do this with an empty config, after pressing the <, then it tags gcc
    // after tagging is completed, backspace to after the 't', then do:
    //   "space""<", and you will
    // see the <a
    // Often when I type the second < and then space, I end up with:
    //   std::cout <<a
    // but it doesn't seem to happen in this small test project.
    // This issue occurs in SE 21.0.3 also

    std::cout
    // This is what I see after typing ' <'
    // std::cout <a;
    return 0;
}

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Still see this issue in Beta 2.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Beta1: Extra 'a' character inserted after '<' in C++ streaming statements
« Reply #2 on: September 05, 2017, 07:08:16 PM »
I found that this issue is not reproduced with default configuration, however it can be reproduced by using my configuration and doing a few things after applying my configuration.

So I uploaded my configuration to support.slickedit.com under "extra_a". I tarballed my 22.0.0 directory as I found I could not reproduce by export/import.

After extracting the 22.0.0 directory, put the cursor after the "t" in "std::cout" and enter "<space>" then "<", then SE will insert an extra "a" character. If you do not see the "a" right away, then you need to toggle between different formatting modes:

Document->C/C++ Options->Formatting, change "Profile" from "2 space indent" to "3 space indent"

Then try again.

If not reproduced, change back from "3 space indent" to "2 space indent", toggle one or 2 more times, eventually the issue starts happening.

You can also try it with the Virtual machine that I uploaded in: https://community.slickedit.com/index.php/topic,15458.msg58927.html#msg58927
« Last Edit: September 05, 2017, 08:31:49 PM by rowbearto »

Dennis

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
Re: Beta1: Extra 'a' character inserted after '<' in C++ streaming statements
« Reply #3 on: September 08, 2017, 05:06:56 PM »
Reproduced using your config.  I'll see what can be done.

"<" is triggering auto-function-help, that's why the GNU tag file is built, it has to try to figure out what "std:: cout" is, since it could be a template type with arguments.  One could argue that the editor should just know that for C++, but we don't hard code stuff. 

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Beta1: Extra 'a' character inserted after '<' in C++ streaming statements
« Reply #4 on: September 08, 2017, 05:08:52 PM »
Good news. It also happens when I stream into other things besides cout, that was just an example. So hardcoding cout wouldn't handle all cases anyway.

Dennis

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
Re: Beta1: Extra 'a' character inserted after '<' in C++ streaming statements
« Reply #5 on: September 08, 2017, 07:28:12 PM »
This will be fixed in the next drop.

The problem was related to "auto-insert matching parameter" being too aggressive for template argument lists.  As a workaround, you can turn off the option for C++.  Document > C/C++ Options... > Context Tagging

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Beta1: Extra 'a' character inserted after '<' in C++ streaming statements
« Reply #6 on: September 08, 2017, 07:53:05 PM »
Thanks Dennis!