oo-ide 0.0.3

∞ is a terminal IDE focused on low distraction, high usability.
Documentation
Feature: Editing commands

  Scenario: Delete word backward removes partial word before cursor
    Given the buffer contains "hello world"
    And the cursor is at row 0, col 8
    When I run "editor.delete_word_backward"
    Then buffer line 0 is "hello rld"
    And the cursor is at row 0, col 6

  Scenario: Delete word backward removes whole word
    Given the buffer contains "hello world"
    And the cursor is at row 0, col 11
    When I run "editor.delete_word_backward"
    Then buffer line 0 is "hello "
    And the cursor is at row 0, col 6

  Scenario: Delete word forward from middle of word
    Given the buffer contains "hello world"
    And the cursor is at row 0, col 2
    When I run "editor.delete_word_forward"
    Then buffer line 0 is "heworld"

  Scenario: Delete word forward at end of line merges next line
    Given the buffer contains:
      """
      foo
      bar
      """
    And the cursor is at row 0, col 3
    When I run "editor.delete_word_forward"
    Then buffer line 0 is "foobar"
    And the buffer has 1 lines

  Scenario: Undo restores previous buffer state
    Given the buffer contains "hello"
    And the cursor is at row 0, col 5
    And a character "!" has been inserted
    When I run "editor.undo"
    Then buffer line 0 is "hello"

  Scenario: Redo re-applies undone edit
    Given the buffer contains "hello"
    And the cursor is at row 0, col 5
    And a character "!" has been inserted
    When I run "editor.undo"
    And I run "editor.redo"
    Then buffer line 0 is "hello!"
    And the cursor is at row 0, col 6

  Scenario: Delete line removes current line
    Given the buffer contains:
      """
      line 1
      line 2
      line 3
      """
    And the cursor is at row 1, col 0
    When I run "editor.delete_line"
    Then buffer line 0 is "line 1"
    And buffer line 1 is "line 3"
    And the buffer has 2 lines

  Scenario: Indent adds indentation to current line
    Given the buffer contains "hello"
    And the cursor is at row 0, col 4
    When I run "editor.indent"
    Then buffer line 0 is "    hello"

  Scenario: Indent rounds up to next indentation mark
    Given the buffer contains "  hello"
    And the cursor is at row 0, col 4
    When I run "editor.indent"
    Then buffer line 0 is "    hello"

  Scenario: Indent rounds up from middle of indentation
    Given the buffer contains "   hello"
    And the cursor is at row 0, col 6
    When I run "editor.indent"
    Then buffer line 0 is "        hello"

  Scenario: Unindent removes indentation from current line
    Given the buffer contains "    hello"
    And the cursor is at row 0, col 6
    When I run "editor.unindent"
    Then buffer line 0 is "hello"

  Scenario: Unindent rounds down to previous indentation mark
    Given the buffer contains "      hello"
    And the cursor is at row 0, col 8
    When I run "editor.unindent"
    Then buffer line 0 is "  hello"

  Scenario: Indent multiple lines with selection
    Given the buffer contains:
      """
      foo
      bar
      baz
      """
    And there is a selection from row 0 col 2 to row 2 col 3
    When I run "editor.indent"
    Then buffer line 0 is "    foo"
    And buffer line 1 is "    bar"
    And buffer line 2 is "    baz"

  Scenario: Unindent multiple lines with selection
    Given the buffer contains:
      """
          foo
          bar
          baz
      """
    And there is a selection from row 0 col 6 to row 2 col 3
    When I run "editor.unindent"
    Then buffer line 0 is "foo"
    And buffer line 1 is "bar"
    And buffer line 2 is "baz"

  Scenario: Enter on unindented line preserves no indentation
    Given the buffer contains "hello"
    And the cursor is at row 0, col 5
    When I press enter
    Then buffer line 1 is ""
    And the cursor is at row 1, col 0

  Scenario: Enter on 2-space indented line carries indentation
    Given the buffer contains "  hello"
    And the cursor is at row 0, col 7
    When I press enter
    Then buffer line 1 is "  "
    And the cursor is at row 1, col 2

  Scenario: Enter on 4-space indented line carries indentation
    Given the buffer contains "    hello"
    And the cursor is at row 0, col 9
    When I press enter
    Then buffer line 1 is "    "
    And the cursor is at row 1, col 4

  Scenario: Enter mid-line on indented line carries indentation
    Given the buffer contains "  helloworld"
    And the cursor is at row 0, col 7
    When I press enter
    Then buffer line 0 is "  hello"
    And buffer line 1 is "  world"
    And the cursor is at row 1, col 2

  Scenario: Enter preserves mixed indentation
    Given the buffer contains "  	hello world"
    And the cursor is at row 0, col 14
    When I press enter
    Then buffer line 0 is "  	hello world"
    And buffer line 1 is "  	"
    And the cursor is at row 1, col 3

  Scenario: Delete word forward starting on whitespace removes to next word end
    Given the buffer contains "hello   world"
    And the cursor is at row 0, col 5
    When I run "editor.delete_word_forward"
    Then buffer line 0 is "helloworld"

  Scenario: Delete line on the only line leaves an empty buffer
    Given the buffer contains "hello"
    And the cursor is at row 0, col 0
    When I run "editor.delete_line"
    Then buffer line 0 is ""
    And the buffer has 1 lines

  Scenario: Delete backward with full-line selection removes everything
    Given the buffer contains "hello"
    And there is a selection from row 0 col 0 to row 0 col 5
    When I run "editor.delete_word_backward"
    Then buffer line 0 is ""