Vec
s made it faster
Mark
? It looks like it's just supposed to represent a byte index into a buffer, and is only used to keep track of the top-left character position and the cursor position. If that's true, what is the usize
for and why is it always 0? I'm confused in part because the mark hashmap is a property of a buffer, rather than a view.
Thanks for the explanation :)
The reason I said that "the usize
is always 0" is that Mark
is defined like enum Mark { Cursor(usize), DisplayMark(usize) }
, and I looked through the code, and found several places where Mark
s are constructed, and they are all instantiated with a value of zero. I just don't understand what that number is supposed to mean.
What's the advantage of a Mark over a usize
that represents a byte index into the buffer?
Also, was iota designed to be able to have multiple views into the same buffer? It seems like it was because of the Arc<Mutex<Buffer>>
dw
do at the moment? I think the text object system was meant to be pretty open ended, so you could basically jump to any point in the document, from any other arbitrary point. Like "the second line down from the cursor" or "the fifth character from the start of the fifth line above the cursor". That sort of thing. The cursor is just one of the positions that can be used as the starting point for a movement. Does that answer your question?
dw
deletes from the cursor to the start of the next word. I was just thinking out loud. A text object at the moment represents a mapping from a buffer to a particular character, and I've been playing around with changing it so that it represents a mapping from a buffer to a range of characters like in vim.