]> git.neil.brown.name Git - edlib.git/log
edlib.git
2 years agocore-pane: change doc and doc_data to singular arrays
NeilBrown [Fri, 1 Sep 2023 02:42:05 +0000 (12:42 +1000)]
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomenu: allow short-cut keys to be shown.
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomenu: support disabled menu entries.
NeilBrown [Wed, 30 Aug 2023 23:18:57 +0000 (09:18 +1000)]
menu: support disabled menu entries.

If menu-add is given number '1' (or at least the lsb set) then the menu
item is greyed-out.  The action isn't disabled - that is up to the
caller.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorenderline: fix "width" calculation.
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).

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoSuppress LOG timestamps when testing.
NeilBrown [Wed, 30 Aug 2023 22:38:53 +0000 (08:38 +1000)]
Suppress LOG timestamps when testing.

The time stamps are less helpful when testing, and they make it hard to
diff outputs between different runs.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoMove <hide> handling to lib-renderlines and fix callers.
NeilBrown [Wed, 30 Aug 2023 09:13:59 +0000 (19:13 +1000)]
Move <hide> handling to lib-renderlines and fix callers.

Complete the <hide> handling in lib-renderlines and remove it from
lib-markup.

This showed up various bugs in how it was being used - it was a wonder
it ever worked!  So fix those bugs in clients too.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: act on menu selection to add address to a "from" list
NeilBrown [Tue, 29 Aug 2023 22:24:53 +0000 (08:24 +1000)]
notmuch: act on menu selection to add address to a "from" list

The menu selection to add to a known query of from: addresses now works.
The menu selection to compose a new message still doesn't.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: place a context menu on all from: addresses
NeilBrown [Tue, 29 Aug 2023 09:54:22 +0000 (19:54 +1000)]
notmuch: place a context menu on all from: addresses

The menu on From: addresses allow the address to be added to any query
in the special "from-list" query.

We don't act on the menu selection yet - that comes later.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: disable word-wrap on To: and Cc: lines
NeilBrown [Tue, 29 Aug 2023 09:52:56 +0000 (19:52 +1000)]
notmuch: disable word-wrap on To: and Cc: lines

The header-list wrap on ',' should be enough, wrapping on spaces as well
looks wrong.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorfc822header: detect and annotate addresses
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorfc822header: only include one space after , in a list
NeilBrown [Tue, 29 Aug 2023 09:33:19 +0000 (19:33 +1000)]
rfc822header: only include one space after , in a list

There is no need to copy all spaces after a comma verbatim.  Precisely
one is what we want for the wrap point.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorfc822header: improvements to render attribute on headers.
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorfc822header: don't mark spaces as wrap points.
NeilBrown [Tue, 29 Aug 2023 09:00:34 +0000 (19:00 +1000)]
rfc822header: don't mark spaces as wrap points.

Now that lib-renderlines supports word-wrap, we don't need rfc822header
to annotate for it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoautospell: cancel old menu before opening a new one.
NeilBrown [Tue, 29 Aug 2023 01:39:16 +0000 (11:39 +1000)]
autospell: cancel old menu before opening a new one.

If the previous spell-fix menu is still open when a new one is opened,
close the old one.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: restore preferred positioning of menus
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomergeview: fix uninitialised-var error
NeilBrown [Mon, 28 Aug 2023 21:40:19 +0000 (07:40 +1000)]
mergeview: fix uninitialised-var error

Forgot to make sure 'diff' was set.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorexel: fix return value in one case.
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemacs-search: be careful to avoid infinite loop.
NeilBrown [Sun, 27 Aug 2023 00:16:42 +0000 (10:16 +1000)]
emacs-search: be careful to avoid infinite loop.

Assuming that 'm' moved if length > 1 isn't entirely safe.
It *should* be the case, but protecting against infinite loops
deserves belt *and* braces.

So add some extra checks, and test for a case that currently causes an
infinite loop

Signed-off-by: NeilBrown <neil@brown.name>
2 years agotextfill: get prefix from regexp when appropriate.
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoedlib.ini: discard stray \ quotes
NeilBrown [Sat, 26 Aug 2023 00:30:02 +0000 (10:30 +1000)]
edlib.ini: discard stray \ quotes

The content found in .ini files does not support \ quoting, so the \\
results in to '\' which we don't want.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorexel: support -B for backtrack testing.
NeilBrown [Sat, 26 Aug 2023 00:28:54 +0000 (10:28 +1000)]
rexel: support -B for backtrack testing.

Add -B option and improve usage() message.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoReview Welcome text
NeilBrown [Fri, 25 Aug 2023 05:55:56 +0000 (15:55 +1000)]
Review Welcome text

*Welcome* text was getting old and irrelevant.

Also clean out all remaining triage, as they are all done.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodiff: use correct file name in 'pre' mode.
NeilBrown [Fri, 25 Aug 2023 05:47:05 +0000 (15:47 +1000)]
diff: use correct file name in 'pre' mode.

When in 'pre' mode we need to go to the 'pre' file, not the post one.
So get the filename after '---'.

Also re-arrange some from the triage in the TODO file.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoChange window-scaling to display-scaling
NeilBrown [Fri, 25 Aug 2023 05:32:27 +0000 (15:32 +1000)]
Change window-scaling to display-scaling

The emacs scaling commands now affect the whole display (window), not
just a single pane.  This is more consistent.

It is done just by changing an attribute on the display pane.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoIntroduce generic Display:set:
NeilBrown [Fri, 25 Aug 2023 05:04:28 +0000 (15:04 +1000)]
Introduce generic Display:set:

Display:set: can be used to set any attribute on the display pane.
The attr name can be in str2, or following Display:set: in the key.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoChange Display:set-noclose to Display:set:no-close and store in attribute.
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoGet rid of attributes shift_left and shift-left
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: fix problems with finding position of 'click' location.
NeilBrown [Fri, 25 Aug 2023 01:38:28 +0000 (11:38 +1000)]
lib-renderline: fix problems with finding position of 'click' location.

This broken menus and links etc.  So add a test for menus in the
spelling test.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAllow command name to be used to choose some data files.
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoMove welcome text into a separate file.
NeilBrown [Fri, 25 Aug 2023 00:44:02 +0000 (10:44 +1000)]
Move welcome text into a separate file.

This makes it easier to edit the welcome text, and to have different
welcome text for different editors.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodisplay-x11: load icon if available.
NeilBrown [Fri, 25 Aug 2023 00:31:30 +0000 (10:31 +1000)]
display-x11: load icon if available.

If edlib-icon.png can be found, load it as the icon for the X11 window.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoMove config file into new 'data' directory.
NeilBrown [Fri, 25 Aug 2023 00:30:15 +0000 (10:30 +1000)]
Move config file into new 'data' directory.

Also make lib/edlib point to data, not just to '..'.
This will allow the image files to be found with xdg-find-edlib-file/data.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAdd a logo
NeilBrown [Wed, 23 Aug 2023 03:43:10 +0000 (13:43 +1000)]
Add a logo

Currently it is just a few image files. Will do more one day.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoIntroduce "Cancel" commands - K:ESC in emacs
NeilBrown [Mon, 21 Aug 2023 11:41:18 +0000 (21:41 +1000)]
Introduce "Cancel" commands - K:ESC in emacs

"Cancel" is like "Abort", but softer.
Currently it cancels any active selection.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomode-emacs: improve path completion in shell commands
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: use foreach_attr() to parse image attrs.
NeilBrown [Sun, 20 Aug 2023 10:11:32 +0000 (20:11 +1000)]
lib-renderline: use foreach_attr() to parse image attrs.

This isn't a big win, but it is a bit nicer.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: discard cached-size attribute
NeilBrown [Sun, 20 Aug 2023 10:00:33 +0000 (20:00 +1000)]
lib-renderline: discard cached-size attribute

We don't need an attribute for this, just store it in rline_data.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoFix "edlib -g"
NeilBrown [Sun, 20 Aug 2023 09:45:16 +0000 (19:45 +1000)]
Fix "edlib -g"

Obviously this was never tested last time I made a change.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agotests: add markup test
NeilBrown [Sun, 20 Aug 2023 06:45:54 +0000 (16:45 +1000)]
tests: add markup test

This test uses the new test-markup pane.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: create a new render-item whenever tab: is set.
NeilBrown [Sun, 20 Aug 2023 06:35:02 +0000 (16:35 +1000)]
lib-renderline: create a new render-item whenever tab: is set.

I sometimes want tab: with no text - particularly to set wrap-margin.
So allow that.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: enhance cvt() to allow > in text attributes.
NeilBrown [Sun, 20 Aug 2023 06:32:37 +0000 (16:32 +1000)]
lib-renderline: enhance cvt() to allow > in text attributes.

This is not particularly useful, but I wanted a '>' in a wrap-head for
testing, and I couldn't.  So I made it possible.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: change right: margin to measure +ve from left.
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: allow word-wrap setting via attributes.
NeilBrown [Sun, 20 Aug 2023 04:40:45 +0000 (14:40 +1000)]
lib-renderline: allow word-wrap setting via attributes.

Word-wrap is normally enabled for the whole pane.  But making it
possible for individual lines might be useful, and certainly eases
testing.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agotests: Allow extra data files to be used in tests.
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

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline; fix double-cursors in display-x11
NeilBrown [Sun, 20 Aug 2023 01:18:44 +0000 (11:18 +1000)]
lib-renderline; fix double-cursors in display-x11

When a line wraps, display-x11 is showing cursor at end of one line and
start of next.  Fix that.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: fix up scaling of margin, vspace, tabs
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: handle garbage better in cvt()
NeilBrown [Sat, 19 Aug 2023 22:39:41 +0000 (08:39 +1000)]
lib-renderline: handle garbage better in cvt()

cvt() shouldn't assume a well-formatted string, and must always quite
when it sees EOL.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodisplay-ncurses: ignore focus changes better.
NeilBrown [Sat, 19 Aug 2023 22:34:13 +0000 (08:34 +1000)]
display-ncurses: ignore focus changes better.

If we got a focus change message, 'buf' would be uninitialised and used.
So initialise it - and don't use it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodisplay-ncurses: Improve attr parsing
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoadd lib-test-markup
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

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: always give cursor offset when measuring cursor line
NeilBrown [Fri, 18 Aug 2023 23:00:51 +0000 (09:00 +1000)]
render-lines: always give cursor offset when measuring cursor line

As presence of cursor can change size of appearance, we need to always
report where the cursor is when measuring the line.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: another wrapping fix.
NeilBrown [Fri, 18 Aug 2023 22:56:44 +0000 (08:56 +1000)]
lib-renderline: another wrapping fix.

If the wrap item is the part that won't it, need need to be caseful that
'x' hasn't been adjusted for xdiff yet.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agotests: fix up "extend" and extend 00-basic
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agohistory: add support for "favourites".
NeilBrown [Fri, 18 Aug 2023 21:03:10 +0000 (07:03 +1000)]
history: add support for "favourites".

favourites can be configured for different history files.
A-n moves to favourites if not in history.

config file can now have "doc:FOO" sections for docs that don't have
file names.

A bug in doc:EOL is fixed

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-render: move tab/non-tab distinction out of find_xy()
NeilBrown [Fri, 18 Aug 2023 19:35:26 +0000 (05:35 +1000)]
lib-render: move tab/non-tab distinction out of find_xy()

The special handling of tabs is best kept in common code.
So move more into do_measure().

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-line:measure now reports if the line ended properly
NeilBrown [Fri, 18 Aug 2023 07:09:20 +0000 (17:09 +1000)]
render-line:measure now reports if the line ended properly

If the last line in a document doesn't end with a newline character, we
need to handle that interesting case.
Make it easier to do so.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomerge-view: allow 9:A-m to both cut and paste.
NeilBrown [Fri, 18 Aug 2023 04:45:01 +0000 (14:45 +1000)]
merge-view: allow 9:A-m to both cut and paste.

If there is an  active merge 9:A-m cuts it.
If there isn't but is a selection, 9:A-m will paste it.

Now if there is an active merge and a selection, 9:A-m will cut and
paste.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomergeview: adding merge to region needs full-lines in region
NeilBrown [Fri, 18 Aug 2023 04:30:25 +0000 (14:30 +1000)]
mergeview: adding merge to region needs full-lines in region

If the region isn't whole lines, make it so.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: avoid putting extra space at EOF for small pane
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemacs-search: don't try to replace same string twice
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoREADME: delete all "Done" items.
NeilBrown [Fri, 18 Aug 2023 03:45:07 +0000 (13:45 +1000)]
README: delete all "Done" items.

It was all getting too noisy.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline - lots of cleanup
NeilBrown [Fri, 18 Aug 2023 03:43:22 +0000 (13:43 +1000)]
lib-renderline - lots of cleanup

Review all non-image code and clean things up in various ways.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: only measure line when needed
NeilBrown [Wed, 16 Aug 2023 21:59:35 +0000 (07:59 +1000)]
lib-renderline: only measure line when needed

Before performing measure_line work, check if any of the inputs have
changed.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderlines: clean up left_margin handling.
NeilBrown [Wed, 16 Aug 2023 09:20:09 +0000 (19:20 +1000)]
lib-renderlines: clean up left_margin handling.

In particular the wrap_margin must initially be based on the left margin.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorexel: fix bug with capturing groups.
NeilBrown [Tue, 15 Aug 2023 12:18:18 +0000 (22:18 +1000)]
rexel: fix bug with capturing groups.

The post-parse editing of group matches to put all the right branches
in place was messing up capture requests.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomessageline: full right-align date/time
NeilBrown [Tue, 15 Aug 2023 12:07:09 +0000 (22:07 +1000)]
messageline: full right-align date/time

Now that I can fully right-align without wrapping, do it for the time in
the message line.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agotests: add a faster version of refresh.
NeilBrown [Tue, 15 Aug 2023 12:02:37 +0000 (22:02 +1000)]
tests: add a faster version of refresh.

Doing it "fast" often works, so allow that as an option.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline allow rtab to avoid line wraps.
NeilBrown [Tue, 15 Aug 2023 11:47:22 +0000 (21:47 +1000)]
lib-renderline allow rtab to avoid line wraps.

If rtab is used, don't wrap if last char is at right edge.
If no rtab, continue to wrap so there is somewhere for cursor to be.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: various wrapping fixed.
NeilBrown [Tue, 15 Aug 2023 10:06:39 +0000 (20:06 +1000)]
lib-renderline: various wrapping fixed.

In particular, the subject line in notmuch summary lines wraps properly
now.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: Fix length of split section in do_draw()
NeilBrown [Mon, 14 Aug 2023 02:27:40 +0000 (12:27 +1000)]
lib-renderline: Fix length of split section in do_draw()

Need to subtract start from the end to get the length.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderlines: erase before drawing an image
NeilBrown [Mon, 14 Aug 2023 00:03:36 +0000 (10:03 +1000)]
lib-renderlines: erase before drawing an image

I lost the Draw:clear for images, so they get drawn on the wrong pane
and end up as background.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoTODO updates.
NeilBrown [Sun, 13 Aug 2023 23:13:55 +0000 (09:13 +1000)]
TODO updates.

What still needs to be done for lib-renderline...

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: move tab handling into do_measure()
NeilBrown [Sun, 13 Aug 2023 09:54:00 +0000 (19:54 +1000)]
lib-renderline: move tab handling into do_measure()

This makes do_measure() more like do_draw()

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: pass ri to do_measure()
NeilBrown [Sun, 13 Aug 2023 09:37:04 +0000 (19:37 +1000)]
lib-renderline: pass ri to do_measure()

Pass in the ri, and don't bother passing the attr which is always
ri->attr.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: introduce measure_str() for simple string measurement.
NeilBrown [Sun, 13 Aug 2023 09:32:18 +0000 (19:32 +1000)]
lib-renderline: introduce measure_str() for simple string measurement.

This makes a clean separation leaving do_measure() only for text in
->line.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: don't pass scale to do_measure()
NeilBrown [Sun, 13 Aug 2023 09:25:05 +0000 (19:25 +1000)]
lib-renderline: don't pass scale to do_measure()

instead of passing scale, extra rd from p and use that to find scale.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderlines: pass split to do_draw() instead of str/len/tab_cols.
NeilBrown [Sun, 13 Aug 2023 09:21:44 +0000 (19:21 +1000)]
lib-renderlines: pass split to do_draw() instead of str/len/tab_cols.

I think this removes most of the ugliness.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline; pass ri to do_draw instead of ri->attr
NeilBrown [Sun, 13 Aug 2023 06:30:55 +0000 (16:30 +1000)]
lib-renderline; pass ri to do_draw instead of ri->attr

I'll use more from ri soon, for now just pass it in and use the ->attr.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: factor out draw_wrap()
NeilBrown [Sun, 13 Aug 2023 06:25:55 +0000 (16:25 +1000)]
lib-renderline: factor out draw_wrap()

Drawing the line-wrap markers doesn't need all the complexity of
do_draw(), so factor it out into a separate function.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: add ->ascent inside do_draw()
NeilBrown [Sun, 13 Aug 2023 06:21:15 +0000 (16:21 +1000)]
lib-renderline: add ->ascent inside do_draw()

Instead of all callers of do_draw() needing to add ->ascent,
add it inside do_draw().

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: drop scale arg to do_draw()
NeilBrown [Sun, 13 Aug 2023 03:41:39 +0000 (13:41 +1000)]
lib-renderline: drop scale arg to do_draw()

We can find the scale from rline_data which we can find from the pane.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline change rl vars to ri
NeilBrown [Sun, 13 Aug 2023 03:35:42 +0000 (13:35 +1000)]
lib-renderline change rl vars to ri

rl vars which used to be for render-line are now for render-item,
so rename to ri.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomassive lib-renderline rewrite
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorenderline - fix margin for tab.
NeilBrown [Fri, 11 Aug 2023 05:51:03 +0000 (15:51 +1000)]
renderline - fix margin for tab.

For some strange reason, tabs were wrapping before other chars.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoDon't show default wrap tail for requested wrap point.
NeilBrown [Fri, 11 Aug 2023 04:52:36 +0000 (14:52 +1000)]
Don't show default wrap tail for requested wrap point.

Requested wrap points suggest wrap is expected, so don't show the
wrap tail.  I think it is ugly.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agotile: silence use-before-set warning.
NeilBrown [Fri, 11 Aug 2023 01:47:54 +0000 (11:47 +1000)]
tile: silence use-before-set warning.

"remain" is only used if "remaining" is not zero, so it will be set
before used.  But compiler cannot see that.  Help it out.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomessageline: don't ask for cursor on render-line
NeilBrown [Wed, 9 Aug 2023 01:05:46 +0000 (11:05 +1000)]
messageline: don't ask for cursor on render-line

To avoid asking of a cursor, we need to pass -1.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: pass focus to vmark_set()
NeilBrown [Wed, 9 Aug 2023 01:04:35 +0000 (11:04 +1000)]
render-lines: pass focus to vmark_set()

Good practice is to always send the focus.
We will need this to get the prefix at 'set' time.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agohistory: use A-r rather than C-R for search
NeilBrown [Wed, 9 Aug 2023 01:01:03 +0000 (11:01 +1000)]
history: use A-r rather than C-R for search

Using C-R and particularly C-S break search-replace because I can no
longer search-again from the replace box (which has history).

So switch to A-r A-s.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-input - don't assume Efallthrough is 0
NeilBrown [Wed, 9 Aug 2023 00:56:23 +0000 (10:56 +1000)]
lib-input - don't assume Efallthrough is 0

One day I might change Efallthrough..

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoncurses: catch and ignore focus-in/out
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoChange pane_resize() to return Bool
NeilBrown [Tue, 8 Aug 2023 22:49:22 +0000 (08:49 +1000)]
Change pane_resize() to return Bool

pane_resize() now reports if any change happened.
One caller wants this.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: factor out code in revalidate_start()
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: call_render_line_to_point never returns error
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.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: don't look for point in line where it isn't.
NeilBrown [Tue, 8 Aug 2023 23:17:13 +0000 (09:17 +1000)]
render-lines: don't look for point in line where it isn't.

call_render_line_to_point() doesn't return an error, so calling
it when point isn't on the line isn't well defined.
So don't do it.

This changes the number of blank lines after end-of-file, which I think
I am happy with, so self-tests change.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-server: fix a couple of typos
NeilBrown [Tue, 8 Aug 2023 22:27:38 +0000 (08:27 +1000)]
lib-server: fix a couple of typos

I mustn't be using this code enough because these should be obvious.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agominor unalloc improvements.
NeilBrown [Tue, 8 Aug 2023 22:25:32 +0000 (08:25 +1000)]
minor unalloc improvements.

unalloc can now free 'const' pointers, and strings.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorenderline: change render-line:measure to return the cursor attributes.
NeilBrown [Sat, 5 Aug 2023 09:00:52 +0000 (19:00 +1000)]
renderline: change render-line:measure to return the cursor attributes.

Rather than saving the attributes at the cursor to be returned later,
return them directly from render-line:measure.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorenderline: change render-line:findxy to return the attributes
NeilBrown [Fri, 4 Aug 2023 23:56:59 +0000 (09:56 +1000)]
renderline: change render-line:findxy to return the attributes

Rather then remembers the attributes to be collected later with a
get:attr, return the attributes in a comm2 callback for immediate use.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: change to use embedded pane data
NeilBrown [Fri, 4 Aug 2023 23:21:04 +0000 (09:21 +1000)]
lib-renderline: change to use embedded pane data

The rline_data is now embedded in the pane.

Signed-off-by: NeilBrown <neil@brown.name>