add 'mouse' option to enable/disable mouse events

cc #268 #570
This commit is contained in:
Gokcehan committed 2021-01-29 19:36:27 +03:00
1 parent 1163efb7aa
commit 13d19d84f9
8 files changed
+46 -2

No files matched your search

+3 -1
View File
@@ -21,7 +21,9 @@ func run() {
} else if err = screen.Init(); err != nil {
log.Fatalf("initializing screen: %s", err)
}
screen.EnableMouse()
if gOpts.mouse {
screen.EnableMouse()
}
f, err := os.Create(gLogPath)
if err != nil {
+3
View File
@@ -97,6 +97,9 @@ var (
"incsearch",
"noincsearch",
"incsearch!",
"mouse",
"nomouse",
"mouse!",
"number",
"nonumber",
"number!",
+5
View File
@@ -114,6 +114,7 @@ The following options can be used to customize the behavior of lf:
ignoredia bool (default on)
incsearch bool (default off)
info []string (default '')
mouse bool (default off)
number bool (default off)
period int (default 0)
preview bool (default on)
@@ -569,6 +570,10 @@ List of information shown for directory items at the right side of pane.
Currently supported information types are 'size', 'time', 'atime', and 'ctime'.
Information is only shown when the pane width is more than twice the width of information.
mouse bool (default off)
Send mouse events as input.
number bool (default off)
Show the position number for directory items at the left side of pane.
+5
View File
@@ -117,6 +117,7 @@ The following options can be used to customize the behavior of lf:
ignoredia bool (default on)
incsearch bool (default off)
info []string (default '')
mouse bool (default off)
number bool (default off)
period int (default 0)
preview bool (default on)
@@ -600,6 +601,10 @@ Currently supported information types are 'size', 'time', 'atime', and
'ctime'. Information is only shown when the pane width is more than twice
the width of information.
mouse bool (default off)
Send mouse events as input.
number bool (default off)
Show the position number for directory items at the left side of pane. When
+18
View File
@@ -110,6 +110,24 @@ func (e *setExpr) eval(app *app, args []string) {
gOpts.incsearch = false
case "incsearch!":
gOpts.incsearch = !gOpts.incsearch
case "mouse":
if !gOpts.mouse {
gOpts.mouse = true
app.ui.screen.EnableMouse()
}
case "nomouse":
if gOpts.mouse {
gOpts.mouse = false
app.ui.screen.DisableMouse()
}
case "mouse!":
if gOpts.mouse {
gOpts.mouse = false
app.ui.screen.DisableMouse()
} else {
gOpts.mouse = true
app.ui.screen.EnableMouse()
}
case "number":
gOpts.number = true
case "nonumber":
+7
View File
@@ -128,6 +128,7 @@ The following options can be used to customize the behavior of lf:
ignoredia bool (default on)
incsearch bool (default off)
info []string (default '')
mouse bool (default off)
number bool (default off)
period int (default 0)
preview bool (default on)
@@ -691,6 +692,12 @@ Jump to the first match after each keystroke during searching.
.PP
List of information shown for directory items at the right side of pane. Currently supported information types are 'size', 'time', 'atime', and 'ctime'. Information is only shown when the pane width is more than twice the width of information.
.PP
.EX
mouse bool (default off)
.EE
.PP
Send mouse events as input.
.PP
.EX
number bool (default off)
.EE
+2
View File
@@ -36,6 +36,7 @@ var gOpts struct {
ignorecase bool
ignoredia bool
incsearch bool
mouse bool
number bool
preview bool
relativenumber bool
@@ -75,6 +76,7 @@ func init() {
gOpts.ignorecase = true
gOpts.ignoredia = true
gOpts.incsearch = false
gOpts.mouse = false
gOpts.number = false
gOpts.preview = true
gOpts.relativenumber = false
+3 -1
View File
@@ -1122,7 +1122,9 @@ func (ui *ui) resume() {
} else if err = screen.Init(); err != nil {
log.Fatalf("initializing screen: %s", err)
}
screen.EnableMouse()
if gOpts.mouse {
screen.EnableMouse()
}
ui.screen = screen