mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 01:18:21 +00:00
parent
aefc18d819
commit
d4d6fd28eb
4 changed files with 37 additions and 1 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -786,6 +786,7 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"simplelog",
|
"simplelog",
|
||||||
"syntect",
|
"syntect",
|
||||||
|
"tempfile",
|
||||||
"textwrap",
|
"textwrap",
|
||||||
"tui",
|
"tui",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ pprof = { version = "0.11", features = ["flamegraph"], optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pretty_assertions = "1.3"
|
pretty_assertions = "1.3"
|
||||||
|
tempfile = "3.2"
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
maintenance = { status = "actively-developed" }
|
maintenance = { status = "actively-developed" }
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ impl StatusTreeComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a Vec<TextDrawInfo> which is used to draw the `FileTreeComponent` correctly,
|
/// Returns a `Vec<TextDrawInfo>` which is used to draw the `FileTreeComponent` correctly,
|
||||||
/// allowing folders to be folded up if they are alone in their directory
|
/// allowing folders to be folded up if they are alone in their directory
|
||||||
fn build_vec_text_draw_info_for_drawing(
|
fn build_vec_text_draw_info_for_drawing(
|
||||||
&self,
|
&self,
|
||||||
|
|
|
||||||
|
|
@ -210,3 +210,37 @@ impl KeysList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
use std::io::Write;
|
||||||
|
use tempfile::NamedTempFile;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_smoke() {
|
||||||
|
let mut file = NamedTempFile::new().unwrap();
|
||||||
|
|
||||||
|
writeln!(
|
||||||
|
file,
|
||||||
|
r"
|
||||||
|
(
|
||||||
|
move_down: Some(( code: Char('j'), modifiers: ( bits: 2,),)),
|
||||||
|
)
|
||||||
|
"
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let keys = KeysList::init(file.path().to_path_buf());
|
||||||
|
|
||||||
|
assert_eq!(keys.move_right, KeysList::default().move_right);
|
||||||
|
assert_eq!(
|
||||||
|
keys.move_down,
|
||||||
|
GituiKeyEvent::new(
|
||||||
|
KeyCode::Char('j'),
|
||||||
|
KeyModifiers::CONTROL
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue