Debian Codegraph @

src/canvas.rs

raw symbols SCIP
1 //! Code related to drawing.
2 //!
3 //! Note that eventually this should not contain any widget-specific draw code,
4 //! but rather just generic code or components.
5
6 pub mod componentsrust-analyzer cargo bottom 0.14.9 canvas/components/;
7 pub mod dialogsrust-analyzer cargo bottom 0.14.9 canvas/dialogs/;
8 mod drawing_utilsrust-analyzer cargo bottom 0.14.9 canvas/drawing_utils/;
9 mod widgetsrust-analyzer cargo bottom 0.14.9 canvas/widgets/;
10
11 use ratatuirust-analyzer cargo ratatui 0.30.2 crate/::{
12 Framerust-analyzer cargo ratatui-core 0.1.2 terminal/frame/Frame#, Terminalrust-analyzer cargo ratatui-core 0.1.2 terminal/Terminal#,
13 backendrust-analyzer cargo ratatui 0.30.2 backend/::Backendrust-analyzer cargo ratatui-core 0.1.2 backend/Backend#,
14 layoutrust-analyzer cargo ratatui-core 0.1.2 layout/::{Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#, Directionrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#, Flexrust-analyzer cargo ratatui-core 0.1.2 layout/flex/Flex#, Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#, Positionrust-analyzer cargo ratatui-core 0.1.2 layout/position/Position#, Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#},
15 stylerust-analyzer cargo ratatui-core 0.1.2 style/::Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#,
16 symbolsrust-analyzer cargo ratatui-core 0.1.2 symbols/::Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#,
17 textrust-analyzer cargo ratatui-core 0.1.2 text/::Spanrust-analyzer cargo ratatui-core 0.1.2 text/span/Span#,
18 widgetsrust-analyzer cargo ratatui 0.30.2 widgets/::Paragraphrust-analyzer cargo ratatui-widgets 0.3.2 paragraph/Paragraph#,
19 };
20
21 use craterust-analyzer cargo bottom 0.14.9 crate/::{
22 apprust-analyzer cargo bottom 0.14.9 app/::{
23 Apprust-analyzer cargo bottom 0.14.9 app/App#,
24 layout_managerrust-analyzer cargo bottom 0.14.9 app/layout_manager/::{BottomColRowrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomColRow#, BottomLayoutrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomLayout#, BottomWidgetTyperust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#},
25 },
26 constantsrust-analyzer cargo bottom 0.14.9 constants/::*,
27 optionsrust-analyzer cargo bottom 0.14.9 options/::configrust-analyzer cargo bottom 0.14.9 options/config/::stylerust-analyzer cargo bottom 0.14.9 options/config/style/::Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#,
28 };
29
30 /// Handles the canvas' state.
31 pub struct Painterrust-analyzer cargo bottom 0.14.9 canvas/Painter# {
32 pub stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles.: Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#,
33
34 /// Used to know whether to invalidate things.
35 previous_heightrust-analyzer cargo bottom 0.14.9 canvas/Painter#previous_height.: u16,
36
37 /// Used to know whether to invalidate things.
38 previous_widthrust-analyzer cargo bottom 0.14.9 canvas/Painter#previous_width.: u16,
39
40 /// The layout.
41 layoutrust-analyzer cargo bottom 0.14.9 canvas/Painter#layout.: BottomLayoutrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomLayout#,
42 }
43
44 impl Painterrust-analyzer cargo bottom 0.14.9 canvas/Painter# {
45 pub fn initrust-analyzer cargo bottom 0.14.9 canvas/impl#[Painter]init().(layout: BottomLayoutrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomLayout#, styling: Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#) -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<Selfrust-analyzer cargo bottom 0.14.9 canvas/impl#[Painter]> {
46 let painter = Painterrust-analyzer cargo bottom 0.14.9 canvas/Painter# {
47 stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles.: styling,
48 previous_heightrust-analyzer cargo bottom 0.14.9 canvas/Painter#previous_height.: 0,
49 previous_widthrust-analyzer cargo bottom 0.14.9 canvas/Painter#previous_width.: 0,
50 layoutrust-analyzer cargo bottom 0.14.9 canvas/Painter#layout.,
51 };
52
53 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(painter)
54 }
55
56 /// Determines the border style.
57 pub fn get_border_stylerust-analyzer cargo bottom 0.14.9 canvas/impl#[Painter]get_border_style().(&self, widget_id: u64, selected_widget_id: u64) -> Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style# {
58 let is_on_widget = widget_id rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().selected_widget_id;
59 if is_on_widget {
60 self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..highlighted_border_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#highlighted_border_style.
61 } else {
62 self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..border_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#border_style.
63 }
64 }
65
66 pub(craterust-analyzer cargo bottom 0.14.9 crate/) fn get_markerrust-analyzer cargo bottom 0.14.9 canvas/impl#[Painter]get_marker().(&self, use_dot: bool) -> Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker# {
67 if use_dot {
68 Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#::Dotrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#Dot#
69 } else {
70 Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#::Braillerust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#Braille#
71 }
72 }
73
74 fn draw_frozen_indicatorrust-analyzer cargo bottom 0.14.9 canvas/impl#[Painter]draw_frozen_indicator().(&self, f: &mut Framerust-analyzer cargo ratatui-core 0.1.2 terminal/frame/Frame#<'_>, draw_loc: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#) {
75 f.render_widgetrust-analyzer cargo ratatui-core 0.1.2 terminal/frame/impl#[`Frame<'_>`]render_widget().(
76 Paragraphrust-analyzer cargo ratatui-widgets 0.3.2 paragraph/Paragraph#::newrust-analyzer cargo ratatui-widgets 0.3.2 paragraph/impl#[`Paragraph<'a>`]new().(Spanrust-analyzer cargo ratatui-core 0.1.2 text/span/Span#::styledrust-analyzer cargo ratatui-core 0.1.2 text/span/impl#[`Span<'a>`]styled().(
77 "Frozen, press 'f' to unfreeze",
78 self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..selected_text_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#selected_text_style.,
79 )),
80 Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::defaultrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout][Default]default().()
81 .horizontal_marginrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]horizontal_margin().(1)
82 .constraintsrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]constraints().([Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(1)])
83 .splitrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]split().(draw_loc)[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().,
84 )
85 }
86
87 pub fn draw_datarust-analyzer cargo bottom 0.14.9 canvas/impl#[Painter]draw_data().<B: Backendrust-analyzer cargo ratatui-core 0.1.2 backend/Backend#>(
88 &mut self, terminal: &mut Terminalrust-analyzer cargo ratatui-core 0.1.2 terminal/Terminal#<B>, app_state: &mut Apprust-analyzer cargo bottom 0.14.9 app/App#,
89 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), B::Errorrust-analyzer cargo ratatui-core 0.1.2 backend/Backend#Error#> {
90 use BottomWidgetTyperust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#::*;
91
92 terminal.drawrust-analyzer cargo ratatui-core 0.1.2 terminal/render/impl#[`Terminal<B>`]draw().(|f| {
93 let (terminal_size, frozen_draw_loc) = if app_state.data_storerust-analyzer cargo bottom 0.14.9 app/App#data_store..is_frozenrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[DataStore]is_frozen().() {
94 // TODO: Remove built-in cache?
95 let split_loc = Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::defaultrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout][Default]default().()
96 .constraintsrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]constraints().([Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Minrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Min#(0), Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(1)])
97 .splitrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]split().(f.arearust-analyzer cargo ratatui-core 0.1.2 terminal/frame/impl#[`Frame<'_>`]area().());
98 (split_loc[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(split_loc[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().))
99 } else {
100 (f.arearust-analyzer cargo ratatui-core 0.1.2 terminal/frame/impl#[`Frame<'_>`]area().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)
101 };
102 let terminal_height = terminal_size.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height.;
103 let terminal_width = terminal_size.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width.;
104
105 if (self.previous_heightrust-analyzer cargo bottom 0.14.9 canvas/Painter#previous_height. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().0 && self.previous_widthrust-analyzer cargo bottom 0.14.9 canvas/Painter#previous_width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().0)
106 || (self.previous_heightrust-analyzer cargo bottom 0.14.9 canvas/Painter#previous_height. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().terminal_height
107 || self.previous_widthrust-analyzer cargo bottom 0.14.9 canvas/Painter#previous_width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().terminal_width)
108 {
109 app_state.is_force_redrawrust-analyzer cargo bottom 0.14.9 app/App#is_force_redraw. = true;
110 self.previous_heightrust-analyzer cargo bottom 0.14.9 canvas/Painter#previous_height. = terminal_height;
111 self.previous_widthrust-analyzer cargo bottom 0.14.9 canvas/Painter#previous_width. = terminal_width;
112 }
113
114 // TODO: We should probably remove this or make it done elsewhere, not the
115 // responsibility of the app.
116 if app_state.should_get_widget_boundsrust-analyzer cargo bottom 0.14.9 app/impl#[App]should_get_widget_bounds().() {
117 // If we're force drawing, reset ALL mouse boundaries.
118 for widget in app_state.widget_maprust-analyzer cargo bottom 0.14.9 app/App#widget_map..values_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]values_mut().() {
119 widget.top_left_cornerrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#top_left_corner. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
120 widget.bottom_right_cornerrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#bottom_right_corner. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
121 }
122
123 // Reset process kill dialog button locations...
124 app_state.process_kill_dialogrust-analyzer cargo bottom 0.14.9 app/App#process_kill_dialog..handle_redrawrust-analyzer cargo bottom 0.14.9 canvas/dialogs/process_kill_dialog/impl#[ProcessKillDialog]handle_redraw().();
125
126 // Reset battery dialog button locations...
127 for battery_widget in app_state.statesrust-analyzer cargo bottom 0.14.9 app/App#states..battery_staterust-analyzer cargo bottom 0.14.9 app/states/AppWidgetStates#battery_state..widget_statesrust-analyzer cargo bottom 0.14.9 app/states/AppBatteryState#widget_states..values_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]values_mut().() {
128 battery_widget.tab_click_locsrust-analyzer cargo bottom 0.14.9 widgets/battery_info/BatteryWidgetState#tab_click_locs. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
129 }
130 }
131
132 // TODO: Make drawing dialog generic.
133 if app_state.help_dialog_staterust-analyzer cargo bottom 0.14.9 app/App#help_dialog_state..is_showing_helprust-analyzer cargo bottom 0.14.9 app/states/AppHelpDialogState#is_showing_help. {
134 let area = f.arearust-analyzer cargo ratatui-core 0.1.2 terminal/frame/impl#[`Frame<'_>`]area().();
135 f.buffer_mutrust-analyzer cargo ratatui-core 0.1.2 terminal/frame/impl#[`Frame<'_>`]buffer_mut().()
136 .set_stylerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_style().(area, self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..general_widget_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#general_widget_style.);
137
138 let gen_help_len = GENERAL_HELP_TEXTrust-analyzer cargo bottom 0.14.9 constants/GENERAL_HELP_TEXT..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() as u16 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().3;
139 let border_len = terminal_height.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(gen_help_len) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div().2;
140 let [_, vertical_dialog_chunk, _] = Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::defaultrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout][Default]default().()
141 .directionrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]direction().(Directionrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#::Verticalrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#Vertical#)
142 .constraintsrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]constraints().([
143 Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(border_len),
144 Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(gen_help_len),
145 Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(border_len),
146 ])
147 .areasrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]areas().(terminal_size);
148
149 // An approximate proxy for the max line length to use.
150 const MAX_TEXT_LENGTHrust-analyzer cargo bottom 0.14.9 canvas/MAX_TEXT_LENGTH.: u16 = const {
151 let mut max = 0;
152
153 let mut i = 0;
154 while i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().HELP_TEXTrust-analyzer cargo bottom 0.14.9 constants/HELP_TEXT..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() {
155 let section = HELP_TEXTrust-analyzer cargo bottom 0.14.9 constants/HELP_TEXT.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().;
156 let mut j = 0;
157 while j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().section.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() {
158 let line = section[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().j]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
159 if line.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().max {
160 max = line.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().();
161 }
162
163 j rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
164 }
165
166 i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
167 }
168
169 max as u16
170 };
171
172 let dialog_width = vertical_dialog_chunk.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width.;
173 let [middle_dialog_chunk] = if dialog_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().MAX_TEXT_LENGTHrust-analyzer cargo bottom 0.14.9 canvas/MAX_TEXT_LENGTH. {
174 Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::defaultrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout][Default]default().()
175 .directionrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]direction().(Directionrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#::Horizontalrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#Horizontal#)
176 .constraintsrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]constraints().([Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100)])
177 .areasrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]areas().(vertical_dialog_chunk)
178 } else {
179 // We calculate this so that the margins never have to split an odd number.
180 let len = if (dialog_width.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(MAX_TEXT_LENGTHrust-analyzer cargo bottom 0.14.9 canvas/MAX_TEXT_LENGTH.)) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Rem<Self>`]rem().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().0 {
181 MAX_TEXT_LENGTHrust-analyzer cargo bottom 0.14.9 canvas/MAX_TEXT_LENGTH.
182 } else {
183 // It can only be 1 if the difference is greater than 1, so this is fine.
184 MAX_TEXT_LENGTHrust-analyzer cargo bottom 0.14.9 canvas/MAX_TEXT_LENGTH. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().1
185 };
186
187 Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::defaultrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout][Default]default().()
188 .directionrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]direction().(Directionrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#::Horizontalrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#Horizontal#)
189 .constraintsrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]constraints().([Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(len)])
190 .flexrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]flex().(Flexrust-analyzer cargo ratatui-core 0.1.2 layout/flex/Flex#::SpaceAroundrust-analyzer cargo ratatui-core 0.1.2 layout/flex/Flex#SpaceAround#)
191 .areasrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]areas().(vertical_dialog_chunk)
192 };
193
194 self.draw_help_dialogrust-analyzer cargo bottom 0.14.9 canvas/dialogs/help_dialog/impl#[Painter]draw_help_dialog().(f, app_state, middle_dialog_chunk);
195 } else if app_state.process_kill_dialogrust-analyzer cargo bottom 0.14.9 app/App#process_kill_dialog..is_openrust-analyzer cargo bottom 0.14.9 canvas/dialogs/process_kill_dialog/impl#[ProcessKillDialog]is_open().() {
196 let area = f.arearust-analyzer cargo ratatui-core 0.1.2 terminal/frame/impl#[`Frame<'_>`]area().();
197 f.buffer_mutrust-analyzer cargo ratatui-core 0.1.2 terminal/frame/impl#[`Frame<'_>`]buffer_mut().()
198 .set_stylerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_style().(area, self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..general_widget_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#general_widget_style.);
199
200 // FIXME: For width, just limit to a max size or full width. For height, not
201 // sure. Maybe pass max and let child handle?
202 let horizontal_padding = if terminal_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().100 { 0 } else { 5 };
203 let vertical_padding = if terminal_height rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().100 { 0 } else { 5 };
204
205 let vertical_dialog_chunk = Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::defaultrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout][Default]default().()
206 .directionrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]direction().(Directionrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#::Verticalrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#Vertical#)
207 .constraintsrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]constraints().([
208 Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(vertical_padding),
209 Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Fillrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Fill#(1),
210 Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(vertical_padding),
211 ])
212 .areasrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]areas().::<3>(terminal_size)[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().;
213
214 let dialog_draw_area = Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::defaultrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout][Default]default().()
215 .directionrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]direction().(Directionrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#::Horizontalrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#Horizontal#)
216 .constraintsrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]constraints().([
217 Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(horizontal_padding),
218 Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Fillrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Fill#(1),
219 Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(horizontal_padding),
220 ])
221 .areasrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]areas().::<3>(vertical_dialog_chunk)[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().;
222
223 app_state
224 .process_kill_dialogrust-analyzer cargo bottom 0.14.9 app/App#process_kill_dialog.
225 .drawrust-analyzer cargo bottom 0.14.9 canvas/dialogs/process_kill_dialog/impl#[ProcessKillDialog]draw().(f, dialog_draw_area, &self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles.);
226 } else if app_state.is_expandedrust-analyzer cargo bottom 0.14.9 app/App#is_expanded. {
227 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(frozen_draw_loc) = frozen_draw_loc {
228 self.draw_frozen_indicatorrust-analyzer cargo bottom 0.14.9 canvas/impl#[Painter]draw_frozen_indicator().(f, frozen_draw_loc);
229 }
230
231 let rect = Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::defaultrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout][Default]default().()
232 .marginrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]margin().(0)
233 .constraintsrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]constraints().([Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100)])
234 .splitrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]split().(terminal_size);
235 match &app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_typerust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_type. {
236 Cpurust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Cpu# => self.draw_cpurust-analyzer cargo bottom 0.14.9 canvas/widgets/cpu_graph/impl#[Painter]draw_cpu().(f, app_state, rect[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.),
237 CpuLegendrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#CpuLegend# => self.draw_cpurust-analyzer cargo bottom 0.14.9 canvas/widgets/cpu_graph/impl#[Painter]draw_cpu().(
238 f,
239 app_state,
240 rect[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().,
241 app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().1,
242 ),
243 Memrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Mem# | BasicMemrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#BasicMem# => self.draw_memory_graphrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_graph/impl#[Painter]draw_memory_graph().(
244 f,
245 app_state,
246 rect[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().,
247 app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.,
248 ),
249 Diskrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Disk# => self.draw_disk_tablerust-analyzer cargo bottom 0.14.9 canvas/widgets/disk_table/impl#[Painter]draw_disk_table().(
250 f,
251 app_state,
252 rect[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().,
253 app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.,
254 ),
255 Temprust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Temp# => self.draw_temp_tablerust-analyzer cargo bottom 0.14.9 canvas/widgets/temperature_table/impl#[Painter]draw_temp_table().(
256 f,
257 app_state,
258 rect[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().,
259 app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.,
260 ),
261 Netrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Net# => {
262 self.draw_networkrust-analyzer cargo bottom 0.14.9 canvas/widgets/network_graph/impl#[Painter]draw_network().(f, app_state, rect[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.)
263 }
264 Procrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Proc# | ProcSearchrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#ProcSearch# | ProcSortrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#ProcSort# => {
265 let widget_id = app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.
266 -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().match &app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_typerust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_type. {
267 ProcSearchrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#ProcSearch# => 1,
268 ProcSortrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#ProcSort# => 2,
269 _ => 0,
270 };
271
272 self.draw_processrust-analyzer cargo bottom 0.14.9 canvas/widgets/process_table/impl#[Painter]draw_process().(f, app_state, rect[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., widget_id);
273 }
274 Batteryrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Battery# =>
275 {
276 #[cfg(feature = "battery")]
277 self.draw_batteryrust-analyzer cargo bottom 0.14.9 canvas/widgets/battery_display/impl#[Painter]draw_battery().(f, app_state, rect[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.)
278 }
279 TempGraphrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#TempGraph# => self.draw_temperature_graphrust-analyzer cargo bottom 0.14.9 canvas/widgets/temperature_graph/impl#[Painter]draw_temperature_graph().(
280 f,
281 app_state,
282 rect[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().,
283 app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.,
284 ),
285 DiskIoGraphrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#DiskIoGraph# => self.draw_disk_io_graphrust-analyzer cargo bottom 0.14.9 canvas/widgets/disk_io_graph/impl#[Painter]draw_disk_io_graph().(
286 f,
287 app_state,
288 rect[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().,
289 app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.,
290 ),
291 _ => {}
292 }
293 } else if app_state.app_config_fieldsrust-analyzer cargo bottom 0.14.9 app/App#app_config_fields..use_basic_moderust-analyzer cargo bottom 0.14.9 app/AppConfigFields#use_basic_mode. {
294 // Basic mode. This basically removes all graphs but otherwise
295 // the same info.
296 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(frozen_draw_loc) = frozen_draw_loc {
297 self.draw_frozen_indicatorrust-analyzer cargo bottom 0.14.9 canvas/impl#[Painter]draw_frozen_indicator().(f, frozen_draw_loc);
298 }
299
300 let data = app_state.data_storerust-analyzer cargo bottom 0.14.9 app/App#data_store..get_datarust-analyzer cargo bottom 0.14.9 app/data/store/impl#[DataStore]get_data().();
301 let actual_cpu_data_len = data.cpu_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#cpu_harvest..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().();
302
303 // This fixes #397, apparently if the height is 1, it can't render the CPU
304 // bars...
305 let cpu_height = {
306 let c = (actual_cpu_data_len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().4) as u16
307 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().u16::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u16][`From<bool>`]from().(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().actual_cpu_data_len.is_multiple_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]is_multiple_of().(4))
308 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().u16::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u16][`From<bool>`]from().(
309 app_state.app_config_fieldsrust-analyzer cargo bottom 0.14.9 app/App#app_config_fields..show_average_cpurust-analyzer cargo bottom 0.14.9 app/AppConfigFields#show_average_cpu.
310 && app_state.app_config_fieldsrust-analyzer cargo bottom 0.14.9 app/App#app_config_fields..dedicated_average_rowrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#dedicated_average_row.
311 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().actual_cpu_data_len.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_sub().(1).is_multiple_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]is_multiple_of().(4),
312 );
313
314 if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]le().1 { 1 } else { c }
315 };
316
317 let mut mem_rows = 1;
318
319 if data.swap_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#swap_harvest..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
320 mem_rows rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().1; // add row for swap
321 }
322
323 #[cfg(feature = "zfs")]
324 {
325 if data.arc_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#arc_harvest..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
326 mem_rows rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().1; // add row for arc
327 }
328 }
329
330 #[cfg(not(target_os = "windows"))]
331 {
332 if data.cache_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#cache_harvest..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
333 mem_rows rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().1;
334 }
335 }
336
337 #[cfg(feature = "gpu")]
338 {
339 mem_rows rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().data.gpu_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#gpu_harvest..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() as u16; // add row(s) for gpu
340 }
341
342 let network_rows = if app_state.app_config_fieldsrust-analyzer cargo bottom 0.14.9 app/App#app_config_fields..network_show_packetsrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#network_show_packets. {
343 4 // 4 rows for RX/TX and Packet Rates (Avg sizes moved to right side)
344 } else {
345 2 // 2 rows for RX and TX
346 };
347
348 if mem_rows rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().network_rows {
349 mem_rows rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().network_rows rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().mem_rows; // min rows
350 }
351
352 let vertical_chunks = Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::defaultrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout][Default]default().()
353 .directionrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]direction().(Directionrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#::Verticalrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#Vertical#)
354 .marginrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]margin().(0)
355 .constraintsrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]constraints().([
356 Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(cpu_height),
357 Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(mem_rows),
358 Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(2),
359 Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Minrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Min#(5),
360 ])
361 .splitrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]split().(terminal_size);
362
363 let middle_chunks = Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::defaultrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout][Default]default().()
364 .directionrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]direction().(Directionrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#::Horizontalrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#Horizontal#)
365 .constraintsrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]constraints().([Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(50), Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(50)])
366 .splitrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]split().(vertical_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
367
368 if vertical_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().2 {
369 self.draw_basic_cpurust-analyzer cargo bottom 0.14.9 canvas/widgets/cpu_basic/impl#[Painter]draw_basic_cpu().(f, app_state, vertical_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., 1);
370 }
371 if middle_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().2 {
372 self.draw_basic_memoryrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_basic/impl#[Painter]draw_basic_memory().(f, app_state, middle_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., 2);
373 }
374 if middle_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().2 {
375 self.draw_basic_networkrust-analyzer cargo bottom 0.14.9 canvas/widgets/network_basic/impl#[Painter]draw_basic_network().(f, app_state, middle_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., 3);
376 }
377
378 let mut later_widget_id: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u64> = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
379 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(basic_table_widget_state) = &app_state.statesrust-analyzer cargo bottom 0.14.9 app/App#states..basic_table_widget_staterust-analyzer cargo bottom 0.14.9 app/states/AppWidgetStates#basic_table_widget_state. {
380 let widget_id = basic_table_widget_state.currently_displayed_widget_idrust-analyzer cargo bottom 0.14.9 app/states/BasicTableWidgetState#currently_displayed_widget_id.;
381 later_widget_id = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(widget_id);
382 if vertical_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().2 {
383 match basic_table_widget_state.currently_displayed_widget_typerust-analyzer cargo bottom 0.14.9 app/states/BasicTableWidgetState#currently_displayed_widget_type. {
384 Diskrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Disk# => {
385 self.draw_disk_tablerust-analyzer cargo bottom 0.14.9 canvas/widgets/disk_table/impl#[Painter]draw_disk_table().(f, app_state, vertical_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., widget_id)
386 }
387 Procrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Proc# | ProcSortrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#ProcSort# => {
388 let wid = widget_id
389 -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().match basic_table_widget_state.currently_displayed_widget_typerust-analyzer cargo bottom 0.14.9 app/states/BasicTableWidgetState#currently_displayed_widget_type.
390 {
391 ProcSearchrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#ProcSearch# => 1,
392 ProcSortrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#ProcSort# => 2,
393 _ => 0,
394 };
395 self.draw_processrust-analyzer cargo bottom 0.14.9 canvas/widgets/process_table/impl#[Painter]draw_process().(f, app_state, vertical_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., wid);
396 }
397 Temprust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Temp# => {
398 self.draw_temp_tablerust-analyzer cargo bottom 0.14.9 canvas/widgets/temperature_table/impl#[Painter]draw_temp_table().(f, app_state, vertical_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., widget_id)
399 }
400 Batteryrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Battery# =>
401 {
402 #[cfg(feature = "battery")]
403 self.draw_batteryrust-analyzer cargo bottom 0.14.9 canvas/widgets/battery_display/impl#[Painter]draw_battery().(f, app_state, vertical_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., widget_id)
404 }
405 TempGraphrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#TempGraph# => self.draw_temperature_graphrust-analyzer cargo bottom 0.14.9 canvas/widgets/temperature_graph/impl#[Painter]draw_temperature_graph().(
406 f,
407 app_state,
408 vertical_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().,
409 widget_id,
410 ),
411 DiskIoGraphrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#DiskIoGraph# => {
412 self.draw_disk_io_graphrust-analyzer cargo bottom 0.14.9 canvas/widgets/disk_io_graph/impl#[Painter]draw_disk_io_graph().(f, app_state, vertical_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., widget_id)
413 }
414 _ => {}
415 }
416 }
417 }
418
419 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(widget_id) = later_widget_id {
420 self.draw_basic_table_arrowsrust-analyzer cargo bottom 0.14.9 canvas/components/widget_carousel/impl#[Painter]draw_basic_table_arrows().(f, app_state, vertical_chunks[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., widget_id);
421 }
422 } else {
423 // Draws using the passed in (or default) layout.
424 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(frozen_draw_loc) = frozen_draw_loc {
425 self.draw_frozen_indicatorrust-analyzer cargo bottom 0.14.9 canvas/impl#[Painter]draw_frozen_indicator().(f, frozen_draw_loc);
426 }
427
428 // A two-pass algorithm - get layouts using constraints (first pass),
429 // then pass each layout to the corresponding widget (second pass).
430 // Note that layouts are already cached in ratatui, so we don't need
431 // to do it manually!
432 let base = Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::verticalrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]vertical().(self.layoutrust-analyzer cargo bottom 0.14.9 canvas/Painter#layout..rowsrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomLayout#rows..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|r| r.constraintrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomRow#constraint.))
433 .splitrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]split().(terminal_size);
434
435 for (br, base) in self.layoutrust-analyzer cargo bottom 0.14.9 canvas/Painter#layout..rowsrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomLayout#rows..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(base.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) {
436 let base =
437 Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::horizontalrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]horizontal().(br.childrenrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomRow#children..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|bc| bc.constraintrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomCol#constraint.)).splitrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]split().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().base);
438
439 for (bc, base) in br.childrenrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomRow#children..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(base.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) {
440 let base = Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::verticalrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]vertical().(bc.childrenrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomCol#children..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|bcr| bcr.constraintrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomColRow#constraint.))
441 .splitrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]split().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().base);
442
443 for (widgets, base) in bc.childrenrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomCol#children..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(base.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) {
444 let widget_draw_locs =
445 Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::horizontalrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]horizontal().(widgets.childrenrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomColRow#children..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|bw| bw.constraintrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#constraint.))
446 .splitrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]split().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().base);
447
448 self.draw_widgets_with_constraintsrust-analyzer cargo bottom 0.14.9 canvas/impl#[Painter]draw_widgets_with_constraints().(
449 f,
450 app_state,
451 widgets,
452 &widget_draw_locs,
453 );
454 }
455 }
456 }
457 }
458 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
459
460 // We also move it back to the origin to try rand avoid wasting CPU cycles for things like kitty's
461 // `cursor_trail` calculations.
462 let backend = terminal.backend_mutrust-analyzer cargo ratatui-core 0.1.2 terminal/backend/impl#[`Terminal<B>`]backend_mut().();
463 backend.set_cursor_positionrust-analyzer cargo ratatui-core 0.1.2 backend/Backend#set_cursor_position().(Positionrust-analyzer cargo ratatui-core 0.1.2 layout/position/Position#::ORIGINrust-analyzer cargo ratatui-core 0.1.2 layout/position/impl#[Position]ORIGIN.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
464 backend.flushrust-analyzer cargo ratatui-core 0.1.2 backend/Backend#flush().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
465
466 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(updated_current_widget) = app_state
467 .widget_maprust-analyzer cargo bottom 0.14.9 app/App#widget_map.
468 .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.)
469 {
470 app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget. = updated_current_widget.clonerust-analyzer cargo bottom 0.14.9 app/layout_manager/impl#[BottomWidget][Clone]clone().();
471 }
472
473 app_state.is_force_redrawrust-analyzer cargo bottom 0.14.9 app/App#is_force_redraw. = false;
474 app_state.is_determining_widget_boundaryrust-analyzer cargo bottom 0.14.9 app/App#is_determining_widget_boundary. = false;
475
476 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
477 }
478
479 fn draw_widgets_with_constraintsrust-analyzer cargo bottom 0.14.9 canvas/impl#[Painter]draw_widgets_with_constraints().(
480 &self, f: &mut Framerust-analyzer cargo ratatui-core 0.1.2 terminal/frame/Frame#<'_>, app_state: &mut Apprust-analyzer cargo bottom 0.14.9 app/App#, widgets: &BottomColRowrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomColRow#,
481 widget_draw_locs: &[Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#],
482 ) {
483 use BottomWidgetTyperust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#::*;
484 for (widget, draw_loc) in widgets.childrenrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomColRow#children..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(widget_draw_locs) {
485 if draw_loc.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().2 && draw_loc.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().2 {
486 match &widget.widget_typerust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_type. {
487 Cpurust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Cpu# => self.draw_cpurust-analyzer cargo bottom 0.14.9 canvas/widgets/cpu_graph/impl#[Painter]draw_cpu().(f, app_state, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().draw_loc, widget.widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.),
488 Memrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Mem# => self.draw_memory_graphrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_graph/impl#[Painter]draw_memory_graph().(f, app_state, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().draw_loc, widget.widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.),
489 Netrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Net# => self.draw_networkrust-analyzer cargo bottom 0.14.9 canvas/widgets/network_graph/impl#[Painter]draw_network().(f, app_state, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().draw_loc, widget.widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.),
490 Temprust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Temp# => self.draw_temp_tablerust-analyzer cargo bottom 0.14.9 canvas/widgets/temperature_table/impl#[Painter]draw_temp_table().(f, app_state, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().draw_loc, widget.widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.),
491 Diskrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Disk# => self.draw_disk_tablerust-analyzer cargo bottom 0.14.9 canvas/widgets/disk_table/impl#[Painter]draw_disk_table().(f, app_state, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().draw_loc, widget.widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.),
492 Procrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Proc# => self.draw_processrust-analyzer cargo bottom 0.14.9 canvas/widgets/process_table/impl#[Painter]draw_process().(f, app_state, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().draw_loc, widget.widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.),
493 Batteryrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#Battery# =>
494 {
495 #[cfg(feature = "battery")]
496 self.draw_batteryrust-analyzer cargo bottom 0.14.9 canvas/widgets/battery_display/impl#[Painter]draw_battery().(f, app_state, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().draw_loc, widget.widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.)
497 }
498 TempGraphrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#TempGraph# => {
499 self.draw_temperature_graphrust-analyzer cargo bottom 0.14.9 canvas/widgets/temperature_graph/impl#[Painter]draw_temperature_graph().(f, app_state, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().draw_loc, widget.widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.)
500 }
501 DiskIoGraphrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidgetType#DiskIoGraph# => {
502 self.draw_disk_io_graphrust-analyzer cargo bottom 0.14.9 canvas/widgets/disk_io_graph/impl#[Painter]draw_disk_io_graph().(f, app_state, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().draw_loc, widget.widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id.)
503 }
504 _ => {}
505 }
506 }
507 }
508 }
509 }