NeilBrown [Sat, 3 Jun 2023 00:55:59 +0000 (10:55 +1000)]
doc-email: be more subtle with default visibility.
We don't want large (base64) attachments to be visible by default, nor
do we want transformations to appear too early.
So mark all spacers, the orig-headers, and the orig first part as
visible, and everything else invisible.
This will, for example, stop LineCount from counting too much of it if
it happens to start before final visibility is configured
NeilBrown [Sat, 3 Jun 2023 00:49:37 +0000 (10:49 +1000)]
linecount: ensure we start a visible beginning of document
The document we are counting might be a 'view' and the early lines might
be clipped off. So use doc:set-ref to move to the beginning as visible
from the focus.
Also simplify the code as two conditions each have exactly the same result.
NeilBrown [Sat, 3 Jun 2023 00:34:08 +0000 (10:34 +1000)]
Always call CountLines on the focus
A view might hide some lines, and might intercept CountLines so exclude
those lines from the count.
As a line count is a particular view on the file, it should be
consistent with other views.
So always use the current focus when calling CountLines.
NeilBrown [Fri, 2 Jun 2023 07:24:00 +0000 (17:24 +1000)]
python: change how modules are loaded into the interpreter
Each edlib module is now a separate python module.
They must all "import edlib" and can find the editor pane in
"edlib.editor"
They must also import any modules they use.
NeilBrown [Fri, 2 Jun 2023 03:07:28 +0000 (13:07 +1000)]
ncurses: don't block in nc_external_viewer
Rather than blocking the whole editor while waiting for use to
copy/paste for plain-text screen, set a flag to say that the display is
suspended, and resume on next key stroke collected in the normal way.
NeilBrown [Wed, 31 May 2023 11:12:32 +0000 (21:12 +1000)]
rexel: don't accidentally make back-refs with impossible capnum.
If we try to make a backref with an impossible CAPture NUMber, it will
look like an invalid opcode, and rexel will abort() (which it
shouldn't...). So make sure it doesn't happen.
NeilBrown [Sun, 28 May 2023 07:58:03 +0000 (17:58 +1000)]
pdf,doc: mark urls.
Copy the url-marking code from notmuch as use it to mark urls in
converted pdf and doc.
I don't know that this is a good idea.. Let's see if I find it useful.
NeilBrown [Sun, 28 May 2023 07:25:27 +0000 (17:25 +1000)]
multipart: don't assume sub-panes never disappear.
If a part-pane sends a Notify:Close we REALLY mustn't touch it again.
So we must set the pointer to NULL. Even though we start closing down,
something bad could happen.
I had a crash where the attempt to send "doc:closed" to all panes
crashed on one that had already been closed.
So remove the 'safe' marking, handle the fall-out, and set .pane to NULL
when told to.
NeilBrown [Sun, 28 May 2023 06:59:54 +0000 (16:59 +1000)]
tests: filter out duplicate "Display" lines.
The 02-grep often duplicates some Display lines, apparently at random.
I don't know why and it doesn't show a display bug.
So filter them out to avoid unnecessary test failure.
NeilBrown [Sun, 28 May 2023 02:34:01 +0000 (12:34 +1000)]
Change rules for doc:render-line with mark2
When doc:render-line is called with mark2, this doesn't interrupt the
rendering, but simply reports (via ->num in the callback) the offset
where mark2 was found.
Now ->num is either negative, or the number of chars to process.
NO_NUMERIC is no longer relevant and is not tested for.
I think this is simpler as ->num and ->mark2 are not independent.
NeilBrown [Sun, 28 May 2023 02:16:21 +0000 (12:16 +1000)]
renderline: fix cursor pos after early wrap.
If a line wraps before he end, due to an early wrap marker, the cursor
will appear where it would have been if the line had been truncated
rather then wrapped.
We need to detect when a "flush" stopped because if found a wrap marker,
and to adjust the cursor pos in that case.
NeilBrown [Sat, 27 May 2023 07:46:18 +0000 (17:46 +1000)]
mark: separate mark:moving from mark:arrived
The mark:moving notification was originally for when a specific mark
moved at all.
For b64 I extended it to also notify when *any* mark moved to a specific
mark.
This can cause illegal nested notification if a mark:moving handler
tries to move a (non-specific) mark. That is bad.
So separate the two: Add mark:arrived for when a mark is moved to a
flagged marks.
Also make sure all new marks aren't flagged. I invert the sense of the
flag and call it "MARK_FLAG_WATCHED". This will be clear by default,
and only set once the (renamed) mark_watch() is called.
NeilBrown [Fri, 26 May 2023 22:14:13 +0000 (08:14 +1000)]
notmuch: use mark:moving to avoid getting stuck in quoted lines
Currently the 'point' can get stuck in hidden quoted-line and 'up'
movements get lost.
Use mark:moving (which is always sent on 'point') to see when this
happens, and to escape.
NeilBrown [Fri, 26 May 2023 03:38:12 +0000 (13:38 +1000)]
introduce doc:append:...
doc:append: is similar to doc:set:, but the given value is appended to
the attr if it exists.
The value should start with a separator character, and this is removed
if it is the first item to be appended.
NeilBrown [Thu, 25 May 2023 23:47:35 +0000 (09:47 +1000)]
doc: add default doc:get-attr which returns pane attribute.
Sometimes we want an attribute which can vary with location in the document,
but offen i satisfied with a document-wide value.
fill:start-re is a good example.
Provide a default doc:get-attr, which will be called if no attr can be
found at the specific location. This returns a pane attribute is
possible.
Also ensure all current doc:get-attr function fall through if they
cannot find a value.
NeilBrown [Mon, 22 May 2023 10:53:47 +0000 (20:53 +1000)]
handle text-fill in .md files better.
Enhance text-fill so that various style attributes can be on the pane
rather than on the character, and set pane attributes for markdown to
notice the starts of various paragraph types, particularly the various
list entries.
NeilBrown [Sun, 14 May 2023 23:42:25 +0000 (09:42 +1000)]
search: speed up backwards search.
Rather stepping back one char at a time and attempting a match, step
back larger and larger numbers of chars, and search in that range.
Once we find, search forward for the last match.
NeilBrown [Sun, 14 May 2023 09:12:44 +0000 (19:12 +1000)]
rexel: add an 'advance' flag to turn on anchored search.
If we want to find a match that *starts* before a given point but may
continue after that point, we cannot just stop when we reach the point,
but we must enable anchored-match when we do.
Introduce matching "anchor_at_end" flag in lib-search which used this
flag.
With anchor_at_end, the match must start by the end mark.
Without, it must be complete by the end mark.
NeilBrown [Sun, 21 May 2023 11:11:46 +0000 (21:11 +1000)]
lib-search: fix bug with matching a pattern that ends at point
Calling rxl_advance() is problematic as merging the two return code is
not trivial.
We really want all the flags that go before a given character to be
handled together.
So set a flag when we see the point, then set the RXL_POINT flag the
next time around.
NeilBrown [Fri, 19 May 2023 06:36:50 +0000 (16:36 +1000)]
rexel: store wctype values directly in rxl array
Rather than having a static mapping from a 2-byte value stored in the
rxl array to an 8-byte wctype_t, store the wctype_t directly in the rxl
array, using as many entries as needed.
NeilBrown [Tue, 16 May 2023 09:37:14 +0000 (19:37 +1000)]
rexel: support unicode beyond 0x7ffff
The comment said we have to create a set for unicode beyond 15 bits, but
the code doesn't.
Instead reserve 17 code value to identify a unicode plane, and the next
'short' is combined to create a full unicode codepoint.
NeilBrown [Sat, 13 May 2023 01:53:41 +0000 (11:53 +1000)]
emacs: if shell command produces no output - say so.
If a shell command exits quickly with no output, emacs mode currently
writes and empty string (the output) to the message line, which isn't a
lot of help.
Instead, write a message that the command did complete - and report any
exit code.
NeilBrown [Sat, 13 May 2023 01:39:43 +0000 (11:39 +1000)]
notmuch: simplify how 'new' tag is cleared
When the search view is explicitly closed with 'q', all new
threads/messages that have been listed get the 'new' tag cleared.
Any implicit close no longer does that.
NeilBrown [Fri, 12 May 2023 09:10:19 +0000 (19:10 +1000)]
notmuch: handle display of alternatives that are multipart.
An alternative can be multipart, e.g. multipart/related.
In that case it won't be the last segment of the path which
says "alternative". We have to look earlier.
NeilBrown [Thu, 11 May 2023 23:39:00 +0000 (09:39 +1000)]
email: ensure text parts always provide characters.
If a base64 part does not declare a charset, we don't provide one, so no
chars are available, only bytes.
This is fine for PDF which wants bytes, but bad for html.
So check for text and require some charset.
NeilBrown [Mon, 8 May 2023 09:48:49 +0000 (19:48 +1000)]
notmuch: avoid inconsistent value of thread_end
thread_end points to the start of the next thread after thread_start.
Changes to the document can insert another thread in between which
causes strange display.
So always recalc thread_next when the doc changes.