mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +00:00
updates and fixes
This commit is contained in:
parent
0383f9517b
commit
61ee3fd695
6 changed files with 17 additions and 18 deletions
|
|
@ -125,15 +125,15 @@ pub struct Environment {
|
||||||
|
|
||||||
/// The need to construct a "whatever" environment only arises in testing right now
|
/// The need to construct a "whatever" environment only arises in testing right now
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
impl Default for Environment {
|
impl Environment {
|
||||||
fn default() -> Self {
|
pub fn test_env() -> Self {
|
||||||
use crossbeam_channel::unbounded;
|
use crossbeam_channel::unbounded;
|
||||||
Self {
|
Self {
|
||||||
queue: Queue::new(),
|
queue: Queue::new(),
|
||||||
theme: Default::default(),
|
theme: Default::default(),
|
||||||
key_config: Default::default(),
|
key_config: Default::default(),
|
||||||
repo: RefCell::new(RepoPath::Path(Default::default())),
|
repo: RefCell::new(RepoPath::Path(Default::default())),
|
||||||
options: Default::default(),
|
options: Rc::new(RefCell::new(Options::test_env())),
|
||||||
sender_git: unbounded().0,
|
sender_git: unbounded().0,
|
||||||
sender_app: unbounded().0,
|
sender_app: unbounded().0,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,6 @@ pub struct ChangesComponent {
|
||||||
|
|
||||||
impl ChangesComponent {
|
impl ChangesComponent {
|
||||||
///
|
///
|
||||||
//TODO: fix
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
env: &Environment,
|
env: &Environment,
|
||||||
title: &str,
|
title: &str,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ use super::{
|
||||||
EventState, ExternalEditorComponent,
|
EventState, ExternalEditorComponent,
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
|
app::Environment,
|
||||||
keys::{key_match, SharedKeyConfig},
|
keys::{key_match, SharedKeyConfig},
|
||||||
options::SharedOptions,
|
options::SharedOptions,
|
||||||
queue::{InternalEvent, NeedsUpdate, Queue},
|
queue::{InternalEvent, NeedsUpdate, Queue},
|
||||||
|
|
@ -65,7 +66,7 @@ const FIRST_LINE_LIMIT: usize = 50;
|
||||||
|
|
||||||
impl CommitComponent {
|
impl CommitComponent {
|
||||||
///
|
///
|
||||||
pub fn new(env: &crate::app::Environment) -> Self {
|
pub fn new(env: &Environment) -> Self {
|
||||||
Self {
|
Self {
|
||||||
queue: env.queue.clone(),
|
queue: env.queue.clone(),
|
||||||
mode: Mode::Normal,
|
mode: Mode::Normal,
|
||||||
|
|
|
||||||
|
|
@ -590,7 +590,7 @@ mod tests {
|
||||||
|
|
||||||
// set up file tree
|
// set up file tree
|
||||||
let mut ftc = StatusTreeComponent::new(
|
let mut ftc = StatusTreeComponent::new(
|
||||||
&Default::default(),
|
&Environment::test_env(),
|
||||||
"title",
|
"title",
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
@ -630,7 +630,7 @@ mod tests {
|
||||||
|
|
||||||
// set up file tree
|
// set up file tree
|
||||||
let mut ftc = StatusTreeComponent::new(
|
let mut ftc = StatusTreeComponent::new(
|
||||||
&Default::default(),
|
&Environment::test_env(),
|
||||||
"title",
|
"title",
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -555,7 +555,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_smoke() {
|
fn test_smoke() {
|
||||||
let mut comp = TextInputComponent::new(
|
let mut comp = TextInputComponent::new(
|
||||||
&Environment::default(),
|
&Environment::test_env(),
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
|
@ -575,7 +575,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn text_cursor_initial_position() {
|
fn text_cursor_initial_position() {
|
||||||
let mut comp = TextInputComponent::new(
|
let mut comp = TextInputComponent::new(
|
||||||
&Environment::default(),
|
&Environment::test_env(),
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
|
@ -600,7 +600,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cursor_second_position() {
|
fn test_cursor_second_position() {
|
||||||
let mut comp = TextInputComponent::new(
|
let mut comp = TextInputComponent::new(
|
||||||
&Environment::default(),
|
&Environment::test_env(),
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
|
@ -636,7 +636,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_visualize_newline() {
|
fn test_visualize_newline() {
|
||||||
let mut comp = TextInputComponent::new(
|
let mut comp = TextInputComponent::new(
|
||||||
&Environment::default(),
|
&Environment::test_env(),
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
|
@ -671,7 +671,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_invisible_newline() {
|
fn test_invisible_newline() {
|
||||||
let mut comp = TextInputComponent::new(
|
let mut comp = TextInputComponent::new(
|
||||||
&Environment::default(),
|
&Environment::test_env(),
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
|
@ -701,7 +701,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_next_word_position() {
|
fn test_next_word_position() {
|
||||||
let mut comp = TextInputComponent::new(
|
let mut comp = TextInputComponent::new(
|
||||||
&Environment::default(),
|
&Environment::test_env(),
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
|
@ -725,7 +725,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_previous_word_position() {
|
fn test_previous_word_position() {
|
||||||
let mut comp = TextInputComponent::new(
|
let mut comp = TextInputComponent::new(
|
||||||
&Environment::default(),
|
&Environment::test_env(),
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
|
@ -752,7 +752,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_next_word_multibyte() {
|
fn test_next_word_multibyte() {
|
||||||
let mut comp = TextInputComponent::new(
|
let mut comp = TextInputComponent::new(
|
||||||
&Environment::default(),
|
&Environment::test_env(),
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ pub struct Options {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
impl Default for Options {
|
impl Options {
|
||||||
fn default() -> Self {
|
pub fn test_env() -> Self {
|
||||||
use asyncgit::sync::RepoPath;
|
use asyncgit::sync::RepoPath;
|
||||||
Self {
|
Self {
|
||||||
repo: RefCell::new(RepoPath::Path(Default::default())),
|
repo: RefCell::new(RepoPath::Path(Default::default())),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue