diff options
author | Michael Davis | 2023-07-10 23:48:29 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2023-07-31 06:05:38 +0000 |
commit | baceb02a090fe711ad772d855635bc590826fa53 (patch) | |
tree | 9bb4eecbce2e7c84caf707f33ff39d7a2dcf7102 /helix-term/src/commands | |
parent | 0f19f282cfa49d441f58a8e2540a6b24efe1b769 (diff) |
Use refactored Registers type
This is an unfortunately noisy change: we need to update virtually all
callsites that access the registers. For reads this means passing in the
Editor and for writes this means handling potential failure when we
can't write to a clipboard register.
Diffstat (limited to 'helix-term/src/commands')
-rw-r--r-- | helix-term/src/commands/typed.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 175f8bc6..28759b3f 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -2285,13 +2285,12 @@ fn clear_register( format!("Invalid register {}", args[0]) ); let register = args[0].chars().next().unwrap_or_default(); - match cx.editor.registers.remove(register) { - Some(_) => cx - .editor - .set_status(format!("Register {} cleared", register)), - None => cx - .editor - .set_error(format!("Register {} not found", register)), + if cx.editor.registers.remove(register) { + cx.editor + .set_status(format!("Register {} cleared", register)); + } else { + cx.editor + .set_error(format!("Register {} not found", register)); } Ok(()) } |