Skip to content

Commit

Permalink
minor: Setup default keymap directly in xtask docgen
Browse files Browse the repository at this point in the history
Instantiating EditorView is a lot of machinery which is unnecessary:
the default keymap is exposed through the `default` function in the
keymap module.
  • Loading branch information
the-mikedavis committed Dec 29, 2024
1 parent 127567d commit 073efe4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
6 changes: 0 additions & 6 deletions helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ pub enum InsertEvent {
RequestCompletion,
}

impl Default for EditorView {
fn default() -> Self {
Self::new(Keymaps::default())
}
}

impl EditorView {
pub fn new(keymaps: Keymaps) -> Self {
Self {
Expand Down
3 changes: 1 addition & 2 deletions xtask/src/docgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::DynError;
use helix_term::commands::MappableCommand;
use helix_term::commands::TYPABLE_COMMAND_LIST;
use helix_term::health::TsFeature;
use helix_term::ui::EditorView;
use helix_view::document::Mode;

use std::collections::HashSet;
Expand Down Expand Up @@ -56,7 +55,7 @@ pub fn typable_commands() -> Result<String, DynError> {

pub fn static_commands() -> Result<String, DynError> {
let mut md = String::new();
let keymap = EditorView::default().keymaps.map();
let keymap = helix_term::keymap::default();
let keymaps = [
("normal", keymap[&Mode::Normal].reverse_map()),
("select", keymap[&Mode::Select].reverse_map()),
Expand Down

0 comments on commit 073efe4

Please sign in to comment.