mirror of
https://github.com/walles/moar.git
synced 2024-09-11 12:15:43 +03:00
Exit search on scroll keypresses
This commit is contained in:
parent
19f477b8e7
commit
2b5828275c
@ -1,6 +1,7 @@
|
|||||||
Moar is a pager. It's designed to just do the right thing without any
|
Moar is a pager. It's designed to just do the right thing without any
|
||||||
configuration:
|
configuration:
|
||||||
|
|
||||||
|
FIXME: Update this to the Go version
|
||||||
![Moar displaying its own test suite](http://walles.github.io/moar/images/moar.png)
|
![Moar displaying its own test suite](http://walles.github.io/moar/images/moar.png)
|
||||||
|
|
||||||
The intention is that Moar should work as a drop-in replacement for
|
The intention is that Moar should work as a drop-in replacement for
|
||||||
@ -89,9 +90,7 @@ FIXME: Go release instructions
|
|||||||
TODO
|
TODO
|
||||||
----
|
----
|
||||||
|
|
||||||
* Exit search on pressing up / down / pageup / pagedown keys and
|
* Remedy all FIXMEs in this README file
|
||||||
scroll. I attempted to do that spontaneously, so it's probably a
|
|
||||||
good idea.
|
|
||||||
|
|
||||||
* Release the `go` version as the new `moar`, replacing the previous Ruby
|
* Release the `go` version as the new `moar`, replacing the previous Ruby
|
||||||
implementation
|
implementation
|
||||||
@ -141,3 +140,7 @@ Done
|
|||||||
|
|
||||||
* Change out-of-file visualization to writing --- after the end of the
|
* Change out-of-file visualization to writing --- after the end of the
|
||||||
file and leaving the rest of the screen blank.
|
file and leaving the rest of the screen blank.
|
||||||
|
|
||||||
|
* Exit search on pressing up / down / pageup / pagedown keys and
|
||||||
|
scroll. I attempted to do that spontaneously, so it's probably a
|
||||||
|
good idea.
|
||||||
|
20
m/pager.go
20
m/pager.go
@ -411,6 +411,26 @@ func (p *_Pager) _OnSearchKey(logger *log.Logger, key tcell.Key) {
|
|||||||
p.searchString = p.searchString[:len(p.searchString)-1]
|
p.searchString = p.searchString[:len(p.searchString)-1]
|
||||||
p._UpdateSearchPattern()
|
p._UpdateSearchPattern()
|
||||||
|
|
||||||
|
case tcell.KeyUp:
|
||||||
|
// Clipping is done in _AddLines()
|
||||||
|
p.firstLineOneBased--
|
||||||
|
p.mode = _Viewing
|
||||||
|
|
||||||
|
case tcell.KeyDown:
|
||||||
|
// Clipping is done in _AddLines()
|
||||||
|
p.firstLineOneBased++
|
||||||
|
p.mode = _Viewing
|
||||||
|
|
||||||
|
case tcell.KeyPgUp:
|
||||||
|
_, height := p.screen.Size()
|
||||||
|
p.firstLineOneBased -= (height - 1)
|
||||||
|
p.mode = _Viewing
|
||||||
|
|
||||||
|
case tcell.KeyPgDn:
|
||||||
|
_, height := p.screen.Size()
|
||||||
|
p.firstLineOneBased += (height - 1)
|
||||||
|
p.mode = _Viewing
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logger.Printf("Unhandled search key event %v", key)
|
logger.Printf("Unhandled search key event %v", key)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user