summaryrefslogtreecommitdiff
path: root/src/tui/tui.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-01-27 01:10:08 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-01-27 01:10:08 +0900
commite91f10ab167f10328816fab65fc38370059986f3 (patch)
treef8e7d059843f3a7a81835a888fe29d7588ee4038 /src/tui/tui.go
parent2c15cd792306119ead573c473c982b6996e11952 (diff)
downloadfzf-e91f10ab167f10328816fab65fc38370059986f3.tar.gz
Enhance click-header event
* Expose the name of the mouse action as $FZF_KEY * Trigger click-header on mouse up * Enhanced clickable header for `kill` completion
Diffstat (limited to 'src/tui/tui.go')
-rw-r--r--src/tui/tui.go36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/tui/tui.go b/src/tui/tui.go
index eab5ad7e..fe8fc243 100644
--- a/src/tui/tui.go
+++ b/src/tui/tui.go
@@ -150,6 +150,10 @@ func (e Event) Comparable() Event {
}
func (e Event) KeyName() string {
+ if me := e.MouseEvent; me != nil {
+ return me.Name()
+ }
+
if e.Type >= Invalid {
return ""
}
@@ -367,7 +371,37 @@ type MouseEvent struct {
Left bool
Down bool
Double bool
- Mod bool
+ Ctrl bool
+ Alt bool
+ Shift bool
+}
+
+func (e MouseEvent) Mod() bool {
+ return e.Ctrl || e.Alt || e.Shift
+}
+
+func (e MouseEvent) Name() string {
+ name := ""
+ if e.Down {
+ return name
+ }
+
+ if e.Ctrl {
+ name += "ctrl-"
+ }
+ if e.Alt {
+ name += "alt-"
+ }
+ if e.Shift {
+ name += "shift-"
+ }
+ if e.Double {
+ name += "double-"
+ }
+ if !e.Left {
+ name += "right-"
+ }
+ return name + "click"
}
type BorderShape int