+4

Text editing: add option to replace tabs with spaces

Andrew Pashkin 2 years ago updated by Steven Magee 8 months ago 7

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".