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 { } else if err = screen.Init(); err != nil {
log.Fatalf("initializing screen: %s", err) log.Fatalf("initializing screen: %s", err)
} }
screen.EnableMouse() if gOpts.mouse {
screen.EnableMouse()
}
f, err := os.Create(gLogPath) f, err := os.Create(gLogPath)
if err != nil { if err != nil {
+3
View File
@@ -97,6 +97,9 @@ var (
"incsearch", "incsearch",
"noincsearch", "noincsearch",
"incsearch!", "incsearch!",
"mouse",
"nomouse",
"mouse!",
"number", "number",
"nonumber", "nonumber",
"number!", "number!",
+5
View File
@@ -114,6 +114,7 @@ The following options can be used to customize the behavior of lf:
ignoredia bool (default on) ignoredia bool (default on)
incsearch bool (default off) incsearch bool (default off)
info []string (default '') info []string (default '')
mouse bool (default off)
number bool (default off) number bool (default off)
period int (default 0) period int (default 0)
preview bool (default on) 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'. 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. 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) number bool (default off)
Show the position number for directory items at the left side of pane. 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) ignoredia bool (default on)
incsearch bool (default off) incsearch bool (default off)
info []string (default '') info []string (default '')
mouse bool (default off)
number bool (default off) number bool (default off)
period int (default 0) period int (default 0)
preview bool (default on) 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 'ctime'. Information is only shown when the pane width is more than twice
the width of information. the width of information.
mouse bool (default off)
Send mouse events as input.
number bool (default off) number bool (default off)
Show the position number for directory items at the left side of pane. When 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 gOpts.incsearch = false
case "incsearch!": case "incsearch!":
gOpts.incsearch = !gOpts.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": case "number":
gOpts.number = true gOpts.number = true
case "nonumber": 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) ignoredia bool (default on)
incsearch bool (default off) incsearch bool (default off)
info []string (default '') info []string (default '')
mouse bool (default off)
number bool (default off) number bool (default off)
period int (default 0) period int (default 0)
preview bool (default on) preview bool (default on)
@@ -691,6 +692,12 @@ Jump to the first match after each keystroke during searching.
.PP .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. 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 .PP
.EX
mouse bool (default off)
.EE
.PP
Send mouse events as input.
.PP
.EX .EX
number bool (default off) number bool (default off)
.EE .EE
+2
View File
@@ -36,6 +36,7 @@ var gOpts struct {
ignorecase bool ignorecase bool
ignoredia bool ignoredia bool
incsearch bool incsearch bool
mouse bool
number bool number bool
preview bool preview bool
relativenumber bool relativenumber bool
@@ -75,6 +76,7 @@ func init() {
gOpts.ignorecase = true gOpts.ignorecase = true
gOpts.ignoredia = true gOpts.ignoredia = true
gOpts.incsearch = false gOpts.incsearch = false
gOpts.mouse = false
gOpts.number = false gOpts.number = false
gOpts.preview = true gOpts.preview = true
gOpts.relativenumber = false gOpts.relativenumber = false
+3 -1
View File
@@ -1122,7 +1122,9 @@ func (ui *ui) resume() {
} else if err = screen.Init(); err != nil { } else if err = screen.Init(); err != nil {
log.Fatalf("initializing screen: %s", err) log.Fatalf("initializing screen: %s", err)
} }
screen.EnableMouse() if gOpts.mouse {
screen.EnableMouse()
}
ui.screen = screen ui.screen = screen