Skip to content

Commit d01860e

Browse files
raaymaxclaude
andcommitted
fix: change case sensitivity toggle to Alt+C
Ctrl+I sends the same keycode as Tab in terminals, making it unusable. Changed to Alt+C and updated help overlay to show filter keybindings. Also fixed history tests to be independent of persisted history. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9977e9a commit d01860e

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

src/app.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -887,37 +887,40 @@ mod tests {
887887
fn test_add_to_history() {
888888
let temp_file = create_temp_log_file(&["line"]);
889889
let mut app = App::new(vec![temp_file.path().to_path_buf()], false).unwrap();
890+
let initial_len = app.filter_history.len();
890891

891892
// Add patterns to history
892893
app.add_to_history("ERROR".to_string(), FilterMode::plain());
893894
app.add_to_history("WARN".to_string(), FilterMode::plain());
894895
app.add_to_history("INFO".to_string(), FilterMode::plain());
895896

896-
assert_eq!(app.filter_history.len(), 3);
897+
assert_eq!(app.filter_history.len(), initial_len + 3);
897898
}
898899

899900
#[test]
900901
fn test_add_to_history_skips_duplicates() {
901902
let temp_file = create_temp_log_file(&["line"]);
902903
let mut app = App::new(vec![temp_file.path().to_path_buf()], false).unwrap();
904+
let initial_len = app.filter_history.len();
903905

904-
app.add_to_history("ERROR".to_string(), FilterMode::plain());
905-
app.add_to_history("ERROR".to_string(), FilterMode::plain()); // Duplicate - should not add
906+
app.add_to_history("ERROR_DUP_TEST".to_string(), FilterMode::plain());
907+
app.add_to_history("ERROR_DUP_TEST".to_string(), FilterMode::plain()); // Duplicate - should not add
906908

907-
assert_eq!(app.filter_history.len(), 1);
909+
assert_eq!(app.filter_history.len(), initial_len + 1);
908910
}
909911

910912
#[test]
911913
fn test_add_to_history_same_pattern_different_mode() {
912914
let temp_file = create_temp_log_file(&["line"]);
913915
let mut app = App::new(vec![temp_file.path().to_path_buf()], false).unwrap();
916+
let initial_len = app.filter_history.len();
914917

915-
app.add_to_history("error".to_string(), FilterMode::plain());
916-
app.add_to_history("error".to_string(), FilterMode::regex()); // Different mode - should add
918+
app.add_to_history("error_mode_test".to_string(), FilterMode::plain());
919+
app.add_to_history("error_mode_test".to_string(), FilterMode::regex()); // Different mode - should add
917920

918-
assert_eq!(app.filter_history.len(), 2);
919-
assert!(!app.filter_history[0].mode.is_regex());
920-
assert!(app.filter_history[1].mode.is_regex());
921+
assert_eq!(app.filter_history.len(), initial_len + 2);
922+
assert!(!app.filter_history[initial_len].mode.is_regex());
923+
assert!(app.filter_history[initial_len + 1].mode.is_regex());
921924
}
922925

923926
#[test]

src/event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub enum AppEvent {
2020
FilterInputCancel,
2121
ClearFilter,
2222
ToggleFilterMode, // Tab in filter input - switch Plain/Regex
23-
ToggleCaseSensitivity, // Ctrl+I in filter input
23+
ToggleCaseSensitivity, // Alt+C in filter input
2424
CursorLeft, // Move cursor left in input
2525
CursorRight, // Move cursor right in input
2626
CursorHome, // Move cursor to start of input

src/handlers/input.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ fn handle_help_mode(key: KeyEvent) -> Vec<AppEvent> {
3333
/// Handle keyboard input in filter input mode
3434
fn handle_filter_input_mode(key: KeyEvent) -> Vec<AppEvent> {
3535
match key.code {
36-
// Ctrl+I toggles case sensitivity
37-
KeyCode::Char('i') if key.modifiers.contains(KeyModifiers::CONTROL) => {
36+
// Alt+C toggles case sensitivity (Ctrl+I doesn't work - same as Tab in terminals)
37+
KeyCode::Char('c') if key.modifiers.contains(KeyModifiers::ALT) => {
3838
vec![AppEvent::ToggleCaseSensitivity]
3939
}
4040
// Ctrl+A goes to start of line

src/ui/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,8 @@ fn render_help_overlay(f: &mut Frame, area: Rect) {
597597
.add_modifier(Modifier::BOLD),
598598
)]),
599599
Line::from(" / Start live filter"),
600+
Line::from(" Tab Toggle Plain/Regex mode"),
601+
Line::from(" Alt+C Toggle case sensitivity"),
600602
Line::from(" Enter Close filter input (keep filter)"),
601603
Line::from(" Esc Clear filter / Cancel input"),
602604
Line::from(" Up/Down Navigate filter history"),

0 commit comments

Comments
 (0)