1-indexing for cursor position is surprising
Drup opened this issue · comments
I think you should change it for 0-indexing. It's really more usual.
It is unusual, but it mirrors the terminal protocols. Mouse is always reported as 1-based. All of the cursor-related escapes are 1-based. I just mirror the underlying semantics here; normalizing it all over the place seemed pretty arbitrary.
You try very hard to provide a nice API that is not a dumb matrix of chars. I feel like "mirroring the underlying semantics" is not the main point here :)
So yes, I think you should normalize it.
My idea is to just leave stuff I'm orthogonal to as it is. But this did seem like a wart.
Let's have a show of hands here. Any well-intentioned souls reading this have an opinion on whether the top-left position is (0, 0)
or (1, 1)
? I'm happy with either 😄 .
Perhaps we could meet somewhere in the middle with (0, 1)
?
All joking aside, here's my unsolicited opinion: (0, 0)
seems superior.
@rgrinberg I simply forgot to solicit your opinion!
I didn't even notice when I tried, because I was using I.pad
. I think 0-based indices are more natural for me, but as long as it's clearly documented I'm not too vindicative on this issue.
Fwiw, lambda-term uses 0 indexing for the cursor. But since lambda-term uses matrices, it would be even more confusing if it wasn't the case.
I'm easy, but agree with @pqwy statement that all you read about terminals is 1-based anyways... no need to normalise
everything to 0.
No strong opinion. As a distraction I'll simply link to this piece by Dijkstra and try to further confuse the issue by noting that emacs uses (0,1)
.
Ok, after some deliberation, I realized that (0, 1)
is indeed the right compromise between the two possible expectations.
Emacs people know their interfaces, after all.