Author Topic: Slickedit incorrectly replacing tabs with spaces  (Read 2690 times)

DaveyC

  • Senior Community Member
  • Posts: 169
  • Hero Points: 9
Slickedit incorrectly replacing tabs with spaces
« on: April 24, 2020, 11:49:36 AM »
I got pulled up on a pull request because Slickedit is replacing tabs with spaces even when I have configured it not to. This is C++ code


DaveyC

  • Senior Community Member
  • Posts: 169
  • Hero Points: 9
Re: Slickedit incorrectly replacing tabs with spaces
« Reply #1 on: April 24, 2020, 11:53:49 AM »
Here's my options
« Last Edit: April 24, 2020, 11:56:33 AM by DaveyC »

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Slickedit incorrectly replacing tabs with spaces
« Reply #2 on: April 24, 2020, 01:17:10 PM »
With a C++ file up, go to Tools -> Beautify -> Edit Current Profile, and in the dialog that pops up, go to Indent -> General, and make sure "Indent with tabs" is on.  That's the setting used when editing code, or when a section of code gets reformatted due to alias expansion, etc...

If that is turned on, then go ahead and post your user.cfg.xml file from your configuration directory.  There are some features like Adaptive Formatting, and configuration file support that can override that setting, but getting the config file is probably faster than sending you to several places in the config dialogs.


DaveyC

  • Senior Community Member
  • Posts: 169
  • Hero Points: 9
Re: Slickedit incorrectly replacing tabs with spaces
« Reply #3 on: April 27, 2020, 05:56:32 AM »
Just to clarify my problem this is only happen at save. The options I posted were save options. My formatting options are to use spaces and not tab but I do not want to convert tabs the spaces on save as it pollutes the file history with changes I had not intention of making.

DaveyC

  • Senior Community Member
  • Posts: 169
  • Hero Points: 9
Re: Slickedit incorrectly replacing tabs with spaces
« Reply #4 on: April 27, 2020, 09:14:45 AM »
Attached user.cfg.xml

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 7043
  • Hero Points: 535
Re: Slickedit incorrectly replacing tabs with spaces
« Reply #5 on: April 27, 2020, 12:20:57 PM »
You have "Expand all tabs to spaces" turned on specifically for C++. (Tools>Options>Languages>Application Languages>C/C++/File Options). This overrides the global File Option settings you posted. Change that back to "Default" or "Do not expand tabs to spaces".

DaveyC

  • Senior Community Member
  • Posts: 169
  • Hero Points: 9
Re: Slickedit incorrectly replacing tabs with spaces
« Reply #6 on: April 27, 2020, 12:35:46 PM »
Thanks! Will that mess with my formatting options when I want to expand tabs to spaces for a specific line of code. I only require this for not modifying code that I haven't changed when I save.
« Last Edit: April 27, 2020, 01:02:42 PM by DaveyC »

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 7043
  • Hero Points: 535
Re: Slickedit incorrectly replacing tabs with spaces
« Reply #7 on: April 27, 2020, 01:18:54 PM »
This option doesn't effect your editing formatting options but this option can potentially change all indent from tabs to spaces when you save.

DaveyC

  • Senior Community Member
  • Posts: 169
  • Hero Points: 9
Re: Slickedit incorrectly replacing tabs with spaces
« Reply #8 on: April 27, 2020, 01:21:26 PM »
That's my problem! I want to change tabs to spaces when I edit but not when I save!

We have a large code base and there is a mix of spaces and tabs. When I change code and submit a PR I don't want to replace lines of code that
I haven't changed because it upsets people who are reviewing the code.
« Last Edit: April 27, 2020, 01:26:29 PM by DaveyC »

jc44

  • Senior Community Member
  • Posts: 329
  • Hero Points: 22
Re: Slickedit incorrectly replacing tabs with spaces
« Reply #9 on: April 28, 2020, 09:22:54 AM »
Like "Strip trailing spaces" that option has a setting for "Only modified lines" - just click on the setting and change it to "only modified lines"

DaveyC

  • Senior Community Member
  • Posts: 169
  • Hero Points: 9
Re: Slickedit incorrectly replacing tabs with spaces
« Reply #10 on: April 28, 2020, 10:04:41 AM »
Perfect! That does exactly what I want.
« Last Edit: April 28, 2020, 11:04:28 AM by DaveyC »