mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-26 11:23:31 +04:00
don't save change history in insert mode
This commit is contained in:
parent
6871d5b24d
commit
cb47f946d7
@ -569,12 +569,12 @@ fn extend_to_line_start(cx: &mut Context) {
|
|||||||
|
|
||||||
fn kill_to_line_start(cx: &mut Context) {
|
fn kill_to_line_start(cx: &mut Context) {
|
||||||
extend_to_line_start(cx);
|
extend_to_line_start(cx);
|
||||||
delete_selection(cx);
|
delete_selection_and_append_history(cx, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn kill_to_line_end(cx: &mut Context) {
|
fn kill_to_line_end(cx: &mut Context) {
|
||||||
extend_to_line_end(cx);
|
extend_to_line_end(cx);
|
||||||
delete_selection(cx);
|
delete_selection_and_append_history(cx, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn goto_first_nonwhitespace(cx: &mut Context) {
|
fn goto_first_nonwhitespace(cx: &mut Context) {
|
||||||
@ -1560,13 +1560,19 @@ fn delete_selection_impl(reg: &mut Register, doc: &mut Document, view_id: ViewId
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn delete_selection(cx: &mut Context) {
|
fn delete_selection(cx: &mut Context) {
|
||||||
|
delete_selection_and_append_history(cx, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn delete_selection_and_append_history(cx: &mut Context, append_change_to_history: bool) {
|
||||||
let reg_name = cx.register.unwrap_or('"');
|
let reg_name = cx.register.unwrap_or('"');
|
||||||
let (view, doc) = current!(cx.editor);
|
let (view, doc) = current!(cx.editor);
|
||||||
let registers = &mut cx.editor.registers;
|
let registers = &mut cx.editor.registers;
|
||||||
let reg = registers.get_mut(reg_name);
|
let reg = registers.get_mut(reg_name);
|
||||||
delete_selection_impl(reg, doc, view.id);
|
delete_selection_impl(reg, doc, view.id);
|
||||||
|
|
||||||
doc.append_changes_to_history(view.id);
|
if append_change_to_history {
|
||||||
|
doc.append_changes_to_history(view.id);
|
||||||
|
}
|
||||||
|
|
||||||
// exit select mode, if currently in select mode
|
// exit select mode, if currently in select mode
|
||||||
exit_select_mode(cx);
|
exit_select_mode(cx);
|
||||||
@ -3861,7 +3867,7 @@ pub fn delete_word_forward(cx: &mut Context) {
|
|||||||
.clone()
|
.clone()
|
||||||
.transform(|range| movement::move_next_word_start(text, range, count));
|
.transform(|range| movement::move_next_word_start(text, range, count));
|
||||||
doc.set_selection(view.id, selection);
|
doc.set_selection(view.id, selection);
|
||||||
delete_selection(cx)
|
delete_selection_and_append_history(cx, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user