goto end of file if count is not present

pull/8135/head
GiM 1 year ago
parent a38ec6d6ca
commit ced96cff2d

@ -3105,16 +3105,13 @@ fn push_jump(view: &mut View, doc: &Document) {
}
fn goto_line(cx: &mut Context) {
if cx.count.is_some() {
let (view, doc) = current!(cx.editor);
push_jump(view, doc);
goto_line_without_jumplist(cx.editor, cx.count);
}
}
fn goto_line_without_jumplist(editor: &mut Editor, count: Option<NonZeroUsize>) {
if let Some(count) = count {
let (view, doc) = current!(editor);
let text = doc.text().slice(..);
let max_line = if text.line(text.len_lines() - 1).len_chars() == 0 {
@ -3123,7 +3120,13 @@ fn goto_line_without_jumplist(editor: &mut Editor, count: Option<NonZeroUsize>)
} else {
text.len_lines() - 1
};
let line_idx = std::cmp::min(count.get() - 1, max_line);
let line_idx = if let Some(count) = count {
std::cmp::min(count.get() - 1, max_line)
} else {
max_line
};
let pos = text.line_to_char(line_idx);
let selection = doc
.selection(view.id)
@ -3132,7 +3135,6 @@ fn goto_line_without_jumplist(editor: &mut Editor, count: Option<NonZeroUsize>)
doc.set_selection(view.id, selection);
}
}
fn goto_last_line(cx: &mut Context) {
let (view, doc) = current!(cx.editor);

Loading…
Cancel
Save