Return Cursor::Caret if selection matches cursor position in Editor::cursor

This commit is contained in:
Héctor Ramón Jiménez 2023-09-12 18:20:02 +02:00
parent 1455911b63
commit abab144857
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -72,15 +72,18 @@ impl editor::Editor for Editor {
fn cursor(&self) -> editor::Cursor {
let internal = self.internal();
let cursor = internal.editor.cursor();
let buffer = internal.editor.buffer();
match internal.editor.select_opt() {
Some(selection) => {
Some(selection)
if cursor.line != selection.line
|| cursor.index != selection.index =>
{
// TODO
Cursor::Selection(vec![])
}
None => {
let cursor = internal.editor.cursor();
let buffer = internal.editor.buffer();
_ => {
let lines_before_cursor: usize = buffer
.lines
.iter()