Skip to content

Commit

Permalink
When clicking on file preview, only open files on right-click
Browse files Browse the repository at this point in the history
Currently, when mouse is on, I often click on the preview accidentally
since it's such a large target. Moreover, there is very little space I
can click without having the `lf` state change drastically (since I must
click on the current file for the preview to stay the same).

This commit prevents that.
  • Loading branch information
ilyagr committed Oct 23, 2022
1 parent a94015d commit 904113b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ The following additional keybindings are provided by default:
If the 'mouse' option is enabled, mouse buttons have the following default effects:
Left mouse button
Click on a file or directory to select it. To open a file, click on the preview.
Click on a file or directory to select it.
Right mouse button
Enter a directory or open a file.
Enter a directory or open a file. Also works on the preview window.
Scroll wheel
Scroll up or down.
Expand Down
4 changes: 2 additions & 2 deletions docstring.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lf.1
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ If the 'mouse' option is enabled, mouse buttons have the following default effec
.PP
.EX
Left mouse button
Click on a file or directory to select it. To open a file, click on the preview.
Click on a file or directory to select it.
.EE
.PP
.EX
Right mouse button
Enter a directory or open a file.
Enter a directory or open a file. Also works on the preview window.
.EE
.PP
.EX
Expand Down
3 changes: 3 additions & 0 deletions ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,9 @@ func (ui *ui) readNormalEvent(ev tcell.Event, nav *nav) expr {
if err != nil {
return nil
} else if !curr.IsDir() || gOpts.dirpreviews {
if tev.Buttons() != tcell.Button2 {
return nil
}
return &callExpr{"open", nil, 1}
}
dir = ui.dirPrev
Expand Down

0 comments on commit 904113b

Please sign in to comment.