mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 17:36:19 +04:00
parent
1df32c917c
commit
aa00a470f3
@ -715,7 +715,10 @@ fn theme(
|
||||
cx.editor.unset_theme_preview();
|
||||
}
|
||||
PromptEvent::Update => {
|
||||
if let Some(theme_name) = args.first() {
|
||||
if args.is_empty() {
|
||||
// Ensures that a preview theme gets cleaned up if the user backspaces until the prompt is empty.
|
||||
cx.editor.unset_theme_preview();
|
||||
} else if let Some(theme_name) = args.first() {
|
||||
if let Ok(theme) = cx.editor.theme_loader.load(theme_name) {
|
||||
if !(true_color || theme.is_16_color()) {
|
||||
bail!("Unsupported theme: theme requires true color support");
|
||||
|
@ -293,6 +293,7 @@ pub fn change_history(
|
||||
register: char,
|
||||
direction: CompletionDirection,
|
||||
) {
|
||||
(self.callback_fn)(cx, &self.line, PromptEvent::Abort);
|
||||
let register = cx.editor.registers.get_mut(register).read();
|
||||
|
||||
if register.is_empty() {
|
||||
@ -314,6 +315,7 @@ pub fn change_history(
|
||||
self.history_pos = Some(index);
|
||||
|
||||
self.move_end();
|
||||
(self.callback_fn)(cx, &self.line, PromptEvent::Update);
|
||||
self.recalculate_completion(cx.editor);
|
||||
}
|
||||
|
||||
@ -564,13 +566,11 @@ fn handle_event(&mut self, event: &Event, cx: &mut Context) -> EventResult {
|
||||
ctrl!('p') | key!(Up) => {
|
||||
if let Some(register) = self.history_register {
|
||||
self.change_history(cx, register, CompletionDirection::Backward);
|
||||
(self.callback_fn)(cx, &self.line, PromptEvent::Update);
|
||||
}
|
||||
}
|
||||
ctrl!('n') | key!(Down) => {
|
||||
if let Some(register) = self.history_register {
|
||||
self.change_history(cx, register, CompletionDirection::Forward);
|
||||
(self.callback_fn)(cx, &self.line, PromptEvent::Update);
|
||||
}
|
||||
}
|
||||
key!(Tab) => {
|
||||
|
Loading…
Reference in New Issue
Block a user