]>
git.neil.brown.name Git - edlib.git/log
NeilBrown [Thu, 14 Sep 2023 11:38:06 +0000 (21:38 +1000)]
Introduce PANE_DATA_VOID
This is for panes that don't have any data.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 11:20:56 +0000 (21:20 +1000)]
Discard pane->_data.
This doesn't have a use any more, so discard it.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 10:25:01 +0000 (20:25 +1000)]
Use PANE_DATA_PTR_TYPE in doc-docs.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 10:22:23 +0000 (20:22 +1000)]
Use PANE_DATA_PTR_TYPE for lib-tile
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 10:19:23 +0000 (20:19 +1000)]
Introduce PANE_DATA_PTR_TYPE_3 for emacs-search.
Emacs-search has 2 pane types, one is a ptr type.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 10:13:32 +0000 (20:13 +1000)]
Use PANE_DATA_PTR_TYPE in lang-python
This avoid the need for _data.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 10:11:18 +0000 (20:11 +1000)]
lib-charset: use PANE_DATA_PTR_TYPE
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 10:08:09 +0000 (20:08 +1000)]
lib-wiggle: switch to embedded data pattern
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 10:04:06 +0000 (20:04 +1000)]
Introduce PANE_DATA_PTR_TYPE for mode-emacs.
PANE_DATA_PTR_TYPE means that ->data is a simple pointer that gets
initialised by pane_register.
Use this for mode-emacs.c
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 09:24:16 +0000 (19:24 +1000)]
Remove pane->data when PANE_DATA_TYPE not set.
This forces use of _dats which easily highlights places that still need
to be converted.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 08:11:47 +0000 (18:11 +1000)]
Remove doc->self link.
Now that doc is always embedded in the pane, we don't need the ->self
link.
So all uses of a generic doc need to use ->doc to find the doc.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 07:01:11 +0000 (17:01 +1000)]
Remove option for doc being stored other than in the pane.
Now DOC_DATA_TYPE must be given, and the doc must be in the pane.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 06:41:25 +0000 (16:41 +1000)]
lang-python: move doc from python object into pane.
I want the doc to *always* be in the pane. Python is only exception.
So change python.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 04:14:09 +0000 (14:14 +1000)]
Explicitly guard against infinite loops in consistency check.
We don't want the consistency check to introduce instability. So make
sure they don't loop indefinitely - either due to corrupted list or just
very large lists.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 04:04:22 +0000 (14:04 +1000)]
notmuch master_view: catch exception so .recursed in reset properly.
If self.list_pane.call(key, **a) raised an exception, self.recursed
would not be reset, and so would cause repeated warnings.
So DTRT.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Thu, 14 Sep 2023 04:01:31 +0000 (14:01 +1000)]
notmuch: refresh query on "doc:closed" rather than "Close" on view.
When a view is closed, doc:closed is sent to the document. This seems
like a slightly better way to trigger the "no-one is watching so
refresh", rather than on "Close" from the view - though both work.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Wed, 13 Sep 2023 23:44:02 +0000 (09:44 +1000)]
Mark all "Close" handlers as being closed_ok.
This allows use to remove the strcmp on "Close".
It requires python commands to be able to be marks closed_ok.
This is done with name "handle_close" or any name ending "_closed_ok".
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Wed, 13 Sep 2023 23:07:51 +0000 (09:07 +1000)]
Use DEF_CMD_CLOSED for Close:mark
Rather than special strcmp handling, use DEF_CMD_CLOSED to ensure
Close:mark can be called after a pane has been closed.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Wed, 13 Sep 2023 22:37:20 +0000 (08:37 +1000)]
Allow Notify:Close to work for docs being closed.
When a doc is closed we need to allow some notifications.
Remove the Close:Notify hack and use Notify:Close with the
target commands defined with DEF_CMD_CLOSED().
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Wed, 13 Sep 2023 22:32:17 +0000 (08:32 +1000)]
Introduce closed_ok flag on commands.
If closed_ok is set, then it is safe to call the command even if ->home
is DAMAGED_CLOSED. This will eventually replace checks on "Close".
For now it allows doc_pass_on to pass commands on to the doc even
when the display stack is shutting down. notmuch needs this to ask
the query doc to refresh when a view is closed.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Wed, 13 Sep 2023 22:29:28 +0000 (08:29 +1000)]
Change calls on closed panes to return Efallthrough, not Efail
Efail is too harsh. We really want to make it appear that the command
doesn't exist. So do that.
This fixes a problem with x11selection-xcb where a notification to a
closed pane returned Efail which has a large abs value and so drowned
out the good results.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Mon, 11 Sep 2023 08:59:15 +0000 (18:59 +1000)]
display-x11: don't draw both cursors.
We were always drawing the outline cursor, and sometimes the block
cursor. This is pointless.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Mon, 11 Sep 2023 08:51:05 +0000 (18:51 +1000)]
display-x11: draw outline cursor entirely inside box.
The stroke draws either side of the line given. We
need to allow for that if we want to stay entirely inside
the allowed space.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Mon, 11 Sep 2023 07:37:49 +0000 (17:37 +1000)]
c-mode: fix () in first statement after 'case'
The code to avoid extra-indenting within a {} block in a case also
broke indenting within () or [].
Fix it.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Sun, 10 Sep 2023 09:41:04 +0000 (19:41 +1000)]
Send warning message when nested notification is prohibited.
As well a logging details - broadcast a message so nested notification
get noticed.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Sat, 9 Sep 2023 03:55:48 +0000 (13:55 +1000)]
Discard DocLeaf - use new pane_leaf() instead.
pane_leaf() follows children of the pane as long as there is only one
with ->z==0. Returns the final pane found.
Use this together with DocPane instead the hackish DocLeaf.
Possible some pane_focus() should be changed to pane_leaf().
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Sat, 9 Sep 2023 03:38:31 +0000 (13:38 +1000)]
Rename pane_leaf() to pane_focus()
As the function follows the ->focus pointer up, this seems like a better
name.
The pane name ".leaf" becomes ".final_focus" as ".focus" is taken for
the immediate focus.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Sat, 9 Sep 2023 03:35:38 +0000 (13:35 +1000)]
Rename pane_focus() to pane_take_focus()
This is more descriptive, matches the interface used in python, and
leaves pane_focus() free for other uses.
Signed-off-by: NeilBrown <neil@brown.name>
NeilBrown [Sat, 9 Sep 2023 03:21:34 +0000 (13:21 +1000)]
core-log: reduce number of statics
Store log_file in the doc, and only store the log_pane.
log_doc and then log_file can be found from there.
Also close log_file() on "Close".
Signed-off-by: NeilBrown <neil@brown.name>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>