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
a062dd25f8 Break markdown links between text and URL
These tend to be long and screw up formatting, they need special
handling.
2021-05-25 17:10:24 +02:00
Johan Walles
05c1b278d6 Merge branch 'walles/wordwrap'
This is what was *actually* requested in #26.
2021-05-24 19:16:17 +02:00
Johan Walles
a24a16434d README: We support word wrapping 2021-05-24 19:15:53 +02:00
Johan Walles
3b7a906ce1 Word wrap URLs after / 2021-05-24 19:10:31 +02:00
Johan Walles
dda01e25a3 Break before whitespace 2021-05-24 18:46:00 +02:00
Johan Walles
ea7e9252b3 Extract wrap cutoff into its own function 2021-05-24 18:37:14 +02:00
Johan Walles
896ac3e874 Add word wrapping tests 2021-05-24 18:30:31 +02:00
Johan Walles
3df48a4ade Simplify line wrapping tests 2021-05-24 18:16:57 +02:00
Johan Walles
e605199d92 Trim leading whitespace from wrapped lines 2021-05-23 16:23:04 +02:00
Johan Walles
0a40404070 Improve test feedback
On comparison failure, print both flavors.
2021-05-23 16:12:00 +02:00
Johan Walles
8a5f6fe473 Strip trailing whitespace when wrapping 2021-05-23 15:25:46 +02:00
Johan Walles
ca352bf37f README: Add px / riff descriptions 2021-05-22 16:28:53 +02:00
Johan Walles
eea4afad18 Merge branch 'walles/wrap'
Add optional line wrapping.

Fixes #26.
2021-05-22 16:05:52 +02:00
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