* Fix incorrect check in doc:raw_remove
Restore caret position on command doc:cut
* merge cursors and fix new line in clipboard
* add new line to the last copied line
* Add `Doc:get_selection_idx`
* Make multicursor paste add a cursor at the end of each paste
* Better manage paste of multicursor whole line copy
* Document `Doc:get_selection_idx`
* Keep track of last added selection in `Doc`
* Make use of `doc.last_selection` in `Doc` commands
* Make `Doc:get_selection` return the `Doc.last_selection` if possible
Before the addition of multi-cursor support, we just returned the second
return value of the "replacer" function to the caller.
With the introduction of multi-cursors, we naively summed the second
return values for each cursor.
In some cases the "replacer" function doesn't return any second value,
so we tried to do math with `nil`, thus throwing errors.
Now the second return value is added to a table which is then returned
to the caller.
It wasn't fine to call core.open_doc without filename argument
and later call Doc:save without providing both the filename and
the absolute filename. It was giving a Doc in an inconsistent
status where self.filename was set but not self.abs_filename.
Added an asset to detect early the problem if ever happens again.
In turn the problem prevented the project's module hook to work if the
file was newly created.
When `highlighter:insert_notify` was called, a hole in the array was
created.
If another call to `highlighter:insert_notify` happened before the hole
was filled, a `Position out of bounds` error could have been raised.
The syntax highlighter keep a cache of the documents like tokenization.
In order to minimize the amount of tokenize re-computations we insert some
emtty lines or remove some lines in the highlither lines corresponding to
the lines added or removed to the document.
In the highlither thread We should accept a previously generated line tokenization
past first_invalid_line only if the text is the same. The text can change because of
insert or remove operations.
Close#573.
The syntax highlighter keep a cache of the documents like tokenization.
In order to minimize the amount of tokenize re-computations we insert some
emtty lines or remove some lines in the highlither lines corresponding to
the lines added or removed to the document.
In the highlither thread We should accept a previously generated line tokenization
past first_invalid_line only if the text is the same. The text can change because of
insert or remove operations.
Close#573.