+5
Completed

Text editing: add option to replace tabs with spaces

Andrew Pashkin 6 years ago updated by Paul W 2 years ago 11

When editing text in SmartGit it could be useful to have an option to force the editor to replace tabs with spaces. My exact use case is editing Index in Index editor.

Should it apply to the whole file or just for new characters?

To me it seems, like the most basic thing that SmartGit could provide is to make replacement for the new characters (which to me personally would be already satisfactory). And the other options would be more "advanced" features: replacement in the whole file, automatic detection of indentation style (tabs or spaces, how many spaces), etc.

One further clarification: what should happen if you paste some text containing tab characters?

I give up on that one :) Probably it should be consistent with the established editor's logic on what happens when text is pasted - either the same as if the text was typed or it should be inserted as is.

Hi friends!

How it's going? In my case i need just insert 4 spaces(instead of one tab) by click on tab button (option exist in most redactors).

I reckon, you mean 1 to 4 spaces.

A first step could be to add the capability to have spaces inserted in place of a tab when the tab key is pressed.   Existing tabs, or pasting of tabs would not be affected.  This is a feature in the majority of editors support.   Changing all tabs in the file to spaces could come later.


The tab size should control the number of spaces inserted.   Since there is already a setting for tab size in the "File Compare Windows: View-Settings", it should be very easy to add a radio button to select "insert spaces for tabs".   Note, that I would think these tab settings should be at the top level menu under "Edit->Preferences".

I agree with Steven Magee’s suggestion. Being able to insert spaces instead of Tab is the most relevant use case. Do you maybe have an update on this issue?

Thanks for all your efforts!

Completed

SmartGit 21.1 #17063 will have this option in Preferences, Built-in Text Editors, Behavior.

It would be great to have an option for all tabs to be converted to spaces upon commit with a similar warning to when trailing spaces are trimmed or line endings are modified.