3 ms·
There are only two kinds of non-modal editors. 1. A useless, primitive thing in which every single keystroke inserts a character or performs an edit action, an
by kazinator 4y ago
There are only two kinds of non-modal editors.
1. A useless, primitive thing in which every single keystroke inserts a character or performs an edit action, and then returns to the initial state. Typically found in the simplest edit controls offered by a windowing UI, or very simple command line editors.
2. A command-oriented editor in which every action is performed by typing a line of input, terminated by Enter to execute the command. E.g. ed, almost. This is always in a command mode, which accumulates characters until Enter, executes, and returns to command mode. If there is a mode for appending lines until . (dot) is entered on a line by itself, then that is modal.
Everything else is modal.
I just fired up Nano. I made some changes and quit with Ctrl-X. Lo and behold, I was dropped into a mode in which I had to type y or n to save or not. Note that the usual action of these keys is to insert the characters y or n into the buffer. I issued y, and was dropped into another mode in which the characters I typed didn't insert into the buffer, but into a prompt asking for the file name.
- dolni 4y agoSuggesting that nano and vim are both "modal editors" because nano has some confirmation dialogs is not a deep insight, it's just pedantry. And it ignores the entire reason why you'd describe an editor as modal: that changing modes is integral to the editing experience. You can't change modes in nano to make editing more efficient.
- deleted 4y ago[deleted]
- kazinator 4y agoThat may be the entire reason you would describe an editor as modal, but those who don't like modal editors have a different reason: they claim that they are confused by stateful behavior: that the same inputs cause different things to happen depending on what state the program is in. Usually, plenty of modal behaviors can be identified in whatever alternative they endorse. The depth of that insight is what it is.