1
1
mirror of https://github.com/walles/moar.git synced 2024-08-17 07:50:35 +03:00
Commit Graph

1025 Commits

Author SHA1 Message Date
Johan Walles
917f75d591 Make the tests pass 2024-04-07 08:25:07 +02:00
Johan Walles
4357eda016 Fix the issue, break testing 2024-04-06 09:03:27 +02:00
Johan Walles
02209f3d1d Add compressed file highlighting test case
For the initial part of <https://github.com/walles/moar/issues/204>.
2024-04-06 08:32:34 +02:00
Johan Walles
056c766bd3 Handle a potential null value
I don't understand how this happens, but:
* It's uncommon
* It's been reported once during startup
* I'm assuming this is a race condition during startup
* Let's just treat the scroll position as zero if unset

Then let's cross our fingers and hope we don't crash anywhere else in
this situation.

Fixes: https://github.com/walles/moar/issues/198
2024-03-20 06:55:29 +01:00
Johan Walles
e92b01da07 Make panic messages look nicer
Cred to @daniejstriata for this flag:
https://github.com/walles/moar/issues/201#issuecomment-1991628189
2024-03-19 07:05:32 +01:00
Johan Walles
4939e6a123 Improve marketing value
Ref: https://github.com/walles/moar/issues/103
2024-03-18 19:20:51 +01:00
Johan Walles
b82895c3b6 Merge branch 'johan/await-first-byte'
Fixes #199
2024-03-18 18:08:20 +01:00
Johan Walles
f05d6a0e83 Only report first byte on read success 2024-03-18 18:06:10 +01:00
Johan Walles
350c370db6 Fix synchronization
After testing it. We used to crash, you are not allowed to close
already-closed channels.
2024-03-18 17:57:34 +01:00
Johan Walles
1395ea5628 Implement pumping reader to stdout 2024-03-17 19:04:34 +01:00
Johan Walles
3c03abcef8 Don't set up the screen too early 2024-03-17 01:04:49 +01:00
Johan Walles
6e8cd95c36 Try fixing sudo | moar
By waiting for the first byte to arrive before starting the UI.
2024-03-17 00:55:04 +01:00
Johan Walles
caafc5ed12 Save some milliseconds on startup
By starting to read the input stream before we query the terminal for
its background color.
2024-03-17 00:33:54 +01:00
Johan Walles
3661bd24d7 Enable setting style after creating a reader
Prep for improving startup latency. Not by much, but still.
2024-03-17 00:29:33 +01:00
Johan Walles
8e360ae07f Prevent a crash
When entering `0` as the go-to-line number.

Reported here:
https://github.com/walles/moar/issues/199

Note that this just prevents the crash, but it doesn't make sudo work
any better so the ticket should still be open.
2024-03-13 06:49:20 +01:00
Johan Walles
8106824116 Hide line numbers on man pages
By default. Press left arrow to get them back. Or use start moar with
--no-linenumbers=false.

`man` starts by checking the terminal width, and then formats man pages
to fit that width.

Then, if moar adds line numbers, the rightmost part of the man page
will be shifted out of view.

So we try to detect showing man pages, and in that case disable line
numbers so that the rightmost part of the page is visible by default.

Fixes #200.
2024-03-10 12:19:39 +01:00
Johan Walles
b5d86961ed Fix a linter complaint
Why wasn't this seen until now?
2024-02-16 12:50:58 +01:00
Johan Walles
7fd69ad308 Decompress .tgz files befire "showing" them
These files are archives, which moar is not designed to view. However,
for tar files containing text, decompressing them before showing them
will make at least text files in the archive readable.

Fixes #194.
2024-02-16 12:44:07 +01:00
Johan Walles
59270d6f8c Print COLORTERM value with --help
Since it affects moar's default color rendering mode.
2024-02-10 19:09:42 +01:00
Johan Walles
01f97736f2
Merge pull request #195 from Wallunen/colorterm
Use 24-bit color if `COLORTERM=truecolor` is in the environment
2024-02-10 19:05:58 +01:00
Johan Walles
c07c9a9942 Print TERM and TERM_PROGRAM with --help
Since they affect colors and scrolling defaults.
2024-02-10 19:00:10 +01:00
Wallunen
e5a600b51d
Use 24-bit color if COLORTERM=truecolor is in the environment 2024-02-10 02:56:00 +02:00
Johan Walles
1043d3feb7 Add an empty line before the env vars section
If needed.
2024-01-29 23:44:08 +01:00
Johan Walles
6ca69b954d On --help, print all *PAGER env vars 2024-01-29 23:38:20 +01:00
Johan Walles
1a42bc8f30
Merge pull request #192 from m154k1/rio
Use the "select" mouse mode on Rio
2024-01-27 14:51:51 +01:00
m154k1
23ec0e3816 Use the "select" mouse mode on Rio 2024-01-27 00:30:54 +02:00
Johan Walles
b88ee7ed8a Explain where "50ms" comes from 2024-01-20 08:41:44 +01:00
Johan Walles
b18dd4f943 Only request terminal bg if needed
Fixes #190 and #191.

4 realz.
2024-01-20 08:34:59 +01:00
Johan Walles
1249f08c10 Probe terminal colors on the alt screen
This may or may not prevent #190 and #191.
2024-01-19 22:27:23 +01:00
Johan Walles
c7eaf9a879 Give the terminal more time to respond
To our background color query.

Fixes #190.
2024-01-19 10:54:17 +01:00
Johan Walles
d391bab3b1 Print MANROFFOPT in usage message
If set.
2024-01-19 09:46:03 +01:00
Johan Walles
0feb87ee37 Revive LESS_TERMCAP handling
It was broken. Regression test added.

Related to #170.
2024-01-19 09:43:57 +01:00
Johan Walles
cc665778e1 Support another terminal color response format
Related to (but I can't see how this would fix) #190.
2024-01-18 21:36:16 +01:00
Johan Walles
35b0ffca2b Regression test for #188 2024-01-17 09:03:45 +01:00
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