1
1
mirror of https://github.com/walles/moar.git synced 2024-11-11 00:27:04 +03:00
moar/m
Johan Walles 7fcf99b006 Handle mouse events
Fixes #16
diff --git m/pager.go m/pager.go
index b7cce09..16e91e7 100644
--- m/pager.go
+++ m/pager.go
@@ -611,6 +611,7 @@ func (p *Pager) StartPaging(logger *log.Logger, screen tcell.Screen) {
 	}

 	p.screen = screen
+	screen.EnableMouse()
 	screen.Show()
 	p._Redraw(logger, "")

@@ -672,6 +673,17 @@ func (p *Pager) StartPaging(logger *log.Logger, screen tcell.Screen) {
 				p._OnKey(logger, ev.Key())
 			}

+		case *tcell.EventMouse:
+			switch ev.Buttons() {
+			case tcell.WheelUp:
+				// Clipping is done in _AddLines()
+				p.firstLineOneBased--
+
+			case tcell.WheelDown:
+				// Clipping is done in _AddLines()
+				p.firstLineOneBased++
+			}
+
 		case *tcell.EventResize:
 			// We'll be implicitly redrawn just by taking another lap in the loop

Change-Id: I3c9971077de9a720b90d6d91960f7f33a3a089e3
2019-11-14 07:45:15 +01:00
..
ansiTokenizer_test.go Add man page formatting tests 2019-10-30 18:47:49 +01:00
ansiTokenizer.go Fix environment depending test failure 2019-11-05 08:32:06 +01:00
matchRanges_test.go Add another match ranges test 2019-11-06 21:40:14 +01:00
matchRanges.go Fix a crash 2019-11-06 21:38:39 +01:00
pager_test.go Pass the tests 2019-11-06 20:30:59 +01:00
pager.go Handle mouse events 2019-11-14 07:45:15 +01:00
reader_test.go Report file IO problems even for filtered files 2019-07-25 07:46:58 +02:00
reader.go Actually show some text on pressing "h" 2019-07-26 19:07:51 +02:00