1
1
mirror of https://github.com/walles/moar.git synced 2024-11-22 21:50:43 +03:00
Commit Graph

149 Commits

Author SHA1 Message Date
Johan Walles
2e13403096 Fix executability check on Windows 2024-06-29 08:36:13 +02:00
Johan Walles
69bef3097c Fix crash on --quit-if-one-screen by dupping stdout 2024-06-24 07:26:42 +02:00
Johan Walles
2012110efa Tune log levels
Improves on #213.

Before this change "log.Info()" resulted in a crash report on exit.

With this change in place log.Warn() is required for that.
2024-06-23 12:20:03 +02:00
Johan Walles
9818eec3dc Launch the editor 2024-06-21 09:17:15 +02:00
Johan Walles
df79efefa7 Add editor launching placeholder code 2024-06-21 08:14:18 +02:00
Johan Walles
52cf51f35e Fix unknown-terminal-bg color handling
Before this change, we just didn't highlight in this case.

With this change in place, we now fall back on the default dark theme
when background color detection fails.

Fixes <https://github.com/walles/moar/issues/202>.
2024-04-29 21:05:16 +02:00
Johan Walles
4357eda016 Fix the issue, break testing 2024-04-06 09:03:27 +02: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
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
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
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
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
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
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
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
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
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
e823d0263a Use 16M color when requested
Before this change we used 8 colors when asked for 16M.
2024-01-10 16:48:42 +01:00
Johan Walles
8c8b82f166 Use ZOpen() instead of os.Open() 2024-01-08 13:43:46 +01:00
Johan Walles
044039739b Make moar.go compile 2024-01-07 08:49:44 +01:00
Johan Walles
5d4201b151 Make pager.go compile again 2024-01-07 08:38:52 +01:00
Johan Walles
2c1dd09bbe Fix some compile errors 2024-01-06 18:55:07 +01:00
Johan Walles
55e2daf07f Move textstyles into the (mostly) not-public part
I don't foresee this ever being published for anybody else to use.
2024-01-05 09:12:17 +01:00
Johan Walles
dc0243f9e3 Handle some warnings 2024-01-05 07:02:58 +01:00