andreikop / enki

A text editor for programmers
http://enki-editor.org
GNU General Public License v2.0
161 stars 38 forks source link

"Increase indent" Edit menu action #179

Closed vi closed 10 years ago

vi commented 10 years ago

While editing a Makefile (Tabs mode), I press "Unindent with 1 space". One tab in the beginning of the line disappears. Then I press "Indent with 1 space". A space (not tab) appears, spoiling the Makefile.

Maybe it they should be "Increase indentation"/"Decrease indentation", but "Indent with 1 space"/"Unindent with 1 space"? BTW I already see "Decrease indentation", which works equivalently to "Unindent with 1 space" in Tabs mode; but not "Increase indentation"...

andreikop commented 10 years ago

Correct name for Unindent with 1 space would be Remove the last space symbol at the beginning of the line, but this text is too long for a main menu. Indent with 1 space works according to it's name.

Increase indentation action is Tab key. It is not included to the main menu, but Tab will work fine, if more than one line is selected. So, use Tab/Shift+Tab for a Makefile.

vi commented 10 years ago

Inconsistent a little... You can decrease one indentation level of one line in a Makefile without moving cursor in 2 ways (Shift+Tab or "Unintent one space"), but not increase. Four times "Indent one space" leads to 4 spaces which looks OK, but actually breaks the Makefile.

andreikop commented 10 years ago

Four times "Indent one space" leads to 4 spaces which looks OK, but actually breaks the Makefile Enki is a tool. If human have said it to break a Makefile, Enki will do it.

I think showing inconsistent indentation would help to solve this issue. What else we could do to improve the behavior?

vi commented 10 years ago

In spaces mode, show "Indent one space" and "Unindent one space" menu items. In Tabs mode, rename them to "Increase indentation" and "Decrease indentation"; I.e. a bit less menu items in Tabs mode. Of course, keyboard shortcuts get merged (or are separate in Tabs in Spaced mode for this).

Also having sole Decrease identation....<Shift+Tab> menu item without corresponding Increase identation.....<Tab> looks asymmetrical. While possibly "Tab" for identation and Shift+Tab for de-identation are handled by different routes in the code, from user's perspecitve it should not be noticeable. I may want to reassign away "Increase identation" to other key (stopping "Tab" being a special tricky multiline-only key).

Enki is a tool. If human have said it to break a Makefile, Enki will do it. -> Yes, but it should be more easily to do what user is expected to want. What hammer is better - the one that magically attracts to nail caps or one that magically attracts to fingers? You can hit a nail or finger with both ones, but the default differs.

Suppose a user that learned "Add a space" / "Remove a space" shortcuts and uses them expensively (most time editing files in Spaces mode). Applying these habits to Tabs mode (required for certain types) gets into problems which we can avoid. "Increase indentation by one space" is a conveniance action, you can still explicitly add a space to one or multiple lines without it (inserting a space in rectangular edit mode).

andreikop commented 10 years ago

I'd like to keep Shift+Space and Shift+Backspace actions context independent to give an user a freedom to do whatever he wants. Maybe somebody wants to hit his nail, I can't forbid him to do it ;)

It is good point to add Increase indent action, so, actions set would be symmetrical.

andreikop commented 10 years ago

Added Edit->Indentation->Increase indentation