67
edits
(→Visual mode: clarifying what "visual position" is.) |
(Note on implementation) |
||
Line 112: | Line 112: | ||
In any event, the deleted character will always be visually adjacent to the caret. | In any event, the deleted character will always be visually adjacent to the caret. | ||
==Note on implementation== | |||
We currently have no method for tracking the caret's visual position (which is necessary for implementing visual mode). Adding such a method might be complicated and cumbersome. | |||
However, adding a separate representation of the caret's position is not really required, if we are willing to give up the "simplification" benefits of the proposed system. | |||
Notice that a logical position, when coupled with a hint, does uniquely correspond to a single visual position. So a visual position can be represented in terms of (logical position, hint). | |||
This will make visual mode work very much like the current system works - for each visual function performed, the current logical position and hint will be considered as a visual position; the visual function will be performed based on that visual position; and the resulting visual position will be converted back to a logical position and a hint. | |||
The difference between the current system and the proposed one will only be when switching from visual to logical mode. Instead of ignoring the hint, and performing the logical function based on the current logical position as the current system does, the proposed system will use the hint to determine the current visual position, and will then, if that visual position is logically ambiguous, use the information obut the logical operation itself in order to chose which of these logical positions to apply the function to. | |||
Implementing the proposed system this way should be relatively easy given the current system. No nmew data structures or tracking mechanisms are necessary, but only added logic for converting a logical position, a hint, and a logical function to a new logical position. |
edits