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.
NeilBrown [Sat, 6 May 2023 23:45:33 +0000 (09:45 +1000)]
notmuch message-view: improve url attributes.
Rather than storing the URL as an attribute of the first char of the
URL, store it as an attribute of the pane, indexed by a tag. This tag
is stored in the render:url attribute instead of a length.
This avoid the need to search backwards for the char with the url
attribute, we can access it directly instead.
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.
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.
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.
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.
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.
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.
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