1
1
mirror of https://github.com/walles/moar.git synced 2024-09-21 00:49:59 +03:00
Commit Graph

406 Commits

Author SHA1 Message Date
Johan Walles
3f4113e7bf Log trace events on user input 2021-04-29 23:04:12 +02:00
Johan Walles
7c553891f7 Fix a progress message 2021-04-27 07:05:52 +02:00
Johan Walles
e63871ae6a Make BenchmarkPlainTextSearch() 15+% faster
By shortcutting styledStringsFromString() on strings without ESC
characters.
2021-04-26 20:06:08 +02:00
Johan Walles
ef612a5620 Make BenchmarkPlainTextSearch() 50+% faster
By using a strings.Builder rather than roll-our-own to build a plain
string.
2021-04-26 08:55:42 +02:00
Johan Walles
860dcd22b4 Make BenchmarkPlainTextSearch() 30% faster
By taking a cheap shortcut on strings without backspace characters.
2021-04-26 06:53:30 +02:00
Johan Walles
f5273fc4b3 Make BenchmarkPlainTextSearch() 20% faster
Using shortcuts on lines without backspace characters.
2021-04-26 06:40:30 +02:00
Johan Walles
7520c9fc8a Make BenchmarkPlainTextSearch() 12% faster
By optimizing plainification for all-ASCII strings.
2021-04-26 00:24:21 +02:00
Johan Walles
02d66fb31c Merge branch 'walles/quicksearch'
This makes BenchmarkPlainTextSearch() report 30% quicker iterations.
2021-04-25 23:53:25 +02:00
Johan Walles
a5f43e3d2f Do plaintext like we do cells
This loses a lot of the performance improvement originally intended, but
this is still 30% faster than before.

Good step in the right direction.
2021-04-25 23:50:14 +02:00
Johan Walles
d6d428f0ef Plaintext broken UTF8 as ?
Just like we render it, but without the coloring.
2021-04-25 23:38:59 +02:00
Johan Walles
17d8a0372a Render unprintable characters as highlighted '?' 2021-04-25 23:35:47 +02:00
Johan Walles
7bf168255a Make test read files like the pager 2021-04-25 21:58:31 +02:00
Johan Walles
e7995bc40f Use ? to mark unprintable chars in plain text rendering 2021-04-25 20:40:38 +02:00
Johan Walles
1d93f43838 Test: Accept prettified man page bullets 2021-04-25 16:32:00 +02:00
Johan Walles
b17c44af28 Fix off-by-X problems comparing strings
Due to byte offsets vs rune offsets.

This fixes some invalid test failures.
2021-04-25 13:21:03 +02:00
Johan Walles
5e59515d3f Improve new test diagnostics 2021-04-25 12:25:52 +02:00
Johan Walles
7814f6af2f Add more plaintext-vs-cells verification 2021-04-25 10:08:19 +02:00
Johan Walles
5e2a63dc36 Handle backspace while plaintexting
More tests pass now, still not all though.
2021-04-24 23:15:53 +02:00
Johan Walles
66175f02aa Initial tab expansion
Tests still fail, but not as many.
2021-04-24 20:49:58 +02:00
Johan Walles
2c20fc31fe Special case stripping string formatting
Stripping string formatting is on the hot path while searching. This
change makes BenchmarkPlainTextSearch() over 7x faster.

But it also has problems with tab expansion so some tests fail, let's
see how we should handle that.
2021-04-24 17:20:09 +02:00
Johan Walles
c8a8cb4517 Improve memory usage for large files
Test:
* Open a 35MB text file
* Search it for some string it doesn't contain

Memory usage before this change: 2.3GB
Memory usage after this change:  0.5GB

The trick is to only provide cells from Lines on demand, since we only
need a few of them when scrolling.

And not storing all of those cells is where the gain in memory usage
comes from.
2021-04-24 16:27:54 +02:00
Johan Walles
c8bc7b0161 Don't highlight files larger than 1MB
They make the highlighter just run in the background slowly eating up
memory.
2021-04-24 16:14:30 +02:00
Johan Walles
9e6af21106
Merge pull request #52 from 89z/master
DeInit: make output copy friendly
2021-04-24 09:22:14 +02:00
Steven Penny
63082a804d m/embed-api.go: fix formatting 2021-04-23 19:33:25 -05:00
Steven Penny
374378b979 DeInit: make output copy friendly
With DeInit turned off, the current output cannot be usefully copied, as no
newlines are emitted. Close the screen in all cases now, but if DeInit is
disabled, reprint the current buffer with newlines after the screen is closed.

Fixes #51
2021-04-23 19:24:05 -05:00
Johan Walles
d8644ed8e1 Add search performance benchmarks 2021-04-23 22:10:59 +02:00
Johan Walles
60b59c2483 Only install linters when needed
This makes most runs of ./test.sh quicker since they don't need to
invoke "go install".
2021-04-23 18:38:40 +02:00
Johan Walles
86ae632f14 Merge branch 'walles/async-highlight'
Do highlighting in the background. For large files, or files that are
slow to highlight, this removes the initial highlighting delay.
2021-04-23 06:52:56 +02:00
Johan Walles
232b784428 Fix tests 2021-04-22 22:05:36 +02:00
Johan Walles
c7a26137ef
Merge pull request #50 from 89z/master
Use CONIN$ for Windows screen setup
2021-04-22 21:39:14 +02:00
Steven Penny
0f9ae758d5 Use CONIN$ for Windows screen setup
Fixes #49
2021-04-22 14:03:22 -05:00
Johan Walles
2c3cc80500 Don't use the plaintext highlighter 2021-04-22 19:31:47 +02:00
Johan Walles
095693eb0b Wait for highlighting to complete in pager tests 2021-04-22 19:26:29 +02:00
Johan Walles
488aaaab88 Highlight in the background
With this change in place, we first quickly get the file contents
without highlighting. Then, when the highlighting is done, the view gets
updated with the highlighted version.

Useful when you're loading long files where highlighting can take time.
2021-04-22 19:26:29 +02:00
Johan Walles
1359a3e558 Merge branch 'walles/test-mod-tidy-install'
Fixes #48 by doing "go mod tidy", getting linters using "go mod install"
and bumping to Go 1.16 to get everything working in CI.

Thanks for your research @89z!
2021-04-22 19:23:15 +02:00
Johan Walles
d51cd89e40 Remove not-needed-any-more check
Since we're getting our linters through "go install".
2021-04-22 19:20:27 +02:00
Johan Walles
19a5fe51c8 Try with Go 1.16 instead 2021-04-22 19:17:58 +02:00
Johan Walles
0a6db4974b Experiment with go mod tidy and go install
Try to work out #48.
2021-04-22 19:13:12 +02:00
Johan Walles
985bcce02c Move highlighting into its own file 2021-04-22 08:14:51 +02:00
Johan Walles
515000eec8 Add file reading benchmark 2021-04-22 07:56:10 +02:00
Johan Walles
c8e2d90ec5 Initial tests of highlighted lines count 2021-04-21 22:57:08 +02:00
Johan Walles
d24acdbf32 CI logs cosmetics 2021-04-21 08:32:31 +02:00
Johan Walles
ee3659e7f0 Fix master CI problem
https://travis-ci.com/github/walles/moar/jobs/500067810
2021-04-21 08:27:14 +02:00
Johan Walles
34299c42a2 Fix modules modification check 2021-04-21 08:24:55 +02:00
Johan Walles
97f5233080 Verify linters are listed in go.mod 2021-04-21 06:54:49 +02:00
Johan Walles
a211a28f49 Correct URL, take II 2021-04-21 06:29:34 +02:00
Johan Walles
2cf40d8f0a Correct URL 2021-04-21 06:25:52 +02:00
Johan Walles
f81f9d47d4 Require version number on v1.2.3 form
See #47.
2021-04-20 20:31:23 +02:00
Johan Walles
54942cf12e Less compatibility improvement
If we get both a filename and a pipe, prefer the filename.

For example, this will show the contents of /etc/passwd:

$ echo hello | moar /etc/passwd

Before this change, it displayed "hello" on a page.
2021-04-20 09:18:02 +02:00
Johan Walles
bc5e464147 Merge branch 'walles/errcheck' 2021-04-20 08:46:49 +02:00