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.
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.
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.
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.
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).
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.
- 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.
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.
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.
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.
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.
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.
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.
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.
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.
NeilBrown [Wed, 28 Jun 2023 09:04:01 +0000 (19:04 +1000)]
add window:set: and use it to set attributes for displays.
We sometimes need to set DISPLAY etc so it is visible to the display
handler, particularly for ncurses.
Use new window:set: to set these on the window-core pane.
This means that editor:active-display is now always immediately after
the display pane is created, so we are closer to letting that be called
as part of creating the display pane.
NeilBrown [Wed, 28 Jun 2023 08:08:15 +0000 (18:08 +1000)]
handle Display:close in window-core
When a display/window is closed, the whole stack needs to go including
the window-core pane. So let the Display:close request get down to
there, and close everything.
NeilBrown [Wed, 28 Jun 2023 06:56:39 +0000 (16:56 +1000)]
introduce core-window.c
core-window provides a window-core pane which provides core
functionality for all windows. Some functionality is moved out of
lib-input where it doesn't really belong.
NeilBrown [Wed, 28 Jun 2023 06:54:41 +0000 (16:54 +1000)]
input: don't use pane_notify to send window notification.
input can currently use pane_notify directly instead all calling
window:notify:foo because it manages these notifications.
But soon it won't, so call("window:notify:foo") like everyone else has
too.
NeilBrown [Wed, 28 Jun 2023 06:03:07 +0000 (16:03 +1000)]
Move parse_ini() into a separate include file.
This makes it easy for it to be reused, or even take out into another
package. Unlike the rest of edlib, it can be used under any popular
open source license.
NeilBrown [Wed, 28 Jun 2023 05:43:18 +0000 (15:43 +1000)]
compose: run notmuch-addr asynchronously.
We can no longer call pane.root.refresh(), so we cannot update the
display while waiting for something - which is good: we shouldn't wait
for things.
So arrange for an even when notmuch-addr reports some data and insert
the first match then - if point hasn't moved.
NeilBrown [Tue, 27 Jun 2023 22:20:03 +0000 (08:20 +1000)]
Split module list into a separate ini file
One day the list of module dependencies will be mechanically generated
from all available modules. To prepare for that, and to keep edlib.ini
small, split out modules.ini.
NeilBrown [Tue, 27 Jun 2023 01:43:32 +0000 (11:43 +1000)]
pane: if an on-idle event to handle damage cannot be added, don't add damage.
If pane_damaged() is called before the event handler is ready, the
on-idle doesn't get registered properly and will never get called.
So check for errors, and leave damage unset so the next pane_damaged()
call can schedule the on-idle event.
NeilBrown [Fri, 23 Jun 2023 07:17:16 +0000 (17:17 +1000)]
messageline: treat an empty message as message-removal.
If a Message command provides a zero-lenth message, remove any current
message rather than setting a explicit empty message. This allows a
default to appear.
NeilBrown [Fri, 23 Jun 2023 05:47:03 +0000 (15:47 +1000)]
renderline: allow Refresh to be handled.
If the requested z depth (at attach time) is >= 0, then Refresh messages
will be sent.
They can now be handled.
The cursor pos for the refresh can now be set with renderline:set.
This ->num is only used for Refresh.
NeilBrown [Fri, 23 Jun 2023 03:09:48 +0000 (13:09 +1000)]
render-complete: add highlight more correctly.
As the original might have attributes in it, we need to find the
character that we want to highlight, and highlight just those. Possibly
there will be multiple ranges if the characters already have differing
highlights.
NeilBrown [Fri, 23 Jun 2023 02:17:22 +0000 (12:17 +1000)]
lib-linefilter: always strip attributes from line before comparing.
If the key is an attribute, tell the callback using ci->key=="attr"
rather than the magic of -num2 == -1, which can get set by other
doc:render-line functions.
When the key is a line from doc:render-line, properly strip all
attributes, both old and new style.
NeilBrown [Thu, 22 Jun 2023 23:02:55 +0000 (09:02 +1000)]
render-present: don't use doc:render-line to get text.
doc:render-line returns a line that can include markup. But
render-present doesn't expect or handle markup.
So use doc:get-str to get the line, and quote and '<' characters.
NeilBrown [Wed, 21 Jun 2023 07:53:03 +0000 (17:53 +1000)]
lib-renderline: make control chars stand out more.
Conrtol chars should not appear in the line given to lib-renderline.
We try to handle them, but let us make them much more obvious so they
look wrong as well as being wrong.
NeilBrown [Wed, 21 Jun 2023 07:48:57 +0000 (17:48 +1000)]
lib-renderline: expect control chars instead of <> for attributes.
Using <> to distinguish attributes is clumsy as it requires that '<' be
quoted.
We already quote control characters, making them <red>^X</red> so use
control characters for distinguishing attributes.
SOH (\1) marks start of attrs
STX (\2) marks end of attrs, start of text
ETX (\3) marks end of the text for those attrs.
ACK (\6) is used as a filler when needed.
A string that start \6 or \1 is assumed not to contain meaningful <>
Otherwise we translate to remain compatible with old code.