diff options
| author | Daniel Jankowski <daniel.jankowski@rub.de> | 2024-05-25 17:05:00 +0200 |
|---|---|---|
| committer | Daniel Jankowski <daniel.jankowski@rub.de> | 2024-05-25 17:10:38 +0200 |
| commit | 87aebe8bb48d9b5af8e784cc568247838c09cc49 (patch) | |
| tree | b7b10408bfcf4198412b222f8c720fe4479c60e2 /src | |
| parent | chore: update flake deps (diff) | |
| download | sl0pstatus-87aebe8bb48d9b5af8e784cc568247838c09cc49.tar.gz sl0pstatus-87aebe8bb48d9b5af8e784cc568247838c09cc49.tar.xz sl0pstatus-87aebe8bb48d9b5af8e784cc568247838c09cc49.zip | |
fix: mouse clicks with hidden parts
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/config.rs b/src/config.rs index 2a8ca81..9c7cbd5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -167,14 +167,6 @@ impl ModuleConfig { ) }); - let mut offset = console::measure_text_width(&output_left); - - self.process_widget_click(click_pos, &self.left_parts, &widget_map, &state, 0); - - if click_pos <= offset { - return; - } - let output_center = self .center_parts .iter_mut() @@ -197,6 +189,17 @@ impl ModuleConfig { ) }); + let (output_left, output_center, output_right) = + self.trim_output(&output_left, &output_center, &output_right, state.cols); + + let mut offset = console::measure_text_width(&output_left); + + self.process_widget_click(click_pos, &self.left_parts, &widget_map, &state, 0); + + if click_pos <= offset { + return; + } + if !output_center.is_empty() { offset += console::measure_text_width(&self.get_spacer_left( &output_left, |
