diff --git a/crates/nu-command/src/viewers/explore.rs b/crates/nu-command/src/viewers/explore.rs index 2831b7d902..e527d5a9dd 100644 --- a/crates/nu-command/src/viewers/explore.rs +++ b/crates/nu-command/src/viewers/explore.rs @@ -76,7 +76,7 @@ impl Command for Explore { update_config(&mut config, show_index, show_head); let show_banner = is_need_banner(&config).unwrap_or(true); - let exit_esc = is_need_esc_exit(&config).unwrap_or(false); + let exit_esc = is_need_esc_exit(&config).unwrap_or(true); let style = style_from_config(&config); diff --git a/crates/nu-explore/src/commands/config.rs b/crates/nu-explore/src/commands/config.rs index 054d87af1e..75afc96321 100644 --- a/crates/nu-explore/src/commands/config.rs +++ b/crates/nu-explore/src/commands/config.rs @@ -70,7 +70,7 @@ impl ViewCommand for ConfigCmd { Some(HelpManual { name: Self::NAME, description: - "Interactive configuration manager.\nCan be used to set various explore settings.\n\nIt could be consired an interactive version of :tweak", + "Interactive configuration manager.\nCan be used to set various explore settings.\n\nLike an interactive version of :tweak", config_options, arguments: vec![], examples: vec![], diff --git a/crates/nu-explore/src/commands/config_show.rs b/crates/nu-explore/src/commands/config_show.rs index 97b7442973..c4547b2b56 100644 --- a/crates/nu-explore/src/commands/config_show.rs +++ b/crates/nu-explore/src/commands/config_show.rs @@ -53,7 +53,7 @@ impl ViewCommand for ConfigShowCmd { Some(HelpManual { name: Self::NAME, description: - "Return a currently used configuration.\nSome default fields might be missing.", + "Show the current `explore` configuration.\nSome default fields might be missing.", arguments: vec![HelpExample::new("nu", "Use a nuon format instead")], config_options: vec![], input: vec![], diff --git a/crates/nu-explore/src/commands/help.rs b/crates/nu-explore/src/commands/help.rs index f4944cc07c..a8df915a8d 100644 --- a/crates/nu-explore/src/commands/help.rs +++ b/crates/nu-explore/src/commands/help.rs @@ -30,19 +30,15 @@ impl HelpCmd { const HELP_MESSAGE: &'static str = r#" Explore - main help file - Move around: Use the cursor keys. - Close this window: Use "". - Get out of Explore: Use ":q" (or + ). - - Get specific help: It is possible to go directly to whatewer you want help on, - by adding an argument to the ":help" command. - - Currently you can only get help on a few commands. - To obtain a list of supported commands run ":help :" + Move around: Use the cursor keys. + Close help: Press "". + Exit Explore: Type ":q" then then (or press Ctrl+D). + Open an interactive REPL: Type ":try" then enter + List all sub-commands: Type ":help :" then ------------------------------------------------------------------------------------ -Regular expressions ~ +# Regular expressions Most commands support regular expressions. diff --git a/crates/nu-explore/src/commands/table.rs b/crates/nu-explore/src/commands/table.rs index 8ef7a12d27..3f88cfabb7 100644 --- a/crates/nu-explore/src/commands/table.rs +++ b/crates/nu-explore/src/commands/table.rs @@ -207,7 +207,7 @@ impl ViewCommand for TableCmd { } if self.settings.line_shift.unwrap_or(false) { - view.set_line_traling(true); + view.set_line_trailing(true); } if self.settings.show_cursor.unwrap_or(false) { diff --git a/crates/nu-explore/src/commands/try.rs b/crates/nu-explore/src/commands/try.rs index dd5081c075..48661201b2 100644 --- a/crates/nu-explore/src/commands/try.rs +++ b/crates/nu-explore/src/commands/try.rs @@ -46,9 +46,9 @@ impl ViewCommand for TryCmd { #[rustfmt::skip] let config_options = vec![ - ConfigOption::boolean(":try options", "Try makes running command on each input character", "try.reactive"), + ConfigOption::boolean(":try options", "In the `:try` REPL, attempt to run the command on every keypress", "try.reactive"), ConfigOption::new(":try options", "Change a border color of the menus", "try.border_color", default_color_list()), - ConfigOption::new(":try options", "Change a highlighed menu color", "try.highlighted_color", default_color_list()), + ConfigOption::new(":try options", "Change a highlighted menu color", "try.highlighted_color", default_color_list()), ]; #[rustfmt::skip] @@ -59,7 +59,7 @@ impl ViewCommand for TryCmd { Some(HelpManual { name: "try", - description: "Opens a panel in which to run Nushell commands and explore their output. The exporer acts liek `:table`.", + description: "Opens a panel in which to run Nushell commands and explore their output. The explorer acts like `:table`.", arguments: vec![], examples, input: shortcuts, diff --git a/crates/nu-explore/src/commands/tweak.rs b/crates/nu-explore/src/commands/tweak.rs index aee52fab5e..6f0d4f701a 100644 --- a/crates/nu-explore/src/commands/tweak.rs +++ b/crates/nu-explore/src/commands/tweak.rs @@ -34,8 +34,7 @@ impl SimpleCommand for TweakCmd { fn help(&self) -> Option { Some(HelpManual { name: "tweak", - description: - "Set different settings.\nIt could be consired a not interactive version of :config", + description: "Set `explore` settings.\nLike a non-interactive version of :config", arguments: vec![], examples: vec![ HelpExample::new(":tweak table.show_index false", "Don't show index anymore"), diff --git a/crates/nu-explore/src/pager/mod.rs b/crates/nu-explore/src/pager/mod.rs index 1f7f08dcc3..22cc8f2b91 100644 --- a/crates/nu-explore/src/pager/mod.rs +++ b/crates/nu-explore/src/pager/mod.rs @@ -180,7 +180,7 @@ impl<'a> PagerConfig<'a> { style_computer, config, peek_value: false, - exit_esc: false, + exit_esc: true, reverse: false, show_banner: false, style: StyleConfig::default(), @@ -471,14 +471,14 @@ fn run_command( fn set_cursor_cmd_bar(f: &mut Frame, area: Rect, pager: &Pager) { if pager.cmd_buf.is_cmd_input { - // todo: deal with a situation where we exeed the bar width + // todo: deal with a situation where we exceed the bar width let next_pos = (pager.cmd_buf.buf_cmd2.len() + 1) as u16; // 1 skips a ':' char if next_pos < area.width { f.set_cursor(next_pos as u16, area.height - 1); } } else if pager.search_buf.is_search_input { - // todo: deal with a situation where we exeed the bar width + // todo: deal with a situation where we exceed the bar width let next_pos = (pager.search_buf.buf_cmd_input.len() + 1) as u16; // 1 skips a ':' char if next_pos < area.width { @@ -670,9 +670,9 @@ fn handle_events( // Sometimes we get a BIG list of events; // for example when someone scrolls via a mouse either UP or DOWN. - // This MIGHT causes freeses as we have a 400 delay for a next command read. + // This MIGHT cause freezes as we have a 400 delay for a next command read. // - // To eliminate that we are trying ot read all possible commands which we should action upon. + // To eliminate that we are trying to read all possible commands which we should act upon. while let Ok(Some(key)) = events.try_next() { let result = handle_event( diff --git a/crates/nu-explore/src/views/information.rs b/crates/nu-explore/src/views/information.rs index 014c55690d..a91e72d8fd 100644 --- a/crates/nu-explore/src/views/information.rs +++ b/crates/nu-explore/src/views/information.rs @@ -62,9 +62,12 @@ impl View for InformationView { _: &mut Stack, _: &Layout, _: &mut ViewInfo, - _: KeyEvent, + event: KeyEvent, ) -> Option { - None + match event.code { + crossterm::event::KeyCode::Esc => Some(Transition::Exit), + _ => None, + } } fn collect_data(&self) -> Vec { diff --git a/crates/nu-explore/src/views/interative.rs b/crates/nu-explore/src/views/interactive.rs similarity index 98% rename from crates/nu-explore/src/views/interative.rs rename to crates/nu-explore/src/views/interactive.rs index 3440c05780..401a4be161 100644 --- a/crates/nu-explore/src/views/interative.rs +++ b/crates/nu-explore/src/views/interactive.rs @@ -27,7 +27,7 @@ use super::{ pub struct InteractiveView<'a> { input: Value, command: String, - imidiate: bool, + immediate: bool, table: Option>, table_theme: TableTheme, view_mode: bool, @@ -40,7 +40,7 @@ impl<'a> InteractiveView<'a> { Self { input, table: None, - imidiate: false, + immediate: false, table_theme: TableTheme::default(), border_color: Style::default(), highlighted_color: Style::default(), @@ -192,7 +192,7 @@ impl View for InteractiveView<'_> { if !self.command.is_empty() { self.command.pop(); - if self.imidiate { + if self.immediate { match self.try_run(engine_state, stack) { Ok(_) => info.report = Some(Report::default()), Err(err) => { @@ -207,7 +207,7 @@ impl View for InteractiveView<'_> { KeyCode::Char(c) => { self.command.push(*c); - if self.imidiate { + if self.immediate { match self.try_run(engine_state, stack) { Ok(_) => info.report = Some(Report::default()), Err(err) => info.report = Some(Report::error(format!("Error: {}", err))), @@ -266,7 +266,7 @@ impl View for InteractiveView<'_> { } if let Some(val) = hm.get("reactive").and_then(|v| v.as_bool().ok()) { - self.imidiate = val; + self.immediate = val; } } diff --git a/crates/nu-explore/src/views/mod.rs b/crates/nu-explore/src/views/mod.rs index b87d243788..65d7df805e 100644 --- a/crates/nu-explore/src/views/mod.rs +++ b/crates/nu-explore/src/views/mod.rs @@ -1,7 +1,7 @@ mod coloredtextw; mod cursor; mod information; -mod interative; +mod interactive; mod preview; mod record; pub mod util; @@ -25,7 +25,7 @@ pub mod configuration; pub use configuration::ConfigurationView; pub use information::InformationView; -pub use interative::InteractiveView; +pub use interactive::InteractiveView; pub use preview::Preview; pub use record::{Orientation, RecordView}; diff --git a/crates/nu-explore/src/views/record/mod.rs b/crates/nu-explore/src/views/record/mod.rs index c552b1bc90..b7aa809bf8 100644 --- a/crates/nu-explore/src/views/record/mod.rs +++ b/crates/nu-explore/src/views/record/mod.rs @@ -74,7 +74,7 @@ impl<'a> RecordView<'a> { } pub fn show_cursor(&mut self, b: bool) { - self.theme.cursor.show_cursow = b; + self.theme.cursor.show_cursor = b; } pub fn set_line_head_top(&mut self, b: bool) { @@ -85,7 +85,7 @@ impl<'a> RecordView<'a> { self.theme.table.header_bottom = b; } - pub fn set_line_traling(&mut self, b: bool) { + pub fn set_line_trailing(&mut self, b: bool) { self.theme.table.shift_line = b; } @@ -636,7 +636,7 @@ fn highlight_cell(f: &mut Frame, area: Rect, info: ElementInfo, theme: &CursorSt f.render_widget(hightlight_block.clone(), area); } - if theme.show_cursow { + if theme.show_cursor { f.set_cursor(info.area.x, info.area.y); } } @@ -791,7 +791,7 @@ fn theme_from_config(config: &ConfigMap) -> TableTheme { theme.cursor.selected_cell = colors.get("selected_cell").cloned(); theme.cursor.selected_row = colors.get("selected_row").cloned(); theme.cursor.selected_column = colors.get("selected_column").cloned(); - theme.cursor.show_cursow = config_get_bool(config, "show_cursor", true); + theme.cursor.show_cursor = config_get_bool(config, "show_cursor", true); theme.table.header_top = config_get_bool(config, "line_head_top", true); theme.table.header_bottom = config_get_bool(config, "line_head_bottom", true); @@ -835,5 +835,5 @@ struct CursorStyle { selected_cell: Option, selected_column: Option, selected_row: Option, - show_cursow: bool, + show_cursor: bool, } diff --git a/crates/nu-explore/src/views/util.rs b/crates/nu-explore/src/views/util.rs index db92cab35c..82f4553b13 100644 --- a/crates/nu-explore/src/views/util.rs +++ b/crates/nu-explore/src/views/util.rs @@ -154,7 +154,7 @@ pub fn make_styled_string( } fn convert_with_precision(val: &str, precision: usize) -> Result { - // vall will always be a f64 so convert it with precision formatting + // val will always be a f64 so convert it with precision formatting let val_float = match val.trim().parse::() { Ok(f) => f, Err(e) => {