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
Johan Walles
b0cf8bc4c8
Fix a crash on 32 bit systems
...
Fixes #18
diff --git m/pager.go m/pager.go
index 178c828..b7cce09 100644
--- m/pager.go
+++ m/pager.go
@@ -3,7 +3,6 @@ package m
import (
"fmt"
"log"
- "math"
"os"
"regexp"
"time"
@@ -507,7 +506,7 @@ func (p *Pager) _OnKey(logger *log.Logger, key tcell.Key) {
p.firstLineOneBased = 1
case tcell.KeyEnd:
- p.firstLineOneBased = math.MaxInt32
+ p.firstLineOneBased = p.reader.GetLineCount()
case tcell.KeyPgDn:
_, height := p.screen.Size()
@@ -565,7 +564,7 @@ func (p *Pager) _OnRune(logger *log.Logger, char rune) {
p.firstLineOneBased = 1
case '>', 'G':
- p.firstLineOneBased = math.MaxInt32
+ p.firstLineOneBased = p.reader.GetLineCount()
case 'f', ' ':
_, height := p.screen.Size()
Change-Id: I17712d93322703ae3fa5b54a5a07169ddd1357c4
2019-11-13 16:17:26 +01:00
Johan Walles
ad4c545df0
Add another match ranges test
2019-11-06 21:40:14 +01:00
Johan Walles
ea3dcf3ca5
Fix a crash
2019-11-06 21:38:39 +01:00
Johan Walles
fb3b6abbe7
Pass the tests
...
But crash the app.
Do:
* ./moar.sh sample-files/long-and-wide.txt
* Search (/) for "monkey"
2019-11-06 20:30:59 +01:00
Johan Walles
494032278b
Fix some failing tests
2019-11-06 18:50:34 +01:00
Johan Walles
df1702ac21
Test that match ranges are by rune not by byte
2019-11-06 06:50:53 +01:00
Johan Walles
109f40e7ed
Prettify
2019-11-05 21:30:04 +01:00
Johan Walles
81fe99f366
WIP: Test search highlights
2019-11-05 21:20:06 +01:00
Johan Walles
ab0e62123b
WIP: Line rendering tests
...
Implement search hits tests as well.
2019-11-05 21:09:45 +01:00
Johan Walles
8e08e729c4
Fix environment depending test failure
2019-11-05 08:32:06 +01:00
Johan Walles
742401ec82
Fix crash removing unicode char from search string
...
Fixes #12
2019-11-02 12:19:04 +01:00
Johan Walles
6334be7dcc
Adapt to LESS_TERMCAP_md and LESS_TERMCAP_us
...
Fixes #14
2019-10-30 20:29:29 +01:00
Johan Walles
a7cba8bb16
Move man page formats into variables
2019-10-30 20:13:28 +01:00
Johan Walles
a4ec70fea3
Add man page formatting tests
2019-10-30 18:47:49 +01:00
Johan Walles
ad0f174651
Make loading spinner more obvious
2019-10-29 22:05:42 +01:00
Johan Walles
1ed285d13b
Merge branch 'walles/moar-colors'
...
Adds eight and twenty four bits color support.
2019-10-29 06:09:25 +01:00
Johan Walles
7405293e25
Add sample file for color handling
...
From #14
2019-10-28 21:54:57 +01:00
Johan Walles
04cd520d0e
Fix the last color handling tests
2019-10-28 21:46:18 +01:00
Johan Walles
1dda4b1a87
Handle 24 bit color
2019-10-28 20:30:04 +01:00
Johan Walles
94774e121a
Report final error message
2019-10-28 20:21:39 +01:00
Johan Walles
8b9e85958c
Handle 8 bit colors
2019-10-28 20:18:07 +01:00
Johan Walles
f973ed5c46
Report incomplete color sequence
2019-10-28 20:09:08 +01:00
Johan Walles
86b5f93895
Add another test
2019-10-27 21:45:26 +01:00
Johan Walles
e1eb4fd51e
Fix an assertion test
2019-10-27 21:43:33 +01:00
Johan Walles
7b935e7c49
Sanity check input
2019-10-27 21:40:30 +01:00
Johan Walles
3f35a545f9
Turn some test errors into failures
2019-10-27 18:53:08 +01:00
Johan Walles
53328770ec
Test incomplete 24 bit sequences
2019-10-27 10:11:25 +01:00
Johan Walles
4f731c37d8
Test incomplete 8 bit sequence
2019-10-27 10:07:34 +01:00
Johan Walles
295db4efa3
Test mid-sequence error reporting
2019-10-27 10:03:57 +01:00
Johan Walles
31946bc74e
Test happy case mid sequence
2019-10-27 09:58:26 +01:00
Johan Walles
b73810dc14
WIP: Initial tests for 8/24 bit color
2019-10-27 09:15:16 +01:00
Johan Walles
7a4e5a36bc
Fix a warning
2019-10-25 19:24:37 +02:00
Johan Walles
1eacd211b1
Merge branch 'walles/highlight-in-progress'
2019-10-16 06:24:50 +02:00
Johan Walles
d3e3dc75a9
Animate the EOF marker
2019-10-16 06:09:21 +02:00
Johan Walles
b13c904c51
Add rolling ... to status bar while loading
2019-10-16 06:01:49 +02:00
Johan Walles
c756bd0288
Support SGR 4, underline
...
diff --git m/ansiTokenizer.go m/ansiTokenizer.go
index 365b76a..7161bc6 100644
--- m/ansiTokenizer.go
+++ m/ansiTokenizer.go
@@ -179,6 +179,9 @@ func _UpdateStyle(logger *log.Logger, style tcell.Style, escapeSequence string)
case "1":
style = style.Bold(true)
+ case "4":
+ style = style.Underline(true)
+
case "7":
style = style.Reverse(true)
@@ -226,7 +229,7 @@ func _UpdateStyle(logger *log.Logger, style tcell.Style, escapeSequence string)
style = style.Background(tcell.ColorDefault)
default:
- logger.Printf("Unrecognized ANSI SGI code <%s>", number)
+ logger.Printf("Unrecognized ANSI SGR code <%s>", number)
}
}
Change-Id: I0527cbaff8b53cf25c99876789d69412af5ca118
2019-09-25 13:41:50 +02:00
Johan Walles
2b5828275c
Exit search on scroll keypresses
2019-08-04 07:40:26 +02:00
Johan Walles
19f477b8e7
Add "---" as an EOF-marker for short files
2019-08-04 07:15:35 +02:00
Johan Walles
5bb74e4f10
Fix search highlighting
...
After scrolling right.
2019-08-03 23:21:40 +02:00
Johan Walles
df9920c11c
Add scroll-right markers
...
For lines extending to the right of the screen width.
2019-08-03 20:14:22 +02:00
Johan Walles
193805abc9
Re-plan future development
2019-07-26 19:40:40 +02:00
Johan Walles
4f7c404845
Formulate the help text
2019-07-26 19:15:24 +02:00
Johan Walles
bcc83f9d0a
Actually show some text on pressing "h"
2019-07-26 19:07:51 +02:00
Johan Walles
009d890dbc
Initial built-in help commit
...
Help text needs to be written, and a NewReaderFromText() function needs
implementing.
2019-07-26 09:26:58 +02:00
Johan Walles
8fbf3dfaa7
Report file IO problems even for filtered files
...
Before this change, trying to open a filterable file that didn't exist,
like "REAXDME.md" for example, would result in us displaying an empty
pager.
With this change in place, that now results in an error message.
2019-07-25 07:46:58 +02:00
Johan Walles
a77d4f058c
Only inform about PAGER= if we're not already it
2019-07-15 22:43:27 +02:00
Johan Walles
d2e94fd26c
Take control of --help output
2019-07-15 22:14:36 +02:00
Johan Walles
ebba21a409
Dodge corner case issue
...
If call "highlight" on an empty file the output will have a line.
We don't really care about that.
This change renames empty.txt (which highlight wants to highlight) into
just "empty", which highlight will not try to highligt, so no line is
added and the test passes.
2019-07-15 18:49:25 +02:00
Johan Walles
0f0c8a1111
Don't highlight files with unsupported file extensions
2019-07-15 18:46:53 +02:00