Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
fix(agent-tui): fold the /find term per char like the text, wrap the settings import
Akarshan Biswas98bd5fa9734c
diff --git a/src-tauri/src/core/cli/tui/find.rs b/src-tauri/src/core/cli/tui/find.rsindex 78877505a..cfa538e75 100644--- a/src-tauri/src/core/cli/tui/find.rs+++ b/src-tauri/src/core/cli/tui/find.rs@@ -45,9 +45,11 @@ impl Find {}/// Lowercased `term`, or `None` when it is blank (nothing to search for).+/// Folded one char at a time like the text in `match_ranges`: `str::to_lowercase`+/// turns a word-final sigma into the final form, which the text side never does.pub(super) fn needle(term: &str) -> Option<String> {let trimmed = term.trim();- (!trimmed.is_empty()).then(|| trimmed.to_lowercase())+ (!trimmed.is_empty()).then(|| trimmed.chars().flat_map(char::to_lowercase).collect())}/// Byte ranges in `text` where the already-lowercased `needle` occurs,@@ -204,6 +206,14 @@ mod tests {assert_eq!(needle(" "), None);}+ #[test]+ fn needle_folds_a_final_sigma_like_the_text() {+ // Capital omicron, delta, omicron, sigma: the sigma ends the word.+ let word = "\u{39f}\u{394}\u{39f}\u{3a3}";+ let n = needle(word).unwrap();+ assert_eq!(match_ranges(word, &n).len(), 1);+ }+#[test]fn highlight_splits_spans_at_match_edges() {let line = Line::from(vec![diff --git a/src-tauri/src/core/cli/tui/vibe_setting.rs b/src-tauri/src/core/cli/tui/vibe_setting.rsindex 713520dd1..a2c233dca 100644--- a/src-tauri/src/core/cli/tui/vibe_setting.rs+++ b/src-tauri/src/core/cli/tui/vibe_setting.rs@@ -18,8 +18,8 @@ use ratatui::widgets::Paragraph;use serde_json::{json, Value};use super::{- current_setting_value, parse_setting_input, setting_path, wrap_spans_hard, write_setting, AgentSettingDef, AgentSettingKind, App, KeyCode,- KeyEvent, SettingScope, AGENT_SETTINGS,+ current_setting_value, parse_setting_input, setting_path, wrap_spans_hard, write_setting,+ AgentSettingDef, AgentSettingKind, App, KeyCode, KeyEvent, SettingScope, AGENT_SETTINGS,};/// `/settings` keys `/vibe-setting` may not propose. `claude_code_alias` decides