core-pane: change doc and doc_data to singular arrays
When PANE_DATA_TYPE is set, make doc (and for DOC_DATA_TYPE doc_data)
into singluar arrays: [1].
This allows the address to be obtained without an '&' with is just noise.
NeilBrown [Wed, 30 Aug 2023 23:28:40 +0000 (09:28 +1000)]
menu: allow short-cut keys to be shown.
If menu it attached with are '1', the "value" passed to the action
command will be shown right-justified. This can be used to display
hot keys.
If "value" starts with a space, it is assumed the action doesn't have a
shortcut, and the value is suppressed.
NeilBrown [Wed, 30 Aug 2023 22:30:31 +0000 (08:30 +1000)]
renderline: fix "width" calculation.
"width" should be the sum of item widths without reference to wrapping
or tabs. Maybe tabs should count, but -ve measures would not be useful,
so just ignore them for now.
This allows rtab in menu formats to work.
Also don't include shift_left in the width. render-lines assumed it did
(which it did, but now doesn't).
NeilBrown [Tue, 29 Aug 2023 09:40:44 +0000 (19:40 +1000)]
rfc822header: detect and annotate addresses
A "list" is a list of addresses, find them (between the commas) and add
attributes so their rendering can be controlled.
Each address is associated with length, a tag, and the header type.
The tag can be used to look up the actually address in a pane attribute.
NeilBrown [Tue, 29 Aug 2023 09:11:20 +0000 (19:11 +1000)]
rfc822header: improvements to render attribute on headers.
1/ the render:rfc822header-FOO attr is now render:rfc822header:FOO
to differentiate from e.g. render:rfc822header-wrap which doesn't
identify a header.
2/ The "FOO" in the above is now always lower-case. This removes the
need to differentiate between hdr and hdr_found
3/ The value of that attr is the type of header. This will be used
more later.
4/ change notmuch to make proper use of some of the above.
NeilBrown [Tue, 29 Aug 2023 00:59:21 +0000 (10:59 +1000)]
lib-renderline: restore preferred positioning of menus
When I rewrote lib-renderline I missed a "hack" which allowed menus from
mouse-clicks to be placed below the active text.
Restore this, and update the spelling test which uses that menu.
NeilBrown [Sun, 27 Aug 2023 00:18:50 +0000 (10:18 +1000)]
rexel: fix return value in one case.
If both a flag and the char match, we currently report just that the
flag matched, which is wrong and results in lib-search thinking the
match ended before it really did based on reported length.
NeilBrown [Sat, 26 Aug 2023 22:49:58 +0000 (08:49 +1000)]
textfill: get prefix from regexp when appropriate.
Revise code for finding start of para so that if the regexp identifies a
prefix - rather than a whole line - we use that prefix to decide where
para starts, rather than skipping punctuation.
Also include trailing spaces of a prefix in the prefix for .md files.
NeilBrown [Fri, 25 Aug 2023 04:56:48 +0000 (14:56 +1000)]
Change Display:set-noclose to Display:set:no-close and store in attribute.
Using an attribute to store the no-close string simplifies code, and
using "Display:set:" is similar to "doc:set:" and will soon be used to
set any attribute at the display level.
NeilBrown [Fri, 25 Aug 2023 03:48:07 +0000 (13:48 +1000)]
Get rid of attributes shift_left and shift-left
Add more meaning to render:wrap and discard shift-left and shift_left.
It was confusing having two ... or three ... attributes for almost the
same thing.
NeilBrown [Fri, 25 Aug 2023 01:10:37 +0000 (11:10 +1000)]
Allow command name to be used to choose some data files.
The icon file, Welcome text, and initial config file are now chosen
based on the base name of the command being run.
So if "edlib" is copied to "elma", then "elma.ini" is used for config,
and "elma-icon.png" for an icon.
If the expected file isn't found, a file named for "edlib" is tried
instead.
This should make it easy to have have various commands providing
different interfaces.
elma - EMACS mode
elvi - VI mode
elnm - notmuch email reader
elpnt - presentation mode
eled - editor with A binding.
maybe.
NeilBrown [Sun, 20 Aug 2023 21:48:46 +0000 (07:48 +1000)]
mode-emacs: improve path completion in shell commands
1/ Allow a ':' or '=' to identify where the path starts as long as it
starts '/'.
2/ Give message when directory cannot be opened or no completions can be
found.
NeilBrown [Sun, 20 Aug 2023 05:06:35 +0000 (15:06 +1000)]
lib-renderline: change right: margin to measure +ve from left.
now right-margin works like left and tabs. +ve is from left edge, -ve
is for right edge.
0 is different. It is right-edge for right margin, and left-edge for others.
NeilBrown [Sun, 20 Aug 2023 01:21:24 +0000 (11:21 +1000)]
tests: Allow extra data files to be used in tests.
Only files in tests.d that start with a digit are now considered to be
tests.
Other files are copied into DOC/extra in the test area for tests to
examine.
I put it DOC so that most tests don't see the extra entry in a directory
and so don't need to be changed. Only 02-presenter looks in DOC
NeilBrown [Sun, 20 Aug 2023 01:10:53 +0000 (11:10 +1000)]
lib-renderline: fix up scaling of margin, vspace, tabs
left and right margins, and above/below space, and tab stops must be
scaled based on the font size - which we measure early. That already
includes the ->scale factor, so we mustn't include it again.
NeilBrown [Sat, 19 Aug 2023 22:32:30 +0000 (08:32 +1000)]
display-ncurses: Improve attr parsing
Move the attr parsing code from lib-renderline into core-misc.c and
use it in display-ncurses to avoid using a fixed-size char array that we
never test for overflow.
NeilBrown [Sat, 19 Aug 2023 22:14:06 +0000 (08:14 +1000)]
add lib-test-markup
lib-test-markup allows arbitrary markup to be provided to lib-renderline
for testing.
When enabled with "test-markup", each line of the document is treated as
verbatim markup
NeilBrown [Fri, 18 Aug 2023 21:55:25 +0000 (07:55 +1000)]
tests: fix up "extend" and extend 00-basic
We now have a test in 00-basic which moves the cursor in and out of a
wrap field so that it appears and disappears. When it appears it
changes the number of displayed lines. This doesn't work properly.
NeilBrown [Fri, 18 Aug 2023 04:19:48 +0000 (14:19 +1000)]
render-lines: avoid putting extra space at EOF for small pane
We normally add a bit of extra space at end-of-file.
I already had code to avoid this in small panes. But it wasn't working
as line_height_post hadn't been initialised usefully.
NeilBrown [Fri, 18 Aug 2023 04:04:42 +0000 (14:04 +1000)]
emacs-search: don't try to replace same string twice
:A:Enter replaces but stays in same place. Repeating the command causes
the replacement to be attempted again, which is bad if orig and new are
different length.
So detect and prevent this.
NeilBrown [Fri, 11 Aug 2023 07:20:26 +0000 (17:20 +1000)]
massive lib-renderline rewrite
This now passes my tests - after adjusting some tests.
lib-renderline is totally different. Parsing and processing are now
distinct steps. Hopefully this will make it easier to work with in
future, though it is still very rough in places, particularly with
handling for \t tabs.
I need to go through it several times and clean stuff up, but at least I
now have a credible base to work on.
NeilBrown [Wed, 9 Aug 2023 00:52:17 +0000 (10:52 +1000)]
ncurses: catch and ignore focus-in/out
focus-in/out comes in as unknown key at awkward times causing problems
for C-l and the refresh causes a focus-out.
So catch and ignore for now.
Also log any unrecognised keys so I can try to handle them.
NeilBrown [Tue, 8 Aug 2023 23:52:41 +0000 (09:52 +1000)]
render-lines: factor out code in revalidate_start()
revalidate start considers 3 cases when the point is on the line. Each
of these checks if the point is on the line.
Factor out that test and other code so that 3 (or 4) cases can focus on
their particular issue.
NeilBrown [Tue, 8 Aug 2023 22:44:02 +0000 (08:44 +1000)]
render-lines: call_render_line_to_point never returns error
Don't test for call_render_line_to_point returning < 0, as it doesn't.
Don't even test for == 0. That is a valid answer and we no longer call
call_render_line_to_point() in a situation where that causes problems.