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.
NeilBrown [Wed, 21 Jun 2023 07:03:14 +0000 (17:03 +1000)]
renderline: fix rendering bug when a TAB wraps.
If a tab wraps, we show the character immediately before the tab at the
start of the next line, which is wrong.
It is particularly weird when that char is the '>' at the end of an
attribute marking.
NeilBrown [Wed, 21 Jun 2023 04:35:50 +0000 (14:35 +1000)]
markup: always convert control characters.
I don't know why this is_true_eol test is here, but is is NEVER set at
this point, so it breaks control characters - leaving them to
lib-renderline to handle, which I don't want.
NeilBrown [Sun, 18 Jun 2023 21:46:27 +0000 (07:46 +1000)]
config: ensure new config overrides earlier config.
Config must be applied in the order is read. So when recording filename
triggers, always add to the end of the list. And when including
per-user configuration, read it after the global configuration.
NeilBrown [Sun, 18 Jun 2023 07:54:12 +0000 (17:54 +1000)]
diff: fix occasional slowness.
If a diff region was marked before it was completely generated, an
attempt to mark the word-diff regions could create over-lapping vmark
ranges, which causes confusion.
So always remove old vmark ranges before adding new ones.
NeilBrown [Sun, 18 Jun 2023 00:03:25 +0000 (10:03 +1000)]
doc: allow key to be passed to doc:set: in ->str2
If "doc:set:" or "doc:append:" is called with an empty key appended to
the name, find the key in ->str2.
This avoids the need for string allocation if the key is in a variable.
NeilBrown [Sat, 10 Jun 2023 04:03:34 +0000 (14:03 +1000)]
Introduce pane_register_root()
pane_register_root() is an internal interface, called only by
editor_new(), which creates a root pane, with ->parent pointing to
itself.
pane_register() and doc_register() must now be given a non-NULL parent.
as a pane that handles one typically needs to handle them all.
The difference notifications are reflected in ->num:
1 : new child registered - ->focus is the child
-1 : existing child is being closed - ->focus is that child
-2 : existing child is being moved away - ->focus is tha child
2 : existing child replaced - ->focus in the new child
This follows a "-2" where the old was moved away.
Several handlers are extended to handle all possibilities.
NeilBrown [Fri, 16 Jun 2023 11:19:15 +0000 (21:19 +1000)]
tile: be extra careful when merging a tile into it's parent.
When a parent tile gets down to just one child, the child is subsumed
into the parent.
This requires that the parent really is a tile pane. As pane_reparent()
and change parantage, it is possible that it isn't.
So add extra checks before assuming the types of things.
NeilBrown [Wed, 14 Jun 2023 10:21:58 +0000 (20:21 +1000)]
Add a config-file parser.
An "ini" style file can be read to set global attributes, configure
auto-loading of modules (listing commands that they define) and
eventually per-doc configurations based on file name.
NeilBrown [Wed, 14 Jun 2023 10:25:33 +0000 (20:25 +1000)]
core-keymap: handle map changing when command is run.
Even if a command returns Efallthrough, it could have changed the map
(by auto-loading a module).
So we cannot assume the "pos" is still correct. So recalculate it each
time when scanning all commands with a given prefix.
NeilBrown [Mon, 12 Jun 2023 11:46:01 +0000 (21:46 +1000)]
mergeview: capture < and > on marker lines.
When cursor is on a marker line, capture < and > for manipulating the
merge.
On the first marker: lines are moved between top of orig and preceding
content.
On the second marker: lines are moved between bottom of orig and
following content.
NeilBrown [Mon, 12 Jun 2023 09:40:56 +0000 (19:40 +1000)]
mergeview/wiggle: improvements for space-only conflicts.
1/ change how the "wiggle" is reported. It is no longer reported
by "set-wiggle". Instead a new "get-result" function returns
various results including the "wiggle".
2/ count how many conflicts only involve white space. If that is
all the conflicts, then still calculate the wiggle.
3/ If a merge only has space conflicts, use blue for the merge
markers rather the red (or green).
4/ mark the green merge markers bold so they stand out more
5/ When adding attrs, annotate conflicts which are space only,
and respond to that with underlines instead of inverse red.
NeilBrown [Mon, 12 Jun 2023 05:14:01 +0000 (15:14 +1000)]
mergeview: add commands to apply the merge.
If :A-m has a numeric arg, then it now behaves differently and often
edits the merge rather than finding another:
-ve: discard the patch and just keep the original.
0 : if no conflicts remain, apply the patch
1 : discard the original and just keep the "after" part.
9 : if there is a selected merge, cut the path and leave the original
if there is no selected merge, paste the recently cut diff,
using the selection as the original.
NeilBrown [Mon, 12 Jun 2023 05:11:24 +0000 (15:11 +1000)]
wiggle: return the wiggled result from set-wiggle.
If set-wiggle is given ->comm2, and if there are no conflicts, return
the successful wiggle as a string.
Also if the attribute passed is an empty string, don't add any markup.
This can be used to only get the wiggle.
The intention of the "wiggle" command was to return the wiggle, but
there is some much commonality with set-wiggle that it seemed easiest to
add the functionality there.
So discard the unimplemented 'wiggle' command.