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.
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).
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.
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
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.
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.
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.
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.
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.
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.