aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorMatouš Dzivjak2022-02-10 02:04:40 +0000
committerGitHub2022-02-10 02:04:40 +0000
commitfdb9a1677b937e4975ff26d252c7da9f2a5df1f0 (patch)
tree9a18098cd0daf405f095567bfd1d462dbefb06be /helix-view
parent59b5bf31780c937096a3f6bbf99b4b0bb7b35494 (diff)
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
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs25
1 files changed, 22 insertions, 3 deletions
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,
}
}
}