News for hackers. Stuff that matters.
Re:A Cursory Look at Cursors by Joker_vD on Tuesday May 28, 2024 @09:47AM (#40500721)
> It would be hard to imagine a program for editing text that doesn't have a cursor.

Ed is the standard text editor. It doesn't waste precious kilobytes on cursor positioning code.

Speaking seriously, this inherent need for the feedback from the user presentation layer back into the internals is why writing a decent multi-line editor with non-monospace fonts is such a nuisance.

Re:A Cursory Look at Cursors by bloopernova on Tuesday May 28, 2024 @09:58AM (#40500821)
What do people on HN use, and why? Box, underline, vertical bar? Flashing or not?
Re:A Cursory Look at Cursors by amitp on Tuesday May 28, 2024 @11:11AM (#40501465)
I use a solid box in a terminal and for coding, and a vertical bar for writing in emacs org-mode. But I recently tried out a one-third box[1] in emacs and I am really loving it! It's partway between a box and an underline. Some software has a half-box option but I don't think MacOS Terminal or iTerm2 have that. [Edit: I was wrong — iTerm2 has an advanced setting for "underline cursor width"]

I used to use flashing but have that turned off right now, for reasons I can't remember.

[1] (setq-local cursor-type '(hbar . 8))

Re:A Cursory Look at Cursors by bloopernova on Tuesday May 28, 2024 @12:38PM (#40502620)
As a fellow Emacs and iTerm user, thank you for sharing, both of those look good to me :)
Re:A Cursory Look at Cursors by PhilipRoman on Tuesday May 28, 2024 @12:16PM (#40502333)
I used a bar until getting into vim, whose semantics are more box-like (with the cursed exception of the cursor moving one position back upon exiting insert mode, as if it were a bar)

Nowadays I like a box because it stands out on any color combination.

Re:A Cursory Look at Cursors by gcassie on Tuesday May 28, 2024 @11:53AM (#40502016)
I'd really like my cursor to kind of glow but my graphics programming skills are not at that level yet.

For editing, a block has more potential than a vertical bar because you always have context of a selected character to perform operations on (e.g. `x` to delete current char in vim). You can also do operations before and after that character (e.g. `i` vs `a` in vim).

Re:A Cursory Look at Cursors by lioeters on Tuesday May 28, 2024 @12:09PM (#40502227)
My favorite style currently is bright yellow vertical bar (2~3px), non flashing, against a dark background.
Re:A Cursory Look at Cursors by netmare on Tuesday May 28, 2024 @11:18AM (#40501548)
I still prefer it the way it was when I started using computers with DOS 6.x and Windows 3.1: underline in console, bar in GUIs, block in both with overwrite mode. Always blinking of course. My problems with modern programs are 1) overwrite mode is usually not implemented and 2) moving the cursor does not reset the blink timer. The first I can understand (although it's trivial to do), but the second results in the cursor getting invisible when moving while pressing the arrow keys. It's the little things...
Re:A Cursory Look at Cursors by jareklupinski on Tuesday May 28, 2024 @10:15AM (#40500954)
> What do people on HN use

i just remember where the cursor is supposed to be :P

Re:A Cursory Look at Cursors by MikeTheGreat on Tuesday May 28, 2024 @11:20AM (#40501576)
Obligatory: https://xkcd.com/378/ :)
Re:A Cursory Look at Cursors by tomjen3 on Tuesday May 28, 2024 @11:40AM (#40501832)
Box if you are overwriting the next char, vertical bar if you are inserting. Dunno whenever you would use underline (I guess if it doesn't work with box for some reason)?

Thats the standard, anyway, so if you don't follow that, you are confusing your users.

Re:A Cursory Look at Cursors by samatman on Tuesday May 28, 2024 @11:57AM (#40502072)
The standard in modal-land is box in normal mode and bar in insert mode. R for overwrite is an underline.
Re:A Cursory Look at Cursors by aquova on Tuesday May 28, 2024 @10:35AM (#40501138)
I use a non-flashing underline for no other reason than I like the look of it.
Re:A Cursory Look at Cursors by dexen on Tuesday May 28, 2024 @11:43AM (#40501873)
I particularly like how in Acme, when selection is zero-width ("empty"), it is the cursor. Conversely selection can be extended from cursor in any direction.

As a side effect, this greatly simplifies the API for manipulating both.

Re:A Cursory Look at Cursors by danhau on Tuesday May 28, 2024 @12:26PM (#40502478)
What is Acme in this context? Id like to get an idea of what you mean.
Re:A Cursory Look at Cursors by tomjakubowski on Tuesday May 28, 2024 @01:10PM (#40502939)
the acme text editor, originally from plan9

http://acme.cat-v.org/ https://www.youtube.com/watch?v=dP1xVpMPn8M

Re:A Cursory Look at Cursors by danhau on Wednesday May 29, 2024 @03:07PM (#40515639)
Thank you!
Re:A Cursory Look at Cursors by RACEWAR on Tuesday May 28, 2024 @01:11PM (#40502949)
Re:A Cursory Look at Cursors by danhau on Wednesday May 29, 2024 @03:08PM (#40515641)
Thanks!
Re:A Cursory Look at Cursors by gcassie on Tuesday May 28, 2024 @11:50AM (#40501964)
I actually used this pattern as well and I really like it. I store another property called `mark_idx`. When `cursor_idx` and `mark_idx` are the same then it's just a cursor. When they differ, the range between them is the selection.