Because these APIs use different numbering schemes, it makes it difficult to use these APIs together. For example, I'd like to take the indices I get from the mouse-rc or cursor-* APIs and pass them to rc but I can't because they use different numbering schemes.
Current API Behavior
Below is a summary of how the APIs currently behave.
Type
Row API
Row Numbering
Column API
Column Numbering
Query
rc
1 is after closet
rc
Counts words
Mouse
mouse-rc
1 is closet
mouse-rc
Counts words
Cursor
cursor-row-number
1 is closet
cursor-column-number
Counts characters
Ideal?
1 is closet
Counts words
"Ideal?" represents the numbering scheme that I think we'd like across the board for the query, mouse, and cursor APIs. That could be achieved either by modifying the behavior of the existing APIs or introducing new APIs.
For "Row Numbering", the below is what I mean by "1 is after closet" vs "1 is closet". Here's what the APIs consider to be row 1 of the lines box in the screenshot below:
mouse-rc considers it to be: row1-col1 row1-col2 (the closet)
rc considers it to be: row2-col1 row2-col2 (after the closet)
For "Column Numbering", the below is what I mean when I say that rc "counts words" whereas cursor-column-number "counts characters". Here's what the APIs consider to be column 2 of row 1 of the lines box in the screenshot below:
rc considers it to be the row's second word: row1-col2
cursor-column-number considers it to be the row's second character: o
Here's my rationale for exposing APIs for querying, mouse, and cursor that match the behavior marked as "Ideal?" above:
Consistency between rc, mouse-rc, and column-* APIs means that you can use rc to access the row/column returned by mouse-rc or cursor-*
Since the closet is included in the numbering scheme (as row 1), these APIs can work with data in the closet.
For the column APIs, I suspect that counting words (rather than characters) is the more common desire. For example, if the user is interested in what procedure name is under the mouse or cursor, then words (rather than characters) is the more useful abstraction.
If we want to make the query, mouse, and column APIs match the behavior marked as "Ideal?" above, then here are some changes we can consider:
rc: change row field so row 1 represents the closet (rather than after the closet)
cursor-column-number: change this to count words rather than characters (or if we don't want to change this API, we can expose a new one with the desired behavior like cursor-rc)
Because these APIs use different numbering schemes, it makes it difficult to use these APIs together. For example, I'd like to take the indices I get from the
mouse-rc
orcursor-*
APIs and pass them torc
but I can't because they use different numbering schemes.Current API Behavior
Below is a summary of how the APIs currently behave.
rc
rc
mouse-rc
mouse-rc
cursor-row-number
cursor-column-number
"Ideal?" represents the numbering scheme that I think we'd like across the board for the query, mouse, and cursor APIs. That could be achieved either by modifying the behavior of the existing APIs or introducing new APIs.
For "Row Numbering", the below is what I mean by "1 is after closet" vs "1 is closet". Here's what the APIs consider to be row 1 of the
lines
box in the screenshot below:mouse-rc
considers it to be:row1-col1 row1-col2
(the closet)rc
considers it to be:row2-col1 row2-col2
(after the closet)For "Column Numbering", the below is what I mean when I say that
rc
"counts words" whereascursor-column-number
"counts characters". Here's what the APIs consider to be column 2 of row 1 of thelines
box in the screenshot below:rc
considers it to be the row's second word:row1-col2
cursor-column-number
considers it to be the row's second character:o
row and column API demo.box.zip illustrates the behavior of all of these APIs. Screenshot:
Potential fix
Here's my rationale for exposing APIs for querying, mouse, and cursor that match the behavior marked as "Ideal?" above:
rc
,mouse-rc
, andcolumn-*
APIs means that you can userc
to access the row/column returned bymouse-rc
orcursor-*
If we want to make the query, mouse, and column APIs match the behavior marked as "Ideal?" above, then here are some changes we can consider:
rc
: change row field so row 1 represents the closet (rather than after the closet)cursor-column-number
: change this to count words rather than characters (or if we don't want to change this API, we can expose a new one with the desired behavior likecursor-rc
)