From fdb9a1677b937e4975ff26d252c7da9f2a5df1f0 Mon Sep 17 00:00:00 2001 From: Matouš Dzivjak Date: Thu, 10 Feb 2022 03:04:40 +0100 Subject: feat(editor): add config for search wrap_around (#1516) * feat(editor): add config for search wrap_around Fixes: https://github.com/helix-editor/helix/issues/1489 * Move search settings into separate config * Disable linter--- helix-view/src/editor.rs | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'helix-view') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 43ea8d15..83822c1d 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -93,8 +93,6 @@ pub struct Config { pub line_number: LineNumber, /// Middle click paste support. Defaults to true. pub middle_click_paste: bool, - /// Smart case: Case insensitive searching unless pattern contains upper case characters. Defaults to true. - pub smart_case: bool, /// Automatic insertion of pairs to parentheses, brackets, etc. Defaults to true. pub auto_pairs: bool, /// Automatic auto-completion, automatically pop up without user trigger. Defaults to true. @@ -110,6 +108,18 @@ pub struct Config { pub cursor_shape: CursorShapeConfig, /// Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative. Defaults to `false`. pub true_color: bool, + /// Search configuration. + #[serde(default)] + pub search: SearchConfig, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "kebab-case", default, deny_unknown_fields)] +pub struct SearchConfig { + /// Smart case: Case insensitive searching unless pattern contains upper case characters. Defaults to true. + pub smart_case: bool, + /// Whether the search should wrap after depleting the matches. Default to true. + pub wrap_around: bool, } // Cursor shape is read and used on every rendered frame and so needs @@ -202,7 +212,6 @@ impl Default for Config { }, line_number: LineNumber::Absolute, middle_click_paste: true, - smart_case: true, auto_pairs: true, auto_completion: true, idle_timeout: Duration::from_millis(400), @@ -211,6 +220,16 @@ impl Default for Config { file_picker: FilePickerConfig::default(), cursor_shape: CursorShapeConfig::default(), true_color: false, + search: SearchConfig::default(), + } + } +} + +impl Default for SearchConfig { + fn default() -> Self { + Self { + wrap_around: true, + smart_case: true, } } } -- cgit v1.2.3-70-g09d2