From 0a27e553ebd2391a13d52cd6cbbf6f7f683d622b Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Thu, 16 Sep 2021 13:13:28 +0900 Subject: [PATCH] change left_chunk_percentage to left_main_chunk_percentage --- src/app.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/app.rs b/src/app.rs index c7c21a5..cfb5031 100644 --- a/src/app.rs +++ b/src/app.rs @@ -34,7 +34,7 @@ pub struct App { databases: DatabasesComponent, connections: ConnectionsComponent, pool: Option>, - left_chunk_percentage: u16, + left_main_chunk_percentage: u16, pub config: Config, pub error: ErrorComponent, } @@ -55,7 +55,7 @@ impl App { error: ErrorComponent::new(config.key_config), focus: Focus::ConnectionList, pool: None, - left_chunk_percentage: 15, + left_main_chunk_percentage: 15, } } @@ -76,8 +76,8 @@ impl App { let main_chunks = Layout::default() .direction(Direction::Horizontal) .constraints([ - Constraint::Percentage(self.left_chunk_percentage), - Constraint::Percentage((100_u16).saturating_sub(self.left_chunk_percentage)), + Constraint::Percentage(self.left_main_chunk_percentage), + Constraint::Percentage((100_u16).saturating_sub(self.left_main_chunk_percentage)), ]) .split(f.size()); @@ -455,7 +455,8 @@ impl App { .key_config .extend_or_shorten_widget_width_to_left { - self.left_chunk_percentage = self.left_chunk_percentage.saturating_sub(5).max(15); + self.left_main_chunk_percentage = + self.left_main_chunk_percentage.saturating_sub(5).max(15); return Ok(EventState::Consumed); } else if key == self @@ -463,7 +464,7 @@ impl App { .key_config .extend_or_shorten_widget_width_to_right { - self.left_chunk_percentage = (self.left_chunk_percentage + 5).min(70); + self.left_main_chunk_percentage = (self.left_main_chunk_percentage + 5).min(70); return Ok(EventState::Consumed); } Ok(EventState::NotConsumed) @@ -512,26 +513,26 @@ mod test { app.extend_or_shorten_widget_width(Key::Char('>')).unwrap(), EventState::Consumed ); - assert_eq!(app.left_chunk_percentage, 20); + assert_eq!(app.left_main_chunk_percentage, 20); - app.left_chunk_percentage = 70; + app.left_main_chunk_percentage = 70; assert_eq!( app.extend_or_shorten_widget_width(Key::Char('>')).unwrap(), EventState::Consumed ); - assert_eq!(app.left_chunk_percentage, 70); + assert_eq!(app.left_main_chunk_percentage, 70); assert_eq!( app.extend_or_shorten_widget_width(Key::Char('<')).unwrap(), EventState::Consumed ); - assert_eq!(app.left_chunk_percentage, 65); + assert_eq!(app.left_main_chunk_percentage, 65); - app.left_chunk_percentage = 15; + app.left_main_chunk_percentage = 15; assert_eq!( app.extend_or_shorten_widget_width(Key::Char('<')).unwrap(), EventState::Consumed ); - assert_eq!(app.left_chunk_percentage, 15); + assert_eq!(app.left_main_chunk_percentage, 15); } }