Skip to content

Commit

Permalink
Resolve current round of code review.
Browse files Browse the repository at this point in the history
Co-authored-by: Ibrahim Dursun <ibrahim@dursun.cc>
  • Loading branch information
shaleh and idursun committed Apr 16, 2024
1 parent 27d22bb commit 0a7e86a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion book/src/generated/typable-cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
| `:quit`, `:q` | Close the current view. |
| `:quit!`, `:q!` | Force close the current view, ignoring unsaved changes. |
| `:open`, `:o` | Open a file from disk into the current view. |
| `:read`, `:r` | Load a file into buffer |
| `:buffer-close`, `:bc`, `:bclose` | Close the current buffer. |
| `:buffer-close!`, `:bc!`, `:bclose!` | Close the current buffer forcefully, ignoring unsaved changes. |
| `:buffer-close-others`, `:bco`, `:bcloseother` | Close all buffers but the currently focused one. |
Expand Down Expand Up @@ -88,3 +87,4 @@
| `:redraw` | Clear and re-render the whole UI |
| `:move` | Move the current buffer and its corresponding file to a different path |
| `:yank-diagnostic` | Yank diagnostic(s) under primary cursor to register, or clipboard by default |
| `:read`, `:r` | Load a file into buffer |
9 changes: 3 additions & 6 deletions helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2455,19 +2455,16 @@ fn yank_diagnostic(
Ok(())
}

fn read(
cx: &mut compositor::Context,
args: &[Cow<str>],
event: PromptEvent,
) -> anyhow::Result<()> {
fn read(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> {
if event != PromptEvent::Validate {
return Ok(());
}

let scrolloff = cx.editor.config().scrolloff;
let (view, doc) = current!(cx.editor);

ensure!(!args.is_empty(), "file name is expected");
ensure!(args.len() == 1, "only the file name is expected");
ensure!(args.len() == 1, "only the file name is expected");

let filename = args.get(0).unwrap();
let path = PathBuf::from(filename.to_string());
Expand Down

0 comments on commit 0a7e86a

Please sign in to comment.