Add `commandline = false`

Hide commandline
pull/11223/head
Erasin 4 months ago
parent b927985cd0
commit 2ffb5eaf85

@ -43,6 +43,7 @@
| `undercurl` | Set to `true` to override automatic detection of terminal undercurl support in the event of a false negative | `false` | | `undercurl` | Set to `true` to override automatic detection of terminal undercurl support in the event of a false negative | `false` |
| `rulers` | List of column positions at which to display the rulers. Can be overridden by language specific `rulers` in `languages.toml` file | `[]` | | `rulers` | List of column positions at which to display the rulers. Can be overridden by language specific `rulers` in `languages.toml` file | `[]` |
| `bufferline` | Renders a line at the top of the editor displaying open buffers. Can be `always`, `never` or `multiple` (only shown if more than one buffer is in use) | `never` | | `bufferline` | Renders a line at the top of the editor displaying open buffers. Can be `always`, `never` or `multiple` (only shown if more than one buffer is in use) | `never` |
| `commandline` | CommandLine Display. | `true` |
| `color-modes` | Whether to color the mode indicator with different colors depending on the mode itself | `false` | | `color-modes` | Whether to color the mode indicator with different colors depending on the mode itself | `false` |
| `text-width` | Maximum line length. Used for the `:reflow` command and soft-wrapping if `soft-wrap.wrap-at-text-width` is set | `80` | | `text-width` | Maximum line length. Used for the `:reflow` command and soft-wrapping if `soft-wrap.wrap-at-text-width` is set | `80` |
| `workspace-lsp-roots` | Directories relative to the workspace root that are treated as LSP roots. Should only be set in `.helix/config.toml` | `[]` | | `workspace-lsp-roots` | Directories relative to the workspace root that are treated as LSP roots. Should only be set in `.helix/config.toml` | `[]` |

@ -233,7 +233,7 @@ impl EditorView {
let statusline_area = view let statusline_area = view
.area .area
.clip_top(view.area.height.saturating_sub(1)) .clip_top(view.area.height.saturating_sub(1))
.clip_bottom(1); // -1 from bottom to remove commandline .clip_bottom(config.commandline as u16); // -1 from bottom to remove commandline
let mut context = let mut context =
statusline::RenderContext::new(editor, doc, view, is_focused, &self.spinners); statusline::RenderContext::new(editor, doc, view, is_focused, &self.spinners);
@ -1481,11 +1481,13 @@ impl Component for EditorView {
_ => false, _ => false,
}; };
// -1 for commandline and -1 for bufferline let editor_area = if use_bufferline {
let mut editor_area = area.clip_bottom(1); // -1 for bufferline
if use_bufferline { area.clip_top(1)
editor_area = editor_area.clip_top(1); } else {
area
} }
.clip_bottom(config.commandline as u16); // -1 for commandline
// if the terminal size suddenly changed, we need to trigger a resize // if the terminal size suddenly changed, we need to trigger a resize
cx.editor.resize(editor_area); cx.editor.resize(editor_area);
@ -1509,6 +1511,9 @@ impl Component for EditorView {
let key_width = 15u16; // for showing pending keys let key_width = 15u16; // for showing pending keys
let mut status_msg_width = 0; let mut status_msg_width = 0;
// commandline
let commandline_msg_pos = if config.commandline { 1 } else { 2 };
// render status msg // render status msg
if let Some((status_msg, severity)) = &cx.editor.status_msg { if let Some((status_msg, severity)) = &cx.editor.status_msg {
status_msg_width = status_msg.width(); status_msg_width = status_msg.width();
@ -1521,7 +1526,7 @@ impl Component for EditorView {
surface.set_string( surface.set_string(
area.x, area.x,
area.y + area.height.saturating_sub(1), area.y + area.height.saturating_sub(commandline_msg_pos),
status_msg, status_msg,
style, style,
); );
@ -1546,7 +1551,7 @@ impl Component for EditorView {
}; };
surface.set_string( surface.set_string(
area.x + area.width.saturating_sub(key_width + macro_width), area.x + area.width.saturating_sub(key_width + macro_width),
area.y + area.height.saturating_sub(1), area.y + area.height.saturating_sub(commandline_msg_pos),
disp.get(disp.len().saturating_sub(key_width as usize)..) disp.get(disp.len().saturating_sub(key_width as usize)..)
.unwrap_or(&disp), .unwrap_or(&disp),
style, style,
@ -1558,7 +1563,7 @@ impl Component for EditorView {
.add_modifier(Modifier::BOLD); .add_modifier(Modifier::BOLD);
surface.set_string( surface.set_string(
area.x + area.width.saturating_sub(3), area.x + area.width.saturating_sub(3),
area.y + area.height.saturating_sub(1), area.y + area.height.saturating_sub(commandline_msg_pos),
&disp, &disp,
style, style,
); );

@ -138,6 +138,8 @@ pub fn raw_regex_prompt(
doc.set_selection(view.id, snapshot.clone()); doc.set_selection(view.id, snapshot.clone());
view.offset = offset_snapshot; view.offset = offset_snapshot;
let commandline = config.commandline as usize;
if event == PromptEvent::Validate { if event == PromptEvent::Validate {
let callback = async move { let callback = async move {
let call: job::Callback = Callback::EditorCompositor(Box::new( let call: job::Callback = Callback::EditorCompositor(Box::new(
@ -146,7 +148,7 @@ pub fn raw_regex_prompt(
let size = compositor.size(); let size = compositor.size();
let popup = Popup::new("invalid-regex", contents) let popup = Popup::new("invalid-regex", contents)
.position(Some(helix_core::Position::new( .position(Some(helix_core::Position::new(
size.height as usize - 2, // 2 = statusline + commandline size.height as usize - 1 - commandline, // = statusline + commandline
0, 0,
))) )))
.auto_close(true); .auto_close(true);

@ -320,6 +320,8 @@ pub struct Config {
pub whitespace: WhitespaceConfig, pub whitespace: WhitespaceConfig,
/// Persistently display open buffers along the top /// Persistently display open buffers along the top
pub bufferline: BufferLine, pub bufferline: BufferLine,
/// Commandline display, Default true.
pub commandline: bool,
/// Vertical indent width guides. /// Vertical indent width guides.
pub indent_guides: IndentGuidesConfig, pub indent_guides: IndentGuidesConfig,
/// Whether to color modes with different colors. Defaults to `false`. /// Whether to color modes with different colors. Defaults to `false`.
@ -964,6 +966,7 @@ impl Default for Config {
rulers: Vec::new(), rulers: Vec::new(),
whitespace: WhitespaceConfig::default(), whitespace: WhitespaceConfig::default(),
bufferline: BufferLine::default(), bufferline: BufferLine::default(),
commandline: true,
indent_guides: IndentGuidesConfig::default(), indent_guides: IndentGuidesConfig::default(),
color_modes: false, color_modes: false,
soft_wrap: SoftWrap { soft_wrap: SoftWrap {
@ -1157,7 +1160,7 @@ impl Editor {
let auto_pairs = (&conf.auto_pairs).into(); let auto_pairs = (&conf.auto_pairs).into();
// HAXX: offset the render area height by 1 to account for prompt/commandline // HAXX: offset the render area height by 1 to account for prompt/commandline
area.height -= 1; area.height -= conf.commandline as u16;
Self { Self {
mode: Mode::Normal, mode: Mode::Normal,

Loading…
Cancel
Save