SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: rowbearto on February 14, 2019, 04:09:42 PM

Title: Issue changing indenting from tab to spaces in macro
Post by: rowbearto on February 14, 2019, 04:09:42 PM
To reproduce, look for tab_to_space_issue.tar.gz on support and follow the instructions in the README file.
Title: Re: Issue changing indenting from tab to spaces in macro
Post by: rowbearto on February 14, 2019, 06:56:52 PM
Same issue occurs if I press <ENTER> after the printf statement and on the next line do "if<space>", then get tabs instead of spaces.

It seems like the same issue I previously reported in Java - https://community.slickedit.com/index.php/topic,16686.msg64422.html#msg64422

So maybe it wasn't really fixed? Or only fixed for Java and not C++?

I'm using 23.0.0.11 Linux x64 Centos 7.2, hotfix 3
Title: Re: Issue changing indenting from tab to spaces in macro
Post by: patrick on February 15, 2019, 02:05:52 PM
I'll take a look at it today.  If I remember correctly, the previous hotfix was general to any language that has a beautifier, so I don't have a good guess of what's going here yet.
Title: Re: Issue changing indenting from tab to spaces in macro
Post by: rowbearto on February 18, 2019, 10:48:58 PM
Patrick: Were you able to reproduce it?
Title: Re: Issue changing indenting from tab to spaces in macro
Post by: patrick on February 19, 2019, 02:45:28 PM
Yes.  I did have to add a step after turning tabs on to do a single edit on the file before calling setIndentToSpace.  I think this is hot-fixable.

For some reason, when you change the indent via LanguageSettings, the cached beautifier settings aren't being invalidated.  If you need to, you can temporarily work around it by adding the following to the end of the setIndentWithTabsOrSpacesLang() function:
Code: [Select]
   _beautifier_cache_clear(bufId.p_LangId);

You'll also need to import beautifier.e at the top of your utils file.
Title: Re: Issue changing indenting from tab to spaces in macro
Post by: rowbearto on February 19, 2019, 05:53:39 PM
Thanks Patrick!

Would it hurt anything if I always kept the " _beautifier_cache_clear(bufId.p_LangId);" in my macro even after you make the hotfix?

Rob
Title: Re: Issue changing indenting from tab to spaces in macro
Post by: patrick on February 19, 2019, 05:59:00 PM
No, it's a cheap operation, and there's no harm in it being done twice in a row.