reedy 0.1.7

A terminal-based RSS reader with a clean TUI interface
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
# Progress Log

## 2026-01-12

### Fixed: Medium Bug #6 - Duplicate Code Between `app.rs` and `rss_manager.rs`

**Location:** `src/rss_manager.rs`

**Problem:** The file `rss_manager.rs` contained 629 lines of dead code that duplicated nearly identical implementations found in `app.rs`. This included `FeedItem`, `SavedState`, `CachedFeed` structs, and many feed management methods. The module was declared in both `main.rs` and `lib.rs` but never actually imported or used anywhere in the codebase.

**Solution:**
1. Deleted the entire `src/rss_manager.rs` file (629 lines of dead code)
2. Removed the `pub mod rss_manager;` declaration from `src/main.rs`
3. Removed the `pub mod rss_manager;` declaration from `src/lib.rs`

**Files changed:**
- `src/rss_manager.rs` - Deleted
- `src/main.rs` - Removed `rss_manager` module declaration
- `src/lib.rs` - Removed `rss_manager` module declaration

**Tests:** All tests pass (16 total: 11 app tests, 5 ui tests)

---

### Fixed: High Bug #5 - Favorites View Not Updated on Unfavorite

**Location:** `src/app.rs:866-893`

**Problem:** When unfavoriting an item while in Favorites view, the item remained visible until the user manually refreshed or toggled the view. This was confusing UX.

**Solution:**
1. Modified `toggle_favorite()` to track whether the item was a favorite before toggling
2. After unfavoriting, if in Favorites view (`PageMode::Favorites`), the item is immediately removed from `current_feed_content`
3. The `selected_index` is adjusted appropriately:
   - If the list becomes empty, `selected_index` is set to `None`
   - If the removed item was at the end, `selected_index` moves to the new last item
   - Otherwise, `selected_index` stays the same (now pointing to the next item)

**Files changed:**
- `src/app.rs` - Modified `toggle_favorite()` to remove unfavorited items from view in Favorites mode
- `tests/app_tests.rs` - Added 3 new tests:
  - `test_unfavorite_removes_from_favorites_view` - verifies item removal and index adjustment
  - `test_unfavorite_last_item_in_favorites_view` - verifies empty list handling
  - `test_unfavorite_does_not_remove_in_feedlist_view` - verifies behavior unchanged in normal view

**Tests:** All tests pass (16 total: 11 app tests, 5 ui tests)

---

### Fixed: High Bug #4 - No HTTP Request Timeouts

**Location:** `src/app.rs` - multiple locations using `reqwest::get()`

**Problem:** All HTTP requests using `reqwest::get()` lacked timeout configuration. When a feed server was slow or unresponsive, the application would hang indefinitely waiting for a response.

**Solution:**
1. Added a `create_http_client()` helper function that creates a `reqwest::Client` with a 30-second timeout
2. Replaced all bare `reqwest::get()` calls with client-based requests using the new helper
3. Added `Duration` to the imports for timeout configuration

**Files changed:**
- `src/app.rs` - Added `create_http_client()` function and updated 5 locations:
  - `is_valid_rss_feed()`
  - `load_feed_content()`
  - `cache_all_feeds()`
  - `refresh_all_feeds()`
  - `fetch_feed()`

**Tests:** All tests pass (13 total: 8 app tests, 5 ui tests)

### Fixed: High Bug #3 - Cache Cleared on Every Startup

**Location:** `src/app.rs:103`

**Problem:** `clear_cache_dir()` was called unconditionally in `App::new()` on every startup, which deleted all cached feed data. This defeated the purpose of caching for offline reading and forced users to wait for feeds to reload every time.

**Solution:** Removed the `clear_cache_dir()` call from `App::new()`. The existing cache system already has proper 1-hour TTL expiration logic in `load_feed_cache()`, making the startup cache clear unnecessary. Also removed the now-unused `clear_cache_dir()` function to avoid dead code.

**Files changed:**
- `src/app.rs` - Removed `clear_cache_dir()` call from `App::new()` and removed the unused `clear_cache_dir()` function

**Tests:** All tests pass (13 total: 8 app tests, 5 ui tests)

### Fixed: Critical Bug #2 - Integer Underflow in `truncate_text`

**Location:** `src/ui.rs:346-361`

**Problem:** When `max_width < 3`, the subtraction `(max_width - 3) as usize` would cause integer underflow, leading to potential panic or unexpected behavior when the terminal is very narrow.

**Solution:** Added an early return guard at the beginning of `truncate_text()` that checks if `max_width < 3`. When true, it returns the text truncated to `max_width` characters without attempting to add ellipsis.

**Files changed:**
- `src/ui.rs` - Added guard for small width values
- `tests/ui_tests.rs` - Added test `test_truncate_text_very_small_width` covering edge cases for width 0, 1, 2, and 3

**Tests:** All tests pass (8 total: 4 app tests, 5 ui tests including new edge case test)

### Fixed: Critical Bug #1 - Panic on Empty List Navigation

**Location:** `src/app.rs:285`, `src/app.rs:296`

**Problem:** `select_previous()` and `select_next()` could panic when navigating an empty list:
- `(current + 1) % len` causes division by zero when `len == 0`
- `len - 1` causes integer underflow when `len == 0`

**Solution:** Added early return guard `if len == 0 { return; }` in both `select_previous()` and `select_next()` functions before any arithmetic operations on `len`.

**Files changed:**
- `src/app.rs` - Added empty list guard in `select_previous()` and `select_next()`
- `tests/app_tests.rs` - Added 4 new tests covering empty list navigation edge cases:
  - `test_select_next_empty_list`
  - `test_select_previous_empty_list`
  - `test_select_next_empty_feed_manager`
  - `test_select_previous_empty_feed_manager`

**Tests:** All tests pass (13 total: 8 app tests, 5 ui tests)

---

### Fixed: Medium Bug #7 - Module Double Declaration

**Location:** `src/main.rs:18-22`

**Problem:** Modules (`app`, `event`, `handler`, `tui`, `ui`) were declared in both `main.rs` and `lib.rs`. This created confusion about which module was being used and potential compilation issues. The `main.rs` was already importing from `reedy::` (the lib crate) but then redundantly re-declared the same modules.

**Solution:**
1. Removed the duplicate module declarations from `src/main.rs` (lines 18-22)
2. The modules remain properly declared in `lib.rs` and are accessed via the `reedy` crate import

**Files changed:**
- `src/main.rs` - Removed 5 redundant `pub mod` declarations

**Tests:** All tests pass (16 total: 11 app tests, 5 ui tests)

---

### Fixed: Medium Bug #8 - Hardcoded Page Sizes

**Location:** `src/app.rs:324-327`, `src/app.rs:613-616`

**Problem:** Page sizes for scrolling were hardcoded to 5 items for FeedList/Favorites and 10 items for FeedManager. This meant pagination didn't adapt to the actual terminal height, causing items to overflow or underflow the visible area.

**Solution:**
1. Added a new `items_per_page()` method that dynamically calculates the number of visible items based on:
   - Terminal height (accounting for 8 lines of UI chrome: 3 title + 3 command bar + 2 borders)
   - Page mode (FeedList/Favorites use 3 lines per item, FeedManager uses 1 line per item)
2. Updated `ensure_selection_visible()` to use `items_per_page()` instead of hardcoded values
3. Updated `page_up()` to use `items_per_page()` instead of hardcoded values
4. Updated `page_down()` to use `items_per_page()` and also fixed it to work correctly in FeedManager mode

**Files changed:**
- `src/app.rs` - Added `items_per_page()` method, updated `ensure_selection_visible()`, `page_up()`, and `page_down()`
- `tests/app_tests.rs` - Added `test_items_per_page_dynamic_calculation` to verify the calculation works correctly for different terminal heights and page modes

**Tests:** All tests pass (17 total: 12 app tests, 5 ui tests)

---

### Fixed: Medium Bug #9 - Blocking Async Patterns

**Location:** `src/app.rs:113-130`, `src/app.rs:885-902`, `src/handler.rs:60-67`, `src/handler.rs:96-100`

**Problem:** The codebase used `tokio::task::block_in_place` with `tokio::runtime::Handle::current().block_on()` to run async code in several places:
1. `App::new()` - blocked during initialization to refresh and cache feeds
2. `toggle_favorites_page()` - blocked when switching from favorites back to feed list
3. `handler.rs` - blocked in the 'c' key handlers for refreshing/caching feeds

This pattern is inefficient and can cause deadlocks in certain scenarios because it blocks the current thread waiting for async operations, defeating the purpose of async programming.

**Solution:**
1. Converted `App::new()` from sync to async - now called with `.await` in main.rs
2. Converted `toggle_favorites_page()` from sync to async - now called with `.await` in handler.rs
3. Removed all `block_in_place` and `block_on` calls from handler.rs - the handler is already async, so async methods can be awaited directly
4. Updated `main.rs` to await the async `App::new()` call

**Files changed:**
- `src/app.rs` - Made `App::new()` and `toggle_favorites_page()` async, removed blocking wrappers
- `src/handler.rs` - Removed `block_in_place`/`block_on` wrappers, now directly awaits async methods
- `src/main.rs` - Updated to await `App::new()`

**Tests:** All tests pass (17 total: 12 app tests, 5 ui tests)

---

### Fixed: Low Bug #10 - Debug Statement Left in Code

**Location:** `src/app.rs:436` (was `src/app.rs:413` before previous fixes shifted line numbers)

**Problem:** A leftover debug statement `debug!("test");` existed in the `select_feed()` function that served no purpose. This was likely left behind during development and cluttered the debug output.

**Solution:** Removed the useless `debug!("test");` statement. The function already has a proper debug statement on the next line that logs meaningful context: `debug!("Loading feed content from index {}", index);`

**Files changed:**
- `src/app.rs` - Removed `debug!("test");` from `select_feed()` function

**Tests:** All tests pass (17 total: 12 app tests, 5 ui tests)

---

### Implemented: High Priority Feature #1 - Search/Filter Functionality

**Location:** `src/app.rs`, `src/handler.rs`, `src/ui.rs`

**Description:** Added the ability to filter feed items by keyword in title or description. This is an essential feature for users with many subscriptions to find specific content.

**Implementation Details:**

1. **New InputMode:** Added `InputMode::Searching` to handle search text input
2. **New App fields:**
   - `search_query: String` - stores the current search query
   - `filtered_indices: Option<Vec<usize>>` - stores indices of matching items when filter is active
3. **New App methods:**
   - `start_search()` - enters search mode
   - `cancel_search()` - cancels search and clears filter
   - `confirm_search()` - confirms search, keeps filter active
   - `update_search_filter()` - updates filtered indices based on query
   - `clear_search()` - clears filter when pressing Esc in normal mode
   - `get_visible_items()` - returns filtered or all items based on filter state
   - `visible_item_count()` - returns count of visible items
   - `get_actual_index()` - converts visible index to actual index in feed content

4. **Key bindings:**
   - `/` - Start search mode (in FeedList and Favorites views)
   - `Enter` - Confirm search and keep filter active
   - `Esc` - Cancel search (clears filter), or clear active filter in normal mode

5. **UI Updates:**
   - Command bar shows search input with cursor during search mode
   - Title bar shows filter indicator when filter is active: `[Filter: "query"]`
   - Shows filtered item count vs total: "Items 1-5/5 of 50"
   - Help menu updated with search documentation

6. **Modified existing methods to work with filtered indices:**
   - `select_previous()`, `select_next()` - navigate filtered list
   - `open_selected_feed()` - uses actual index
   - `toggle_read_status()` - uses actual index
   - `mark_as_read()` - uses actual index
   - `mark_all_as_read()` - marks only visible (filtered) items
   - `toggle_favorite()` - uses actual index, handles filter index updates

**Files changed:**
- `src/app.rs` - Added search state, methods, and updated existing methods
- `src/handler.rs` - Added search mode key handling and `/` key binding
- `src/ui.rs` - Updated rendering to show filtered items and search UI
- `tests/app_tests.rs` - Added 3 new tests for search functionality

**Tests:** All tests pass (20 total: 15 app tests, 5 ui tests)

---

### Implemented: High Priority Feature #2 - Feed Export/Import via Clipboard

**Location:** `src/app.rs`, `src/handler.rs`, `src/ui.rs`

**Description:** Added the ability to export and import feed subscriptions via the system clipboard. This allows users to easily backup, share, or migrate their feed subscriptions.

**Implementation Details:**

1. **New Dependency:** Added `arboard` crate (v3, default-features disabled) for cross-platform clipboard access

2. **New InputMode:** Added `InputMode::Importing` to handle multi-line URL input

3. **New App field:**
   - `import_result: Option<String>` - stores the result message from import operation

4. **New App methods:**
   - `export_feeds_to_clipboard()` - copies all feed URLs to clipboard, one per line
   - `start_importing()` - enters import mode, pre-fills input buffer with clipboard content
   - `cancel_importing()` - cancels import mode and clears state
   - `import_feeds()` - validates and imports feeds from input buffer

5. **Key bindings (in Feed Manager mode):**
   - `e` - Export all feed URLs to clipboard
   - `i` - Start import mode (clipboard content auto-pasted)
   - `Enter` - Confirm import and validate URLs
   - `Esc` - Cancel import

6. **Import behavior:**
   - Parses input buffer as one URL per line
   - Validates each URL as a valid RSS/Atom feed
   - Skips duplicate URLs already in the feed list
   - Shows summary message: "Import: X added, Y duplicate, Z invalid"

7. **UI Updates:**
   - Command bar shows export/import options: `[e] Export  [i] Import`
   - Import mode shows URL count: "Import feeds (X URLs pasted) - [Enter] Import  [Esc] Cancel"
   - Help menu updated with export/import documentation

**Files changed:**
- `Cargo.toml` - Added `arboard` dependency
- `src/app.rs` - Added `InputMode::Importing`, `import_result` field, and export/import methods
- `src/handler.rs` - Added `e` and `i` key bindings, `Importing` input mode handler
- `src/ui.rs` - Updated command bar and help menu with export/import documentation
- `tests/app_tests.rs` - Added 3 new tests for import functionality

**Tests:** All tests pass (23 total: 18 app tests, 5 ui tests)

---

### Implemented: High Priority Feature #4 - Feed Title Display

**Location:** `src/app.rs`, `src/ui.rs`

**Description:** Extract and display the actual feed title instead of showing the raw URL. This provides much better UX as users can identify feeds at a glance.

**Implementation Details:**

1. **New Data Structure:** Added `FeedInfo` struct with `url` and `title` fields to store feed subscriptions:
   ```rust
   pub struct FeedInfo {
       pub url: String,
       pub title: String,
   }
   ```

2. **Changed `rss_feeds` type:** From `Vec<String>` to `Vec<FeedInfo>`

3. **Updated `SavedState`:** Now persists `Vec<FeedInfo>` instead of `Vec<String>`

4. **New validation function:** Renamed `is_valid_rss_feed()` to `validate_and_get_feed_title()` which returns `Option<String>` containing the feed title on success

5. **Title extraction:** When adding a feed (manually or via import), the feed title is extracted from:
   - RSS: `channel.title()`
   - Atom: `feed.title().value`
   - Falls back to URL if title is empty

6. **Backwards compatibility:** Added migration logic in `load_feeds()` to handle:
   - New format: `Vec<FeedInfo>` with titles
   - Middle format: `Vec<String>` with favorites
   - Old format: `Vec<String>` without favorites
   - Old formats are converted by using the URL as the initial title

7. **UI updates:**
   - Feed Manager now displays feed titles instead of raw URLs
   - Feed items show "Item Title | Feed Title" instead of "Item Title | URL"

8. **Updated helper functions:**
   - `convert_rss_items()` and `convert_atom_items()` now take `feed_title` parameter
   - All methods iterating over `rss_feeds` updated to use `FeedInfo` fields

**Files changed:**
- `src/app.rs` - Added `FeedInfo` struct, updated `SavedState`, `App`, validation, add/import functions, and all feed iteration code
- `src/ui.rs` - Updated `render_feed_manager()` to display feed titles

**Tests:** All tests pass (23 total: 18 app tests, 5 ui tests)

---

### Implemented: High Priority Feature #5 - Unread Count per Feed

**Location:** `src/app.rs`, `src/ui.rs`

**Description:** Added the ability to display unread item counts for each feed in the Feed Manager. This helps users quickly identify which feeds have new content without needing to open each feed individually.

**Implementation Details:**

1. **New FeedItem field:** Added `feed_url: String` field to `FeedItem` struct with `#[serde(default)]` for backwards compatibility with existing cache data.

2. **Updated FeedItem creation:** All places that create `FeedItem` instances now set the `feed_url` field:
   - `convert_rss_items()` function
   - `convert_atom_items()` function
   - Inline creation in `load_feed_content()` for both RSS and Atom feeds

3. **New App methods:**
   - `count_unread_for_feed(url: &str) -> usize` - Returns count of unread items for a feed by loading from cache
   - `count_total_for_feed(url: &str) -> usize` - Returns total item count for a feed

4. **UI Updates in Feed Manager:**
   - Each feed now displays: "Feed Title (unread/total)" e.g., "Tech News (3/10)"
   - Unread counts are styled with cyan color and bold when there are unread items
   - Count appears in dark gray when all items are read
   - No count shown if feed has no cached content yet
   - Title width dynamically adjusted to account for count display

**Files changed:**
- `src/app.rs` - Added `feed_url` field to `FeedItem`, added count methods, updated all FeedItem creation sites
- `src/ui.rs` - Updated `render_feed_manager()` to display unread/total counts
- `tests/app_tests.rs` - Updated all test FeedItem creations to include `feed_url` field

**Tests:** All tests pass (23 total: 18 app tests, 5 ui tests)

---

### Implemented: High Priority Feature #6 - Configurable HTTP Timeout

**Location:** `src/app.rs`

**Description:** Added a configuration system that allows users to customize the HTTP request timeout. This prevents the application from hanging indefinitely when connecting to slow or unresponsive feed servers.

**Implementation Details:**

1. **New Config struct:** Added `Config` struct with `http_timeout_secs` field:
   ```rust
   pub struct Config {
       pub http_timeout_secs: u64, // default: 30
   }
   ```

2. **Configuration file:** Config is stored at `~/.config/reedy/config.json` alongside the existing `feeds.json`

3. **New App methods:**
   - `get_config_path()` - Returns the path to config.json
   - `load_config()` - Loads config from file or returns defaults if not found
   - `save_config()` - Saves current config to file

4. **Updated HTTP client creation:** Modified `create_http_client()` to accept timeout as parameter instead of using a constant

5. **Updated all HTTP request call sites:**
   - `validate_and_get_feed_title()` - Now takes timeout parameter
   - `load_feed_content()` - Uses `self.config.http_timeout_secs`
   - `cache_all_feeds()` - Uses `self.config.http_timeout_secs`
   - `refresh_all_feeds()` - Uses `self.config.http_timeout_secs`
   - `fetch_feed()` - Public API now accepts optional timeout parameter

6. **Config persistence:** Config is loaded at app startup and stored in the App struct

7. **Backwards compatibility:**
   - If config.json doesn't exist, default values are used
   - The `#[serde(default)]` attribute ensures missing fields use defaults
   - `fetch_feed()` accepts `Option<u64>` for timeout, using default if None

**Example config.json:**
```json
{
  "http_timeout_secs": 30
}
```

**Files changed:**
- `src/app.rs` - Added `Config` struct, config methods, `config` field to `App`, updated all HTTP client calls

**Tests:** All tests pass (23 total: 18 app tests, 5 ui tests)

---

### Implemented: Medium Priority Feature #7 - Feed Categories/Tags

**Location:** `src/app.rs`, `src/handler.rs`, `src/ui.rs`

**Description:** Added the ability to organize feeds into custom categories. This helps users with many subscriptions to better organize and navigate their feed list.

**Implementation Details:**

1. **Updated FeedInfo struct:** Added optional `category` field with `#[serde(default)]` for backwards compatibility:
   ```rust
   pub struct FeedInfo {
       pub url: String,
       pub title: String,
       #[serde(default)]
       pub category: Option<String>,
   }
   ```

2. **New InputMode:** Added `InputMode::SettingCategory` to handle category text input

3. **New App methods:**
   - `start_setting_category()` - enters category setting mode, pre-fills with existing category
   - `cancel_setting_category()` - cancels without saving changes
   - `set_category()` - saves the category (or clears it if empty)
   - `get_categories()` - returns sorted list of unique categories
   - `get_feeds_by_category()` - returns feeds grouped by category

4. **Key bindings (in Feed Manager mode):**
   - `t` - Start category setting mode for selected feed
   - `Enter` - Save the category
   - `Esc` - Cancel category setting

5. **UI Updates in Feed Manager:**
   - Feeds are now displayed grouped by category with section headers
   - Section headers use magenta color and bold formatting: "── Category Name ──"
   - Uncategorized feeds appear first under "── Uncategorized ──"
   - Categories are sorted alphabetically
   - Feeds within each category maintain their original order
   - Command bar shows `[t] Tag/Category` option
   - Help menu updated with category documentation

6. **Backwards compatibility:**
   - Existing saved state files work without modification
   - The `#[serde(default)]` attribute ensures missing category fields default to `None`
   - All FeedInfo creation sites updated to include `category: None`

**Files changed:**
- `src/app.rs` - Added `category` field to `FeedInfo`, new `InputMode::SettingCategory`, category management methods
- `src/handler.rs` - Added `t` key binding, `SettingCategory` input mode handler
- `src/ui.rs` - Updated `render_feed_manager()` to display grouped feeds, updated command bar and help menu
- `tests/app_tests.rs` - Added 6 new tests for category functionality

**Tests:** All tests pass (29 total: 24 app tests, 5 ui tests)

---

### Fixed: Low Bug #11 - Silent Error Handling

**Location:** `src/app.rs` - `load_feeds()` and `load_config()` functions

**Problem:** Some errors were silently ignored, making debugging difficult:
1. When loading the feeds file (`feeds.json`), if all three format parsing attempts (new, middle, old) failed, the app silently continued with empty feeds. Users had no idea their file was corrupted or malformed.
2. When loading the config file (`config.json`), if the file existed but couldn't be read or parsed, the app silently used defaults without informing the user.

**Solution:**
1. **`load_feeds()` (line ~386)**: Added error handling for the case when all parsing formats fail. Now:
   - Logs an error message with the file path
   - Sets `self.error_message` to display a warning to the user about potential file corruption

2. **`load_config()` (lines 217-241)**: Rewrote using match expressions instead of nested `if let Ok()`. Now:
   - Logs a warning with the specific error when file reading fails
   - Logs a warning with the parse error when JSON parsing fails
   - Still returns default config, but user is informed via log output

3. **Added `warn` macro import**: Added `warn` to the log imports for the new warning messages.

**Files changed:**
- `src/app.rs` - Added error reporting in `load_feeds()`, improved error logging in `load_config()`, added `warn` to imports

**Tests:** All tests pass (29 total: 24 app tests, 5 ui tests)

---

### Implemented: Medium Priority Feature #8 - Auto-Refresh Interval

**Location:** `src/app.rs`, `src/main.rs`, `src/handler.rs`, `src/ui.rs`

**Description:** Added the ability to automatically refresh feeds at a configurable interval. This allows users to see new content without having to manually refresh, making the app more convenient for continuous monitoring of feeds.

**Implementation Details:**

1. **Updated Config struct:** Added `auto_refresh_mins` field with `#[serde(default)]` for backwards compatibility:
   ```rust
   pub struct Config {
       pub http_timeout_secs: u64,
       pub auto_refresh_mins: u64, // default: 0 (disabled)
   }
   ```

2. **New App fields:**
   - `last_refresh: Option<SystemTime>` - Tracks when feeds were last refreshed
   - `auto_refresh_pending: bool` - Flag set by tick() when refresh is due

3. **Updated App methods:**
   - `tick()` - Now checks if auto-refresh interval has elapsed and sets the pending flag
   - `perform_auto_refresh()` - New async method that executes the refresh when pending
   - `time_until_next_refresh()` - Returns duration until next auto-refresh for UI display

4. **Main loop integration:**
   - The tick event now calls both `tick()` and `perform_auto_refresh().await`
   - This allows the auto-refresh to execute asynchronously without blocking

5. **Manual refresh integration:**
   - When user presses `c` to refresh, `last_refresh` is updated to reset the timer

6. **UI Updates:**
   - Title bar shows auto-refresh countdown when enabled: `[Auto: M:SS]`
   - Format shows minutes and seconds remaining until next refresh

7. **Smart refresh behavior:**
   - Only refreshes in FeedList or Favorites mode
   - Skips refresh during input modes (Adding, Searching, Importing, etc.)
   - In Favorites mode, re-filters content after refresh to maintain view

**Example config.json:**
```json
{
  "http_timeout_secs": 30,
  "auto_refresh_mins": 5
}
```

**Files changed:**
- `src/app.rs` - Added `auto_refresh_mins` to Config, `last_refresh` and `auto_refresh_pending` to App, implemented tick(), perform_auto_refresh(), and time_until_next_refresh()
- `src/main.rs` - Updated tick event handler to call perform_auto_refresh()
- `src/handler.rs` - Updated manual refresh handler to reset last_refresh timer
- `src/ui.rs` - Added auto-refresh countdown display to title bar

**Tests:** All tests pass (29 total: 24 app tests, 5 ui tests)

---

### Fixed: Low Bug #12 - Dead Code Warning Suppression

**Location:** `src/event.rs:23`

**Problem:** The `EventHandler` struct had an `#[allow(dead_code)]` attribute suppressing warnings for fields that appeared unused. The `sender` field and `handler` field were stored but never directly accessed. However, these fields must exist to keep the event handler functioning:
- `sender` being dropped would close the mpsc channel
- `handler` being dropped would detach the tokio task

This is a common pattern in Rust where fields must stay alive for their side effects.

**Solution:**
1. Renamed `sender` to `_sender` and `handler` to `_handler` following Rust conventions for intentionally unused fields
2. Removed the `#[allow(dead_code)]` attribute from the struct
3. Updated the doc comments to explain why these fields exist (to keep the channel and task alive)
4. Updated the constructor to use the new field names

**Files changed:**
- `src/event.rs` - Renamed fields, removed `#[allow(dead_code)]`, updated comments and constructor

**Tests:** All tests pass (29 total: 24 app tests, 5 ui tests)

---

### Implemented: Medium Priority Feature #9 - Article Preview Pane

**Location:** `src/app.rs`, `src/handler.rs`, `src/ui.rs`

**Description:** Added the ability to view full article content in a dedicated preview pane within the TUI. This allows users to read article content without leaving the terminal or opening a browser.

**Implementation Details:**

1. **New InputMode:** Added `InputMode::Preview` to handle the article preview state

2. **New App field:**
   - `preview_scroll: u16` - Tracks the scroll position within the preview pane

3. **New App methods:**
   - `open_preview()` - Opens the preview pane for the currently selected item
   - `close_preview()` - Closes the preview pane and returns to normal mode
   - `preview_scroll_up()` - Scrolls the preview content up by one line
   - `preview_scroll_down()` - Scrolls the preview content down by one line
   - `preview_page_up()` - Scrolls the preview content up by a page
   - `preview_page_down()` - Scrolls the preview content down by a page
   - `get_preview_item()` - Returns the currently selected feed item for preview

4. **Key bindings:**
   - `p` (in FeedList or Favorites) - Open article preview pane
   - `↑/k` - Scroll preview up
   - `↓/j` - Scroll preview down
   - `PgUp` - Page up in preview
   - `PgDn` - Page down in preview
   - `g` - Scroll to top of preview
   - `o` - Open article in browser (from preview)
   - `r` - Toggle read status (from preview)
   - `f` - Toggle favorite status (from preview)
   - `Esc/q/p` - Close preview and return to feed list

5. **UI Features:**
   - Preview displays article title (styled in bold green)
   - Shows feed name, publication date, and article link
   - Displays read/favorite status
   - Separator line between metadata and content
   - Full article description with word wrapping
   - Scroll position indicator when content overflows: "Article Preview (Line X/Y)"

6. **New helper function:**
   - `wrap_text()` - Wraps text to fit within a specified width for proper display

**Files changed:**
- `src/app.rs` - Added `InputMode::Preview`, `preview_scroll` field, and preview-related methods
- `src/handler.rs` - Added preview mode key event handling and `p` key binding
- `src/ui.rs` - Added `render_article_preview()` function, `wrap_text()` helper, updated command bars and help menus

**Tests:** All tests pass (29 total: 24 app tests, 5 ui tests)

---

### Implemented: Medium Priority Feature #10 - Configurable Cache Duration

**Location:** `src/app.rs`

**Description:** Added the ability to configure how long feed cache remains valid. Previously, the cache TTL was hardcoded to 1 hour (3600 seconds). Now users can customize this value to suit their needs (e.g., longer duration for low-bandwidth situations or shorter duration for always-fresh content).

**Implementation Details:**

1. **New constant:** Added `DEFAULT_CACHE_DURATION_MINS` constant set to 60 (1 hour)

2. **Updated Config struct:** Added `cache_duration_mins` field with `#[serde(default)]` for backwards compatibility:
   ```rust
   pub struct Config {
       pub http_timeout_secs: u64,
       pub auto_refresh_mins: u64,
       pub cache_duration_mins: u64, // new field, default: 60
   }
   ```

3. **Updated `load_feed_cache()`:** Changed the hardcoded 3600 seconds check to use the configured value:
   - Calculates `cache_duration_secs = self.config.cache_duration_mins * 60`
   - Compares cache age against this configurable value

4. **Backwards compatibility:**
   - Existing config files without `cache_duration_mins` will use the default (60 minutes)
   - The `#[serde(default = "default_cache_duration")]` attribute handles missing fields

**Example config.json:**
```json
{
  "http_timeout_secs": 30,
  "auto_refresh_mins": 5,
  "cache_duration_mins": 120
}
```

**Files changed:**
- `src/app.rs` - Added `DEFAULT_CACHE_DURATION_MINS` constant, `cache_duration_mins` field to Config, `default_cache_duration()` function, and updated `load_feed_cache()` to use configurable duration

**Tests:** All tests pass (29 total: 24 app tests, 5 ui tests)

---

### Implemented: Medium Priority Feature #11 - Theme Customization

**Location:** `src/app.rs`, `src/ui.rs`

**Description:** Added support for customizable color themes, allowing users to personalize the application's appearance or switch between light and dark themes. This improves accessibility and supports user preference.

**Implementation Details:**

1. **New Theme struct:** Added `Theme` struct with 8 customizable color fields:
   ```rust
   pub struct Theme {
       pub primary: String,      // Titles, headers (default: "green")
       pub secondary: String,    // Selected items, section headers (default: "yellow")
       pub text: String,         // Default text (default: "white")
       pub muted: String,        // Read items, inactive elements (default: "dark_gray")
       pub error: String,        // Error messages (default: "red")
       pub highlight: String,    // Unread counts, links (default: "cyan")
       pub description: String,  // Secondary text (default: "gray")
       pub category: String,     // Category headers (default: "magenta")
   }
   ```

2. **Updated Config struct:** Added `theme` field with `#[serde(default)]` for backwards compatibility

3. **New color parsing function:** Added `parse_color()` in `ui.rs` that converts color strings to ratatui `Color` values:
   - Supports named colors: black, red, green, yellow, blue, magenta, cyan, gray, white
   - Supports light variants: light_red, light_green, light_blue, etc.
   - Supports dark_gray (and alternate spellings like darkgray, dark_grey)
   - Supports hex colors with or without #: "#ff5500" or "ff5500"
   - Case-insensitive matching
   - Falls back to white for unknown colors

4. **ThemeColors helper struct:** Created internal struct to hold resolved Color values, avoiding repeated parsing during rendering

5. **Updated all rendering functions:** Modified to accept and use `ThemeColors`:
   - `render()` - Creates ThemeColors from config theme
   - `render_feed_content()` - Uses theme colors for items, dates, descriptions
   - `render_feed_manager()` - Uses theme colors for feeds, categories, counts, errors
   - `render_help_menu()` - Uses theme colors for headers and section titles
   - `render_article_preview()` - Uses theme colors for title, metadata, content
   - `render_command_bar()` - Uses theme colors for command text

6. **Built-in light theme:** Added `Theme::light()` preset method for light terminal backgrounds:
   ```rust
   Theme {
       primary: "blue",
       secondary: "magenta",
       text: "black",
       muted: "dark_gray",
       error: "red",
       highlight: "blue",
       description: "dark_gray",
       category: "magenta",
   }
   ```

7. **Backwards compatibility:** All theme fields use `#[serde(default)]` with default functions, so existing config files work without modification

**Example config.json:**
```json
{
  "http_timeout_secs": 30,
  "auto_refresh_mins": 5,
  "cache_duration_mins": 60,
  "theme": {
    "primary": "blue",
    "secondary": "magenta",
    "text": "white",
    "muted": "dark_gray",
    "error": "red",
    "highlight": "cyan",
    "description": "gray",
    "category": "light_magenta"
  }
}
```

**Files changed:**
- `src/app.rs` - Added `Theme` struct with default functions, added `theme` field to `Config`
- `src/ui.rs` - Added `parse_color()` function, `ThemeColors` helper struct, updated all render functions to use theme colors
- `tests/ui_tests.rs` - Added 6 new tests for `parse_color()` function

**Tests:** All tests pass (35 total: 24 app tests, 11 ui tests)

---

### Implemented: Low Priority Feature #19 - Vim-Style `G` for Bottom

**Location:** `src/app.rs`, `src/handler.rs`, `src/ui.rs`

**Description:** Added vim-style `G` (shift+g) command to scroll to the bottom of any list, complementing the existing `g` command that scrolls to the top. This follows standard vim navigation patterns that terminal users expect.

**Implementation Details:**

1. **New App method:** Added `scroll_to_bottom()` that:
   - Determines the list length based on page mode (FeedList/Favorites use `visible_item_count()`, FeedManager uses `rss_feeds.len()`)
   - Returns early if the list is empty (prevents panics)
   - Selects the last item in the list
   - Calls `ensure_selection_visible()` to scroll the view appropriately

2. **Key bindings added:**
   - `G` in FeedList mode - scrolls to bottom of feed items
   - `G` in Favorites mode - scrolls to bottom of favorites list
   - `G` in FeedManager Normal mode - scrolls to bottom of feed list
   - `G` in Preview mode - scrolls to end of article content (sets `preview_scroll = u16::MAX`, which gets capped by the UI)

3. **Filter support:** When a search filter is active, `scroll_to_bottom()` correctly navigates to the last *visible* item, not the last actual item.

4. **Help menu updates:** Added `G` documentation to all three help sections (FeedList, FeedManager, Favorites).

**Files changed:**
- `src/app.rs` - Added `scroll_to_bottom()` method
- `src/handler.rs` - Added `G` key bindings to FeedList, FeedManager, Favorites, and Preview modes
- `src/ui.rs` - Updated help menus with `G` documentation for all modes
- `tests/app_tests.rs` - Added 4 new tests:
  - `test_scroll_to_bottom` - basic scroll to bottom functionality
  - `test_scroll_to_bottom_empty_list` - verifies no panic on empty list
  - `test_scroll_to_bottom_feed_manager` - works in FeedManager mode
  - `test_scroll_to_bottom_with_filter` - respects active search filters

**Tests:** All tests pass (39 total: 28 app tests, 11 ui tests)

---

### Implemented: High Priority Feature #3 - OPML Import/Export

**Location:** `src/app.rs`, `src/handler.rs`, `src/ui.rs`

**Description:** Added support for importing and exporting feed lists in OPML format, the industry standard for RSS feed sharing. This enables compatibility with other RSS readers for migration and backup purposes.

**Implementation Details:**

1. **New Dependency:** Added `quick-xml` crate (v0.37) for XML parsing and generation

2. **New App methods:**
   - `export_opml()` - Exports all feeds to an OPML file at `~/.config/reedy/feeds.opml`
   - `generate_opml()` - Generates OPML 2.0 XML content with proper structure
   - `import_opml(path)` - Imports feeds from an OPML file path
   - `import_opml_content(content)` - Imports feeds from OPML content string
   - `parse_and_import_opml(content)` - Internal parser that handles OPML structure
   - `get_opml_path()` - Returns the default OPML file path

3. **OPML Export Features:**
   - Generates valid OPML 2.0 XML with proper declaration and structure
   - Groups feeds by category - categorized feeds are nested under category outline elements
   - Uncategorized feeds appear at the top level of the body
   - Includes feed title, text, and xmlUrl attributes
   - Saves to `~/.config/reedy/feeds.opml`

4. **OPML Import Features:**
   - Parses both category (nested outline) and flat feed structures
   - Extracts categories from parent outline elements and assigns to feeds
   - Handles both self-closing (`<outline ... />`) and start-end (`<outline>...</outline>`) tags
   - Skips duplicate URLs that already exist in the feed list
   - Uses feed titles from OPML, falls back to URL if title is empty
   - Supports lowercase `xmlurl` attribute in addition to standard `xmlUrl`

5. **Key bindings (in Feed Manager mode):**
   - `E` (shift+e) - Export feeds to OPML file
   - `I` (shift+i) - Import feeds from OPML file

6. **UI Updates:**
   - Command bar shows `[e/E] Export  [i/I] Import` to indicate both clipboard and OPML options
   - Help menu documents both export methods (clipboard and OPML)
   - Status messages inform user of export path or import results

**Example OPML output:**
```xml
<?xml version="1.0" encoding="UTF-8"?>
<opml version="2.0">
  <head><title>Reedy RSS Feeds</title></head>
  <body>
    <outline type="rss" text="Uncategorized Feed" title="Uncategorized Feed" xmlUrl="https://example.com/feed.xml"/>
    <outline text="Tech" title="Tech">
      <outline type="rss" text="Tech News" title="Tech News" xmlUrl="https://tech.com/rss"/>
    </outline>
  </body>
</opml>
```

**Files changed:**
- `Cargo.toml` - Added `quick-xml` dependency
- `src/app.rs` - Added OPML export/import methods with XML parsing/generation
- `src/handler.rs` - Added `E` and `I` key bindings for OPML operations
- `src/ui.rs` - Updated command bar and help menu with OPML documentation
- `tests/app_tests.rs` - Added 6 new tests for OPML functionality:
  - `test_opml_generate` - verifies feed setup for export
  - `test_opml_import_empty_content` - handles empty/invalid OPML
  - `test_opml_import_basic` - basic import without categories
  - `test_opml_import_with_categories` - import with category structure
  - `test_opml_import_skips_duplicates` - skips existing feed URLs
  - `test_export_opml_empty_feeds` - error handling for empty export

**Tests:** All tests pass (45 total: 34 app tests, 11 ui tests)

---

### Implemented: Low Priority Feature #12 - Keyboard Shortcuts Customization

**Location:** `src/app.rs`, `src/handler.rs`, `src/ui.rs`

**Description:** Added the ability for users to configure their own keybindings via the config file. This allows power users to optimize their workflow by customizing keys to match their preferences or muscle memory from other applications.

**Implementation Details:**

1. **New Keybindings struct:** Added `Keybindings` struct in `app.rs` with 24 customizable key actions:
   - Navigation: `move_up`, `move_down`, `page_up`, `page_down`, `scroll_to_top`, `scroll_to_bottom`
   - Actions: `select`, `open_in_browser`, `toggle_read`, `mark_all_read`, `toggle_favorite`, `toggle_favorites_view`, `refresh`
   - Search: `start_search`
   - Preview: `open_preview`
   - Feed Manager: `open_feed_manager`, `add_feed`, `delete_feed`, `set_category`, `export_clipboard`, `export_opml`, `import_clipboard`, `import_opml`
   - UI: `help`, `quit`

2. **Multi-key support:** Each keybinding field is a comma-separated string supporting multiple keys:
   - Example: `"k,Up"` means both 'k' and Up arrow trigger the action
   - Default vim-style bindings: navigation uses both vim keys (hjkl) and arrow keys

3. **Key parser function:** Created `parse_key()` in `handler.rs` that converts key strings to `KeyCode`:
   - Supports special keys: Enter, Esc, Up, Down, Left, Right, PageUp, PageDown, Home, End, Tab, Space, Backspace, Delete
   - Supports single character keys (case-sensitive for letters)
   - Supports alternative spellings (e.g., "PgUp" and "PageUp")

4. **Key matching function:** Created `key_matches()` to check if a key event matches any key in a keybinding string

5. **Handler refactoring:** Converted all hardcoded `KeyCode` matches in `handler.rs` to use `key_matches()` with the configurable keybindings:
   - FeedList mode: all keys customizable
   - FeedManager mode: all keys customizable
   - Favorites mode: all keys customizable
   - Preview mode: all keys customizable
   - Text input modes (Adding, Importing, SettingCategory): remain hardcoded (Enter/Esc/Char/Backspace)

6. **Dynamic help menu:** Updated `render_help_menu()` in `ui.rs` to display configured keybindings:
   - Added `format_keybinding()` helper to convert key strings to display format
   - Converts "Up" to "↑", "PageUp" to "PgUp", etc.
   - Shows multiple keys joined with "/" (e.g., "k/↑")

7. **Config integration:** Added `keybindings` field to `Config` struct with `#[serde(default)]` for backwards compatibility

8. **Backwards compatibility:**
   - All keybinding fields have default functions providing vim-style bindings
   - Existing config files without keybindings work perfectly
   - Partial keybinding configs work (missing fields use defaults)

**Example config.json with custom keybindings:**
```json
{
  "http_timeout_secs": 30,
  "auto_refresh_mins": 5,
  "keybindings": {
    "move_up": "w,Up",
    "move_down": "s,Down",
    "quit": "x,q",
    "toggle_favorite": "b"
  }
}
```

**Customizable Keys:**
| Key | Default | Description |
|-----|---------|-------------|
| `move_up` | `k,Up` | Navigate up |
| `move_down` | `j,Down` | Navigate down |
| `page_up` | `PageUp` | Page up |
| `page_down` | `PageDown` | Page down |
| `scroll_to_top` | `g` | Go to top |
| `scroll_to_bottom` | `G` | Go to bottom |
| `select` | `Enter` | Select item |
| `open_in_browser` | `o` | Open in browser |
| `toggle_read` | `r` | Toggle read status |
| `mark_all_read` | `R` | Mark all as read |
| `toggle_favorite` | `f` | Toggle favorite |
| `toggle_favorites_view` | `F` | Show/hide favorites |
| `refresh` | `c` | Refresh feeds |
| `start_search` | `/` | Start search |
| `open_preview` | `p` | Open preview pane |
| `open_feed_manager` | `m` | Open feed manager |
| `add_feed` | `a` | Add new feed |
| `delete_feed` | `d` | Delete feed |
| `set_category` | `t` | Set category |
| `export_clipboard` | `e` | Export to clipboard |
| `export_opml` | `E` | Export to OPML |
| `import_clipboard` | `i` | Import from clipboard |
| `import_opml` | `I` | Import from OPML |
| `help` | `?` | Toggle help |
| `quit` | `q` | Quit |

**Files changed:**
- `src/app.rs` - Added `Keybindings` struct with 24 fields, default functions, Default impl, added to Config struct
- `src/handler.rs` - Added `parse_key()`, `key_matches()`, `keys()` helper functions; refactored `handle_key_events()` to use configurable keybindings
- `src/ui.rs` - Added `format_keybinding()` helper; updated `render_help_menu()` to display configured keybindings
- `tests/app_tests.rs` - Added 4 new tests:
  - `test_keybindings_default` - verifies all default keybinding values
  - `test_config_includes_keybindings` - verifies keybindings in Config
  - `test_keybindings_serialization` - tests JSON round-trip
  - `test_keybindings_partial_config` - tests partial JSON with defaults

**Tests:** All tests pass (49 total: 38 app tests, 11 ui tests)

---

### Implemented: Low Priority Feature #13 - Vi-Style Commands

**Location:** `src/app.rs`, `src/handler.rs`, `src/ui.rs`

**Description:** Added support for vi-style command mode with `:q`, `:w`, `:wq` style commands. This provides a familiar interface for vim users and offers a consistent terminal experience.

**Implementation Details:**

1. **New InputMode:** Added `InputMode::Command` to handle command input state

2. **New App field:** Added `command_buffer: String` to store the typed command

3. **New App methods:**
   - `start_command_mode()` - enters command mode (triggered by `:`)
   - `cancel_command_mode()` - cancels command mode without executing
   - `execute_command()` - parses and executes the command buffer

4. **Supported Commands:**
   | Command | Aliases | Action |
   |---------|---------|--------|
   | `:q` | `:quit` | Quit the application |
   | `:w` | `:write`, `:save` | Save application state |
   | `:wq` | `:x` | Save and quit |
   | `:q!` | - | Force quit without explicit save |
   | `:help` | `:h` | Toggle help menu |
   | `:feeds` | `:manage` | Open feed manager |
   | `:favorites` | `:fav` | Toggle favorites view |
   | `:read` | `:markread` | Mark all items as read |
   | `:refresh` | `:r` | Trigger feed refresh |
   | `:0` | `:top`, `:gg` | Scroll to top |
   | `:$` | `:bottom` | Scroll to bottom |

5. **Key bindings:**
   - `:` in FeedList, FeedManager, or Favorites view enters command mode
   - `Enter` executes the command
   - `Esc` cancels command mode

6. **UI Updates:**
   - Command bar shows `:command█` during command mode
   - Help menus updated with Vi-Style Commands section documenting all available commands

7. **Handler integration:**
   - Command mode handled before other input modes in handler
   - Special handling for async commands (`:favorites` uses a marker to trigger async action)

**Files changed:**
- `src/app.rs` - Added `InputMode::Command`, `command_buffer` field, and command execution methods
- `src/handler.rs` - Added `:` key binding to enter command mode, command mode key handling
- `src/ui.rs` - Updated command bar to show command input, added Vi-Style Commands section to help menus
- `tests/app_tests.rs` - Added 9 new tests:
  - `test_command_mode_start_and_cancel` - verifies entering and canceling command mode
  - `test_command_quit` - tests `:q` command
  - `test_command_quit_long` - tests `:quit` command
  - `test_command_wq` - tests `:wq` command
  - `test_command_help` - tests `:help` command
  - `test_command_feeds` - tests `:feeds` command
  - `test_command_unknown` - tests unknown command error handling
  - `test_command_empty` - tests empty command handling
  - `test_command_scroll_to_top` - tests `:0` command

**Tests:** All tests pass (58 total: 47 app tests, 11 ui tests)

---

### Implemented: Low Priority Feature #14 - Mouse Support

**Location:** `src/handler.rs`, `src/main.rs`

**Description:** Added mouse support for clicking to select items and scroll wheel navigation. This improves accessibility for users who prefer mouse navigation over keyboard-only interfaces.

**Implementation Details:**

1. **New mouse handler function:** Added `handle_mouse_events()` in `handler.rs` to process mouse events

2. **Click-to-select functionality:**
   - In FeedList/Favorites view: clicking on a feed item selects it
   - Clicking on an already-selected item opens the article preview (simulating double-click)
   - In FeedManager view: clicking on a feed selects it, accounting for category headers
   - Clicking on an already-selected feed loads it and returns to FeedList
   - Clicking anywhere in Help mode closes the help menu

3. **Scroll wheel support:**
   - ScrollUp/ScrollDown events navigate through items (3 items per scroll tick)
   - In Preview mode, scroll events scroll the article content
   - Scrolling is ignored in Help mode (could be implemented later if needed)

4. **Input mode handling:**
   - Mouse events are ignored during text input modes (Adding, Importing, Searching, SettingCategory, Command)
   - This prevents accidental selections while typing

5. **Layout calculation:**
   - Mouse click positions are calculated relative to the content area (accounting for 3-line title bar and 3-line command bar)
   - FeedList/Favorites items use 3-line height per item
   - FeedManager items use 1-line height per item, with category headers properly accounted for

6. **Integration:**
   - Updated `main.rs` to call `handle_mouse_events()` instead of ignoring mouse events
   - Mouse capture was already enabled in `tui.rs`

**Key bindings:**
- Left click: Select item / Open preview (if already selected) / Close help
- Scroll up: Navigate to previous items (3 at a time) / Scroll preview up
- Scroll down: Navigate to next items (3 at a time) / Scroll preview down

**Files changed:**
- `src/handler.rs` - Added `handle_mouse_events()`, `handle_mouse_click()`, `handle_mouse_scroll_up()`, `handle_mouse_scroll_down()` functions
- `src/main.rs` - Updated to call `handle_mouse_events()` for mouse events

**Tests:** All tests pass (58 total: 47 app tests, 11 ui tests)

---

### Implemented: Low Priority Feature #15 - Export Articles

**Location:** `src/app.rs`, `src/handler.rs`, `src/ui.rs`

**Description:** Added the ability to export/save articles to clipboard (markdown format) or to a file. This allows users to save interesting articles for later reference outside of the application.

**Implementation Details:**

1. **New Keybinding struct field:** Added `export_article` field with default value `"s"`

2. **New App methods:**
   - `format_article_markdown()` - Formats a feed item as markdown with title, date, link, status, and content
   - `export_article_to_clipboard()` - Copies the selected article to clipboard in markdown format
   - `export_article_to_file()` - Saves the selected article to a markdown file

3. **Export to clipboard (`s` key):**
   - Works in FeedList, Favorites, and Preview modes
   - Formats article as markdown with metadata and content
   - Uses the arboard crate for cross-platform clipboard access
   - Shows confirmation message on success

4. **Export to file (`S` key):**
   - Saves article to `~/.local/share/reedy/exports/` directory
   - Filename is generated from article title (sanitized) + timestamp to avoid collisions
   - Format: `{title}_{timestamp}.md`
   - Shows full path on success

5. **Markdown format includes:**
   - Article title as H1 header
   - Publication date (if available)
   - Article link
   - Read/favorite status
   - Full article content (HTML converted to plain text)

6. **UI Updates:**
   - Command bar in FeedList/Favorites shows `[s/S] Export` option
   - Command bar in Preview shows `[s] Copy  [S] Save` options
   - Help menus updated with Export section documenting both keys

**Files changed:**
- `src/app.rs` - Added `export_article` to Keybindings struct, added export methods
- `src/handler.rs` - Added `s` and `S` key bindings to FeedList, Favorites, and Preview modes
- `src/ui.rs` - Updated command bars and help menus with export documentation
- `tests/app_tests.rs` - Added 3 new tests:
  - `test_export_article_no_selection` - verifies error handling when no article selected
  - `test_export_article_file_no_selection` - verifies file export error handling
  - `test_keybindings_export_article_default` - verifies default keybinding value

**Tests:** All tests pass (61 total: 50 app tests, 11 ui tests)

---

### Implemented: Low Priority Feature #16 - Feed Health Indicators

**Location:** `src/app.rs`, `src/ui.rs`

**Description:** Added visual indicators showing feed status (healthy, slow, broken) in the Feed Manager. This helps users quickly identify problematic feeds that may need attention or removal.

**Implementation Details:**

1. **New FeedStatus enum:** Added four health states:
   - `Healthy` - Feed responded successfully in under 5 seconds
   - `Slow` - Feed responded but took longer than 5 seconds
   - `Broken` - Feed failed to load or parse
   - `Unknown` - Feed has not been checked yet

2. **New FeedHealth struct:** Tracks detailed health information per feed:
   - `status: FeedStatus` - Current health state
   - `last_success: Option<SystemTime>` - Timestamp of last successful fetch
   - `last_response_time_ms: Option<u64>` - Response time in milliseconds
   - `last_error: Option<String>` - Error message from last failure
   - `consecutive_failures: u32` - Number of consecutive failures

3. **New App field:** Added `feed_health: HashMap<String, FeedHealth>` to store health data keyed by feed URL

4. **Updated refresh_all_feeds():**
   - Now measures response time for each feed using `std::time::Instant`
   - Records health status based on response time and success/failure
   - Tracks consecutive failures for persistently problematic feeds
   - Feeds taking > 5000ms are marked as Slow; network/parse errors mark as Broken

5. **New App method:**
   - `get_feed_health(url: &str) -> FeedHealth` - Returns health for a feed URL (defaults to Unknown)

6. **FeedHealth helper methods:**
   - `status_indicator()` - Returns icon for status: `●` (healthy), `◐` (slow), `✗` (broken), `○` (unknown)
   - `status_description()` - Returns human-readable status: "OK (250ms)", "Slow (6000ms)", "Error: ...", "Not checked"

7. **UI Updates in Feed Manager:**
   - Health indicator icon displayed before each feed in the list
   - Icon color matches status: green (healthy), yellow (slow), red (broken), gray (unknown)
   - Status bar shows detailed health info for the selected feed

**Files changed:**
- `src/app.rs` - Added `FeedStatus` enum, `FeedHealth` struct, `feed_health` field, `get_feed_health()` method, updated `refresh_all_feeds()` with health tracking
- `src/ui.rs` - Updated `render_feed_manager()` to display health indicators and status bar
- `tests/app_tests.rs` - Added 6 new tests:
  - `test_feed_health_default` - verifies default FeedHealth values
  - `test_feed_health_status_indicator` - tests icon for each status
  - `test_feed_health_status_description` - tests description for each status
  - `test_get_feed_health_unknown_url` - verifies default for unknown URLs
  - `test_app_default_has_empty_feed_health` - verifies empty health map on startup

**Tests:** All tests pass (66 total: 55 app tests, 11 ui tests)

---

### Implemented: Low Priority Feature #17 - Notification Support

**Location:** `src/app.rs`, `Cargo.toml`

**Description:** Added desktop notification support for new articles in subscribed feeds. When enabled, users receive system notifications whenever new articles are detected during feed refresh, keeping them informed without needing to keep the app in focus.

**Implementation Details:**

1. **New Dependency:** Added `notify-rust` crate (v4.11) for cross-platform desktop notifications (Linux, macOS, Windows)

2. **New Config field:** Added `notifications_enabled` to `Config` struct with `#[serde(default)]` for backwards compatibility:
   ```rust
   pub struct Config {
       // ... existing fields ...
       pub notifications_enabled: bool, // default: false
   }
   ```

3. **New App field:** Added `seen_items: HashSet<String>` to track article IDs that have already been seen (notified about)

4. **Notification logic in `refresh_all_feeds()`:**
   - After fetching all feed items, compares against `seen_items` to identify new articles
   - If `notifications_enabled` is true and there are new items, calls `send_new_articles_notification()`
   - All fetched items are then added to `seen_items` for future comparisons

5. **New method `send_new_articles_notification()`:**
   - Takes a slice of new `FeedItem` references
   - Creates a desktop notification with:
     - Summary: "1 new article" or "N new articles"
     - Body: Up to 3 article titles with bullet points
     - If more than 3 articles: appends "...and N more"
     - App name: "Reedy"
     - Timeout: 5 seconds

6. **Startup initialization:**
   - On app startup, existing cached items are loaded and their IDs added to `seen_items`
   - This prevents notifications for all existing articles on first run
   - Only truly new articles (fetched after startup) trigger notifications

7. **Backwards compatibility:**
   - `notifications_enabled` defaults to `false`, so existing users won't see unexpected notifications
   - The `#[serde(default)]` attribute ensures missing field in config uses default

**Example config.json to enable notifications:**
```json
{
  "http_timeout_secs": 30,
  "auto_refresh_mins": 5,
  "notifications_enabled": true
}
```

**Files changed:**
- `Cargo.toml` - Added `notify-rust` dependency
- `src/app.rs` - Added `notifications_enabled` to Config, `seen_items` to App, notification detection in `refresh_all_feeds()`, new `send_new_articles_notification()` method
- `tests/app_tests.rs` - Added 2 new tests:
  - `test_notifications_disabled_by_default` - verifies notifications off by default
  - `test_config_notifications_enabled_field` - tests config serialization/deserialization

**Tests:** All tests pass (68 total: 57 app tests, 11 ui tests)

---

### Implemented: Low Priority Feature #18 - Mark Items Read on Scroll

**Location:** `src/app.rs`

**Description:** Added the option to automatically mark items as read when scrolling past them. This is a common feature in RSS readers that reduces the need for manual marking and makes feed consumption more efficient.

**Implementation Details:**

1. **New Config option:** Added `mark_read_on_scroll` to `Config` struct with `#[serde(default)]` for backwards compatibility:
   ```rust
   pub struct Config {
       // ... existing fields ...
       pub mark_read_on_scroll: bool, // default: false
   }
   ```

2. **New constant:** Added `DEFAULT_MARK_READ_ON_SCROLL: bool = false` at top of `app.rs`

3. **New helper method:** Added `mark_current_as_read_on_scroll()` that:
   - Checks if `mark_read_on_scroll` is enabled in config
   - Only operates in FeedList or Favorites page modes
   - Marks the currently selected item as read if not already read
   - Does NOT save state immediately to avoid excessive disk writes during rapid scrolling

4. **Updated `select_next()`:** Now calls `mark_current_as_read_on_scroll()` before moving to the next item, marking the item being scrolled away from as read.

5. **Behavior:**
   - When scrolling forward (j/↓/select_next), the item being left behind is marked as read
   - Works in both FeedList and Favorites views
   - Disabled in FeedManager and Preview modes
   - State is saved on quit or next explicit save action (not on every scroll)

6. **Backwards compatibility:**
   - `mark_read_on_scroll` defaults to `false`, so existing users won't see behavior changes
   - The `#[serde(default)]` attribute ensures missing field in config uses default

**Example config.json to enable mark-read-on-scroll:**
```json
{
  "http_timeout_secs": 30,
  "mark_read_on_scroll": true
}
```

**Files changed:**
- `src/app.rs` - Added `mark_read_on_scroll` to Config, added `mark_current_as_read_on_scroll()` helper method, updated `select_next()` to call it
- `tests/app_tests.rs` - Added 5 new tests:
  - `test_mark_read_on_scroll_disabled_by_default` - verifies feature off by default
  - `test_config_mark_read_on_scroll_field` - tests config serialization/deserialization
  - `test_select_next_marks_read_when_enabled` - verifies items are marked read when scrolling with feature enabled
  - `test_select_next_does_not_mark_read_when_disabled` - verifies no marking when feature disabled
  - `test_select_next_does_not_mark_read_in_feed_manager` - verifies feature doesn't work in FeedManager mode

**Tests:** All tests pass (73 total: 62 app tests, 11 ui tests)