mirror of
				https://github.com/ClementTsang/bottom.git
				synced 2025-10-30 18:54:04 +01:00 
			
		
		
		
	bug: fix not switching sort type when toggling % in mem
This commit is contained in:
		
							parent
							
								
									3c373d7129
								
							
						
					
					
						commit
						eb5ac54ad0
					
				
							
								
								
									
										20
									
								
								src/app.rs
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								src/app.rs
									
									
									
									
									
								
							| @ -359,9 +359,25 @@ impl App { | |||||||
|                     proc_widget_state |                     proc_widget_state | ||||||
|                         .columns |                         .columns | ||||||
|                         .toggle(&processes::ProcessSorting::Mem); |                         .toggle(&processes::ProcessSorting::Mem); | ||||||
|                     proc_widget_state |                     if let Some(mem_percent_state) = proc_widget_state | ||||||
|                         .columns |                         .columns | ||||||
|                         .toggle(&processes::ProcessSorting::MemPercent); |                         .toggle(&processes::ProcessSorting::MemPercent) | ||||||
|  |                     { | ||||||
|  |                         if proc_widget_state.process_sorting_type | ||||||
|  |                             == processes::ProcessSorting::MemPercent | ||||||
|  |                             || proc_widget_state.process_sorting_type | ||||||
|  |                                 == processes::ProcessSorting::Mem | ||||||
|  |                         { | ||||||
|  |                             if mem_percent_state { | ||||||
|  |                                 proc_widget_state.process_sorting_type = | ||||||
|  |                                     processes::ProcessSorting::MemPercent; | ||||||
|  |                             } else { | ||||||
|  |                                 proc_widget_state.process_sorting_type = | ||||||
|  |                                     processes::ProcessSorting::Mem; | ||||||
|  |                             } | ||||||
|  |                         } | ||||||
|  |                     } | ||||||
|  | 
 | ||||||
|                     self.proc_state.force_update = Some(self.current_widget.widget_id); |                     self.proc_state.force_update = Some(self.current_widget.widget_id); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  | |||||||
| @ -260,9 +260,13 @@ impl Default for ProcColumn { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl ProcColumn { | impl ProcColumn { | ||||||
|     pub fn toggle(&mut self, column: &ProcessSorting) { |     /// Returns its new status.
 | ||||||
|  |     pub fn toggle(&mut self, column: &ProcessSorting) -> Option<bool> { | ||||||
|         if let Some(mapping) = self.column_mapping.get_mut(column) { |         if let Some(mapping) = self.column_mapping.get_mut(column) { | ||||||
|             mapping.enabled = !(mapping.enabled); |             mapping.enabled = !(mapping.enabled); | ||||||
|  |             Some(mapping.enabled) | ||||||
|  |         } else { | ||||||
|  |             None | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user