dap: Use cursor_line over cursor + char_to_line

pull/574/head
Blaž Hrastnik 3 years ago
parent 54f8e5c9c3
commit de5e5863aa

@ -164,8 +164,7 @@ fn get_breakpoint_at_current_line(editor: &mut Editor) -> Option<(usize, Breakpo
let (view, doc) = current!(editor); let (view, doc) = current!(editor);
let text = doc.text().slice(..); let text = doc.text().slice(..);
let pos = doc.selection(view.id).primary().cursor(text); let line = doc.selection(view.id).primary().cursor_line(text);
let line = text.char_to_line(pos);
let path = match doc.path() { let path = match doc.path() {
Some(path) => path, Some(path) => path,
None => return None, None => return None,
@ -418,8 +417,7 @@ pub fn dap_toggle_breakpoint(cx: &mut Context) {
} }
}; };
let text = doc.text().slice(..); let text = doc.text().slice(..);
let pos = doc.selection(view.id).primary().cursor(text); let line = doc.selection(view.id).primary().cursor_line(text);
let line = text.char_to_line(pos);
dap_toggle_breakpoint_impl(cx, path, line); dap_toggle_breakpoint_impl(cx, path, line);
} }

Loading…
Cancel
Save