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
Johan Walles
a66f8b41ba
Don't highlight extensionless files
2019-07-15 18:32:43 +02:00
Johan Walles
1103ebf5bc
Add tokenizer tests
2019-07-15 13:34:42 +02:00
Johan Walles
35429e672b
Make first line read appear immediately
2019-07-15 07:08:04 +02:00
Johan Walles
2bc8215d59
Stop logging more-lines events as unhandled
2019-07-14 23:18:26 +02:00
Johan Walles
480bbc031e
Only update display every 200ms
...
Even if we get multiple lines during that time. This improves CPU usage,
and most likely responsiveness.
2019-07-14 23:10:54 +02:00
Johan Walles
937951d610
Fix pager hangs
2019-07-14 18:59:21 +02:00
Johan Walles
bfbdadd6c7
Minor clarifications
2019-07-13 22:55:21 +02:00
Johan Walles
195f48f229
Move stream reading into its own function
2019-07-12 06:35:08 +02:00
Johan Walles
447da01d49
Handle new lines arriving
...
We display the lines, but we also just freeze. Try "./moar.sh moar.sh"
and try to search and you'll see.
2019-07-11 18:52:20 +02:00
Johan Walles
106626388d
Notify a channel after we read a line
2019-07-11 18:34:10 +02:00
Johan Walles
c4c2027dfc
Comment out some failing tests
...
They do find errors, but this branch is not the place to fix those.
2019-07-10 06:44:10 +02:00
Johan Walles
c1665113e6
Add more tests, find more problems...
2019-07-10 00:21:36 +02:00
Johan Walles
a43aafe7b9
Fix concurrency issues in the tests...
...
... and unveil actual highlighting problems.
2019-07-09 23:41:49 +02:00
Johan Walles
ddee885e92
Make tests compile
...
But not pass. The tests need to wait for the reader to get done before
verifying what it did.
2019-07-09 19:57:32 +02:00
Johan Walles
0a6dbbe909
Input now read in the background, but...
...
... the reader still needs to notify the pager when new lines are
available, and the pager must update the display if it would affect the
display, but not too often.
2019-07-09 19:53:04 +02:00
Johan Walles
56feddd038
Code reshufflings
...
Pager still doesn't show anything.
2019-07-09 06:12:18 +02:00
Johan Walles
399d5d6975
WIP: First stab at background reading
...
Try ./moar.sh moar.sh, nothing is shown. Fix stuff.
2019-07-08 18:58:37 +02:00
Johan Walles
f97e50fe2c
Add two comments
2019-07-08 08:58:53 +02:00
Johan Walles
2f5c2da2e3
Case insensitive search on lowercase-only pattern
2019-07-06 22:16:08 +02:00
Johan Walles
ea5b4fdefe
Extract search string compilation into its own testable function
2019-07-06 13:51:48 +02:00
Johan Walles
633d4b0db7
Scroll left and right using arrow keys
2019-07-06 13:33:41 +02:00
Johan Walles
16c92de86c
Add support for searching backwards
2019-07-06 10:31:40 +02:00
Johan Walles
0f7ae9d089
Warn about unexpected pager modes
2019-07-06 07:54:33 +02:00
Johan Walles
ed657dbde6
Implement searching for next hit
2019-07-06 07:45:07 +02:00
Johan Walles
7d6f1f5361
Scroll to first hit while typing
2019-06-30 22:16:04 +02:00
Johan Walles
9693c91aac
Reset search on new '/'
2019-06-30 22:15:27 +02:00
Johan Walles
f16d818715
Have the tokenizer provide an unformatted string as well
2019-06-30 15:06:33 +02:00
Johan Walles
4541f7fb08
Fix crash before first search
2019-06-30 09:53:24 +02:00
Johan Walles
af10a5f6c7
Add search matching functionality
2019-06-30 09:43:58 +02:00
Johan Walles
8a8672a1e9
Add logic for highlighting search hits
2019-06-29 18:29:37 +02:00
Johan Walles
8a9470c651
Add a cursor when entering the search string
2019-06-29 11:24:03 +02:00
Johan Walles
656c01456e
Enable entering a search string
2019-06-29 11:20:48 +02:00
Johan Walles
917a096270
Support / for search mode, ESC for back to view
2019-06-28 22:43:03 +02:00
Johan Walles
e78f452557
Add support for man page rendering
2019-06-27 21:39:46 +02:00
Johan Walles
94007d767c
Plan for more filter testing
2019-06-25 19:44:22 +02:00
Johan Walles
fd10508c8d
Implement transparent decompression
2019-06-24 21:55:33 +02:00
Johan Walles
e640c7d856
Add (failing) compressed-files tests
2019-06-23 21:30:11 +02:00
Johan Walles
70500056af
Show file name and line numbers
2019-06-21 23:24:53 +02:00
Johan Walles
8b0e695a82
Prepare for dynamic footer from the GetLines() result
2019-06-18 21:58:17 +02:00
Johan Walles
7a33e82ba1
It's already there
2019-06-18 20:19:07 +02:00
Johan Walles
7517856fda
Add usability FIXME
2019-06-18 20:17:56 +02:00
Johan Walles
c33fd4eb47
Add missing SGI code
...
00 is produced by highlight.
2019-06-18 20:12:35 +02:00
Johan Walles
bd4f7c5567
Fix the glitch
2019-06-18 20:11:27 +02:00
Johan Walles
f546e05cb7
Code complete, doesn't work
2019-06-18 20:06:38 +02:00
Johan Walles
1ec6216ab1
Add code highlighting test
2019-06-18 19:47:23 +02:00
Johan Walles
5cc47df367
Render broken UTF8 as red-on-white question marks
...
The default broken UTF8 marker in Go doesn't render well in my terminal.
2019-06-18 19:08:35 +02:00
Johan Walles
3011b15a09
Add note about broken UTF8
2019-06-17 22:22:17 +02:00
Johan Walles
9619c020e4
Add support for rendering TABs
2019-06-17 21:39:57 +02:00
Johan Walles
42c45aedae
Simplify Reader API
2019-06-16 21:54:25 +02:00
Johan Walles
e4006b2c78
Support inverse video
2019-06-16 21:39:27 +02:00
Johan Walles
aa1cd1da5f
Actually match moar and less output colors
2019-06-16 21:26:04 +02:00
Johan Walles
eecd9120cd
Look more like Ruby moar and less
2019-06-16 21:12:08 +02:00
Johan Walles
75760fb7fa
Support rendering bold text
2019-06-16 20:58:19 +02:00
Johan Walles
4717624c89
Handle background color changes
2019-06-16 20:57:03 +02:00
Johan Walles
0ba1efbe46
Handle mouse wheel scroll better
...
Before this change, if you scrolled up a lot with the mouse wheel, thus
creating many arrow-up events, you could sometimes escape and start
scrolling into the terminal's scrollback buffer (iTerm2, macOS).
With this change in place that doesn't happen any more.
I don't understand why.
The difference between Sync() and Show() is that:
* Sync() redraws the entire screen unconditionally
* Show() tries to update only the parts of the screen that actually changed
2019-06-16 20:33:18 +02:00
Johan Walles
a1cdf0c200
Add logging
2019-06-16 10:02:19 +02:00
Johan Walles
abe8f37eaf
Fix an off-by-one error
2019-06-16 09:23:25 +02:00
Johan Walles
d7dacd4dae
WIP: Implement ANSI foreground color setting
...
Doesn't work, but the parts are there. Go fix.
2019-06-16 09:14:30 +02:00
Johan Walles
38f3c28faf
FIXME: Add broken-UTF8 tests
2019-06-15 17:13:10 +02:00
Johan Walles
0336c55a71
Add tests for ANSI foreground color support
2019-06-15 17:10:31 +02:00
Johan Walles
86007b3293
Remove useless threading
2019-06-15 09:23:53 +02:00
Johan Walles
a9b8b5b9d5
Fix displaying UTF-8 runes
...
Before this change we displayed spaces after each UTF-8 rune.
With this change in place the extra spaces are gone.
2019-06-15 08:10:56 +02:00
Johan Walles
29f497ef19
Print footer line in reverse video
2019-06-14 07:08:20 +02:00
Johan Walles
e4b83d91b5
Fix another off-by-one error
2019-06-14 06:59:19 +02:00
Johan Walles
0abaf16da5
Fix off-by-one error in the _Reader
2019-06-14 06:49:27 +02:00
Johan Walles
da30eaf956
Handle displaying empty files
...
And introduce a unit test!
2019-06-13 20:04:51 +02:00
Johan Walles
f6b5755501
Add some more moar.rb keybindings
2019-06-13 15:56:06 +02:00
Johan Walles
a241dcf6ca
PgUp / PgDown
2019-06-13 06:21:43 +02:00
Johan Walles
a14ecc3168
Support moving to top / bottom
2019-06-13 06:14:41 +02:00
Johan Walles
74d4d26112
Support scrolling up and down with arrow buttons
2019-06-12 21:55:09 +02:00
Johan Walles
b7311e5785
Show file contents
2019-06-12 07:07:13 +02:00
Johan Walles
6436cce8f6
Add support for handling keypresses
2019-06-11 21:32:24 +02:00
Johan Walles
95132357b1
Split event handling into more readable pieces
2019-06-11 21:28:21 +02:00
Johan Walles
ab9702953f
Better resource cleanup
2019-06-11 21:22:32 +02:00
Johan Walles
6143f3f55f
Moar state in the struct
2019-06-11 21:21:12 +02:00
Johan Walles
78c12f8d2f
Moar methods, less functions
2019-06-11 21:09:57 +02:00
Johan Walles
29183c1eeb
Print a footer at the bottom
2019-06-11 18:52:38 +02:00
Johan Walles
6f13bde11e
Show blank screen and wait for user input
2019-06-11 18:29:30 +02:00
Johan Walles
12210d923d
Read from the correct stream
...
Not always from stdin.
2019-06-11 18:28:36 +02:00
Johan Walles
9bf41e8f43
It's *supposed* to be private
...
I think...
2019-06-11 15:31:26 +02:00
Johan Walles
289dd35bd6
Fix compile error
2019-06-11 13:26:04 +02:00
Johan Walles
e23eaddabd
Add placeholder code for starting the pager
...
This version doesn't compile and I don't know why.
2019-06-10 21:50:31 +02:00