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

1055 Commits

Author SHA1 Message Date
Johan Walles
c8b4ecf38a Fix a hang 2024-05-22 07:01:14 +02:00
Johan Walles
e9bc0dffda Have only one searcher
Before this change we were passing things by value and our updates to
local state never had any effect.
2024-05-22 07:01:14 +02:00
Johan Walles
5eb548a126 Fix the warnings 2024-05-22 07:01:10 +02:00
Johan Walles
6325a1cd95 WIP: Go to the line with the search hit
Some warnings, we should at least be using scrollPosition.isVisible().
2024-05-19 09:13:07 +02:00
Johan Walles
c1641c8456 WIP Implement searching
Now we just need to jump to the result.
2024-05-19 09:13:07 +02:00
Johan Walles
6bb2919459 WIP Trigger background search
Except we don't have anything doing anything in the background yet.
2024-05-19 09:13:07 +02:00
Johan Walles
eae1915b5e Fix formatting 2024-05-18 15:34:17 +02:00
Johan Walles
11095496b2 Tune logging 2024-05-18 15:23:37 +02:00
Johan Walles
d1fac66a23 Improve search logging 2024-05-18 15:15:45 +02:00
Johan Walles
f434895eef Fix backwards search performance issue
This problem was here all along, but it was excarberated by the newly
introduced parallel search.
2024-05-18 08:37:06 +02:00
Johan Walles
7b032b2fa4 Merge branch 'johan/parallel-search' 2024-05-18 08:17:13 +02:00
Johan Walles
686882ffcd Improve docs 2024-05-18 08:13:08 +02:00
Johan Walles
60d3577b59 Don't crash searching in empty buffer 2024-05-18 07:59:44 +02:00
Johan Walles
64ae443e1f Log searches 2024-05-18 07:55:46 +02:00
Johan Walles
856574c289 Don't divide by zero 2024-05-18 07:52:20 +02:00
Johan Walles
ee35c6b166 Fix the chunk before positions 2024-05-18 07:47:40 +02:00
Johan Walles
625193933d Fix the line counts 2024-05-18 07:44:01 +02:00
Johan Walles
387fb348c7 Fix loop variables warning 2024-05-18 07:33:53 +02:00
Johan Walles
84cf4a9cd9 Return the search results
And fix backwards searches.
2024-05-18 07:31:28 +02:00
Johan Walles
aa342d4325 Implement more of the parallel search 2024-05-18 07:28:17 +02:00
Johan Walles
27d03630a5 Half way implement the parallel search 2024-05-18 07:23:40 +02:00
Johan Walles
0ba0415a50 Set the stage for parallel search 2024-05-18 07:15:31 +02:00
Johan Walles
edb3e51680 Don't search the whole file more than once
Should improve the performance situation reported here:
https://github.com/walles/moar/issues/209
2024-05-13 07:59:40 +02:00
Johan Walles
e6c69c2d97 Improve search hits highlighting
Before this change, if you had a search hit inside inverse video text
with a non standard color, search hits in there would be invisible.

With this change in place, we now force the search hits highlights to
use the default colors, making them visible in this case.

This could sometimes be a problem when searching riff highlighted git
diffs:
https://github.com/walles/riff
2024-05-11 07:25:42 +02:00
Johan Walles
01c22cd50b Wrap interactive search on no hit 2024-05-11 06:53:34 +02:00
Johan Walles
21b87eb2d9 Release only releases
Inspired by <https://github.com/walles/riff/pull/64>.
2024-05-09 16:31:24 +02:00
Johan Walles
f1e886624e Mouse copying in VSCode and IntelliJ
Selecting text now works by default with these terminals.
2024-05-06 06:48:59 +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
4db604533d Improve timing printouts with --debug
By reporting stream reading timings as first the reading time and then
the highlighting time.
2024-04-07 10:18:25 +02:00
Johan Walles
2692fd2a84
Merge pull request #205 from walles/johan/decompression-improvements
Fix highlighting of compressed files
2024-04-07 08:40:34 +02:00
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