]> git.neil.brown.name Git - edlib.git/log
edlib.git
2 years agolib-renderline allow rtab to avoid line wraps.
NeilBrown [Tue, 15 Aug 2023 11:47:22 +0000 (21:47 +1000)]
lib-renderline allow rtab to avoid line wraps.

If rtab is used, don't wrap if last char is at right edge.
If no rtab, continue to wrap so there is somewhere for cursor to be.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: various wrapping fixed.
NeilBrown [Tue, 15 Aug 2023 10:06:39 +0000 (20:06 +1000)]
lib-renderline: various wrapping fixed.

In particular, the subject line in notmuch summary lines wraps properly
now.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: Fix length of split section in do_draw()
NeilBrown [Mon, 14 Aug 2023 02:27:40 +0000 (12:27 +1000)]
lib-renderline: Fix length of split section in do_draw()

Need to subtract start from the end to get the length.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderlines: erase before drawing an image
NeilBrown [Mon, 14 Aug 2023 00:03:36 +0000 (10:03 +1000)]
lib-renderlines: erase before drawing an image

I lost the Draw:clear for images, so they get drawn on the wrong pane
and end up as background.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoTODO updates.
NeilBrown [Sun, 13 Aug 2023 23:13:55 +0000 (09:13 +1000)]
TODO updates.

What still needs to be done for lib-renderline...

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: move tab handling into do_measure()
NeilBrown [Sun, 13 Aug 2023 09:54:00 +0000 (19:54 +1000)]
lib-renderline: move tab handling into do_measure()

This makes do_measure() more like do_draw()

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: pass ri to do_measure()
NeilBrown [Sun, 13 Aug 2023 09:37:04 +0000 (19:37 +1000)]
lib-renderline: pass ri to do_measure()

Pass in the ri, and don't bother passing the attr which is always
ri->attr.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: introduce measure_str() for simple string measurement.
NeilBrown [Sun, 13 Aug 2023 09:32:18 +0000 (19:32 +1000)]
lib-renderline: introduce measure_str() for simple string measurement.

This makes a clean separation leaving do_measure() only for text in
->line.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: don't pass scale to do_measure()
NeilBrown [Sun, 13 Aug 2023 09:25:05 +0000 (19:25 +1000)]
lib-renderline: don't pass scale to do_measure()

instead of passing scale, extra rd from p and use that to find scale.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderlines: pass split to do_draw() instead of str/len/tab_cols.
NeilBrown [Sun, 13 Aug 2023 09:21:44 +0000 (19:21 +1000)]
lib-renderlines: pass split to do_draw() instead of str/len/tab_cols.

I think this removes most of the ugliness.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline; pass ri to do_draw instead of ri->attr
NeilBrown [Sun, 13 Aug 2023 06:30:55 +0000 (16:30 +1000)]
lib-renderline; pass ri to do_draw instead of ri->attr

I'll use more from ri soon, for now just pass it in and use the ->attr.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: factor out draw_wrap()
NeilBrown [Sun, 13 Aug 2023 06:25:55 +0000 (16:25 +1000)]
lib-renderline: factor out draw_wrap()

Drawing the line-wrap markers doesn't need all the complexity of
do_draw(), so factor it out into a separate function.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: add ->ascent inside do_draw()
NeilBrown [Sun, 13 Aug 2023 06:21:15 +0000 (16:21 +1000)]
lib-renderline: add ->ascent inside do_draw()

Instead of all callers of do_draw() needing to add ->ascent,
add it inside do_draw().

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: drop scale arg to do_draw()
NeilBrown [Sun, 13 Aug 2023 03:41:39 +0000 (13:41 +1000)]
lib-renderline: drop scale arg to do_draw()

We can find the scale from rline_data which we can find from the pane.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline change rl vars to ri
NeilBrown [Sun, 13 Aug 2023 03:35:42 +0000 (13:35 +1000)]
lib-renderline change rl vars to ri

rl vars which used to be for render-line are now for render-item,
so rename to ri.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomassive lib-renderline rewrite
NeilBrown [Fri, 11 Aug 2023 07:20:26 +0000 (17:20 +1000)]
massive lib-renderline rewrite

This now passes my tests - after adjusting some tests.

lib-renderline is totally different.  Parsing and processing are now
distinct steps.  Hopefully this will make it easier to work with in
future, though it is still very rough in places, particularly with
handling for \t tabs.

I need to go through it several times and clean stuff up, but at least I
now have a credible base to work on.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorenderline - fix margin for tab.
NeilBrown [Fri, 11 Aug 2023 05:51:03 +0000 (15:51 +1000)]
renderline - fix margin for tab.

For some strange reason, tabs were wrapping before other chars.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoDon't show default wrap tail for requested wrap point.
NeilBrown [Fri, 11 Aug 2023 04:52:36 +0000 (14:52 +1000)]
Don't show default wrap tail for requested wrap point.

Requested wrap points suggest wrap is expected, so don't show the
wrap tail.  I think it is ugly.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agotile: silence use-before-set warning.
NeilBrown [Fri, 11 Aug 2023 01:47:54 +0000 (11:47 +1000)]
tile: silence use-before-set warning.

"remain" is only used if "remaining" is not zero, so it will be set
before used.  But compiler cannot see that.  Help it out.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomessageline: don't ask for cursor on render-line
NeilBrown [Wed, 9 Aug 2023 01:05:46 +0000 (11:05 +1000)]
messageline: don't ask for cursor on render-line

To avoid asking of a cursor, we need to pass -1.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: pass focus to vmark_set()
NeilBrown [Wed, 9 Aug 2023 01:04:35 +0000 (11:04 +1000)]
render-lines: pass focus to vmark_set()

Good practice is to always send the focus.
We will need this to get the prefix at 'set' time.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agohistory: use A-r rather than C-R for search
NeilBrown [Wed, 9 Aug 2023 01:01:03 +0000 (11:01 +1000)]
history: use A-r rather than C-R for search

Using C-R and particularly C-S break search-replace because I can no
longer search-again from the replace box (which has history).

So switch to A-r A-s.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-input - don't assume Efallthrough is 0
NeilBrown [Wed, 9 Aug 2023 00:56:23 +0000 (10:56 +1000)]
lib-input - don't assume Efallthrough is 0

One day I might change Efallthrough..

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoncurses: catch and ignore focus-in/out
NeilBrown [Wed, 9 Aug 2023 00:52:17 +0000 (10:52 +1000)]
ncurses: catch and ignore focus-in/out

focus-in/out comes in as unknown key at awkward times causing problems
for C-l and the refresh causes a focus-out.
So catch and ignore for now.
Also log any unrecognised keys so I can try to handle them.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoChange pane_resize() to return Bool
NeilBrown [Tue, 8 Aug 2023 22:49:22 +0000 (08:49 +1000)]
Change pane_resize() to return Bool

pane_resize() now reports if any change happened.
One caller wants this.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: factor out code in revalidate_start()
NeilBrown [Tue, 8 Aug 2023 23:52:41 +0000 (09:52 +1000)]
render-lines: factor out code in revalidate_start()

revalidate start considers 3 cases when the point is on the line.  Each
of these checks if the point is on the line.
Factor out that test and other code so that 3 (or 4) cases can focus on
their particular issue.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: call_render_line_to_point never returns error
NeilBrown [Tue, 8 Aug 2023 22:44:02 +0000 (08:44 +1000)]
render-lines: call_render_line_to_point never returns error

Don't test for call_render_line_to_point returning < 0, as it doesn't.
Don't even test for == 0.  That is a valid answer and we no longer call
call_render_line_to_point() in a situation where that causes problems.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: don't look for point in line where it isn't.
NeilBrown [Tue, 8 Aug 2023 23:17:13 +0000 (09:17 +1000)]
render-lines: don't look for point in line where it isn't.

call_render_line_to_point() doesn't return an error, so calling
it when point isn't on the line isn't well defined.
So don't do it.

This changes the number of blank lines after end-of-file, which I think
I am happy with, so self-tests change.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-server: fix a couple of typos
NeilBrown [Tue, 8 Aug 2023 22:27:38 +0000 (08:27 +1000)]
lib-server: fix a couple of typos

I mustn't be using this code enough because these should be obvious.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agominor unalloc improvements.
NeilBrown [Tue, 8 Aug 2023 22:25:32 +0000 (08:25 +1000)]
minor unalloc improvements.

unalloc can now free 'const' pointers, and strings.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorenderline: change render-line:measure to return the cursor attributes.
NeilBrown [Sat, 5 Aug 2023 09:00:52 +0000 (19:00 +1000)]
renderline: change render-line:measure to return the cursor attributes.

Rather than saving the attributes at the cursor to be returned later,
return them directly from render-line:measure.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorenderline: change render-line:findxy to return the attributes
NeilBrown [Fri, 4 Aug 2023 23:56:59 +0000 (09:56 +1000)]
renderline: change render-line:findxy to return the attributes

Rather then remembers the attributes to be collected later with a
get:attr, return the attributes in a comm2 callback for immediate use.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: change to use embedded pane data
NeilBrown [Fri, 4 Aug 2023 23:21:04 +0000 (09:21 +1000)]
lib-renderline: change to use embedded pane data

The rline_data is now embedded in the pane.

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