]> git.neil.brown.name Git - edlib.git/log
edlib.git
2 years agorenderline: fix spelling of upscale
NeilBrown [Sat, 6 May 2023 23:19:14 +0000 (09:19 +1000)]
renderline: fix spelling of upscale

A recent patch broke it...

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomarkup: implement "hide" attribute
NeilBrown [Sat, 6 May 2023 23:15:45 +0000 (09:15 +1000)]
markup: implement "hide" attribute

text with attribute "hide" is not rendered at all.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomarkup: make "priority" unsigned.
NeilBrown [Sat, 6 May 2023 23:14:18 +0000 (09:14 +1000)]
markup: make "priority" unsigned.

"priority" is now an unsigned short and the behaviour of integers
outside that range is sensible and documented.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemail: cause images to behave as 3 lines with 3 char positions each.
NeilBrown [Sat, 29 Apr 2023 10:14:26 +0000 (20:14 +1000)]
email: cause images to behave as 3 lines with 3 char positions each.

This allows the cursor to move around the image without jumping the
whole image all at once.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: initial support for multi-line renders.
NeilBrown [Sat, 29 Apr 2023 10:11:44 +0000 (20:11 +1000)]
render-lines: initial support for multi-line renders.

An image will soon appear as multiple lines so that the cursor can
appear at locations within it.

Moving down always goes to start of line.  Moving up goes to top of
image.
These aren't ideal, but better than nothing for now.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: don't set reposition needlessly.
NeilBrown [Sat, 29 Apr 2023 09:57:29 +0000 (19:57 +1000)]
render-lines: don't set reposition needlessly.

If render_prev finds a new first mark we need to set reposition, but if
it is the same first mark as already existed, we don't.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorender-lines: minor clean up.
NeilBrown [Sat, 29 Apr 2023 04:32:30 +0000 (14:32 +1000)]
render-lines: minor clean up.

1/ Ensure call_render_line_prev() *always* frees m
   if it doesn't return it.

2/ Use gotos to make code easier to follow when render_lines_move_line
   tried to find the target x column.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: allow <image> to have map: attribute.
NeilBrown [Fri, 28 Apr 2023 23:52:41 +0000 (09:52 +1000)]
lib-renderline: allow <image> to have map: attribute.

A "map" helps place the cursor within an image.  The map provides both a
number of rows and columns, and a collection of the characters in the
rendering which can be used to communicate where the cursor is.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-renderline: fold more core into render_image()
NeilBrown [Fri, 28 Apr 2023 23:43:20 +0000 (09:43 +1000)]
lib-renderline: fold more core into render_image()

setting line height and cursor pos now happens inside render_image().

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolib-markup: allow eol chars to be skipped.
NeilBrown [Fri, 28 Apr 2023 23:30:48 +0000 (09:30 +1000)]
lib-markup: allow eol chars to be skipped.

When rendering, lib-markup can be told to use some other function for
line via the markup:func attribute.  This can easily included eol chars
in the range being rendered.

However when moving backwards with doc:render-line-prev there is not
currently a way to skip over some eol chars.

So introduce a mark:not_eol text attributes which can be applied to eol
characters to cause lib-markup to ignore them.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoRemove any suggestion that num2 is significant for doc:render-line
NeilBrown [Fri, 28 Apr 2023 23:29:20 +0000 (09:29 +1000)]
Remove any suggestion that num2 is significant for doc:render-line

render-line does doesn't use num2, only 'num'.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoDraw:image: allow a cursor to be displayed
NeilBrown [Fri, 28 Apr 2023 23:18:20 +0000 (09:18 +1000)]
Draw:image: allow a cursor to be displayed

A cursor is (expected to be) a rectangular outline around a cell of the
image when considered as a matrix of a given number of rows and columns.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoChange numeric args to Draw:image
NeilBrown [Fri, 28 Apr 2023 23:05:59 +0000 (09:05 +1000)]
Change numeric args to Draw:image

'num' now combine both the "Stretch" flag and the various alignment
flags.
This leaves num2 open for other purposes.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agorenderline: always cache the measured size of the image
NeilBrown [Tue, 25 Apr 2023 06:09:41 +0000 (16:09 +1000)]
renderline: always cache the measured size of the image

Knowing the size of the image can be generally useful so keep track of
it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agonotmuch: only search 10,000 chars for urls
NeilBrown [Tue, 25 Apr 2023 00:42:59 +0000 (10:42 +1000)]
notmuch: only search 10,000 chars for urls

Searching 50,000 takes too long - particularly over base64.
So drop down to 10,000 to avoid triggering the 15-second timeout.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAdd a TODO for w3m
NeilBrown [Wed, 26 Apr 2023 03:58:20 +0000 (13:58 +1000)]
Add a TODO for w3m

Want w3m for html email..

Signed-off-by: NeilBrown <neil@brown.name>
2 years agopython: silence a warning
NeilBrown [Tue, 25 Apr 2023 00:18:42 +0000 (10:18 +1000)]
python: silence a warning

smatch doesn't know 'a' cannot be NULL, so tell it.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agolang-python: update initialisation.
NeilBrown [Mon, 24 Apr 2023 23:44:59 +0000 (09:44 +1000)]
lang-python: update initialisation.

Py_SetProgramName and PySys_SetArgv are deprecated, so use
PyConfig to avoid warnings.
Also enable "isolated" initialisation to see if it is a bad idea or not.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoAbort more quickly when time is up.
NeilBrown [Mon, 24 Apr 2023 23:30:54 +0000 (09:30 +1000)]
Abort more quickly when time is up.

After 15 seconds in one command we want to abort to avoid
infinite loops.  However doc:content calls don't get
caught currently because the call to the handler
doesn't go through key_handle().
So add a light-weight test in the call.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agomultipart: Set ref mark to NULL when freeing it
NeilBrown [Thu, 20 Apr 2023 22:24:01 +0000 (08:24 +1000)]
multipart: Set ref mark to NULL when freeing it

We usually store a new value in ref.m after freeing this one, but it
possible for that to fail.
So for safety, set to NULL rather than leaving an invalid mark pointer.

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoemail/notmuch: attend or a disposition of "attachment"
NeilBrown [Thu, 20 Apr 2023 22:21:36 +0000 (08:21 +1000)]
email/notmuch: attend or a disposition of "attachment"

Keep track of content disposition and if it claims "attachment" then:

 1/ don't highlight URLs etc
 2/ don't make visible by default - even when plain text

Signed-off-by: NeilBrown <neil@brown.name>
2 years agoMake: change how default_arg in added.
NeilBrown [Thu, 20 Apr 2023 22:12:27 +0000 (08:12 +1000)]
Make: change how default_arg in added.

We currently make the default arg 'replacable' so that typing any text
replaces it.  This is sometimes useful, but sometime awkward.
1/ It is clumsy to edit the arg - you need to abort the 'replaceable'
   state first
2/ it doesn't help with added option e.g. to grep.

So don't make it 'replaceable' but instead place the cursor before the
text.  Then it is easy to insert options or edit the text, and replacing
it is as simple as ctrl-K.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAlways normalise paths returned by find-file.
NeilBrown [Wed, 29 Mar 2023 22:25:18 +0000 (09:25 +1100)]
Always normalise paths returned by find-file.

The "~" prefix is useful when entering a file name, but it need to be
removed before the name is used.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: change wrapping of subjects
NeilBrown [Thu, 23 Mar 2023 05:47:28 +0000 (16:47 +1100)]
notmuch: change wrapping of subjects

If the subject in the message summary needs to be wrapped, wrap it ALL
onto the next line.  This makes long subjects easier to read.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: show all filenames in extended headers
NeilBrown [Wed, 22 Feb 2023 23:44:54 +0000 (10:44 +1100)]
notmuch: show all filenames in extended headers

As a message can be found in multiple files, and as notmuch knows them
all, add the complete list to the extended headers.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch/email: allow extra headers to be shown.
NeilBrown [Sun, 19 Feb 2023 21:41:34 +0000 (08:41 +1100)]
notmuch/email: allow extra headers to be shown.

When viewing an email, it can be useful to be some extra headers without
having to look through the complete raw headers.

There is also information that notmuch knows which doesn't exist in the
headers.

So add an "extras" button which causes both doc-email and notmuch to add
extra headers that might be interesting.
 Message-ID
 In-Reply-To
 References
 Filename
 Thread-ID

Signed-off-by: NeilBrown <neil@brown.name>
3 years agomake: allow a config item to say "all direct below".
NeilBrown [Wed, 15 Feb 2023 09:36:12 +0000 (20:36 +1100)]
make: allow a config item to say "all direct below".

make:$MODE config can now be found in a dir with a trailing '/'.
e.g. /home/kernels/

This means that it applies to all subdirs.  So "make" etc will be run in
/home/kernels/foo, not in /home/kernels/

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoemail: add "Reply-to" to standard headers
NeilBrown [Wed, 15 Feb 2023 04:35:01 +0000 (15:35 +1100)]
email: add "Reply-to" to standard headers

I probably should make this list of headers configurable.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agopython: handle bad utf-8 in string conversion.
NeilBrown [Wed, 15 Feb 2023 02:50:48 +0000 (13:50 +1100)]
python: handle bad utf-8 in string conversion.

If a string contains bad utf-8, treat it as 8bit ascii.

Also handle failure from python_string() correctly.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: don't leave un-waited processes.
NeilBrown [Wed, 15 Feb 2023 02:41:14 +0000 (13:41 +1100)]
notmuch: don't leave un-waited processes.

If a timeout expires, kill the process and wait for it.  Don't just
leave it there.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoconfig: add some make defaults for my /home/kernels dir
NeilBrown [Wed, 15 Feb 2023 01:06:51 +0000 (12:06 +1100)]
config: add some make defaults for my /home/kernels dir

I really should move this config file into $HOME/.config ...

Signed-off-by: NeilBrown <neil@brown.name>
3 years agolinefilter: restore damage for doc:replace
NeilBrown [Wed, 15 Feb 2023 00:59:01 +0000 (11:59 +1100)]
linefilter: restore damage for doc:replace

When a change is made we need to reassess if anything is left.
But for view:changed we don't seem to need the damage.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: when toggling visibility, ensure to move point.
NeilBrown [Sun, 5 Feb 2023 20:50:04 +0000 (07:50 +1100)]
notmuch: when toggling visibility, ensure to move point.

When a Mouse-Activate message arrives, the mark is not the point, so
moving it to the previous part is pointless.  Find the mark and move it.

Also do this whenever visibility changes at all.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoemail: introduce doc:email-step-part
NeilBrown [Sun, 5 Feb 2023 20:46:17 +0000 (07:46 +1100)]
email: introduce doc:email-step-part

doc:email-step-part is like doc:step-part provided by multipath, but it
limits the stepping to visible parts.

Using this for notmuch email viewer when changing the visibilty of a part.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoemacs: don't create empty selection when clicking.
NeilBrown [Sun, 5 Feb 2023 20:43:25 +0000 (07:43 +1100)]
emacs: don't create empty selection when clicking.

When not selection words or line, and when the pointer didn't move,
there cannot be a selection, so don't leave the selection enabled.
Otherwise it can suddenly appear sometimes.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agomultipath: don't step back before the first visible part.
NeilBrown [Sun, 5 Feb 2023 20:41:48 +0000 (07:41 +1100)]
multipath: don't step back before the first visible part.

When considering visibility, never step before the first visible part.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agorenderline: allow a wrap-margin
NeilBrown [Sun, 5 Feb 2023 00:56:02 +0000 (11:56 +1100)]
renderline: allow a wrap-margin

The location of the first wrap-margin tag is remembered, and any
subsequent line wrap is wrapped to that offset.

This is used to wrap subjects for notmuch message summaries.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: messages in visible thread should not disappear.
NeilBrown [Sun, 5 Feb 2023 00:18:49 +0000 (11:18 +1100)]
notmuch: messages in visible thread should not disappear.

While a thread is visible, background refresh should not cause messages
to disappear - e.g. if I archive one and then a refresh happens.
They should only disappear when I re-visit the thread, or when I
explicitly request a refresh with '='.

So keep track of that explicit request, and when not present but the
query is open, preserve all 'True' matched values.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agopython: avoid buffer overflow in LOG()
NeilBrown [Sun, 5 Feb 2023 00:18:00 +0000 (11:18 +1100)]
python: avoid buffer overflow in LOG()

Due to using and unsigned int, some the tests where were bad.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agocomplete: allow an attribute to be requested.
NeilBrown [Tue, 31 Jan 2023 23:06:48 +0000 (10:06 +1100)]
complete: allow an attribute to be requested.

Rendering a fill line is slower than just getting an attribute.
So getting the (new) format:plain attribute is preferred there
it makes sense.

So allow render-complete to be given an attr to use, and do that for
file completion.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agorender-format: support format:plain attribute.
NeilBrown [Fri, 3 Feb 2023 02:42:27 +0000 (13:42 +1100)]
render-format: support format:plain attribute.

"format:plain" allows a caller to get the content of a line without any
markup and so without all the overhead of checking for markup.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agolinefilter: don't cause so much damage
NeilBrown [Wed, 1 Feb 2023 03:32:33 +0000 (14:32 +1100)]
linefilter: don't cause so much damage

Setting damage-view requires the whole doc to be reassessed, which is
slow for large directories.

It isn't clear why this is needed, so remove it for now.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agocomplete: return all of chosen line
NeilBrown [Wed, 1 Feb 2023 02:33:16 +0000 (13:33 +1100)]
complete: return all of chosen line

We currently only return the remainder of the chosen line from the
cursor.  So if the cursor has been moved to the right, the result is
wrong.

Need to move to start of line.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoqprint: don't count flushed lws is reported content size
NeilBrown [Wed, 1 Feb 2023 02:21:24 +0000 (13:21 +1100)]
qprint: don't count flushed lws is reported content size

The content callback reports how many bytes/chars were used.
The lws flushed has already been reported. So don't report it again.

This corrupts a qp file when there is a space before an '='.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoUpdate some copyright dates.
NeilBrown [Wed, 1 Feb 2023 01:33:00 +0000 (12:33 +1100)]
Update some copyright dates.

I wonder if these dates really mean anything..

Signed-off-by: NeilBrown <neil@brown.name>
3 years agorender-format: remove focus arg from next_line()
NeilBrown [Tue, 31 Jan 2023 22:53:30 +0000 (09:53 +1100)]
render-format: remove focus arg from next_line()

next_line() doesn't use focus, so don't require it.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agorender-complete: fix memory leak.
NeilBrown [Tue, 31 Jan 2023 22:52:25 +0000 (09:52 +1100)]
render-complete: fix memory leak.

We allocated this but never freed it.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agocompose-mail: support forwarding emails as attachments
NeilBrown [Tue, 31 Jan 2023 03:19:33 +0000 (14:19 +1100)]
compose-mail: support forwarding emails as attachments

The command 'z' or 'F' with a prefix arg will forward as an attachment.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAllow a line boundary to be reported by the document.
NeilBrown [Tue, 31 Jan 2023 01:07:12 +0000 (12:07 +1100)]
Allow a line boundary to be reported by the document.

Rendering renders up to a line boundary.  Usually a newline, but the doc
can say where it is.  This allows multi-part to put a boundary between
parts, in case a part contains garbage.

This removes some blank lines in email messages -  nice.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoemail-view: be more selective of alternates.
NeilBrown [Mon, 30 Jan 2023 23:37:19 +0000 (10:37 +1100)]
email-view: be more selective of alternates.

Rather and selecting the first among alternates, select the last that we
understand, but avoid html unless there is no alternative.
This is more standards-compliant, and allows text/calendar to be easily
seen.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agomail-view: move text markup away from visibility setting.
NeilBrown [Mon, 30 Jan 2023 23:03:40 +0000 (10:03 +1100)]
mail-view: move text markup away from visibility setting.

Marking up text is quite separate from setting visibility.  So move
these pieces of code apart.

Also move the 'dup' of the start mark into the code that needs it.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoemail: add parsing of calendars
NeilBrown [Mon, 30 Jan 2023 20:57:40 +0000 (07:57 +1100)]
email: add parsing of calendars

Basinc info is extracted from calendar.  Importantly, the time is
displayed in the local timezone.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agox11-xcb - always check for invalid utf-8
NeilBrown [Mon, 30 Jan 2023 20:56:20 +0000 (07:56 +1100)]
x11-xcb - always check for invalid utf-8

Passing invalid utf-8 to pango_layout_set_text() causes error messages
to stderr :-(
So always check, and replace any invalid utf with "*INV*"

Signed-off-by: NeilBrown <neil@brown.name>
3 years agodoc-email: clear charset when not used.
NeilBrown [Mon, 30 Jan 2023 04:30:11 +0000 (15:30 +1100)]
doc-email: clear charset when not used.

If the charset variable is not being used, its value becomes stale, and
copying it to a pane attr causes corruption.  This results in non-utf8
being passed to pango_layout_set_text()

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoTrack XAUTHORITY with DISPLAY
NeilBrown [Mon, 30 Jan 2023 02:36:02 +0000 (13:36 +1100)]
Track XAUTHORITY with DISPLAY

XAUTHORITY is collected when edlib starts, and is passed in by the
server/client.  It is recorded on the display pane and used for starting
new displays and for running external viewers

Signed-off-by: NeilBrown <neil@brown.name>
3 years agopython: don't assume the Pane has a valid pane.
NeilBrown [Mon, 30 Jan 2023 02:36:42 +0000 (13:36 +1100)]
python: don't assume the Pane has a valid pane.

If ->pane is NULL, don't free it.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agokeymap: protect against freed marks.
NeilBrown [Mon, 30 Jan 2023 02:30:42 +0000 (13:30 +1100)]
keymap: protect against freed marks.

If a mark has been freed, don't allow any command to be called on it.
This might make it easier to find out where they get wrongly freed.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agopopup: allow direct placement
NeilBrown [Sun, 13 Nov 2022 07:43:56 +0000 (18:43 +1100)]
popup: allow direct placement

A new mode flag 'x' allows the location of the popup to be explicitly
requested, and means that the location and size can later be changed by
the owner.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAdd ref-counting for panes
NeilBrown [Sun, 13 Nov 2022 07:31:30 +0000 (18:31 +1100)]
Add ref-counting for panes

New pane_get() and pane_put() make it possible to ensure a pane is not
freed while a reference is held.  This is used by python to stop bad
code from crashing when holding an old ref to a pane.

The pane can be closed and the ->data can be freed, but the pane object
itself will remain so that it can be safely tested to see if it is valid.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agolog: avoid recursion
NeilBrown [Sun, 13 Nov 2022 07:21:41 +0000 (18:21 +1100)]
log: avoid recursion

A LOG() command can send a notification to a display pane.
If that display pane then logs something, you can get unlimited
recursion.

Nip that in the bug by never handling a LOG() call while another is
active.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAdd doc-list
NeilBrown [Wed, 26 Oct 2022 04:00:51 +0000 (15:00 +1100)]
Add doc-list

The "list" document time stores lists of elements with content in the
attributes.  It will be used for entries in a menu.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoemail: allow images to be larger
NeilBrown [Sun, 18 Sep 2022 04:44:21 +0000 (14:44 +1000)]
email: allow images to be larger

Images can now be full-width, and up to 75% of the height of the pane.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: keep point nearby when returning from whole-thread
NeilBrown [Sun, 18 Sep 2022 02:35:21 +0000 (12:35 +1000)]
notmuch: keep point nearby when returning from whole-thread

If, while viewing a whole thread, point is moved to EOF, then when we
switch back we don't want it to stay at EOF, we want it to be at
thread_end, or similar.
So we need to clip anything after thread_end upwards.

Clip doesn't move marks *at* the end point, so we need to make our eof
look just a little bit different temporarily.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: fix display for whole-thread
NeilBrown [Sun, 18 Sep 2022 02:16:38 +0000 (12:16 +1000)]
notmuch: fix display for whole-thread

render-format when used with shared-ref requires that EOF is marked by a
NULL pos.  So when we step to the end of the thread, we need to move the
mark all the way to true EOF to get that NULL pos.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: tidy up
NeilBrown [Sun, 18 Sep 2022 00:33:10 +0000 (10:33 +1000)]
notmuch: tidy up

For set-ref, always compare with 1, not zero, because that is what all
other codes does.

For notify-clip, we can pass a bool.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAutospell: pass num arg when clipping.
NeilBrown [Sun, 18 Sep 2022 00:31:44 +0000 (10:31 +1000)]
Autospell: pass num arg when clipping.

Notify:clip has a num which really should be passed to .clip()

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoPython: allow bool to be passed to .clip and .to_end
NeilBrown [Sun, 18 Sep 2022 00:28:48 +0000 (10:28 +1000)]
Python: allow bool to be passed to .clip and .to_end

These really take bools: for clip a true value means move to start, not
end.
For .to_end, a true value means move to end, not start.
Yes, that is confusing.

This still allows integers to be passed, but also allows any truth value.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: new command 'j' - jump to unread message
NeilBrown [Sat, 17 Sep 2022 06:47:30 +0000 (16:47 +1000)]
notmuch: new command 'j' - jump to unread message

'j' in query of view pane will jump the the next unread message if there
is one.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agopresent: allow switching to presentation from markdown
NeilBrown [Sat, 17 Sep 2022 03:07:35 +0000 (13:07 +1000)]
present: allow switching to presentation from markdown

:Commit (:C-c :C-c) will now switch markdown view to presenter view.
This is a bit clumsy as we have to ensure now markup (like spell errors)
can mess things up for us.

Switching back sometimes works

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoautospell: don't fail map-attr
NeilBrown [Sat, 17 Sep 2022 03:06:53 +0000 (13:06 +1000)]
autospell: don't fail map-attr

If map-attr doesn't have the args we need, just fall through, don't fail.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agopython: add name to pane in debugging.
NeilBrown [Sat, 17 Sep 2022 03:06:03 +0000 (13:06 +1000)]
python: add name to pane in debugging.

When a textual repr of a pane is requested, include the name.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agolib-view: make trailing space in file name apparent.
NeilBrown [Sat, 17 Sep 2022 02:01:52 +0000 (12:01 +1000)]
lib-view: make trailing space in file name apparent.

If document name starts or ends with a space, enclose in quotes for
status line.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoSupport display-context for macro recording.
NeilBrown [Sat, 17 Sep 2022 01:54:37 +0000 (11:54 +1000)]
Support display-context for macro recording.

lib-view will show a display-context
lib-input can record it
lib-macro will set it as needed.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agobase64: fix pos tracking.
NeilBrown [Tue, 13 Sep 2022 23:04:55 +0000 (09:04 +1000)]
base64: fix pos tracking.

Various bugs in pos tracking.
Particularly, for the content callback the mark is moved lower in the
stack so the pos isn't automatically updated - we have to update it in
the callback.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoFix various doc:char handlers when stepped towards a mark.
NeilBrown [Tue, 13 Sep 2022 06:34:00 +0000 (16:34 +1000)]
Fix various doc:char handlers when stepped towards a mark.

I obviously never tested this - the condition was inverted.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agopython: reset signal handler when restoring alarm()
NeilBrown [Mon, 5 Sep 2022 11:02:05 +0000 (21:02 +1000)]
python: reset signal handler when restoring alarm()

A subordinate python call might have disabled the signal handler.  We
need to re-enable it.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAdd timer to avoid looping bugs
NeilBrown [Mon, 5 Sep 2022 10:01:04 +0000 (20:01 +1000)]
Add timer to avoid looping bugs

If a key/mouse event takes longer than 15 seconds, all calls start
failing.
This may well cause some code to misbehave... I should find and clean up
such code.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agobase64: improve how current position is determined.
NeilBrown [Sun, 4 Sep 2022 05:28:49 +0000 (15:28 +1000)]
base64: improve how current position is determined.

Now that we can track mark movements including to_mark, use that to
maintain a 'b64-pos' attr on any mark so that we know where in a QUAD it
is.  This makes finding current location much more efficient.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: limit searching to 50000 character
NeilBrown [Sun, 4 Sep 2022 05:25:58 +0000 (15:25 +1000)]
notmuch: limit searching to 50000 character

I'm not sure this is necessary, but email could be large and we don't
want to waste time needlessly.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agobase64: change base64_step() to a normal function.
NeilBrown [Sun, 4 Sep 2022 01:26:42 +0000 (11:26 +1000)]
base64: change base64_step() to a normal function.

This doesn't need to be a DEF_CMD() any more.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agomark: allow extra tracking of mark_to_mark movements.
NeilBrown [Sun, 4 Sep 2022 00:26:31 +0000 (10:26 +1000)]
mark: allow extra tracking of mark_to_mark movements.

If a mark is being tracked, and mark_ack() was called last time it
moved, then when any mark is moved to that mark, track it as well.
This way marks move into a range can start being tracked.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoSend mark:moving notification on all marks
NeilBrown [Sun, 4 Sep 2022 00:18:57 +0000 (10:18 +1000)]
Send mark:moving notification on all marks

Instead of just on points, send the notification on all marks.
This means it is important to really check what mark the notification
was for.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoRename point:moving to mark:moving
NeilBrown [Sat, 3 Sep 2022 23:04:10 +0000 (09:04 +1000)]
Rename point:moving to mark:moving

The "point:moving" event is now called "mark:moving" and the "moved"
flag is now stored in every mark.  This is a first step towards
supporting movement events on all marks.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agotests: improve stability: aspell and git
NeilBrown [Sat, 3 Sep 2022 22:57:11 +0000 (08:57 +1000)]
tests: improve stability: aspell and git

Aspell can be affected by config in $HOME, so set that to /tmp
git can set core.abbrev dynamically so set a fixed value

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: tag replied messages as "replied"
NeilBrown [Sun, 21 Aug 2022 00:08:13 +0000 (10:08 +1000)]
notmuch: tag replied messages as "replied"

When replying to a message, mark it "replied"
When forwarding a message, mark it "forwarded"
Highlight these messages with tag characters.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAdd some developer documentation
NeilBrown [Sat, 20 Aug 2022 23:33:06 +0000 (09:33 +1000)]
Add some developer documentation

I worked on this for hackweek in June 2022.  It is far from comolete,
but hopefully a useful start.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agomisc random fixes
NeilBrown [Fri, 1 Jul 2022 06:12:15 +0000 (16:12 +1000)]
misc random fixes

mostly fixes to comments.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoMove some functions from core.h to internal.h
NeilBrown [Tue, 28 Jun 2022 00:34:38 +0000 (10:34 +1000)]
Move some functions from core.h to internal.h

These are only used in core-foo.c, so only need to be in internal.h

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoconfig: .md files need fill and spell.
NeilBrown [Mon, 27 Jun 2022 00:20:15 +0000 (10:20 +1000)]
config: .md files need fill and spell.

auto-enable fill and spell for .md files.

But don't enable auto-spell for testing - it is too confounding

Signed-off-by: NeilBrown <neil@brown.name>
3 years agomisc: fix a few typos
NeilBrown [Tue, 21 Jun 2022 07:11:53 +0000 (17:11 +1000)]
misc: fix a few typos

just stuff I saw while reading.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoncurses - clear paste state on shutdown
NeilBrown [Tue, 21 Jun 2022 07:10:48 +0000 (17:10 +1000)]
ncurses - clear paste state on shutdown

As ncurses_stop() might be followed by ncurses_start() we need to be
sure to clear up properly.
The 'paste' state was freed by not zeroed.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agopresent: don't claim to be primary markdown handler
NeilBrown [Sun, 19 Jun 2022 05:54:27 +0000 (15:54 +1000)]
present: don't claim to be primary markdown handler

The "markdown" handler is only an interface for presenter, so
describe it as such.  This leaves room for something else to define
"attach-markdown".

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoserver: fix problem with server forgetting to accept connections.
NeilBrown [Fri, 3 Jun 2022 03:18:51 +0000 (13:18 +1000)]
server: fix problem with server forgetting to accept connections.

The important change here is to use focus.root for activating the
event:read, otherwise when the focus pane is closed, the event is
disabled.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: fix get-attr for query_view
NeilBrown [Wed, 1 Jun 2022 10:30:17 +0000 (20:30 +1000)]
notmuch: fix get-attr for query_view

I wrote this code, but never tested it as I didn't provide a "handle:"
comment.
Time to make it right.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agonotmuch: ensure all handlers explicitly return
NeilBrown [Wed, 1 Jun 2022 04:05:44 +0000 (14:05 +1000)]
notmuch: ensure all handlers explicitly return

A missing return means Efallthrough, which should be shown explicitly.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoncurses - do full terminal reset on Display:refresh
NeilBrown [Wed, 1 Jun 2022 03:54:17 +0000 (13:54 +1000)]
ncurses - do full terminal reset on Display:refresh

Sometimes the terminal can lose setting - mosh does this.
So on Display:refresh (:C-L) do a full restart.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAdd Draw:image-size and don't upscale images in emails.
NeilBrown [Sat, 28 May 2022 23:37:49 +0000 (09:37 +1000)]
Add Draw:image-size and don't upscale images in emails.

New display function Draw:image-size reports the size of an image in
(x,y).
This is used when drawing an image with new attr noupscale to
ensure the size of the image is never scaled up, only down.

email now requests noupscale

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoUpdate the year in some copyright claims
NeilBrown [Sat, 28 May 2022 00:36:25 +0000 (10:36 +1000)]
Update the year in some copyright claims

It is well into 2022 now, so time to update some copyright statements.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoncurses: call ncurses_end() before closing the pane.
NeilBrown [Sat, 28 May 2022 00:34:53 +0000 (10:34 +1000)]
ncurses: call ncurses_end() before closing the pane.

We need ncurses_end() to be called before we notify the server to close,
so it must be called before pane_close().

Signed-off-by: NeilBrown <neil@brown.name>
3 years agorender-lines: refresh last line properly when moving cursor
NeilBrown [Fri, 27 May 2022 23:59:09 +0000 (09:59 +1000)]
render-lines: refresh last line properly when moving cursor

If cursor is at end-of-file, then moving it might not refresh the last
line so it could still display the cursor.

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