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

123 Commits

Author SHA1 Message Date
Johan Walles
8ec3df792a Use "select" as a term for selecting text
This is a better term, as pointed out by @postsolar in #173
2023-12-19 09:20:02 +01:00
Johan Walles
d511e50652 Downsample colors to terminal palette
As neeed.

This enables you to view 24 bit color documents in a 256 color terminal.
With reduced quality obviously, but still.
2023-12-19 08:47:40 +01:00
Johan Walles
a3f1c6118d Document Contour mouse marking 2023-12-18 19:52:10 +01:00
Johan Walles
ccc535074d Improve foot terminal detection 2023-12-18 09:53:31 +01:00
Johan Walles
21afb4f2ef Don't track the formatter
They are only needed at startup, so let's not keep them around while
paging.
2023-12-17 16:09:29 +01:00
Johan Walles
b067a84b36 Auto configure mouse settings in more terminals
Tested all the Linux ones in Virtualbox. Yay Virtualbox!
2023-12-16 18:59:58 +01:00
Johan Walles
4468a6528c Add command line options for setting the mouse mode 2023-12-15 21:36:29 +01:00
Johan Walles
a6f188e0ea Set mouse mode by terminal
Some terminals convert mouse events to key events making scrolling
better without our built-in mouse support, and some do not.

With this change in place, on those we know that do this, we let them
handle mouse events instead of enabling our built-in mouse scroll
support.
2023-12-14 03:06:13 +01:00
johan.walles@gmail.com
eb48418c10 Add another hyperlink test
Seemed there were no tests for hyperlink rendering.

Now we at least have two.
2023-12-13 09:27:05 +01:00
johan.walles@gmail.com
14c2351e53 Reset hyperlinks properly to unstyled
Before this change, if you had a hyperlink followed by unstyled text,
moar wouldn't reset the hyperlink property, messing up everything after
it.

With this change in place, that now works as one would expect.

Fixes #169.
2023-12-13 09:26:50 +01:00
Johan Walles
ddd7aec274 This is benign
So log it as debug rather than warning.

Ref: https://github.com/walles/moar/issues/164#issuecomment-1831255422
2023-11-29 14:03:55 +01:00
Johan Walles
0e27391c53 Bump event queue size
Fixes #164

Or at least that's the intent, I'm unable to test this.
2023-11-13 13:17:20 +01:00
Johan Walles
ae34878ee5 Document assertions
To clarify questions from #163.
2023-10-14 08:43:18 +02:00
Wallunen
6f2691ca10
Fix tests in twin/screen_test.go 2023-10-14 06:04:13 +03:00
Wallunen
3f1457aacb
Fix rendering of whitespace lines 2023-10-13 19:58:41 +03:00
Johan Walles
123b3c3692 Complete mutation coverage 2023-10-10 21:38:03 +02:00
Johan Walles
40a5ab1430 Cover one more mutation 2023-10-10 21:33:18 +02:00
Johan Walles
5313c02dd6 Simplify line rendering more 2023-10-10 21:26:43 +02:00
Johan Walles
dff0774141 Simplify line rendering 2023-10-10 21:14:36 +02:00
Johan Walles
99de54c510 Pass another mutation test 2023-10-10 20:46:53 +02:00
Johan Walles
8478883821 Test another corner case
It worked!
2023-10-10 06:18:03 +02:00
Johan Walles
a082fe207e Use the correct style for the trailer 2023-10-10 06:16:09 +02:00
Johan Walles
59a636205a Add trailing whitespace test
Failing.
2023-10-10 06:01:49 +02:00
Johan Walles
d7c104e80a Be smarter about line endings
Doesn't help Kitty though, don't know why.
2023-10-09 19:52:01 +02:00
Johan Walles
cd95996e8e Shortcut common style changes 2023-10-09 19:45:43 +02:00
Johan Walles
47e72d093c Fix an outdated test 2023-10-09 19:45:27 +02:00
Johan Walles
c747b8ec0b Add test for #161
It fails.
2023-10-08 12:00:07 +02:00
Ilya Grigoriev
7b8d7eafe3 keys.go: Allow alternative Home/End key encoding
My setup is Tmux running in Alacritty on Debian Linux running on Chrome OS.
Before this change, Home and End keys did not work for me inside Tmux.
(Outside tmux, I don't think there was a problem).

I got the required sequences by running `cat` and pressing Home/End.

This looks similar to (or possibly the opposite of)
daafbcdac4.
The reference in that commit mentions these sequences for Home and End, these
kinds of sequences were already used for Delete, PgUp, and PgDown. 

For reference, the missing `\x1b[2~`  sequence would correspond to the Insert
key.
2023-09-29 23:30:38 -07:00
Johan Walles
5932600b65 Handle more TTY corner cases
Fixes #150, which I to my surprise could reproduce on my own machine.
2023-08-31 19:48:02 +02:00
Johan Walles
5a33eda766 Improve console input EOF handling
Related to #126. Need some Windows tester to tell me how it works.
2023-08-30 21:26:29 +02:00
Johan Walles
574235bc03 Print log messages on panic()
Before this change, if moar...
1. Logged some messages
2. Panicked

... then only the panic() output would be printed and the log messages
would be lost.

With this change in place, both are printed.
2023-08-27 09:02:31 +02:00
Johan Walles
848958dad0 Clarify where Windows errors come from 2023-08-14 19:47:42 +02:00
Johan Walles
daafbcdac4 Handle "SS3" arrow key events
Ref:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-C1-_8-Bit_-Control-Characters

Fixes #138
2023-06-07 19:49:13 +02:00
Johan Walles
15a90f5f77 Do all < 32 characters, not just ESC 2023-06-06 08:50:42 +02:00
Johan Walles
6abe5ba1b1 Improve debug logging of unhandled key events
Should help troubleshooting #138.
2023-06-06 08:31:42 +02:00
Johan Walles
5ea3e61e8c Improve test diagnostics 2023-05-03 19:45:04 +02:00
Johan Walles
6f8fc89f2e Improve parsing
But it still doesn't work.
2023-05-03 19:07:32 +02:00
Johan Walles
dc0fe53366 Don't repeat the same hyperlink 2023-05-02 06:30:09 +02:00
Johan Walles
f6b7edc768 Reset hyperlinks at the end of each screen line 2023-05-02 06:29:37 +02:00
Johan Walles
a4da40ff8c Add rendering support for terminal hyperlinks 2023-05-01 15:56:08 +02:00
Johan Walles
9ee1d18ab5 Add another test
Turns out the thing I worried about wasn't moar's fault, but this test
is still valid so let's keep it.

Ref: https://gitlab.com/gnachman/iterm2/issues/10862
2023-03-23 22:42:40 +01:00
Johan Walles
a5bd7037e3 Single character shift when moving right / left
By holding ALT while pressing the right / left arrow keys.

Relates to #130.
2023-03-19 11:25:52 +01:00
Johan Walles
cc6819efd0 Display Private Use Unicode characters
Before this change, we rendered those as highlighted question marks.

With this change in place, we just send them to the screen for
displaying.

The reason is that Font Awesome uses these for symbols, this one for
example: https://fontawesome.com/v4/icon/battery-empty

More reading: https://en.wikipedia.org/wiki/Private_Use_Areas
2023-02-28 19:28:37 +01:00
Johan Walles
e8a948ae9a Additional corner case test 2023-01-11 11:08:38 +01:00
Johan Walles
05a2153c2c Fix handling incoming pastes 2023-01-11 11:06:38 +01:00
Johan Walles
3e8ba22a0d Test all existing functionality 2023-01-11 10:44:24 +01:00
Johan Walles
31d9bdc95f Add initial input consumtion test
The idea is that when this test grows up it's going to cover
https://github.com/walles/moar/issues/73.
2023-01-11 10:14:07 +01:00
Johan Walles
3e9d6d2a44 Bump testing library to latest version 2022-09-25 09:06:46 +02:00
Johan Walles
46a5924796 Fix feature envy
The ScreenLines struct was just a subset of the pager struct.
2022-02-18 19:27:10 +01:00
Johan Walles
dd776b94fa golangci-lintify linter exclusions 2022-02-13 08:34:09 +01:00
Johan Walles
b96c88c4d1 Support retaining screen contents after exit
Fixes #76.
2021-11-09 18:56:02 +01:00
Johan Walles
46b84fb392 Add a Windows executable to the release 2021-09-10 06:50:44 +02:00
Johan Walles
e605199d92 Trim leading whitespace from wrapped lines 2021-05-23 16:23:04 +02:00
Johan Walles
8a5f6fe473 Strip trailing whitespace when wrapping 2021-05-23 15:25:46 +02:00
Johan Walles
da47a1730e Fix off-by-one screen rendering corner case 2021-05-22 11:42:42 +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
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
Steven Penny
0f9ae758d5 Use CONIN$ for Windows screen setup
Fixes #49
2021-04-22 14:03:22 -05: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
730ed46f4f Fix errcheck reported problems 2021-04-20 08:43:37 +02:00
Johan Walles
44dc59d365 Better error message on paging to non-tty 2021-04-18 18:37:55 +02:00
Johan Walles
39ab1fc93d Don't panic on no-piped-stdin on Windows 2021-04-18 13:33:13 +02:00
Johan Walles
1b292fa050 Improve messaging 2021-04-18 07:45:41 +02:00
Johan Walles
4e8c49ea8d Warn about getting piped data on Windows 2021-04-18 07:36:13 +02:00
Johan Walles
1e46089cff Fix build errors on Unix 2021-04-17 22:29:45 +02:00
Johan Walles
ff9380fe15 Restore console settings when done 2021-04-17 22:29:45 +02:00
Johan Walles
9e0d48e866 Fix arrow keys handling 2021-04-17 22:29:45 +02:00
Johan Walles
9b86fc5736 Windows: Color output, character input
Arrow keys don't work.
2021-04-17 22:29:45 +02:00
Johan Walles
9f9dc37594 Remove a superfluous : 2021-04-17 22:29:45 +02:00
Johan Walles
e5ec2ce19a Open CONIN$ the usual way 2021-04-17 22:29:45 +02:00
Johan Walles
e72baff02e Try getting hold of the console on Windows 2021-04-17 22:29:45 +02:00
Johan Walles
44a064c024 Write tcell replacement
Fixes #37 and fixes #34.
2021-04-17 22:24:40 +02:00