1
1
mirror of https://github.com/walles/moar.git synced 2024-09-11 12:15:43 +03:00
Commit Graph

593 Commits

Author SHA1 Message Date
Johan Walles
ac6bdb4dbb Update tests with new status line format
Line numbers are gone, the tests should reflect that.
2021-05-22 16:05:06 +02:00
Johan Walles
5e09be8a82 Update screenshot
New status bar without current line numbers.
2021-05-22 15:59:26 +02:00
Johan Walles
0f43cf1ea3 Make line wrapping controllable from the command line 2021-05-22 15:56:55 +02:00
Johan Walles
1538ed7e8d Don't display current line numbers in the footer
They are visible on the side anyway, having them in the status bar is
just redundant.

NOTE: Wrapping should:
	* default to off
	* be controllable from the command line
	* documented
2021-05-22 15:44:15 +02:00
Johan Walles
4efa280389 Make wrapping optional
And controllable from within by pressing 'w'.

NOTE: Wrapping should:
    * default to off
    * be controllable from the command line
    * documented
	* not mean we get the displayed line numbers wrong in the status line
2021-05-22 15:41:44 +02:00
Johan Walles
dcf8bbf9a7 Always wrap
NOTE: Wrapping should:
* be optional
* documented
* default to off
* be controllable from the command line
* be possible to toggle by pressing 'w'
2021-05-22 15:41:44 +02:00
Johan Walles
f0283e9e57 Implement simplistic wrapping 2021-05-22 15:41:44 +02:00
Johan Walles
b4a82b2668 Add initial line wrapper implementation
With failing tests.
2021-05-22 15:41:44 +02:00
Johan Walles
dc070cad75 Left pad line numbers
Fixes a regression, this is what it used to look like and should have
looked like all the time.
2021-05-22 15:39:39 +02:00
Johan Walles
da47a1730e Fix off-by-one screen rendering corner case 2021-05-22 11:42:42 +02:00
Johan Walles
f1061202ba Extract search highlighting into its own Line method 2021-05-22 11:25:44 +02:00
Johan Walles
7e3a73f053 Three-group line numbers
Both the numbers in the left column of the file display, and the line
numbers shown in the page footer.

Fixes #6.
2021-05-21 19:38:10 +02:00
Johan Walles
6330e255d1 Request help with Homebrew packaging 2021-05-14 15:08:23 +02:00
Johan Walles
2b1e87b8ac Log received events on trace level
If you run moar with -trace you'll get all handled events listed after
moar finishes running.

The point would be to be able to debug mishandled keys as reported
in #55.

Also, remove the screen refresh timings from the trace logs. We get lots
of them, and I don't think they provide value any more.
2021-05-13 19:12:44 +02:00
Johan Walles
edacfeec31 Read config from MOAR environment variable
Together with c95e1645 this fixes #60.
2021-05-13 19:00:53 +02:00
Johan Walles
c95e164595 Enable picking style and formatter from command line
Related to #60.
2021-05-13 07:37:34 +02:00
Johan Walles
91292592ac
Merge pull request #62 from 89z/master
Update go.mod
2021-05-12 22:23:57 +02:00
Steven Penny
8fd5229840 Update go.mod
New Chroma version and remove "xerrors"
2021-05-12 11:20:45 -05:00
Johan Walles
92575c64d0
Merge pull request #61 from 89z/master
Clean up imports
2021-05-11 21:55:43 +02:00
Steven Penny
61f071936a Clean up imports
Remove "io/ioutil" and "math"
2021-05-11 12:20:31 -05:00
Johan Walles
e62c057710
Merge pull request #59 from 89z/master
NewReaderFromStream: simplify init code
2021-05-11 18:43:58 +02:00
Steven Penny
747dd0a914 NewReaderFromStream: simplify init code
Remove redundant and single use variables
2021-05-11 11:35:04 -05:00
Johan Walles
de4028e7b7
Merge pull request #58 from 89z/master
Simplify StyleDefault definition
2021-05-11 15:22:40 +02:00
Steven Penny
f76fd6ddd3 Simplify StyleDefault definition
StyleDefault is all zero values, so we can simplify the definition. If that
changes in the future (not likely) we can go back to the old definition method.

Fixes #57
2021-05-11 08:14:15 -05:00
Johan Walles
5e49329110 Split a large function into smaller ones
For great readability.
2021-05-08 17:21:08 +02:00
Johan Walles
e3e8be0b8b CTRL-L isn't a thing any more
Since replacing tcell with twin, we now redraw the whole screen every
time, and CTRL-L doesn't do anything.
2021-05-08 15:05:12 +02:00
Johan Walles
5d5ecae7c0 Speed up line counting 4x
And improve large file loading performance in the process.
2021-05-08 14:16:38 +02:00
Johan Walles
09ab8a4072 Add a line counting performance benchmark 2021-05-08 13:57:54 +02:00
Johan Walles
78ab63273a Move some test-only code into *_test.go files 2021-05-08 10:32:04 +02:00
Johan Walles
99d8db63fb Improve startup interactivity
By moving line counting into the background goroutine that consumes the
input stream.

This will make the UI appear faster for large files where line counting
takes time.
2021-05-08 10:26:16 +02:00
Johan Walles
5e847f4cd7 Improve large file reading performance by 10%
By reading the file in two passes.

The first pass just counts the lines in the file.

The second pass starts by preallocating the correct number of lines, and
then reads the file.

The whole time saving comes from not having to dynamically resize the
lines slice while reading the file.
2021-05-03 20:33:25 +02:00
Johan Walles
97884d1805 Add a large file benchmark 2021-05-03 19:15:43 +02:00
Johan Walles
f8e45f73e2 Log input stream consumption time
At debug level.
2021-05-03 08:08:41 +02:00
Johan Walles
9af12f451c Move code outside of a lock 2021-05-03 06:44:57 +02:00
Johan Walles
7a66c633ca Lower memory usage by 10%
When loading a 577MB file.
2021-05-02 19:28:51 +02:00
Johan Walles
306442f2b2 Split a line to improve profilability
The line is top of the pprof alloc profile, but splitting it might
show which allocation on that line it is that is so common.
2021-05-02 17:36:22 +02:00
Johan Walles
96d26bb97c Avoid some memory allocations
By reusing the same slice for reading all lines from the input file.
2021-05-02 14:47:20 +02:00
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