]> git.neil.brown.name Git - edlib.git/log
edlib.git
2 years agoRename Display: commands to window:
NeilBrown [Sat, 9 Sep 2023 02:34:47 +0000 (12:34 +1000)]
Rename Display: commands to window:

We already have some window:.  Having both is confusion.
Standardise on window:

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoDiscard Display:set: in favour of window:set:
NeilBrown [Sat, 9 Sep 2023 02:33:32 +0000 (12:33 +1000)]
Discard Display:set: in favour of window:set:

Display:set: and window:set: to essentially the same thing.
We only need one.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoDisable LOG during refresh if log is visible.
NeilBrown [Sat, 9 Sep 2023 02:17:28 +0000 (12:17 +1000)]
Disable LOG during refresh if log is visible.

If there is a view on the log, then allowing log during
refresh trigger recursion in unhelpful way.

Also line-count is sync in testing mode, and log is big
so disable line-count then.

This allows log to be viewed when viewing a test.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoIntroduce Close:Notify
NeilBrown [Sat, 9 Sep 2023 00:07:16 +0000 (10:07 +1000)]
Introduce Close:Notify

Close:Notify is like Notify:Close, but can be called even after the home
pane has DAMAGED_CLOSED.  Functions that respond to this must be careful
to not trust anything that "Close" might have freed.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoDiscard "Free"
NeilBrown [Fri, 8 Sep 2023 12:54:15 +0000 (22:54 +1000)]
Discard "Free"

"Free" is no longer needed and nothing responds to ti. So stop sending it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agotile: don't use "Free", just "Close".
NeilBrown [Fri, 8 Sep 2023 12:51:20 +0000 (22:51 +1000)]
tile: don't use "Free", just "Close".

"Close" is now completely safe against subsequent calls, so we don't
need "Free".

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodisplay-x11-xcb: don't use Free
NeilBrown [Fri, 8 Sep 2023 12:30:44 +0000 (22:30 +1000)]
display-x11-xcb: don't use Free

Now that Close is guaranteed to be the last thing call, all for "Free"
can be done in "Close".

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoEnsure we never call anything after "Close".
NeilBrown [Fri, 8 Sep 2023 12:27:34 +0000 (22:27 +1000)]
Ensure we never call anything after "Close".

The only valid commands on a close pane are "Close", "Close:mark", and
"Notify:Close" and these are always pane_call.  So blocks all other
calls on DAMAGED_CLOSED panes, and block even these on DAMAGED_DEAD.

Note that "Free" is also allowed, but will soon be gone.

This requires that home_comm_call() must be supported so that a comm can
be called with a recently-closed pane as the focus (assuming it won't be
dereferenced).

Signed-off-by: NeilBrown <neil@brown.name>
2 years agocopybuf: switch to embedded-data pattern
NeilBrown [Fri, 8 Sep 2023 12:10:21 +0000 (22:10 +1000)]
copybuf: switch to embedded-data pattern

Signed-off-by: NeilBrown <neil@brown.name>
2 years agohistory: switch to embedded-data pattern.
NeilBrown [Fri, 8 Sep 2023 12:04:40 +0000 (22:04 +1000)]
history: switch to embedded-data pattern.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agohistory: drop second string arg to attach-history
NeilBrown [Fri, 8 Sep 2023 11:54:01 +0000 (21:54 +1000)]
history: drop second string arg to attach-history

All callers pass popup:close as second arg to attach-history.
This is a command that history catches so as to save the new
entry into this history.
Handling it requires complexity that I would rather avoid.
So for now - just assume it is always popup:close.
If a need appears, I can come up with some other way to
achieve the same effect.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoinput: switch to embedded-data pattern
NeilBrown [Fri, 8 Sep 2023 10:36:16 +0000 (20:36 +1000)]
input: switch to embedded-data pattern

Signed-off-by: NeilBrown <neil@brown.name>
2 years agokeymap: switch to embedded-data pattern.
NeilBrown [Fri, 8 Sep 2023 10:32:52 +0000 (20:32 +1000)]
keymap: switch to embedded-data pattern.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agopopup: switch to embedded-data pattern.
NeilBrown [Fri, 8 Sep 2023 10:31:13 +0000 (20:31 +1000)]
popup: switch to embedded-data pattern.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-complete: use Close instead of Free
NeilBrown [Fri, 8 Sep 2023 10:12:46 +0000 (20:12 +1000)]
render-complete: use Close instead of Free

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-format: switch from "Free" to "Close"
NeilBrown [Fri, 8 Sep 2023 10:08:25 +0000 (20:08 +1000)]
render-format: switch from "Free" to "Close"

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodoc-multipart: don't use Free
NeilBrown [Fri, 8 Sep 2023 10:04:54 +0000 (20:04 +1000)]
doc-multipart: don't use Free

Just use Close.  Don't need ->parts to be 'safe'.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agotext: don't use Free
NeilBrown [Fri, 8 Sep 2023 09:58:25 +0000 (19:58 +1000)]
text: don't use Free

There is no need to delay freeing of names to Free - do it in Close.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodoc-email: free ->invis at Close time, not Free
NeilBrown [Fri, 8 Sep 2023 09:55:04 +0000 (19:55 +1000)]
doc-email: free ->invis at Close time, not Free

I want to reduce the use for Free.  This one can easily be removed.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoDiscard edlib_do_free()
NeilBrown [Fri, 8 Sep 2023 09:41:59 +0000 (19:41 +1000)]
Discard edlib_do_free()

No code uses this any more, so discard it.
Also change pane->data_size to pane->alloc_size and use it for
accounting when freeing the pane.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agox11selection-xcb: switch to embedded-data pattern
NeilBrown [Fri, 8 Sep 2023 09:35:42 +0000 (19:35 +1000)]
x11selection-xcb: switch to embedded-data pattern

Now that we can have two pane types - this is easy.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemacs-search: use embedded data pattern.
NeilBrown [Fri, 8 Sep 2023 09:28:02 +0000 (19:28 +1000)]
emacs-search: use embedded data pattern.

emacs-search has three pane types.
One uses a simple pointer which is easy.
Two use different structures.  So introduce PANE_DATA_TYPE_2
and allow two different data types: ->data and ->data2

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodocs: discard "Free" handler
NeilBrown [Fri, 8 Sep 2023 08:17:43 +0000 (18:17 +1000)]
docs: discard "Free" handler

The doc already uses DOC_DATA_TYPE, so "Free" is not needed.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: switch to embedded-data pattern
NeilBrown [Fri, 8 Sep 2023 07:52:36 +0000 (17:52 +1000)]
render-lines: switch to embedded-data pattern

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-hex: switch to embedded-data pattern
NeilBrown [Fri, 8 Sep 2023 07:48:06 +0000 (17:48 +1000)]
render-hex: switch to embedded-data pattern

Signed-off-by: NeilBrown <neil@brown.name>
2 years agox11selection-gtk: switch to embedded-data pattern
NeilBrown [Fri, 8 Sep 2023 07:46:22 +0000 (17:46 +1000)]
x11selection-gtk: switch to embedded-data pattern

Signed-off-by: NeilBrown <neil@brown.name>
2 years agowhitespace: switch to embedded-data pattern
NeilBrown [Fri, 8 Sep 2023 07:44:04 +0000 (17:44 +1000)]
whitespace: switch to embedded-data pattern

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoviewer: switch to embedded-data pattern.
NeilBrown [Fri, 8 Sep 2023 07:42:36 +0000 (17:42 +1000)]
viewer: switch to embedded-data pattern.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoview: switch to embedded-data pattern
NeilBrown [Fri, 8 Sep 2023 07:40:49 +0000 (17:40 +1000)]
view: switch to embedded-data pattern

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorfc822header: switch to embedded-data pattern
NeilBrown [Fri, 8 Sep 2023 07:39:35 +0000 (17:39 +1000)]
rfc822header: switch to embedded-data pattern

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorenderline: discard "Free" interface
NeilBrown [Fri, 8 Sep 2023 07:38:00 +0000 (17:38 +1000)]
renderline: discard "Free" interface

lib-renderline already uses embedded-data, to "Free" is pointless.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomarkup: switch to embedded-data pattern
NeilBrown [Fri, 8 Sep 2023 07:37:28 +0000 (17:37 +1000)]
markup: switch to embedded-data pattern

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolinefilter: switch to embedded-data pattern.
NeilBrown [Fri, 8 Sep 2023 07:36:05 +0000 (17:36 +1000)]
linefilter: switch to embedded-data pattern.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolinecount: switch to embedded-data pattern.
NeilBrown [Fri, 8 Sep 2023 07:32:49 +0000 (17:32 +1000)]
linecount: switch to embedded-data pattern.

linecount now embeds data.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolibevent: switch to embedded data pattern.
NeilBrown [Fri, 8 Sep 2023 07:29:12 +0000 (17:29 +1000)]
libevent: switch to embedded data pattern.

Note that previously pane_register was being called with a NULL parent,
though this was hidden from smatch.
This meant that pane_damaged() skipped this event:idle registration.
Fixing that resulted in extreme recursion.  That wasn't really
needed for libevent, so break it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agobase64: don't define "Free"
NeilBrown [Fri, 8 Sep 2023 07:10:49 +0000 (17:10 +1000)]
base64: don't define "Free"

b64 doesn't have per-pane data, so no need for "Free"

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-aspell: switch to embedded data pattern
NeilBrown [Fri, 8 Sep 2023 07:08:44 +0000 (17:08 +1000)]
lib-aspell: switch to embedded data pattern

aspell now embedded data in pane.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agocore-doc; embed doc_data in the pane.
NeilBrown [Fri, 8 Sep 2023 07:02:30 +0000 (17:02 +1000)]
core-doc; embed doc_data in the pane.

Switch to the embed-data-in-pane for doc_data.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-view: prevent stray clicks from going to parent.
NeilBrown [Fri, 8 Sep 2023 06:50:10 +0000 (16:50 +1000)]
lib-view: prevent stray clicks from going to parent.

Any clicks outside of the child should be stopped from getting to the
parent where generic handing might assume the click is in the document.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: handle case where cursor at end-of-file.
NeilBrown [Fri, 8 Sep 2023 06:20:08 +0000 (16:20 +1000)]
render-lines: handle case where cursor at end-of-file.

When cursor is at end-of-file, revalidate_start() wasn't detecting that
it was on-screen.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorenderline: don't try to parse <> in the prefix.
NeilBrown [Fri, 8 Sep 2023 05:46:32 +0000 (15:46 +1000)]
renderline: don't try to parse <> in the prefix.

Markup isn't allowed in the prefix, so don't try to parse it.
This fixes a problem when the default for find-document ends <2>.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoinput: Add Keystroke-sequence interface
NeilBrown [Fri, 8 Sep 2023 05:35:51 +0000 (15:35 +1000)]
input: Add Keystroke-sequence interface

Rather than having two copies for code to convert a string (from a
menu selection) to a sequence of keystrokes, put the code in lib-input.

As the keys are space-separated, allow :SPC to be used for a space "- ".

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemacs: put a menu on the selection.
NeilBrown [Fri, 8 Sep 2023 05:19:39 +0000 (15:19 +1000)]
emacs: put a menu on the selection.

The selection can now trigger a menu (right-click)
to which other modules can easily add entries.

Also: don't claim selection until we are clearly starting one.  A single
click doesn't start a menu.

Also: allow menus to be placed at-mouse rather than always at start
of the active region.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: support a to-list as well as a from-list
NeilBrown [Fri, 8 Sep 2023 02:51:31 +0000 (12:51 +1000)]
notmuch: support a to-list as well as a from-list

queries in query.to-list can be extended by menu selection to have
to:ADDR added.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAdd lib-menubar
NeilBrown [Sun, 3 Sep 2023 12:11:51 +0000 (22:11 +1000)]
Add lib-menubar

We now have a menu bar.  It can be disabled by config, and this is done
for testing.

There are still things to do to make it good, but we have a good start.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomenu: show action in a different colour
NeilBrown [Sun, 3 Sep 2023 12:07:34 +0000 (22:07 +1000)]
menu: show action in a different colour

To make sure the name and the action look different, use a different
color (blue) for the action.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomenu: support detaching the doc from a menu.
NeilBrown [Sun, 3 Sep 2023 11:56:16 +0000 (21:56 +1000)]
menu: support detaching the doc from a menu.

It might be use to create a menu doc once, and re-use it.

For this to work we need to be able to create a menu with an existing
doc.
A new mode for attach-menu allows this.

It will also be useful to be able to edit the detached document so add
global commands menu:add and menu:clear which do this.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-menu: be more consistent in setting 'mode' of menu
NeilBrown [Sun, 3 Sep 2023 11:52:35 +0000 (21:52 +1000)]
lib-menu: be more consistent in setting 'mode' of menu

Rather than using the string of one mode flag and the num for
another, use the string for all.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomenu: add menu-clear interface
NeilBrown [Sun, 3 Sep 2023 11:46:48 +0000 (21:46 +1000)]
menu: add menu-clear interface

This allows a menu to be cleared prior to recreating it.
I think this is easier that allowing fine-grained editing.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: allow background to be given.
NeilBrown [Sun, 3 Sep 2023 09:56:58 +0000 (19:56 +1000)]
lib-renderline: allow background to be given.

Often background is provided by some other pane.
But allow it to be given to renderline-set too.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoncurses: fix setting of default attrs on Draw:clear
NeilBrown [Sun, 3 Sep 2023 09:48:18 +0000 (19:48 +1000)]
ncurses: fix setting of default attrs on Draw:clear

If no attrs are given for Draw:clear, we use background from parent.

This wasn't implemented properly.  If the pane receiving the text was
the same as the pane that was cleared, the text got the background of a
different pane.  That should only happen on clear, not when drawing text.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoconfig: allow the TESTING and NOTESTING prefix to apply to every line.
NeilBrown [Sun, 3 Sep 2023 09:39:56 +0000 (19:39 +1000)]
config: allow the TESTING and NOTESTING prefix to apply to every line.

We might want any config item to apply differently in testing,
so make that possible.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomenu: disable shift as well as wrap.
NeilBrown [Sun, 3 Sep 2023 09:34:20 +0000 (19:34 +1000)]
menu: disable shift as well as wrap.

As 'popup' sets render-wrap, we must set to later in the stack for it to
take effect.  We need text not to shift at all, or we get problems with
cursor at the end of right-aligned text.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoDon't call "Close" on panes that haven't been initialised.
NeilBrown [Sun, 3 Sep 2023 09:24:23 +0000 (19:24 +1000)]
Don't call "Close" on panes that haven't been initialised.

If the Child-Notify call fails we discard the pane.  But calling "Close"
will call code that expect the pane.data to be initialised.  It won't
be.

So add a DAMAGED flag to allow this call to be skipped.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: avoid looping indefinitely when shifting.
NeilBrown [Sun, 3 Sep 2023 09:16:51 +0000 (19:16 +1000)]
render-lines: avoid looping indefinitely when shifting.

If <rtab> is used for markup when wrap is enabled, and if the cursor is
at the end of the list, it is impossible to shift enough that there is
room for the cursor after the text.
So the shift loop continues endlessly.

Put a hard limit on this, and use a consistent limit in the other places
that we shift.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: clean up action code.
NeilBrown [Sun, 3 Sep 2023 02:04:06 +0000 (12:04 +1000)]
render-lines: clean up action code.

The 'if' branching was less than clear.  Tidy it up a bit.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agopane: add option arg to pane_has_focus()
NeilBrown [Sat, 2 Sep 2023 10:32:08 +0000 (20:32 +1000)]
pane: add option arg to pane_has_focus()

A second arg to pane_has_focus checks is the target pane as the focus
from the given root.  This is occasionally useful.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomenu: flip args to menu-add
NeilBrown [Fri, 1 Sep 2023 23:26:07 +0000 (09:26 +1000)]
menu: flip args to menu-add

Rather then action, then name, pass name then action
to menu-add. Action default to name.
This seems more natural.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoRename doc:attach-helper to doc:get-doc
NeilBrown [Fri, 1 Sep 2023 02:47:22 +0000 (12:47 +1000)]
Rename doc:attach-helper to doc:get-doc

The behaviour of doc:attach-helper is to call the comm2 callback with
the doc as the ci->focus.
This can be used to attach a helper, but can be used for other things.
It really just gets the doc for the caller to act on.
So rename it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomessageline: change to use PANE_DOC_DATA
NeilBrown [Fri, 1 Sep 2023 02:44:38 +0000 (12:44 +1000)]
messageline: change to use PANE_DOC_DATA

This avoids the need to alloc/free.

Signed-off-by: NeilBrown <neil@brown.name>
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>