# TODO

This is a list of tasks that are on my list:

## Startup

[x] Editing of non-existing files when given as argument, create on save.

## Misc

[ ] There is a memory leak hiding somewhere in Tk, you have to find out what that is, probably it's keeping references to old Tk entities somewhere, strange thing is that this also happens when you just open another file in the same buffer, some stress testing and use of ObjectSpace should reveal the issue.

## VER::Text

Following is a list of things that need redefinition or mapping and porting to
Ruby from the original tk bindings of the Tk::Text widget. This needs to be
done so we can provide true modal editing with full control over what happens
in the widget, otherwise we will have to keep the original binding in place to
provide this functionality.

Mouse actions should generally invoke the select_char mode until we get
line-numbers going, then clicks on the line-numbers should invoke select_line
mode.
Many of the mouse bindings seem non-trivial, and are rather low priority as I
want to focus on efficient editing with keyboard first.

I'll tackle each of them, some may not be implemented at all, or done in other
ways, and trivial ones first.


[ ] If any normal printing characters are typed, they are inserted at the point
    of the insertion cursor.

[ ] The Left and Right keys move the insertion cursor one character to the left
    or right; they also clear any selection in the text. If Left or Right is
    typed with the Shift key down, then the insertion cursor moves and the
    selection is extended to include the new character. Control-Left and
    Control-Right move the insertion cursor by words, and Control-Shift-Left
    and Control-Shift-Right move the insertion cursor by words and also extend
    the selection. Control-b and Control-f behave the same as Left and Right,
    respectively. Meta-b and Meta-f behave the same as Control-Left and
    Control-Right, respectively.

[ ] The Up and Down keys move the insertion cursor one line up or down and
    clear any selection in the text. If Up or Right is typed with the Shift key
    down, then the insertion cursor moves and the selection is extended to
    include the new character. Control-Up and Control-Down move the insertion
    cursor by paragraphs (groups of lines separated by blank lines), and
    Control-Shift-Up and Control-Shift-Down move the insertion cursor by
    paragraphs and also extend the selection. Control-p and Control-n behave
    the same as Up and Down, respectively.

[ ] The Next and Prior keys move the insertion cursor forward or backwards by
    one screenful and clear any selection in the text. If the Shift key is held
    down while Next or Prior is typed, then the selection is extended to
    include the new character.

[ ] Control-Next and Control-Prior scroll the view right or left by one page
    without moving the insertion cursor or affecting the selection.

[ ] Home and Control-a move the insertion cursor to the beginning of its
    display line and clear any selection in the widget. Shift-Home moves the
    insertion cursor to the beginning of the display line and also extends the
    selection to that point.

[ ] End and Control-e move the insertion cursor to the end of the display line
    and clear any selection in the widget. Shift-End moves the cursor to the
    end of the display line and extends the selection to that point.

[ ] Control-Home and Meta-< move the insertion cursor to the beginning of the
    text and clear any selection in the widget. Control-Shift-Home moves the
    insertion cursor to the beginning of the text and also extends the
    selection to that point.

[ ] Control-End and Meta-> move the insertion cursor to the end of the text and
    clear any selection in the widget. Control-Shift-End moves the cursor to
    the end of the text and extends the selection to that point.

[ ] The Select key and Control-Space set the selection anchor to the position
    of the insertion cursor. They do not affect the current selection.
    Shift-Select and Control-Shift-Space adjust the selection to the current
    position of the insertion cursor, selecting from the anchor to the
    insertion cursor if there was not any selection previously.

[ ] Control-/ selects the entire contents of the widget.

[ ] Control-\ clears any selection in the widget.

[ ] The F16 key (labelled Copy on many Sun workstations) or Meta-w copies the
    selection in the widget to the clipboard, if there is a selection. This
    action is carried out by the command tk_textCopy.

[ ] The F20 key (labelled Cut on many Sun workstations) or Control-w copies the
    selection in the widget to the clipboard and deletes the selection. This
    action is carried out by the command tk_textCut. If there is no selection
    in the widget then these keys have no effect.

[ ] The F18 key (labelled Paste on many Sun workstations) or Control-y inserts
    the contents of the clipboard at the position of the insertion cursor. This
    action is carried out by the command tk_textPaste.

[ ] The Delete key deletes the selection, if there is one in the widget. If
    there is no selection, it deletes the character to the right of the
    insertion cursor.

[ ] Backspace and Control-h delete the selection, if there is one in the
    widget. If there is no selection, they delete the character to the left of
    the insertion cursor.

[ ] Control-d deletes the character to the right of the insertion cursor.

[ ] Meta-d deletes the word to the right of the insertion cursor.

[ ] Control-k deletes from the insertion cursor to the end of its line; if the
    insertion cursor is already at the end of a line, then Control-k deletes
    the newline character.

[ ] Control-o opens a new line by inserting a newline character in front of the
    insertion cursor without moving the insertion cursor.

[ ] Meta-backspace and Meta-Delete delete the word to the left of the insertion
    cursor.

[ ] Control-x deletes whatever is selected in the text widget after copying it
    to the clipboard.

[ ] Control-t reverses the order of the two characters to the right of the
    insertion cursor.

[ ] Control-z (and Control-underscore on UNIX when tk_strictMotif is true)
    undoes the last edit action if the -undo option is true. Does nothing
    otherwise.

[ ] Control-Z (or Control-y on Windows) reapplies the last undone edit action
    if the -undo option is true. Does nothing otherwise. 

[ ] Clicking mouse button 1 positions the insertion cursor just before the
    character underneath the mouse cursor, sets the input focus to this widget,
    and clears any selection in the widget. Dragging with mouse button 1
    strokes out a selection between the insertion cursor and the character
    under the mouse.

[ ] Double-clicking with mouse button 1 selects the word under the mouse and
    positions the insertion cursor at the start of the word. Dragging after a
    double click will stroke out a selection consisting of whole words.

[ ] Triple-clicking with mouse button 1 selects the line under the mouse and
    positions the insertion cursor at the start of the line. Dragging after a
    triple click will stroke out a selection consisting of whole lines.

[ ] The ends of the selection can be adjusted by dragging with mouse button 1
    while the Shift key is down; this will adjust the end of the selection that
    was nearest to the mouse cursor when button 1 was pressed. If the button is
    double-clicked before dragging then the selection will be adjusted in units
    of whole words; if it is triple-clicked then the selection will be adjusted
    in units of whole lines.

[ ] Clicking mouse button 1 with the Control key down will reposition the
    insertion cursor without affecting the selection.

[ ] The view in the widget can be adjusted by dragging with mouse button 2. If
    mouse button 2 is clicked without moving the mouse, the selection is copied
    into the text at the position of the mouse cursor. The Insert key also
    inserts the selection, but at the position of the insertion cursor.

[ ] If the mouse is dragged out of the widget while button 1 is pressed, the
    entry will automatically scroll to make more text visible (if there is more
    text off-screen on the side where the mouse left the window).