#443 Feature - Increase/Decrease Indent for Line and Selection

Undefined
open
nobody
Editor (11)
Feature_Request
2016-12-04
2016-12-02
No

Code:blocks devs, as I find myself migrating to codeblocks and kde continues its slide downward, there are missing features in codeblocks that are indispensable. 'Increase Indent' and 'Decrease Indent'. The codeblocks indent model currently provides the ability to indent and block indent through the 'tab' key, but this does not allow indent from within a line and you cannot create a shortcut-key to 'Decrease Indent'. Therein lies the reason for 'Increase/Decrease' indent.

Currently, you block indent by selecting the lines of interest and pressing tab. That's fine. However, there is no way to 'Decrease Indent' in a similar manner (or I haven't found it going line-by-line through the settings) Further, I cannot find a way to assign a shortcut to indent, and, of course, there isn't a decrease indent. Coming from kde, kate/write implement the increase/decrease indent by configurable shortcuts of ctrl+i/ctrl+shift+i. (I could easily reassign the current codeblocks 'incremental search' (currently ctrl+i) to another key.

The 'Increase Indent' feature simply indents the current line (or any lines contained within a block-selection) by the current indent. Repeated calls, simply increase the indent to the next stop. This works on a line, and it works regardless of where the caret is within the line. Currently 'tab' is limited to providing indent only if the caret is in the leading whitespace. Of course, the 'Decrease Indent' feature simply decreases the indent level by the current indent setting (repeated calls just do it again)

This should not take much to implement as a large part of the functionality is already in place through the current indent. What would be needed is a way to provide a configurable hook for assignment of a shortcut to the current 'tab' indent and tweaking the 'tab' indent so that if it is called from the 'Increase Indent' function, the line in indented regardless of the current caret position. (I believe for block-intent, it would probably work as-is.

For 'Decrease Indent', would operate in the same manner simply reducing the indent-level on each call. This would take several lines of new code. While you can block-indent with current 'tab', attempting to block-decrease indent (which operates through the 'backspace' key on a per-line basis if the caret is in leading whitespace) simply results in deleted text.

If you are not familiar with the kde kate/kwrite 'Increase Indent' and 'Decrease Indent', give it a try (although the current Plasma/Frameworks 5 indent model is horrible, these features still work as they should). This would be a great efficiency addition to the codeblocks editor.

Please list this as a feature request, as I could not find a way to select that on this input page.

Discussion

  • Teodor Petrov

    Teodor Petrov - 2016-12-04

    Have you tried Shift-Tab? It is used for unindenting in all editors I know of. (I'm not talking about vim and emacs, or any other text base editor).

    I'm not sure if this indent/unindent in the middle of the line will be that useful.

     
  • Teodor Petrov

    Teodor Petrov - 2016-12-04
    • labels: --> Editor
    • Type: Undefined --> Feature_Request
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks