Author Topic: How to prevent auto-formatting when opening an existing file?  (Read 3758 times)

Offline Anonymous

  • Anonymous
  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
How to prevent auto-formatting when opening an existing file?
« on: December 27, 2010, 02:10:16 pm »
(HE 1.49.793, Windows 7 64 bit)

I want to insert spaces when I press Tab, so I've set HE to convert tabs to spaces in "Formatting -> Replace tabs by spaces".

When I open an existing file that has tabs in it, HE seems to automatically convert all tabs to spaces.

This has a very unfortunate consequence: the file, when it is about to be checked back in the Subversion repository, appears completely modified even if I modify just a single character somewhere.

I would expect HE to behave like other editors in this respect and to preserve the parts of the file that were not modified, regardless of whether they contain tab characters or not.

Is it possible to configure HE somehow to behave like I just described?

Thanks in advance!

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2172
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: How to prevent auto-formatting when opening an existing file?
« Reply #1 on: December 27, 2010, 02:57:05 pm »
Hi,

hm... tabs are replaced not during open, but during save of the document (probably you have modified it). This is hard-coded behavior that HE converts all tabs to spaces during save (this is not reflected in document loaded in editor but only on disk - not very nice), if user has selected Replace tabs by spaces or Auto and in existing content (should be enough for statistics) no tabs were found.
There is no switch, to disable this, but I can think about it for new 1.49 beta.


The safest way for you will be to switch to auto mode, it will adopt style to allow or not allow spaces depending on the content. But in this case, for new documents you will be allowed to enter tabs (here I can also think about adding default for auto mode, if there is not enough existing content for statistics to decide which mode to select).


Best regards,
Alex.

Offline Anonymous

  • Anonymous
  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: How to prevent auto-formatting when opening an existing file?
« Reply #2 on: December 27, 2010, 03:14:08 pm »
Thanks for the quick response!

IMHO keeping the non-modified parts of the document intact should always have precedence over any (potentially convoluted) logic required to decide how to treat tabs and spaces during typing or when saving.

And if the user really wants an explicit, all-accross tab-to-space conversion, there can always be a command for that available in the UI somewhere.

In any case, thanks in advance for considering an improvement here.


Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2172
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: How to prevent auto-formatting when opening an existing file?
« Reply #3 on: December 27, 2010, 09:58:37 pm »
OK, I agree, and probably nobody has noticed that tabs were changed on save before, so I will change default behavior to leave them untouched and will add the flag to change this default.

Offline Anonymous

  • Anonymous
  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: How to prevent auto-formatting when opening an existing file?
« Reply #4 on: December 28, 2010, 09:57:13 am »
Great, thanks!

 

Related Topics

  Subject / Started by Replies Last post
3 Replies
2271 Views
Last post April 19, 2009, 08:42:05 am
by Stefan
1 Replies
1708 Views
Last post April 26, 2009, 09:31:06 pm
by alex
2 Replies
2918 Views
Last post October 20, 2010, 07:30:48 pm
by alex
8 Replies
3693 Views
Last post November 18, 2010, 03:05:02 pm
by alex
1 Replies
999 Views
Last post February 12, 2016, 01:50:29 am
by alex