summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2019-05-31 16:20:27 -0400
committerJiayi Zhao <jeff.no.zhao@gmail.com>2019-05-31 16:20:27 -0400
commit281249d5d78a88681f24182d34065cad565d5d82 (patch)
tree7de1a55cea58074b22c5175a6c85d3cce79f212e /src
parentf741728044c6e4f06481b74821f125553a92dd8d (diff)
cargo fmt
Diffstat (limited to 'src')
-rw-r--r--src/config/keymap.rs20
-rw-r--r--src/main.rs3
-rw-r--r--src/run.rs2
-rw-r--r--src/textfield.rs2
4 files changed, 16 insertions, 11 deletions
diff --git a/src/config/keymap.rs b/src/config/keymap.rs
index f5c8eb1..2f834d1 100644
--- a/src/config/keymap.rs
+++ b/src/config/keymap.rs
@@ -79,12 +79,12 @@ pub struct JoshutoKeyMapping {
pub home: i32,
#[serde(default = "default_end")]
pub end: i32,
-/*
- #[serde(default = "default_up")]
- pub page_up: i32,
- #[serde(default = "default_up")]
- pub page_down: i32,
-*/
+ /*
+ #[serde(default = "default_up")]
+ pub page_up: i32,
+ #[serde(default = "default_up")]
+ pub page_down: i32,
+ */
#[serde(default = "default_backspace")]
pub backspace: i32,
#[serde(default = "default_delete")]
@@ -167,7 +167,11 @@ impl ConfigStructure for JoshutoCommandMapping {
}
}
-fn insert_keycommand(map: &mut JoshutoCommandMapping, keycommand: Box<JoshutoCommand>, keys: &[i32]) {
+fn insert_keycommand(
+ map: &mut JoshutoCommandMapping,
+ keycommand: Box<JoshutoCommand>,
+ keys: &[i32],
+) {
match keys.len() {
0 => {}
1 => match map.entry(keys[0]) {
@@ -190,7 +194,7 @@ fn insert_keycommand(map: &mut JoshutoCommandMapping, keycommand: Box<JoshutoCom
}
},
Entry::Vacant(entry) => {
- let mut new_map = HashMap::new();
+ let mut new_map = JoshutoCommandMapping::new();
insert_keycommand(&mut new_map, keycommand, &keys[1..]);
let composite_command = CommandKeybind::CompositeKeybind(new_map);
entry.insert(composite_command);
diff --git a/src/main.rs b/src/main.rs
index 5d6435f..edfa4ee 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -18,7 +18,8 @@ use std::path::PathBuf;
use structopt::StructOpt;
use config::{
- ConfigStructure, JoshutoConfig, JoshutoCommandMapping, JoshutoKeyMapping, JoshutoMimetype, JoshutoPreview, JoshutoTheme,
+ ConfigStructure, JoshutoCommandMapping, JoshutoConfig, JoshutoKeyMapping, JoshutoMimetype,
+ JoshutoPreview, JoshutoTheme,
};
use run::run;
diff --git a/src/run.rs b/src/run.rs
index 33f069a..299c96c 100644
--- a/src/run.rs
+++ b/src/run.rs
@@ -2,7 +2,7 @@ use std::process;
use std::time;
use crate::commands::{CommandKeybind, FileOperationThread, JoshutoCommand, ReloadDirList};
-use crate::config::{self, JoshutoConfig, JoshutoCommandMapping};
+use crate::config::{self, JoshutoCommandMapping, JoshutoConfig};
use crate::context::JoshutoContext;
use crate::error::JoshutoError;
use crate::tab::JoshutoTab;
diff --git a/src/textfield.rs b/src/textfield.rs
index 61e006f..d074b0c 100644
--- a/src/textfield.rs
+++ b/src/textfield.rs
@@ -1,5 +1,5 @@
-use crate::KEYMAP_T;
use crate::window;
+use crate::KEYMAP_T;
use rustyline::completion::{Candidate, Completer, FilenameCompleter, Pair};
use rustyline::line_buffer;