#43 ✓resolved
zachriggle

Feature: Indent / Dedent

Reported by zachriggle | December 24th, 2010 @ 06:43 AM | in 0.0.3

What I did

Select a block of text, and press tab or shift+tab.

alternately

Select a block of text, and press ⌘+] (indent) or ⌘+[ (dedent).

What I expected to happen

The indentation level of the selected text should increase by one, respecting the tabs vs. spaces setting of the IDE. Opposite for dedent.

What actually happened

Nothing.

Comments and changes to this ticket

  • rsms

    rsms December 26th, 2010 @ 07:59 PM

    • Milestone set to 0.0.3
    • State changed from “new” to “open”
    • Assigned user set to “rsms”
    • Tag set to @todo, indentation
    • Milestone order changed from “25” to “0”

    Thanks. This is a todo.

    ⌘+] (indent) or ⌘+[ (dedent) is the current de-facto "standard" and will be the default key mapping in Kod.

  • rsms

    rsms December 26th, 2010 @ 07:59 PM

    • Tag changed from @todo, indentation to @high, @todo, indentation
  • Jonas Schneider

    Jonas Schneider December 26th, 2010 @ 10:46 PM

    Will Tab/Shift+Tab also be a default key mapping? Many non-US keyboard layouts would be unable to use the direct bracket hotkeys.

  • Swizec

    Swizec December 26th, 2010 @ 11:15 PM

    Personally I think code indentation should be automatic and follow standards for different languages. Similar to how this happens in emacs.

    Essentially, pressing "Tab" should indent to the proper indentation as per surrounding code, whether this is indend or dedent shouldn't matter.

  • Jeremy Johnstone

    Jeremy Johnstone December 26th, 2010 @ 11:27 PM

    @Jonas

    Based on this: http://en.wikipedia.org/wiki/Keyboard_layout

    It seems very very few intls (around five worldwide) don't have square braces on the keyboard. Can you please clarify what defines "many" to you?

  • rsms

    rsms December 26th, 2010 @ 11:59 PM

    @Swizec: Yeah, that would be nice. The more I think about it, the more I realize that we need to re-write the whole syntax parsing machinery. We can't use any source code from source-highlight nor modify it to fit our needs (it's released under a GPL aka "virus" license). I believe it's too basic for what we need to accomplish these things.

  • firedev

    firedev December 27th, 2010 @ 08:20 AM

    I'd love cmd+[/] to work, if possible. Thank you.

  • Swizec

    Swizec December 28th, 2010 @ 02:48 AM

    I would love to give this feature a whirl. But being [very] inexperienced with Mac dev I have no idea how long it might take me or how successful I will be in implementing it.

    To be honest this feature is the primary reason I even wanted to actively contribute to this project :P

  • Swizec

    Swizec December 28th, 2010 @ 05:34 AM

    Hmmm ok, I got a basic indent/unindent working in perhaps a bit of a hacky way.

    I went for tab/shift+tab combination and decided on four spaces as indentation for now.

    Going to make a pull request on this for now and work on variable indentation based on syntax when everybody decides on how text parsing is going to work, because that's probably best left up to a central API.

  • Erik Johansson

    Erik Johansson December 28th, 2010 @ 02:29 PM

    There has to be a setting in preferences later on, so you can change how many spaces the tab should be.

  • Wil

    Wil December 29th, 2010 @ 12:43 PM

    What about making indenting similar to Vim's? That is, we have a "dumb" indenter that "sorta works" (just follow the indentation of the previous line) and optional language-sensitive indenters as plug-ins? The language-sensitive indenters could be written in Javascript since we already have Node.js/V8 embedded anyway. Moreover, they could declare their options which will be displayed in the preferences pane.

    Disclaimer: I haven't checked the scripting API yet.

  • rsms

    rsms December 31st, 2010 @ 03:00 AM

    • State changed from “open” to “resolved”
    • Tag changed from @high, @todo, indentation to @high, @todo, indentation, text

    Fixed in c44b7796c1c7cb82b28866bfa7ba835d9aca132b

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

A text editor for Mac OS X

People watching this ticket

Referenced by

Pages