Author Topic: Issue changing indenting from tab to spaces in macro  (Read 286 times)

rowbearto

  • Senior Community Member
  • Posts: 1344
  • Hero Points: 100
Issue changing indenting from tab to spaces in macro
« 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.

rowbearto

  • Senior Community Member
  • Posts: 1344
  • Hero Points: 100
Re: Issue changing indenting from tab to spaces in macro
« Reply #1 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
« Last Edit: February 14, 2019, 07:58:52 pm by rowbearto »

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1025
  • Hero Points: 86
Re: Issue changing indenting from tab to spaces in macro
« Reply #2 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.

rowbearto

  • Senior Community Member
  • Posts: 1344
  • Hero Points: 100
Re: Issue changing indenting from tab to spaces in macro
« Reply #3 on: February 18, 2019, 10:48:58 pm »
Patrick: Were you able to reproduce it?

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1025
  • Hero Points: 86
Re: Issue changing indenting from tab to spaces in macro
« Reply #4 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.

rowbearto

  • Senior Community Member
  • Posts: 1344
  • Hero Points: 100
Re: Issue changing indenting from tab to spaces in macro
« Reply #5 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

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1025
  • Hero Points: 86
Re: Issue changing indenting from tab to spaces in macro
« Reply #6 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.