Johan Walles
99d83768c7
Fix a broken assertion
...
Fixes #188 . Sorry about this.
2024-01-17 07:55:18 +01:00
Johan Walles
f4af673d3c
Allow passing through multiple files
...
With this change in place you can invoke moar like this:
moar file1 file2 file3 | wc -l
Note that I believe this is a corner case, and I will on purpose leave
this undocumented.
Fixes #187
2024-01-16 16:35:27 +01:00
Johan Walles
c44f1e0a0b
Help text tuning
...
I learned about backticks in flag descriptions!
2024-01-15 10:47:59 +01:00
Johan Walles
f6fc1f15f0
Remove unused parameter
2024-01-15 10:31:14 +01:00
Johan Walles
29f3b9365a
Use the right color count for help printing
2024-01-15 10:27:34 +01:00
Johan Walles
68dc82e1dc
Make printout code lines easier to read
2024-01-15 10:18:09 +01:00
Johan Walles
507200fa52
Merge pull request #184 from walles/johan/check-terminal-background
...
Adapt theme to terminal background
2024-01-15 10:15:18 +01:00
Johan Walles
9da969b4f4
Merge branch 'master' into johan/check-terminal-background
2024-01-14 18:25:59 +01:00
Johan Walles
305d247190
Print less help on errors
...
But direct people to --help. This should make it more obvious what
actually went wrong.
2024-01-14 18:25:10 +01:00
Johan Walles
94a1f267c3
Remove unneeded parentheses
...
They just made the expression harder to read.
2024-01-14 12:17:46 +01:00
Johan Walles
2aa5dd364b
Be clearer when LESS_TERMCAP_xx are invalid
...
Relates to #170 .
2024-01-14 09:41:22 +01:00
Johan Walles
0d504e950d
Cosmetics
2024-01-13 12:43:29 +01:00
Johan Walles
5646a67ced
Prevent a useless warning message
2024-01-13 12:37:42 +01:00
Johan Walles
30c40dc0a7
Get terminal background color asynchronously
2024-01-13 12:36:26 +01:00
Johan Walles
0ddefbdeb7
Move background color detection code into twin
2024-01-13 11:52:01 +01:00
Johan Walles
711960c606
Clock bg color detection and log it
2024-01-13 10:28:30 +01:00
Johan Walles
f4884b5d2a
Use constants for the default themes
2024-01-13 10:20:18 +01:00
Johan Walles
86992161ec
Colors returned are 16 bits per component, not 8
2024-01-13 10:14:58 +01:00
Johan Walles
1dc180aa32
Log detected terminal background color
2024-01-13 10:11:52 +01:00
Johan Walles
7097d151e2
Set raw terminal state before querying for background color
2024-01-13 10:08:26 +01:00
Johan Walles
45009ef842
Try to auto detect terminal background color
...
And pick a theme based on that.
2024-01-13 10:03:21 +01:00
Johan Walles
df10236ea5
Prep for auto style based on terminal background color
2024-01-13 09:20:32 +01:00
Johan Walles
f6571b3942
Improve color downsampling
...
Tested on the green-gradient.txt sample file, looks much better after
this change.
2024-01-12 15:01:37 +01:00
Johan Walles
a9832386f2
Merge branch 'johan/fix-done'
...
Fixes #183 by making sure both file loaded and file highlighted are
reported as they should.
2024-01-12 09:40:41 +01:00
Johan Walles
9fa0ad682a
Make all tests pass
2024-01-12 09:28:56 +01:00
Johan Walles
559165c091
Remove redundant code
...
Already done inside of highlightFromMemory().
2024-01-12 08:55:18 +01:00
Johan Walles
b2068fad01
Prevent a race in the tests
2024-01-12 08:54:57 +01:00
Johan Walles
3e9a8d7f01
Make the waiting tests pass
2024-01-12 08:48:13 +01:00
Johan Walles
2e1dd0ec82
Use the same waiting code in all places
2024-01-12 08:40:08 +01:00
Johan Walles
9f3f62d6ee
Add tests for reader done reporting
2024-01-12 08:34:21 +01:00
Johan Walles
ba00295011
Render non-breaking spaces
...
As spaces. Go's unicode.IsPrint() doesn't consider them printable, but
they are just spaces so we should print them anyway.
Just tested this in ITerm2 and it works fine.
2024-01-11 09:33:23 +01:00
Johan Walles
35c89d69d0
Merge branch 'johan/man-page-headings-space'
...
Accept non-bold whitespace in man page headings.
2024-01-11 09:01:46 +01:00
Johan Walles
96430848a3
Fix broken tests
2024-01-11 09:00:32 +01:00
Johan Walles
9bb857fe74
Attempt reimplementing the state machine
...
With support for both bold and not-bold whitespace.
Tests fail.
2024-01-11 08:54:18 +01:00
Johan Walles
06747d3c96
WIP Restart heading parsing implementation
2024-01-11 06:29:10 +01:00
Johan Walles
84f332d020
Test that bold spaces also work
2024-01-11 06:28:47 +01:00
Johan Walles
89f7309854
Add another man page heading test
2024-01-10 23:05:28 +01:00
Johan Walles
7672b755e7
Whitespace in man page headings can be not-bold
...
Add a failing test for this.
2024-01-10 22:57:31 +01:00
Johan Walles
75592ac471
Print less text on bad command lines
...
Hopefully this change could have made this situation more obvious:
https://github.com/walles/moar/issues/170#issuecomment-1869806311
2024-01-10 22:49:46 +01:00
Johan Walles
0c8bf3ce7a
Merge branch 'johan/man-page-headings'
...
Use GenericHeading style for man page headings.
Related to #170 .
2024-01-10 17:31:10 +01:00
Johan Walles
4d3eef299a
Fix a broken test
2024-01-10 17:29:25 +01:00
Johan Walles
319d777c56
Properly detect man page headers while rendering
2024-01-10 17:26:44 +01:00
Johan Walles
190e362f14
Update a test
...
So it doesn't get special treatment from being identified as a heading.
2024-01-10 17:19:58 +01:00
Johan Walles
ce89f69b1c
Test highlighing man page headers
...
Fails.
2024-01-10 17:17:14 +01:00
Johan Walles
2e6d79a177
Use the right index
2024-01-10 17:00:28 +01:00
Johan Walles
a72423cffc
Add a test
2024-01-10 16:50:20 +01:00
Johan Walles
96bf1394fc
Optimize out a unicode operation in the common case
...
Common case = no backspaces in the string.
2024-01-10 16:50:20 +01:00
Johan Walles
fe0e5493ab
Headings do not start with whitespace
2024-01-10 16:50:20 +01:00
Johan Walles
4ccc36732d
Fix a heading identification bug
2024-01-10 16:50:20 +01:00
Johan Walles
3b16284ed9
Use GenericHeading for man page headings
2024-01-10 16:50:20 +01:00