@@ -149,8 +149,7 @@ impl App {
149
149
BottomWidgetType :: Proc => {
150
150
if let Some ( current_proc_state) = self
151
151
. proc_state
152
- . widget_states
153
- . get_mut ( & self . current_widget . widget_id )
152
+ . get_mut_widget_state ( self . current_widget . widget_id )
154
153
{
155
154
if current_proc_state. is_search_enabled ( ) {
156
155
current_proc_state
@@ -164,8 +163,7 @@ impl App {
164
163
BottomWidgetType :: ProcSearch => {
165
164
if let Some ( current_proc_state) = self
166
165
. proc_state
167
- . widget_states
168
- . get_mut ( & ( self . current_widget . widget_id - 1 ) )
166
+ . get_mut_widget_state ( self . current_widget . widget_id - 1 )
169
167
{
170
168
if current_proc_state. is_search_enabled ( ) {
171
169
current_proc_state
@@ -243,8 +241,7 @@ impl App {
243
241
BottomWidgetType :: Cpu => {
244
242
if let Some ( cpu_widget_state) = self
245
243
. cpu_state
246
- . widget_states
247
- . get_mut ( & self . current_widget . widget_id )
244
+ . get_mut_widget_state ( self . current_widget . widget_id )
248
245
{
249
246
cpu_widget_state. is_multi_graph_mode =
250
247
!cpu_widget_state. is_multi_graph_mode ;
@@ -253,8 +250,7 @@ impl App {
253
250
BottomWidgetType :: Proc => {
254
251
if let Some ( proc_widget_state) = self
255
252
. proc_state
256
- . widget_states
257
- . get_mut ( & self . current_widget . widget_id )
253
+ . get_mut_widget_state ( self . current_widget . widget_id )
258
254
{
259
255
// Toggles process widget grouping state
260
256
proc_widget_state. is_grouped = !( proc_widget_state. is_grouped ) ;
@@ -285,8 +281,7 @@ impl App {
285
281
// Toggle on
286
282
if let Some ( proc_widget_state) = self
287
283
. proc_state
288
- . widget_states
289
- . get_mut ( & self . current_widget . widget_id )
284
+ . get_mut_widget_state ( self . current_widget . widget_id )
290
285
{
291
286
proc_widget_state
292
287
. process_search_state
@@ -500,12 +495,20 @@ impl App {
500
495
pub fn on_left_key ( & mut self ) {
501
496
if !self . is_in_dialog ( ) {
502
497
match self . current_widget . widget_type {
498
+ BottomWidgetType :: Proc => {
499
+ if let Some ( proc_widget_state) = self
500
+ . proc_state
501
+ . get_mut_widget_state ( self . current_widget . widget_id )
502
+ {
503
+ proc_widget_state. current_column_index =
504
+ proc_widget_state. current_column_index . saturating_sub ( 1 ) ;
505
+ }
506
+ }
503
507
BottomWidgetType :: ProcSearch => {
504
508
let is_in_search_widget = self . is_in_search_widget ( ) ;
505
509
if let Some ( proc_widget_state) = self
506
510
. proc_state
507
- . widget_states
508
- . get_mut ( & ( self . current_widget . widget_id - 1 ) )
511
+ . get_mut_widget_state ( self . current_widget . widget_id - 1 )
509
512
{
510
513
if is_in_search_widget {
511
514
let prev_cursor = proc_widget_state. get_cursor_position ( ) ;
@@ -533,8 +536,7 @@ impl App {
533
536
if !self . canvas_data . battery_data . is_empty ( ) {
534
537
if let Some ( battery_widget_state) = self
535
538
. battery_state
536
- . widget_states
537
- . get_mut ( & self . current_widget . widget_id )
539
+ . get_mut_widget_state ( self . current_widget . widget_id )
538
540
{
539
541
if battery_widget_state. currently_selected_battery_index > 0 {
540
542
battery_widget_state. currently_selected_battery_index -= 1 ;
@@ -552,12 +554,21 @@ impl App {
552
554
pub fn on_right_key ( & mut self ) {
553
555
if !self . is_in_dialog ( ) {
554
556
match self . current_widget . widget_type {
557
+ BottomWidgetType :: Proc => {
558
+ if let Some ( proc_widget_state) = self
559
+ . proc_state
560
+ . get_mut_widget_state ( self . current_widget . widget_id )
561
+ {
562
+ if proc_widget_state. current_column_index < proc_widget_state. num_columns {
563
+ proc_widget_state. current_column_index += 1 ;
564
+ }
565
+ }
566
+ }
555
567
BottomWidgetType :: ProcSearch => {
556
568
let is_in_search_widget = self . is_in_search_widget ( ) ;
557
569
if let Some ( proc_widget_state) = self
558
570
. proc_state
559
- . widget_states
560
- . get_mut ( & ( self . current_widget . widget_id - 1 ) )
571
+ . get_mut_widget_state ( self . current_widget . widget_id - 1 )
561
572
{
562
573
if is_in_search_widget {
563
574
let prev_cursor = proc_widget_state. get_cursor_position ( ) ;
@@ -586,8 +597,7 @@ impl App {
586
597
let battery_count = self . canvas_data . battery_data . len ( ) ;
587
598
if let Some ( battery_widget_state) = self
588
599
. battery_state
589
- . widget_states
590
- . get_mut ( & self . current_widget . widget_id )
600
+ . get_mut_widget_state ( self . current_widget . widget_id )
591
601
{
592
602
if battery_widget_state. currently_selected_battery_index
593
603
< battery_count - 1
@@ -887,8 +897,7 @@ impl App {
887
897
if let BottomWidgetType :: Proc = self . current_widget . widget_type {
888
898
if let Some ( proc_widget_state) = self
889
899
. proc_state
890
- . widget_states
891
- . get_mut ( & self . current_widget . widget_id )
900
+ . get_mut_widget_state ( self . current_widget . widget_id )
892
901
{
893
902
match proc_widget_state. process_sorting_type {
894
903
processes:: ProcessSorting :: CPU => {
@@ -911,8 +920,7 @@ impl App {
911
920
if let BottomWidgetType :: Proc = self . current_widget . widget_type {
912
921
if let Some ( proc_widget_state) = self
913
922
. proc_state
914
- . widget_states
915
- . get_mut ( & self . current_widget . widget_id )
923
+ . get_mut_widget_state ( self . current_widget . widget_id )
916
924
{
917
925
match proc_widget_state. process_sorting_type {
918
926
processes:: ProcessSorting :: MEM => {
@@ -934,8 +942,7 @@ impl App {
934
942
if let BottomWidgetType :: Proc = self . current_widget . widget_type {
935
943
if let Some ( proc_widget_state) = self
936
944
. proc_state
937
- . widget_states
938
- . get_mut ( & self . current_widget . widget_id )
945
+ . get_mut_widget_state ( self . current_widget . widget_id )
939
946
{
940
947
// Skip if grouped
941
948
if !proc_widget_state. is_grouped {
@@ -956,21 +963,32 @@ impl App {
956
963
}
957
964
}
958
965
}
966
+ 'P' => {
967
+ if let BottomWidgetType :: Proc = self . current_widget . widget_type {
968
+ if let Some ( proc_widget_state) = self
969
+ . proc_state
970
+ . get_mut_widget_state ( self . current_widget . widget_id )
971
+ {
972
+ proc_widget_state. is_using_full_path =
973
+ !proc_widget_state. is_using_full_path ;
974
+ self . proc_state . force_update = Some ( self . current_widget . widget_id ) ;
975
+ }
976
+ }
977
+ }
959
978
'n' => {
960
979
if let BottomWidgetType :: Proc = self . current_widget . widget_type {
961
980
if let Some ( proc_widget_state) = self
962
981
. proc_state
963
- . widget_states
964
- . get_mut ( & self . current_widget . widget_id )
982
+ . get_mut_widget_state ( self . current_widget . widget_id )
965
983
{
966
984
match proc_widget_state. process_sorting_type {
967
- processes:: ProcessSorting :: NAME => {
985
+ processes:: ProcessSorting :: IDENTIFIER => {
968
986
proc_widget_state. process_sorting_reverse =
969
987
!proc_widget_state. process_sorting_reverse
970
988
}
971
989
_ => {
972
990
proc_widget_state. process_sorting_type =
973
- processes:: ProcessSorting :: NAME ;
991
+ processes:: ProcessSorting :: IDENTIFIER ;
974
992
proc_widget_state. process_sorting_reverse = false ;
975
993
}
976
994
}
@@ -1371,8 +1389,7 @@ impl App {
1371
1389
if let Some ( new_widget) = self . widget_map . get ( & new_widget_id) {
1372
1390
if let Some ( proc_widget_state) = self
1373
1391
. proc_state
1374
- . widget_states
1375
- . get ( & self . current_widget . widget_id )
1392
+ . get_widget_state ( self . current_widget . widget_id )
1376
1393
{
1377
1394
if proc_widget_state. is_search_enabled ( ) {
1378
1395
self . current_widget = new_widget. clone ( ) ;
@@ -1393,8 +1410,7 @@ impl App {
1393
1410
BottomWidgetType :: Proc => {
1394
1411
if let Some ( proc_widget_state) = self
1395
1412
. proc_state
1396
- . widget_states
1397
- . get_mut ( & self . current_widget . widget_id )
1413
+ . get_mut_widget_state ( self . current_widget . widget_id )
1398
1414
{
1399
1415
proc_widget_state. scroll_state . current_scroll_position = 0 ;
1400
1416
proc_widget_state. scroll_state . scroll_direction = ScrollDirection :: UP ;
@@ -1403,8 +1419,7 @@ impl App {
1403
1419
BottomWidgetType :: Temp => {
1404
1420
if let Some ( temp_widget_state) = self
1405
1421
. temp_state
1406
- . widget_states
1407
- . get_mut ( & self . current_widget . widget_id )
1422
+ . get_mut_widget_state ( self . current_widget . widget_id )
1408
1423
{
1409
1424
temp_widget_state. scroll_state . current_scroll_position = 0 ;
1410
1425
temp_widget_state. scroll_state . scroll_direction = ScrollDirection :: UP ;
@@ -1413,8 +1428,7 @@ impl App {
1413
1428
BottomWidgetType :: Disk => {
1414
1429
if let Some ( disk_widget_state) = self
1415
1430
. disk_state
1416
- . widget_states
1417
- . get_mut ( & self . current_widget . widget_id )
1431
+ . get_mut_widget_state ( self . current_widget . widget_id )
1418
1432
{
1419
1433
disk_widget_state. scroll_state . current_scroll_position = 0 ;
1420
1434
disk_widget_state. scroll_state . scroll_direction = ScrollDirection :: UP ;
@@ -1423,8 +1437,7 @@ impl App {
1423
1437
BottomWidgetType :: CpuLegend => {
1424
1438
if let Some ( cpu_widget_state) = self
1425
1439
. cpu_state
1426
- . widget_states
1427
- . get_mut ( & ( self . current_widget . widget_id - 1 ) )
1440
+ . get_mut_widget_state ( self . current_widget . widget_id - 1 )
1428
1441
{
1429
1442
cpu_widget_state. scroll_state . current_scroll_position = 0 ;
1430
1443
cpu_widget_state. scroll_state . scroll_direction = ScrollDirection :: UP ;
@@ -1445,8 +1458,7 @@ impl App {
1445
1458
BottomWidgetType :: Proc => {
1446
1459
if let Some ( proc_widget_state) = self
1447
1460
. proc_state
1448
- . widget_states
1449
- . get_mut ( & self . current_widget . widget_id )
1461
+ . get_mut_widget_state ( self . current_widget . widget_id )
1450
1462
{
1451
1463
if let Some ( finalized_process_data) = self
1452
1464
. canvas_data
@@ -1465,8 +1477,7 @@ impl App {
1465
1477
BottomWidgetType :: Temp => {
1466
1478
if let Some ( temp_widget_state) = self
1467
1479
. temp_state
1468
- . widget_states
1469
- . get_mut ( & self . current_widget . widget_id )
1480
+ . get_mut_widget_state ( self . current_widget . widget_id )
1470
1481
{
1471
1482
if !self . canvas_data . temp_sensor_data . is_empty ( ) {
1472
1483
temp_widget_state. scroll_state . current_scroll_position =
@@ -1478,8 +1489,7 @@ impl App {
1478
1489
BottomWidgetType :: Disk => {
1479
1490
if let Some ( disk_widget_state) = self
1480
1491
. disk_state
1481
- . widget_states
1482
- . get_mut ( & self . current_widget . widget_id )
1492
+ . get_mut_widget_state ( self . current_widget . widget_id )
1483
1493
{
1484
1494
if !self . canvas_data . disk_data . is_empty ( ) {
1485
1495
disk_widget_state. scroll_state . current_scroll_position =
@@ -1491,8 +1501,7 @@ impl App {
1491
1501
BottomWidgetType :: CpuLegend => {
1492
1502
if let Some ( cpu_widget_state) = self
1493
1503
. cpu_state
1494
- . widget_states
1495
- . get_mut ( & ( self . current_widget . widget_id - 1 ) )
1504
+ . get_mut_widget_state ( self . current_widget . widget_id - 1 )
1496
1505
{
1497
1506
let cap = self . canvas_data . cpu_data . len ( ) ;
1498
1507
if cap > 0 {
@@ -1564,8 +1573,7 @@ impl App {
1564
1573
fn change_process_position ( & mut self , num_to_change_by : i64 ) {
1565
1574
if let Some ( proc_widget_state) = self
1566
1575
. proc_state
1567
- . widget_states
1568
- . get_mut ( & self . current_widget . widget_id )
1576
+ . get_mut_widget_state ( self . current_widget . widget_id )
1569
1577
{
1570
1578
let current_posn = proc_widget_state. scroll_state . current_scroll_position ;
1571
1579
0 commit comments