]> git.neil.brown.name Git - edlib.git/log
edlib.git
6 months agoTODO: clean out done items. master
NeilBrown [Wed, 1 Nov 2023 06:44:55 +0000 (17:44 +1100)]
TODO: clean out done items.

It is always fun crossing things of the todo list, or erasing them completely.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agolib-search: add a "forward" command
NeilBrown [Wed, 1 Nov 2023 06:42:42 +0000 (17:42 +1100)]
lib-search: add a "forward" command

To match "reverse", add "forward".

Signed-off-by: NeilBrown <neil@brown.name>
6 months agolib-search: add "reverse" command for search commands.
NeilBrown [Wed, 1 Nov 2023 06:23:07 +0000 (17:23 +1100)]
lib-search: add "reverse" command for search commands.

A "search" command created with make-search now responds to
"reverse" and does a backwards search.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agorenderlines: Move-Line should return Efalse not Efail
NeilBrown [Mon, 30 Oct 2023 04:12:15 +0000 (15:12 +1100)]
renderlines: Move-Line should return Efalse not Efail

Commands returning Efail cause warning messages.  We don't want that
just for reaching end of file.  So return Efalse instead.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agolib-server: catch errors from Tile:bury
NeilBrown [Mon, 30 Oct 2023 04:03:46 +0000 (15:03 +1100)]
lib-server: catch errors from Tile:bury

When we call Tile:bury, the tile pane might already be read which would
result in an error.  But we don't care, so catch it.

This happens when the client-side is run with "-t".

Signed-off-by: NeilBrown <neil@brown.name>
6 months agourl: slow click doesn't activate link
NeilBrown [Thu, 19 Oct 2023 09:31:01 +0000 (20:31 +1100)]
url: slow click doesn't activate link

A slow click will display the link only.  A fast click is needed,
or a repeated Enter, to activate it.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agoFilename completion: don't include trailing slash unless only match.
NeilBrown [Thu, 19 Oct 2023 09:11:51 +0000 (20:11 +1100)]
Filename completion: don't include trailing slash unless only match.

Return precise number of matches from the completion code, and when
completing a file name, drop the slash if not unique.

Otherwise if there are several directory that end with the same string,
that can get a '/' added too early.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agoAdd a "prepare" action on mouse-down.
NeilBrown [Wed, 18 Oct 2023 21:56:03 +0000 (08:56 +1100)]
Add a "prepare" action on mouse-down.

mouse-down sends "prepare"
mouse-up sends "activate"

lib-url uses this to show the url on down, and follow it on up.
The follow can be aborted by moving the mouse.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agoRespell "window:" as "Window:".
NeilBrown [Wed, 18 Oct 2023 04:00:06 +0000 (15:00 +1100)]
Respell "window:" as "Window:".

It seems more consistent to capitalise these Windows now that I can.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agoRespell "Window:" as "Tile:".
NeilBrown [Tue, 17 Oct 2023 05:48:31 +0000 (16:48 +1100)]
Respell "Window:" as "Tile:".

A "Display" is a module for drawing.
A "Window" is one particular instance of a Display
A "Tile" is a rectangle within a Window. It might overlap
 other Tiles, it might now.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agow3m: write html to tempfile, not to a pipe.
NeilBrown [Tue, 17 Oct 2023 05:43:47 +0000 (16:43 +1100)]
w3m: write html to tempfile, not to a pipe.

If the HTML is large and w3m passes it straight through, we can block
writing to the pipe.  So write to a temp file first instead.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agonotmuch: show raw message in a Popup:Tile
NeilBrown [Tue, 17 Oct 2023 05:36:41 +0000 (16:36 +1100)]
notmuch: show raw message in a Popup:Tile

The "V" command now shows the message in a popup tile.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agoautospell: fix detection of existing spell range handler
NeilBrown [Mon, 9 Oct 2023 22:35:04 +0000 (09:35 +1100)]
autospell: fix detection of existing spell range handler

Two cases:
 no rangecheck at all - return is 0
 rangecheck existgs, but not for spell: return is Efalse

So test <= 0.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agorangetrack: dont' track owner or clean up when owner closes.
NeilBrown [Mon, 9 Oct 2023 22:30:34 +0000 (09:30 +1100)]
rangetrack: dont' track owner or clean up when owner closes.

We want parsing to be stable - we shouldn't have to re-spellcheck when
a doc is revisited.  So leave range info permanently until doc is closed.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agoSplit display creation into two separate steps.
NeilBrown [Sun, 8 Oct 2023 08:17:21 +0000 (19:17 +1100)]
Split display creation into two separate steps.

This effectively reverts an earlier patch.
That patch caused x11 selection to stop working because
the relevant pane was attached before DISPLAY had been set.
So now we create the display first, then have the opportunity to set
attributes, then call window-active-display which adds all the extra
panes and attaches a document.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agoFix redraw when requesting to display last line
NeilBrown [Fri, 6 Oct 2023 23:36:46 +0000 (10:36 +1100)]
Fix redraw when requesting to display last line

When we request to display the last line, we need to know if the last
line is fully displayed.  We previously assumed it wasn't, which created
strange artifacts.
We can know for certain, so add that test.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agoAdd QRCODE to selection menu
NeilBrown [Fri, 6 Oct 2023 22:28:30 +0000 (09:28 +1100)]
Add QRCODE to selection menu

Signed-off-by: NeilBrown <neil@brown.name>
6 months agoChange image scaling from adaptive to box-filter
NeilBrown [Sun, 8 Oct 2023 08:07:50 +0000 (19:07 +1100)]
Change image scaling from adaptive to box-filter

When I add QR-codes I'll need precise scaling of pizel - no bluring.
So change the scaling used.  Maybe one day this should be selectable.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agoncurses: don't look past the end of an image.
NeilBrown [Fri, 6 Oct 2023 22:02:48 +0000 (09:02 +1100)]
ncurses: don't look past the end of an image.

If the image is an odd number of rows, we need to use something else for
the last row displayed.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agoimageview: support requesting an integral zoom.
NeilBrown [Fri, 6 Oct 2023 21:56:23 +0000 (08:56 +1100)]
imageview: support requesting an integral zoom.

Some images (like QR code) don't do well when scaled non-integal
amounts.
So allow imageview to be told that integral scaling is needed.

Signed-off-by: NeilBrown <neil@brown.name>
6 months agoimageview: don't measure image until first refresh.
NeilBrown [Fri, 6 Oct 2023 21:24:35 +0000 (08:24 +1100)]
imageview: don't measure image until first refresh.

The image might not be ready until the first refresh.  e.g.  some later
pane might have an effect.
So measure on the first refresh.
Also allow the image source to be set with a pane attribute, or to fall
back to an obvious defailt.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agomode-basic: add F4 and F5 function key handlers.
NeilBrown [Wed, 4 Oct 2023 06:12:10 +0000 (17:12 +1100)]
mode-basic: add F4 and F5 function key handlers.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agorangetrack: fix some status returns.
NeilBrown [Wed, 4 Oct 2023 06:00:33 +0000 (17:00 +1100)]
rangetrack: fix some status returns.

If the range name isn't registered yet, report 'false', not 'fail'.
It might be a simple test to see if there is a registration.

And rangetrack:clear should succeed if there is nothing to clear.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoCreate mode-basic.
NeilBrown [Mon, 2 Oct 2023 05:27:14 +0000 (16:27 +1100)]
Create mode-basic.

"basic" mode provides core functionality needed by any other mode.
This included entering test and managing the selection using the mouse.
Other things will likely be added in due course.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoDiscard lib-keymap
NeilBrown [Sun, 1 Oct 2023 23:50:31 +0000 (10:50 +1100)]
Discard lib-keymap

lib-keymap was an idea that turned out not to be useful.
Discard it and make 'mode-emacs' into a regular pane.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agomenubar: allow ancestor pane to add menus
NeilBrown [Sun, 1 Oct 2023 23:39:25 +0000 (10:39 +1100)]
menubar: allow ancestor pane to add menus

THe current ordering requirement for emacs and menubar are odd.
emacs handling must be below menubar so that menus can understand basic
mouse and keystrokes.  But emacs must be initialised after menubar so it
can register.

Break this requirement by having menubar tell any ancestor that they can
configure now.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoStart git-mode: selection menu item to view git commit.
NeilBrown [Sat, 30 Sep 2023 22:59:55 +0000 (09:59 +1100)]
Start git-mode: selection menu item to view git commit.

The selection menu now has a "git view" entry. If the seleciton is a git
commit hash which can be found in a visited directory, then show it.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoAdd Documents menu to the menubar
NeilBrown [Fri, 29 Sep 2023 23:57:02 +0000 (09:57 +1000)]
Add Documents menu to the menubar

The Documents menu shows the 10 most recently used docs.

This also fixes some problems with lib-menu and lib-menubar

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoChange return value of docs:byeach
NeilBrown [Fri, 29 Sep 2023 23:14:09 +0000 (09:14 +1000)]
Change return value of docs:byeach

Rather than 0 for continue and non-zero for stop,
use Efalse for don't continue, Errors for abort,
and normal values for continue.

This makes it similar to event handlers which stop being called after
Efalse.

Also cause a False return from python code to be Efalse.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agorenderline: fix handling of <hide> with nested attrs.
NeilBrown [Fri, 29 Sep 2023 09:29:05 +0000 (19:29 +1000)]
renderline: fix handling of <hide> with nested attrs.

Without this, a 'hide' would stop when any nest attribute stopped.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agomenubar: refresh bar whenever size changes.
NeilBrown [Fri, 29 Sep 2023 06:48:27 +0000 (16:48 +1000)]
menubar: refresh bar whenever size changes.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoinput: Report unrecognised key sequence
NeilBrown [Fri, 29 Sep 2023 06:16:14 +0000 (16:16 +1000)]
input: Report unrecognised key sequence

If keystroke is not recognised, report the fact.
This helps e.g. if keyboard in is some other-language mode.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoMove some common code from Draw:image implementations into lib-window
NeilBrown [Fri, 29 Sep 2023 02:59:35 +0000 (12:59 +1000)]
Move some common code from Draw:image implementations into lib-window

lib-window now provides Draw:scale-image which is used by Draw:image to
interpret the request and provide simple requests for the Drawing
engine.
pygtk doesn't use this yet.

Draw:scale-image should probably parse the file name etc too.

This fixes a bug in image display in ncurses where the image isn't
centred vertically when it isn't high enough to fill space.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoAdd render-imageview
NeilBrown [Fri, 22 Sep 2023 23:48:35 +0000 (09:48 +1000)]
Add render-imageview

render-imageview displays an image and allows it to be zoomed or panned.

This isn't quite the final design, but it is a first step that lets me
explore what I want.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoDraw:image: support scale and crop.
NeilBrown [Fri, 22 Sep 2023 05:41:44 +0000 (15:41 +1000)]
Draw:image: support scale and crop.

->num if non-zero scales the image.
->num2 if non zero sets absolute height and ->num becomes absolute
->width.

->x and ->y set top-left corner.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoDraw:image: move cursor cols,rows into mode (str2)
NeilBrown [Fri, 22 Sep 2023 05:07:29 +0000 (15:07 +1000)]
Draw:image: move cursor cols,rows into mode (str2)

Move the rows,cols numbers from x,y into str2, so that we
can store more interesting numbers in x,y.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoDraw:image - move mode information from num to str2
NeilBrown [Fri, 22 Sep 2023 04:40:59 +0000 (14:40 +1000)]
Draw:image - move mode information from num to str2

The information about whether the images should be stretch, centered, or
aligned top/bot/left/right is now in 'str2', leaving number free to be a
number.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agomenubar: handle the bar being closed.
NeilBrown [Wed, 27 Sep 2023 05:59:33 +0000 (15:59 +1000)]
menubar: handle the bar being closed.

The bar pane should get closed.  But if it does we must be careful.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agopopup: improve positioning.
NeilBrown [Fri, 22 Sep 2023 23:56:44 +0000 (09:56 +1000)]
popup: improve positioning.

1/ for full-width ("4") popups, use full height too.
2/ drop the bw/bh offset as this is wrong.
   This requires refreshing most tests.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agomode-emacs: handle cx-cc from a popup better
NeilBrown [Fri, 22 Sep 2023 23:52:13 +0000 (09:52 +1000)]
mode-emacs: handle cx-cc from a popup better

cx-cc will try to create a popup for selecting docs to save.
This fails when a popup is active.
Instead of silently failing, abort the popup so the user can
try again.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoRemove meaning for str2 arg to Draw:image and Draw:image-size
NeilBrown [Fri, 22 Sep 2023 04:33:02 +0000 (14:33 +1000)]
Remove meaning for str2 arg to Draw:image and Draw:image-size

The 'str2' arg is passed to the command when the image name start
"comm:".
However this was never use and it is not clear that the caller could
ever have a useful string to pass.  All details of how to find the
images can be encoded in the command name.

So drop all use for str2 in Draw:image and Draw:image-size handlers.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agotests: add test for dict-change signal
NeilBrown [Tue, 19 Sep 2023 12:09:45 +0000 (22:09 +1000)]
tests: add test for dict-change signal

Add a word (pygtk) to the dictionary so the dict-changed signal will
cause other appearances of the word to be un-highlighted.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoAdd lib-rangetrack
NeilBrown [Tue, 19 Sep 2023 10:49:52 +0000 (20:49 +1000)]
Add lib-rangetrack

Split the rangetracking code out of lib-autospell.py and place it
in lib-rangetrack.c.  This will allow it to be used by other modules
that want on-demand parsing of content.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agotests: use a fixed personal dictionary
NeilBrown [Tue, 19 Sep 2023 11:10:05 +0000 (21:10 +1000)]
tests: use a fixed personal dictionary

The test results shouldn't depend on a personal dictionary.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoChange how SIGALRM interrupts python.
NeilBrown [Fri, 15 Sep 2023 08:17:55 +0000 (18:17 +1000)]
Change how SIGALRM interrupts python.

Rather than setting an resetting alarm(), set the alarm() once and
set/clear a flag to say if python is running.
Then interrupt python only if it is running.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoexport do_comm_call and use it from TYPE_pane and TYPE_comm
NeilBrown [Fri, 15 Sep 2023 03:28:30 +0000 (13:28 +1000)]
export do_comm_call and use it from TYPE_pane and TYPE_comm

This simplifies the inline code for do_call_val(), and
includes pane and comm calls in the backtrace from LOG_BT()

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoLimit the consistency checks run in each loop
NeilBrown [Fri, 15 Sep 2023 03:11:02 +0000 (13:11 +1000)]
Limit the consistency checks run in each loop

Limit the number of consistency check run for a single user command to
about 60.
Maybe this could use times_up???

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoRemove var-args pane_register()
NeilBrown [Thu, 14 Sep 2023 11:42:54 +0000 (21:42 +1000)]
Remove var-args pane_register()

pane_register() is now precisely defined by the PANE_DATA* #define.
No need for different versions with different numbers of args.

Signed-off-by: NeilBrown <neil@brown.name>
7 months agoIntroduce PANE_DATA_VOID
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>
7 months agoDiscard pane->_data.
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>
7 months agoUse PANE_DATA_PTR_TYPE in doc-docs.
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>
7 months agoUse PANE_DATA_PTR_TYPE for lib-tile
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>
7 months agoIntroduce PANE_DATA_PTR_TYPE_3 for emacs-search.
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>
7 months agoUse PANE_DATA_PTR_TYPE in lang-python
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>
7 months agolib-charset: use PANE_DATA_PTR_TYPE
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>
7 months agolib-wiggle: switch to embedded data pattern
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>
7 months agoIntroduce PANE_DATA_PTR_TYPE for mode-emacs.
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>
7 months agoRemove pane->data when PANE_DATA_TYPE not set.
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>
7 months agoRemove doc->self link.
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>
7 months agoRemove option for doc being stored other than in the pane.
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>
7 months agolang-python: move doc from python object into pane.
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>
7 months agoExplicitly guard against infinite loops in consistency check.
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>
7 months agonotmuch master_view: catch exception so .recursed in reset properly.
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>
7 months agonotmuch: refresh query on "doc:closed" rather than "Close" on view.
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>
7 months agoMark all "Close" handlers as being closed_ok.
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>
7 months agoUse DEF_CMD_CLOSED for Close:mark
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>
7 months agoAllow Notify:Close to work for docs being closed.
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>
7 months agoIntroduce closed_ok flag on commands.
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>
7 months agoChange calls on closed panes to return Efallthrough, not Efail
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>
7 months agodisplay-x11: don't draw both cursors.
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>
7 months agodisplay-x11: draw outline cursor entirely inside box.
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>
7 months agoc-mode: fix () in first statement after 'case'
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>
7 months agoSend warning message when nested notification is prohibited.
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>
7 months agoDiscard DocLeaf - use new pane_leaf() instead.
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>
7 months agoRename pane_leaf() to pane_focus()
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>
7 months agoRename pane_focus() to pane_take_focus()
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>
7 months agocore-log: reduce number of statics
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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>
7 months 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>