4 ms·
Cursor shape is important, because is plays into position/selections semantics. In some terminal emulators, like Gnome Terminal and others, you can select whet
by kazinator 5y ago
Cursor shape is important, because is plays into position/selections semantics.
In some terminal emulators, like Gnome Terminal and others, you can select whether your cursor is a block, "I beam" or underline.
Unfortunately, some editing software doesn't have the semantics adjustment for this.
For instance in Vim, when you make a visual selection from point A to point B, it is inclusive: it assumes that a block cursor is wiping over the selection, so it includes the originating character and terminating character. If you start a selection and do not move the cursor, and copy text, you are copying one character: the one covered by the block cursor.
If the cursor is an I-beam, this makes no sense. The I-beam cursor appears to be between characters. When you start a selection, and do not move it, you want it to be empty, rather than arbitrarily inclusive of the one character to the right of the I-beam. Only the characters that you move over, in either direction, should be included in the selection.
In the TXR Lisp REPL, you can toggle the semantics to match your cursor. If the special variable *listener-sel-inclusive-p* is true, it has endpoint-inclusive semantics (good for block cursors), otherwise exclusive (great with I-beam).
- thaumasiotes 5y ago> For instance in Vim, when you make a visual selection from point A to point B, it is inclusive: it assumes that a block cursor is wiping over the selection, so it includes the originating character and terminating character. If you start a selection and do not move the cursor, and copy text, you are copying one character: the one covered by the block cursor. Compare emacs, where you're using a block cursor, your selection will include the originating character -- but not the terminating character -- and starting a selection and then failing to move the cursor will result in a selection of zero characters. You've described a Vim convention, not a block-cursor convention.
- saurik 5y agoDoesn't this mean that semantically you are using an I-beam cursor? (Note I say this as someone who always uses block cursors, visually, not matter the semantics.) The reason this distinction is fun to talk about in vi is because, semantically, insert mode uses an I-beam cursor while normal mode uses a block cursor, and some people have everything configured to visually switch back/forth between the two cursor styles as you switch modes (though I don't).
- thaumasiotes 5y ago> Doesn't this mean that semantically you are using an I-beam cursor? No. "I-beam cursor" is a description of a visual phenomenon; semantics are a separate concern. You can render an I-beam on the right of its square just as easily as you can do it on the left.