Skip to content

Commit

Permalink
Implement basic double click delay (#2033)
Browse files Browse the repository at this point in the history
* Implement basic double click delay

Fixes #2031

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>

* Updated CHANGELOG

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>

* Reimplement using the event itself

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
  • Loading branch information
hbina committed Jan 18, 2023
1 parent 10a82f9 commit 3f842d9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- [#1972](https://github.com/lapce/lapce/pull/1972): Add file duplication option in fs tree context menu
- [#1991](https://github.com/lapce/lapce/pull/1991): Implement rendering of images in markdown views
- [#2004](https://github.com/lapce/lapce/pull/2004): Add ToggleHistory command
- [#2033](https://github.com/lapce/lapce/pull/2033): Add setting for double click delay (Currently only works for opening file from the explorer)

### Bug Fixes
- [#1911](https://github.com/lapce/lapce/pull/1911): Fix movement on selections with left/right arrow keys
Expand Down
1 change: 1 addition & 0 deletions defaults/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ multicursor-whole-words = true
render-whitespace = "none"
show-indent-guide = true
atomic-soft-tabs = false
double-click = false

[terminal]
font-family = ""
Expand Down
2 changes: 2 additions & 0 deletions lapce-data/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ pub struct EditorConfig {
desc = "If enabled the cursor treats leading soft tabs as if they are hard tabs."
)]
pub atomic_soft_tabs: bool,
#[field_names(desc = "Use double click to open interact with file explorer")]
pub double_click: bool,
}

impl EditorConfig {
Expand Down
5 changes: 4 additions & 1 deletion lapce-ui/src/explorer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,10 @@ impl Widget<LapceTabData> for FileExplorerFileList {
let file_explorer = Arc::make_mut(&mut data.file_explorer);
let index = ((mouse_event.pos.y + self.line_height)
/ self.line_height) as usize;
if mouse_event.button.is_left() {

if mouse_event.button.is_left()
&& (!data.config.editor.double_click || mouse_event.count == 2)
{
if let Some((_, node)) =
file_explorer.get_node_by_index_mut(index)
{
Expand Down

0 comments on commit 3f842d9

Please sign in to comment.