boxer-project / boxer-sunrise

Sunrise on the Boxer Reconstruction Project
BSD 3-Clause "New" or "Revised" License
39 stars 2 forks source link

Inconsistent numbering between row & column APIs: `rc`, `mouse-rc`, `cursor-row/column-number` #89

Open rigdern opened 4 days ago

rigdern commented 4 days ago

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:

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:

row and column API demo.box.zip illustrates the behavior of all of these APIs. Screenshot:

image

Potential fix

Here's my rationale for exposing APIs for querying, mouse, and cursor that match the behavior marked as "Ideal?" above:

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: