]> git.neil.brown.name Git - edlib.git/log
edlib.git
2 years agominor change to xcb drawing and scaling
NeilBrown [Wed, 2 Aug 2023 21:10:31 +0000 (07:10 +1000)]
minor change to xcb drawing and scaling

1/ ask for "monospace", not "mono"
2/ default to 12 point
3/ scale up and down by same ratio.  use 1.2 like others
4/ fix font_description size calc, which was weird.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agocompose-email: check for needed headers:
NeilBrown [Fri, 28 Jul 2023 06:09:11 +0000 (16:09 +1000)]
compose-email: check for needed headers:

Don't sent the messages unless there is at least
 - From:
 - Subject:
 - To: or Cc:

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodiscard commcache.
NeilBrown [Fri, 28 Jul 2023 05:59:24 +0000 (15:59 +1000)]
discard commcache.

The idea here was to accelerate repeated calls to the one request, so we
didn't need to repeat the search up the pane tree, or for the comm in
the keymap.
However I since decided that it is generally best to avoid repeated
calls like this, and mostly we do.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAvoid null pointer deref when ccache used.
NeilBrown [Thu, 27 Jul 2023 11:32:07 +0000 (21:32 +1000)]
Avoid null pointer deref when ccache used.

This can make ->home NULL which times_up() no trips over.

I should probably discard this ccache stuff.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemacs: support shows shell output in a popup.
NeilBrown [Thu, 27 Jul 2023 10:32:59 +0000 (20:32 +1000)]
emacs: support shows shell output in a popup.

With a prefix arg of 0 or 1, shellcmd still interpolates the output into
the current buffer.
With a prefix arg of 4, it now shows the output in a popup window, like
visiting a file with
  Cx 4 4 f

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoFactor out list sorting into list.h
NeilBrown [Thu, 27 Jul 2023 06:33:29 +0000 (16:33 +1000)]
Factor out list sorting into list.h

No point having two copies of the same code.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorenderline: calculate curs_width even when only a prefix is displayed.
NeilBrown [Thu, 27 Jul 2023 06:23:00 +0000 (16:23 +1000)]
renderline: calculate curs_width even when only a prefix is displayed.

Also make sure that the size we shift is always at least 1 - else it
loops forever.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomode-emacs: allow cx-} and cx-{ to be repeated with single char.
NeilBrown [Mon, 24 Jul 2023 11:31:02 +0000 (21:31 +1000)]
mode-emacs: allow cx-} and cx-{ to be repeated with single char.

Just like cx-< etc

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: fix handling of truncation.
NeilBrown [Mon, 24 Jul 2023 11:21:23 +0000 (21:21 +1000)]
lib-renderline: fix handling of truncation.

When looking for a bug in wrap-mode I found this bug in non-wrap mode.
But I cannot reproduce the first bug any more.
Weird.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoDon't initialise ->data in pane_init()
NeilBrown [Mon, 24 Jul 2023 11:17:51 +0000 (21:17 +1000)]
Don't initialise ->data in pane_init()

There may not be a ->data any more, and the caller initialises this if needed.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoRename _CALL _VFUNC _VFUNC_
NeilBrown [Sun, 23 Jul 2023 23:04:16 +0000 (09:04 +1000)]
Rename _CALL _VFUNC _VFUNC_

All names that start underscore followed by capital letter are reserved
by C library.  So stop using them.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAvoid using names with "__" prefix.
NeilBrown [Sun, 23 Jul 2023 22:59:39 +0000 (08:59 +1000)]
Avoid using names with "__" prefix.

Names prefixed with "__" are reserved for use by the C library.
For global names, use "do_" instead.
For local name, use a single "_".

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAdd doc:list-sort and sort command name for completion.
NeilBrown [Sat, 22 Jul 2023 02:45:51 +0000 (12:45 +1000)]
Add doc:list-sort and sort command name for completion.

doc:list-sort can sort entries in a doc-list based on an attribute of
choice.

emacs command listing uses this.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemacs: use doc-list for command name completion.
NeilBrown [Sat, 22 Jul 2023 02:42:54 +0000 (12:42 +1000)]
emacs: use doc-list for command name completion.

doc-list is good for this sort of thing.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoChange times_up() to use pane_too_long() on root.
NeilBrown [Sat, 22 Jul 2023 02:06:44 +0000 (12:06 +1000)]
Change times_up() to use pane_too_long() on root.

Also check for debugger in all pane_too_long() calls.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoDon't impose time limits when run under a debugger
NeilBrown [Sat, 22 Jul 2023 01:37:38 +0000 (11:37 +1000)]
Don't impose time limits when run under a debugger

Single-stepping in the debug can make things take much longer.  We
shouldn't let that change behaviour or debugging becomes harder.
So detect debugger and skip the timing.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agocompose-email: use menu for address completion
NeilBrown [Fri, 21 Jul 2023 10:34:50 +0000 (20:34 +1000)]
compose-email: use menu for address completion

Rather than having 'tab' cycle through addresses, drop down a menu to
choose from.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomenu: allow memu to get wider
NeilBrown [Fri, 21 Jul 2023 10:33:28 +0000 (20:33 +1000)]
menu: allow memu to get wider

If menu gets smaller we already reduce size.
Now we do so when menu gets bigger too.
For this, we add 1 to width so there is a change for it to appear wider
as the width reported is only ever the visible width.

This makes all menus slightly wider.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: focus on query pane when changing messages
NeilBrown [Fri, 21 Jul 2023 08:43:30 +0000 (18:43 +1000)]
notmuch: focus on query pane when changing messages

The previous patch didn't fix this properly.  'K-a' wasn't handled for
examine.
Try again.

Fixes: 5707b369a802 ("notmuch: when moving among messages, set focus to query pane.")
Signed-off-by: NeilBrown <neil@brown.name>
2 years agohistory: improve stability of search.
NeilBrown [Fri, 21 Jul 2023 08:29:18 +0000 (18:29 +1000)]
history: improve stability of search.

When searching for string that matched at start of line, we would stay
on the line as we typed more of the match.
When searching elsewhere, we keep moving backward in the history.

Fix by always starting search at end of line.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agopopup: fix popup_child_notify
NeilBrown [Fri, 21 Jul 2023 08:08:44 +0000 (18:08 +1000)]
popup:  fix popup_child_notify

Two silly typos meant this didn't work properly.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: fix cursor-placement sometimes off-screen
NeilBrown [Fri, 21 Jul 2023 07:48:29 +0000 (17:48 +1000)]
render-lines: fix cursor-placement sometimes off-screen

I was measuring against the bottom of the cursor, not the top.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agowiggle: skeletal support for IgnoreBlanks
NeilBrown [Fri, 21 Jul 2023 06:52:13 +0000 (16:52 +1000)]
wiggle: skeletal support for IgnoreBlanks

I don't know if I would ever want IgnoreBlanks, but this shows some of
the changes that would be needed for it to work.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomergeview: highlight result after change.
NeilBrown [Fri, 21 Jul 2023 04:50:47 +0000 (14:50 +1000)]
mergeview: highlight result after change.

When an alt-m command replaces the merge with some result, highlight the
result to help user see exactly what it is.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agowiggle: nul-terminate string from collect_merge()
NeilBrown [Fri, 21 Jul 2023 04:45:43 +0000 (14:45 +1000)]
wiggle: nul-terminate string from collect_merge()

I love untested code.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-abbrev: Don't show a menu when not needed.
NeilBrown [Fri, 21 Jul 2023 03:10:27 +0000 (13:10 +1000)]
lib-abbrev: Don't show a menu when not needed.

If there is only one match, just insert it, don't show a menu.

If all matches have a common prefix, just insert that.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomake: possibly fix problem with not always following.
NeilBrown [Fri, 21 Jul 2023 02:33:24 +0000 (12:33 +1000)]
make: possibly fix problem with not always following.

This is just a guess, but maybe this is why make sometimes doesn't
follow the output properly.

Signed-off-by: NeilBrown <neil@brown.name>
2 years ago.gitingore updates.
NeilBrown [Fri, 21 Jul 2023 02:21:24 +0000 (12:21 +1000)]
.gitingore updates.

Added these targets and forgot to tell git.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodoc-test: doc:clear must send doc:replaced
NeilBrown [Fri, 21 Jul 2023 02:17:46 +0000 (12:17 +1000)]
doc-test: doc:clear must send doc:replaced

Without this, linecount gets badly confused.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: improvements to left shift.
NeilBrown [Fri, 21 Jul 2023 01:27:17 +0000 (11:27 +1000)]
render-lines: improvements to left shift.

If there is lots of space on the right, only shift left if the cursor
requires it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: remove obvious error
NeilBrown [Fri, 21 Jul 2023 01:08:23 +0000 (11:08 +1000)]
render-lines: remove obvious error

There can be no justification to multiply by cw twice.

This doesn't affect display-ncurses but is problematic for x11

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: ensure cursor doesn't fall off end of line.
NeilBrown [Fri, 21 Jul 2023 00:24:16 +0000 (10:24 +1000)]
render-lines: ensure cursor doesn't fall off end of line.

If the line is not allowed to left-shift and doesn't wrap, cursor might
be off the right edge.
In that case, do think that the cursor is drawn.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoTODO - lots of updates
NeilBrown [Wed, 19 Jul 2023 10:46:11 +0000 (20:46 +1000)]
TODO - lots of updates

So much to do, so little time.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-utf8: use do_char_byte()
NeilBrown [Wed, 19 Jul 2023 10:34:13 +0000 (20:34 +1000)]
lib-utf8: use do_char_byte()

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoqprint: use do_char_byte()
NeilBrown [Wed, 19 Jul 2023 10:30:04 +0000 (20:30 +1000)]
qprint: use do_char_byte()

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-crop: use do_char_byte()
NeilBrown [Wed, 19 Jul 2023 10:24:49 +0000 (20:24 +1000)]
lib-crop: use do_char_byte()

Signed-off-by: NeilBrown <neil@brown.name>
2 years agocrop: switch to embedded pane data
NeilBrown [Wed, 19 Jul 2023 10:17:38 +0000 (20:17 +1000)]
crop: switch to embedded pane data

Signed-off-by: NeilBrown <neil@brown.name>
2 years agobase64: use do_char_byte
NeilBrown [Wed, 19 Jul 2023 10:01:17 +0000 (20:01 +1000)]
base64: use do_char_byte

I duplicated the code.. I wonder if I should have done.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomulitpath: use do_char_byte()
NeilBrown [Wed, 19 Jul 2023 09:51:12 +0000 (19:51 +1000)]
mulitpath: use do_char_byte()

Just a simple conversion using mp_step largely unchanged.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-format: use do_char_byte()
NeilBrown [Wed, 19 Jul 2023 09:43:54 +0000 (19:43 +1000)]
render-format: use do_char_byte()

This requires some more ugly #define stuff, but I think the code sharing
is good.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-format: switch to embedded pane data
NeilBrown [Wed, 19 Jul 2023 09:11:13 +0000 (19:11 +1000)]
render-format: switch to embedded pane data

pane data is now embedded.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodoc-email use do_char_byte for the doc:char function
NeilBrown [Wed, 19 Jul 2023 09:01:36 +0000 (19:01 +1000)]
doc-email use do_char_byte for the doc:char function

do_char_byte now passes a mark to the next/prev functions and doc-email
makes use of it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodoc-email: switch to embedded data.
NeilBrown [Wed, 19 Jul 2023 08:41:22 +0000 (18:41 +1000)]
doc-email: switch to embedded data.

struct email_view is now embedded in the pane, no found by a pointer deref.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemacs: don't move cursor when opening/selecting menu.
NeilBrown [Tue, 18 Jul 2023 11:39:19 +0000 (21:39 +1000)]
emacs: don't move cursor when opening/selecting menu.

Having the cursor jump around looks noisy, so try removing it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoMove-CursorXY - only perform action on direct hit.
NeilBrown [Tue, 18 Jul 2023 11:32:48 +0000 (21:32 +1000)]
Move-CursorXY - only perform action on direct hit.

If Move-CursoyXY don't find a character under the cursor, don't perform
the action.  Still move the mark though.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAlways pass 0 to Move-CursorXY for num and num2
NeilBrown [Tue, 18 Jul 2023 11:05:51 +0000 (21:05 +1000)]
Always pass 0 to Move-CursorXY for num and num2

The num and num2 values aren't used, and the values passed aren't
consistent.
The new meaning of "str" takes over what some of them were meant to do.

So always pass 0.  Maybe one day I'll think of something useful to do.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoChange how Move-CursorXY is passed "no change" co-ordinates.
NeilBrown [Tue, 18 Jul 2023 10:57:36 +0000 (20:57 +1000)]
Change how Move-CursorXY is passed "no change" co-ordinates.

Currently a negative co-ordinate means "use the ->cx/cy value of the target
pane".  This allows changing position in one dimension only.

However it prevents receiving a negative co-ordinate, which might happen
in the mount event happens out-side the pane which has grabbed the
mouse.

So instead of a negative number, use MAX_INT to say "don't change".

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-menu: prohibit left-shift of display.
NeilBrown [Tue, 18 Jul 2023 10:55:12 +0000 (20:55 +1000)]
lib-menu: prohibit left-shift of display.

As the menu window is sized to match the longest line, there is a risk
of a left-shift happening if the cursor ever ends up at the end of that
line.
That would be bad, so explicitly disable left-shift.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-abbrev: fix positioning of menu
NeilBrown [Mon, 17 Jul 2023 11:27:30 +0000 (21:27 +1000)]
lib-abbrev: fix positioning of menu

The xy location of the menu must be relative to the parent of the menu.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodo_char_byte: pass the pane to DOC_NEXT, not doc_data
NeilBrown [Sun, 16 Jul 2023 11:57:18 +0000 (21:57 +1000)]
do_char_byte: pass the pane to DOC_NEXT, not doc_data

If we pass the pane, the inline code is more generic and does not need
to know about the internals of struct pane.
This is a constant offset from the doc_data, so does not change the
number of memory accesses.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodoc-docs: switch to doc_data and do_char_byte()
NeilBrown [Sat, 15 Jul 2023 23:19:07 +0000 (09:19 +1000)]
doc-docs: switch to doc_data and do_char_byte()

Use embedded doc in pane, and use common code for doc:char handler.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoSimplify some doc:char handlers.
NeilBrown [Sat, 15 Jul 2023 21:53:13 +0000 (07:53 +1000)]
Simplify some doc:char handlers.

Create a shared inline function that does the bulk of the work of a
'doc:char' function and only needs to be given next and prev functions
which update the doc_ref and report the character.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodoc-text fix text_next for bytes
NeilBrown [Sat, 15 Jul 2023 21:20:35 +0000 (07:20 +1000)]
doc-text fix text_next for bytes

I was completely ignoring 'bytes' for text_next.
Consequently the 'hex' test, which display bytes, was all wrong.

Also simplify text_prev using denormalise

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoFix return of Action
NeilBrown [Wed, 12 Jul 2023 22:10:25 +0000 (08:10 +1000)]
Fix return of Action

If Action doesn't find an action tag it must return Efallthrough so some
other pane has a change to handle K:Enter

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: remove support for saved: synonym for query:
NeilBrown [Wed, 12 Jul 2023 21:18:52 +0000 (07:18 +1000)]
notmuch: remove support for saved: synonym for query:

Before notmuch supported query: I was handling saved:.
For a while I've supported both, but that adds no value.
So get rid of all saved: search terms and saved. config entries.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: support mouse-click to select search and thread
NeilBrown [Wed, 12 Jul 2023 21:13:41 +0000 (07:13 +1000)]
notmuch: support mouse-click to select search and thread

mouse-click on search name will select that search.
mouse-click on thread subject will select that thread,
or message within a thread (I think... that last one is a bit weird).

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoUpdate copyright dates.
NeilBrown [Wed, 12 Jul 2023 06:42:15 +0000 (16:42 +1000)]
Update copyright dates.

Gotta keep those dates accurate :-)

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAdd lib-askpass
NeilBrown [Wed, 12 Jul 2023 06:37:03 +0000 (16:37 +1000)]
Add lib-askpass

AskPass will as for a password and not display what is entered.
A new script "el-askpass" is provided that ssh can use to ask for a
password through edlib.
lib-shellcmd sets the environment so this script is used.

Net result is that if a command run from edlib needs ssh to ask for a
password, it can.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-server: separate out choose_pane functionality
NeilBrown [Wed, 12 Jul 2023 00:20:42 +0000 (10:20 +1000)]
lib-server: separate out choose_pane functionality

Create function to choose the display and pane on which to place the popup

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAdd a "bin" type for xdg-find-edlib-file
NeilBrown [Tue, 11 Jul 2023 22:23:06 +0000 (08:23 +1000)]
Add a "bin" type for xdg-find-edlib-file

This searches $PATH after looking the a "bin" dir near the lib that the
code was loaded from.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoMake a "bin" directory
NeilBrown [Tue, 11 Jul 2023 22:14:42 +0000 (08:14 +1000)]
Make a "bin" directory

"bin" will hold program that can be run.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoserver: split client and server code more cleanly.
NeilBrown [Tue, 11 Jul 2023 11:40:29 +0000 (21:40 +1000)]
server: split client and server code more cleanly.

Have all server code together, and all client code too.

Also differentiate based on argv[0] - it seems a little cleaner.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-server: various clean-ups.
NeilBrown [Tue, 11 Jul 2023 11:33:21 +0000 (21:33 +1000)]
lib-server: various clean-ups.

- Use '\0' to separate arg and env, rather than space.
- Use arg consistently - not ':' etc.
- Use simpler names for commands, don't try to mimic internal messages.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoautospell: provide drop-down menu on spelling errors.
NeilBrown [Mon, 10 Jul 2023 05:17:44 +0000 (15:17 +1000)]
autospell: provide drop-down menu on spelling errors.

Multiple enhancement to make menus work as drop-downs triggered by a
mouse action.  Still some problems.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoRevise how location-sensitive actions are managed.
NeilBrown [Sat, 8 Jul 2023 02:42:51 +0000 (12:42 +1000)]
Revise how location-sensitive actions are managed.

To create a location-sensitive action, the attribute "action-FOO" must
be set to a command name, for some value of FOO.
Currently only "activate" is effective, and this send on a mouse click.
In the future "menu" may be added, and possibly others such as for
drag-and-drop.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: update lines/cols earlier
NeilBrown [Fri, 7 Jul 2023 22:21:27 +0000 (08:21 +1000)]
render-lines: update lines/cols earlier

Instead of only updaes lines/cols during the final render, update them
when choosing the range of lines to display.
This makes them available to interested parties earlier.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoInitial menu support.
NeilBrown [Fri, 7 Jul 2023 04:18:29 +0000 (14:18 +1000)]
Initial menu support.

We can now place a menu and receive a selection.
This is demonstrated with lib-abbrev which pops up a menu showing the
options to choose between.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoTrack and report actual displayed size
NeilBrown [Fri, 7 Jul 2023 03:13:11 +0000 (13:13 +1000)]
Track and report actual displayed size

render:reposition messages now contain more accurate columns
information, and are generated whenever it is updated.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodisplay-xcb: switch to embedded data
NeilBrown [Tue, 4 Jul 2023 05:35:45 +0000 (15:35 +1000)]
display-xcb: switch to embedded data

display-xcb pane now uses embedded data.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodisplay-ncurses - switch to embedded data.
NeilBrown [Tue, 4 Jul 2023 05:31:02 +0000 (15:31 +1000)]
display-ncurses - switch to embedded data.

Ncurses now uses embedded data in pane

Signed-off-by: NeilBrown <neil@brown.name>
2 years agocore-window: use embedded data
NeilBrown [Tue, 4 Jul 2023 05:25:25 +0000 (15:25 +1000)]
core-window: use embedded data

core-window data is now embedded.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodoc-text - use embedded data in pane
NeilBrown [Tue, 4 Jul 2023 05:22:46 +0000 (15:22 +1000)]
doc-text - use embedded data in pane

The doc-text pane now embeds the data

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomultipart - use embedded data
NeilBrown [Tue, 4 Jul 2023 04:57:00 +0000 (14:57 +1000)]
multipart - use embedded data

doc-multipart now used embedded data.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodoc-list: use embedded data
NeilBrown [Tue, 4 Jul 2023 04:41:31 +0000 (14:41 +1000)]
doc-list: use embedded data

doc-list panes now embed the data.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodoc-dir: switch to embedded data
NeilBrown [Tue, 4 Jul 2023 04:29:56 +0000 (14:29 +1000)]
doc-dir: switch to embedded data

the pane or doc-dir now embeds the data.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolog: switch to embedding data in pane
NeilBrown [Tue, 4 Jul 2023 04:16:56 +0000 (14:16 +1000)]
log: switch to embedding data in pane

log panes now have data embedded.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agocore-editor: embed ed_info in the struct pane
NeilBrown [Tue, 4 Jul 2023 03:58:17 +0000 (13:58 +1000)]
core-editor: embed ed_info in the struct pane

This makes all content of ed_info just one pointer dereference away from
any pane.  We can start putting content that is current global, into
ed_info.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoSupport inline pane data.
NeilBrown [Tue, 4 Jul 2023 03:14:15 +0000 (13:14 +1000)]
Support inline pane data.

If a NULL data pointer is passed to __pane_register(), then a larger
memory allocation will be made to hold both the pane and the data.

If a type is defined with PANE_DATA_TYPE then that will be the size
passed to __pane_register by pane_register().

Similarly DOC_DATA_TYPE can give a type for a document.  The "struct
doc" must appear first in this type.

If PANE_DATA_TYPE is defined, then "core-pane.h" must be included after
the type has been declared, which will usually be after "core.h" is included.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAlways handle pane_register failure immediately.
NeilBrown [Mon, 3 Jul 2023 22:38:09 +0000 (08:38 +1000)]
Always handle pane_register failure immediately.

Rather then
 p = pane_register();
 if (p)
     ....

Use

 p = pane_register();
 if (!p)
    return FAIL
 ...

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoInclude some include files where there are needed in include files.
NeilBrown [Mon, 3 Jul 2023 22:30:28 +0000 (08:30 +1000)]
Include some include files where there are needed in include files.

This makes it easier to move includes around in .c files.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoIntroduce point_new()
NeilBrown [Sun, 2 Jul 2023 12:03:38 +0000 (22:03 +1000)]
Introduce point_new()

point_new() is vmark_new() for MARK_POINT.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoIntroduce mark_new()
NeilBrown [Sun, 2 Jul 2023 12:01:04 +0000 (22:01 +1000)]
Introduce mark_new()

mark_new() is vmark_new() for MARK_UNGROUPED.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolinecount: allow attachment to a viewer stack.
NeilBrown [Sun, 2 Jul 2023 11:42:57 +0000 (21:42 +1000)]
linecount: allow attachment to a viewer stack.

Sometimes we want linecount to count lines in a view, not in a document.

Instead of having the view pretend to be a document for linecount,
change it to explicitly support attachment.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolinecount: fix mark used for 'goto'.
NeilBrown [Sun, 2 Jul 2023 11:39:47 +0000 (21:39 +1000)]
linecount: fix mark used for 'goto'.

The mark passed to CountLines/goto:line as 'mark' is handed to
doc:GotoLine as 'mark2', but that function expects 'mark'.

This works as the doc: function always gets point for mark if nothing
else is given.  But it is wrong. Let's fix it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoview: fix scroll bar on directories etc.
NeilBrown [Sun, 2 Jul 2023 11:31:56 +0000 (21:31 +1000)]
view: fix scroll bar on directories etc.

When linecount is attached to a view, as with lib-format (directories)
and emails, the location of the scroll bar handle is wrong.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoDisable pane_too_long() with edlib_timing_allowed = False.
NeilBrown [Sun, 2 Jul 2023 10:29:24 +0000 (20:29 +1000)]
Disable pane_too_long() with edlib_timing_allowed = False.

edlib_timing_allowed = False
now disables pane_too_long() too.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolinecount: run the on-idle event on the linecount pane.
NeilBrown [Sun, 2 Jul 2023 10:26:07 +0000 (20:26 +1000)]
linecount: run the on-idle event on the linecount pane.

We currently queue the on-idle event on the document.  That is untidy.
The event belongs to the linecount pane, so that is where it should run.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemacs: allow :C-q to be repeated when a unicode name was found.
NeilBrown [Sun, 2 Jul 2023 05:33:57 +0000 (15:33 +1000)]
emacs: allow :C-q to be repeated when a unicode name was found.

If we found a unicode char with a given name, there might be another
one.
So allow the command to be repeated.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAdd lib-unicode-names and use it for emacs :C-q
NeilBrown [Sun, 2 Jul 2023 05:14:58 +0000 (15:14 +1000)]
Add lib-unicode-names and use it for emacs :C-q

:C-q can now be given a unicode name from NamesList.txt and it will
insert the first match - which might not be the one you want.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agosearch: various fixes for searching a string in a string
NeilBrown [Sun, 2 Jul 2023 05:11:28 +0000 (15:11 +1000)]
search: various fixes for searching a string in a string

I guess I hadn't tested this, but searching for a string in a string
didn't work for various reasons.

Also allow max length to search to be given.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoUse XDG standard to find config (and data) files.
NeilBrown [Sun, 2 Jul 2023 01:31:42 +0000 (11:31 +1000)]
Use XDG standard to find config (and data) files.

Provide an interface to search for config and data files in appropriate
XDG locations.  Enhance this by looking in the directory that contains
the main shared library - after HOME but before system locations.
Use this for config files.  This removes the need to use ARGV[0]
to find the initial ini file.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: fix vline positioning.
NeilBrown [Sat, 1 Jul 2023 00:42:06 +0000 (10:42 +1000)]
render-lines: fix vline positioning.

When we want to position the cursor line precisely, we need
consume_space to consume at most one line each top a bottom else we
might miss the target line.

Also document how find_lines() works with a bit more detail.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: don't change y_pre or y_post after found_start/end set
NeilBrown [Sat, 1 Jul 2023 00:35:14 +0000 (10:35 +1000)]
render-lines: don't change y_pre or y_post after found_start/end set

To be able to achieve precise positioning on the display (e.g.  with
vline) we need to stop changing y_pre or y_post once found_start or
found_end are set - respectively.

So when we hit EOF and set a 10% y_post, we should NOT set found_end
yet.

This shows an off-by-one error in vline calculation which was previously
hidden as consume_space() would always move us to the start of that line.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agohistory: support searching history of entries
NeilBrown [Fri, 30 Jun 2023 01:16:02 +0000 (11:16 +1000)]
history: support searching history of entries

C-S searches forward, but the more useful is C-R which searches
backward.

Search doesn't wrap - I wonder if it should.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agopygtk: discard new_display2
NeilBrown [Wed, 28 Jun 2023 21:01:46 +0000 (07:01 +1000)]
pygtk: discard new_display2

new_display and new_display2 are now sufficiently similar that we can
merge them.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-glibevents: catch errors from callbacks.
NeilBrown [Wed, 28 Jun 2023 21:00:45 +0000 (07:00 +1000)]
lib-glibevents: catch errors from callbacks.

The on-idle and poll callbacks didn't catch errors, would cause be
fatal.

Also change on-idle callbacks to not return errors, on Efalse.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agodisplay-xcb: merge display_xcb and xcb_new_display
NeilBrown [Wed, 28 Jun 2023 20:44:50 +0000 (06:44 +1000)]
display-xcb: merge display_xcb and xcb_new_display

These two function are largely equivalent, so xcb_new_display does a
couple of step that are not harmful for display_xcb.

So discard display_xcb and just use xcb_new_display.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoFinish attach-display-foo commands with doc:attach-view
NeilBrown [Wed, 28 Jun 2023 20:40:20 +0000 (06:40 +1000)]
Finish attach-display-foo commands with doc:attach-view

And attach-display-* command must now be called on a document or on the
root.
If it was on a document, that document is viewed in the created display
using doc:attach-view.
This makes it easier for a caller to create a useful window in a single
command.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agocall editor:activate-display from the display code.
NeilBrown [Wed, 28 Jun 2023 09:22:49 +0000 (19:22 +1000)]
call editor:activate-display from the display code.

Any command that creates a display pane now also calls
editor:activate-display and returns the result.
That means other code what wants a display doesn't need to know about
activating the display.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoserver: don't hold reference to the display pane.
NeilBrown [Wed, 28 Jun 2023 09:11:43 +0000 (19:11 +1000)]
server: don't hold reference to the display pane.

The display pane will soon not be available as creation a display will
transparently stack various things on top of it.
So use "Display:close" instead of .close() and just hold the top level.

.term and .disp are often the same now. I wonder if we need both.

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