SlickEdit Community
Archived Beta Discussions => SlickEdit 201x Beta Discussions => SlickEdit 2017 v22 Beta Discussion => Topic started by: rowbearto on August 19, 2017, 03:27:49 AM
-
Here is an example C++ code in a C++ project:
void main(int argc, char *argv[]) {
if
}
Place the cursor to the right of the "f" in "if", and press space, it expands to this:
if ()<space>
{
}
The problem is that an extra "space" character is added after the closing parenthesis of the "if".
I was able to reproduce this in Beta2 with the attached project, just add the "if" in "RunContext.cc"
I'm able to reproduce this by creating a new configuration in an empty directory ("-sc <emptydir>"), and then modifying the brace style for "if" statements to "next line". After this modification of the configuration, put the cursor to the right of the "f" in "if" and press <space>.
-
Reproduced. I think I know what this is. We sometimes preserve spaces that otherwise wouldn't be allowed if a cursor is adjacent to the space. That's desirable for some situations, like an alias expansion like this: "if (%\c) %\c". But it doesn't make sense for your example, since we already know the brace is going to be on the next line.
Thanks for the report, I can probably get this in for beta 3.
-
Fixed for beta 3. Looking back, I think we've had to address this problem before, but the fixes never ended up working in all cases, because I missed the root cause. The short version is the logic was good, but the data about where cursors/hotspots were was not so good. Your example made that obvious, since there are no hotspots or cursors in a position to make us retain the space.
Thanks again for the report.
-
Will the fix apply to C# too? I see the same problem.
-
Yes, it covers the beautifiers added since v16, which includes C#. I just double checked it to be paranoid.