Disable editor autoscroll on mouse clicks (#20287)
Closes #18148 Release Notes: - Stop scrolling when clicking to the edges of the visible text area. Use `autoscroll_on_clicks` to configure this behavior. https://github.com/user-attachments/assets/3afd5cbb-5957-4e39-94c6-cd2e927038fd --------- Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
This commit is contained in:
parent
eadb107339
commit
f9d5de834a
4 changed files with 19 additions and 1 deletions
|
@ -300,6 +300,8 @@
|
||||||
"scroll_beyond_last_line": "one_page",
|
"scroll_beyond_last_line": "one_page",
|
||||||
// The number of lines to keep above/below the cursor when scrolling.
|
// The number of lines to keep above/below the cursor when scrolling.
|
||||||
"vertical_scroll_margin": 3,
|
"vertical_scroll_margin": 3,
|
||||||
|
// Whether to scroll when clicking near the edge of the visible text area.
|
||||||
|
"autoscroll_on_clicks": false,
|
||||||
// Scroll sensitivity multiplier. This multiplier is applied
|
// Scroll sensitivity multiplier. This multiplier is applied
|
||||||
// to both the horizontal and vertical delta values while scrolling.
|
// to both the horizontal and vertical delta values while scrolling.
|
||||||
"scroll_sensitivity": 1.0,
|
"scroll_sensitivity": 1.0,
|
||||||
|
|
|
@ -2931,7 +2931,7 @@ impl Editor {
|
||||||
let start;
|
let start;
|
||||||
let end;
|
let end;
|
||||||
let mode;
|
let mode;
|
||||||
let auto_scroll;
|
let mut auto_scroll;
|
||||||
match click_count {
|
match click_count {
|
||||||
1 => {
|
1 => {
|
||||||
start = buffer.anchor_before(position.to_point(&display_map));
|
start = buffer.anchor_before(position.to_point(&display_map));
|
||||||
|
@ -2967,6 +2967,7 @@ impl Editor {
|
||||||
auto_scroll = false;
|
auto_scroll = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
auto_scroll &= !EditorSettings::get_global(cx).autoscroll_on_clicks;
|
||||||
|
|
||||||
let point_to_delete: Option<usize> = {
|
let point_to_delete: Option<usize> = {
|
||||||
let selected_points: Vec<Selection<Point>> =
|
let selected_points: Vec<Selection<Point>> =
|
||||||
|
|
|
@ -18,6 +18,7 @@ pub struct EditorSettings {
|
||||||
pub gutter: Gutter,
|
pub gutter: Gutter,
|
||||||
pub scroll_beyond_last_line: ScrollBeyondLastLine,
|
pub scroll_beyond_last_line: ScrollBeyondLastLine,
|
||||||
pub vertical_scroll_margin: f32,
|
pub vertical_scroll_margin: f32,
|
||||||
|
pub autoscroll_on_clicks: bool,
|
||||||
pub scroll_sensitivity: f32,
|
pub scroll_sensitivity: f32,
|
||||||
pub relative_line_numbers: bool,
|
pub relative_line_numbers: bool,
|
||||||
pub seed_search_query_from_cursor: SeedQuerySetting,
|
pub seed_search_query_from_cursor: SeedQuerySetting,
|
||||||
|
@ -222,6 +223,10 @@ pub struct EditorSettingsContent {
|
||||||
///
|
///
|
||||||
/// Default: 3.
|
/// Default: 3.
|
||||||
pub vertical_scroll_margin: Option<f32>,
|
pub vertical_scroll_margin: Option<f32>,
|
||||||
|
/// Whether to scroll when clicking near the edge of the visible text area.
|
||||||
|
///
|
||||||
|
/// Default: false
|
||||||
|
pub autoscroll_on_clicks: Option<bool>,
|
||||||
/// Scroll sensitivity multiplier. This multiplier is applied
|
/// Scroll sensitivity multiplier. This multiplier is applied
|
||||||
/// to both the horizontal and vertical delta values while scrolling.
|
/// to both the horizontal and vertical delta values while scrolling.
|
||||||
///
|
///
|
||||||
|
|
|
@ -133,6 +133,16 @@ Define extensions which should be installed (`true`) or never installed (`false`
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Autoscroll on Clicks
|
||||||
|
|
||||||
|
- Description: Whether to scroll when clicking near the edge of the visible text area.
|
||||||
|
- Setting: `autoscroll_on_clicks`
|
||||||
|
- Default: `false`
|
||||||
|
|
||||||
|
**Options**
|
||||||
|
|
||||||
|
`boolean` values
|
||||||
|
|
||||||
## Auto Update
|
## Auto Update
|
||||||
|
|
||||||
- Description: Whether or not to automatically check for updates.
|
- Description: Whether or not to automatically check for updates.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue