Commit Graph

123 Commits

Author SHA1 Message Date
Přemysl Eric Janouch 536aa57761
Slightly optimize very large directories
Cumulatively 10% of user time, give or take.

These are mainly pointless multibyte to wide string conversions.

The hit to source code readibility is minimal.
2021-10-05 21:01:32 +02:00
Přemysl Eric Janouch 0d10ae06e6
Measured stat performance, io_uring not worth it
Large directories are slow for different reasons.
2021-10-05 19:18:15 +02:00
Přemysl Eric Janouch e1b0831854
Don't reload on sort changes
It is unexpected behaviour, and likes to take too long.
2021-09-26 09:38:16 +02:00
Přemysl Eric Janouch 4e93dfbb8d
Add a comment about libacl
So that I don't repeat my actions in the future.
2021-09-26 09:19:54 +02:00
Přemysl Eric Janouch 8a6bb54eb5
Ignore empty XDG_CONFIG_DIRS
As the specification says we should.  GLib does this as well.

It is still possible to achieve an empty set by using ":",
which are two non-absolute paths that should be ignored.
GLib doesn't implement this.  Thus, we're now better than GLib.
2021-09-26 08:59:57 +02:00
Přemysl Eric Janouch 7de8c84e8f
Fix a signedness compiler warning 2021-07-19 09:12:17 +02:00
Přemysl Eric Janouch e17c5e2083
Bind F6 to a rename prompt
Mostly just so that the F7 binding isn't completely alone.

Since Shift-F6 isn't something we can just bind to, use a prefill.
2021-07-17 14:47:50 +02:00
Přemysl Eric Janouch 9bd3739122
Bind F7 to an mkdir prompt
This might have needed more thought, but we'll see.
2021-07-17 14:41:57 +02:00
Přemysl Eric Janouch ec1f1031cc
Implement search iteration
The interactive search now has its own keymap, overriding "input".

Closes #5
2021-07-17 14:19:37 +02:00
Přemysl Eric Janouch bc99b3dd48
Add a right-side prompt to the search 2021-07-17 13:04:42 +02:00
Přemysl Eric Janouch e948741864
Enable pushing the search in a certain direction
We want to make it possible to iterate all current matches.
2021-07-17 08:49:54 +02:00
Přemysl Eric Janouch 0adbac2066
Make search() return the number of matches 2021-07-17 07:54:03 +02:00
Přemysl Eric Janouch 2238db5a4e
Make removing characters invoke g.editor_on_change 2021-07-17 07:24:16 +02:00
Přemysl Eric Janouch 98612f5492
Improve C-char parsing
I was hoping that a superoptimiser would help me find a miraculous
branchless equation to cover it, but in the end the branching
doesn't hurt at all in our case.

It's more readable than `(((char >> 2) - 0x38) & 0x60) ^ char`
or `(char ^ 0x40) & (((char >> 1) ^ 0x20) | 0x5f)`.
2021-07-09 05:16:37 +02:00
Přemysl Eric Janouch fdb338fe12
Allow binding to custom key sequences
And document this feature in the manual page.
2021-07-07 21:21:32 +02:00
Přemysl Eric Janouch 07ef834a1e
Include a header required for kill()
Yet, this program remains fairly unportable.
2020-10-29 03:24:37 +01:00
Přemysl Eric Janouch 0c1a8d9902
Implement the --version option
Since we have a version number at all, even if it's meaningless.
2020-10-26 19:07:47 +01:00
Přemysl Eric Janouch c88566e7bb
Bind F1 to show the help 2020-10-25 08:19:49 +01:00
Přemysl Eric Janouch 39c840cd74
Mark a minor issue for later resolution 2020-10-24 19:28:11 +02:00
Přemysl Eric Janouch c503954f44
Cleanup
The wchar_t variant of compute_width() is no longer needed.

So all in all the better help has saved code.
2020-10-23 07:53:37 +02:00
Přemysl Eric Janouch 77973fc026
Group help message by action
Considerably more useful and concise.
2020-10-23 03:51:26 +02:00
Přemysl Eric Janouch 61be9528e4
Bind M-Up to the "parent" action
Taken from Windows Explorer, which previously used Backspace.

We might want to use h/l for parent/choose by default.
2020-10-23 03:38:47 +02:00
Přemysl Eric Janouch 2313485970
Bind C-d in the editor
We do get these as a key, after all.

Closes #4
2020-10-23 01:37:14 +02:00
Přemysl Eric Janouch 20c883fb8a
Implement C-v in the editor
Not completely happy with the explicit `halfdelay (1)`.

Updates #4
2020-10-23 01:37:07 +02:00
Přemysl Eric Janouch bbf97f6d3d
Implement C-u C-k in the editor
Updates #4
2020-10-23 01:21:25 +02:00
Přemysl Eric Janouch 706795c85c
Cleanup 2020-10-22 00:51:57 +02:00
Přemysl Eric Janouch e8eaa2366a
Implement Delete in the editor
Not caring about C-d right now, we might have to convince the tty
to send it to us--I'm not sure if it does, or returns EOF.

Updates #4
2020-10-22 00:06:41 +02:00
Přemysl Eric Janouch 12d8f6a931
Implement C-a C-e C-b C-f in the editor
Updates #4
2020-10-21 23:57:16 +02:00
Přemysl Eric Janouch 5d0c105b10
Make backspace erase combining characters
They might not be even printed correctly, though.

Updates #4
2020-10-21 23:56:51 +02:00
Přemysl Eric Janouch 33a8e26efc
Track cursor position in the editor
Updates #4
2020-10-21 23:55:01 +02:00
Přemysl Eric Janouch a0eacf4607
Add an installation script
Copying snippets from the README was uncomfortable and laborious,
and wasted a lot of space in the document, especially after
the recent additions.

Closes #3
2020-10-21 08:26:42 +02:00
Přemysl Eric Janouch 63e7895905
Let the caller decide how to launch helpers
In the end, we don't need to impose any policy on it,
and it removes a level of quoting, as well as an `eval`.
2020-10-08 19:50:04 +02:00
Přemysl Eric Janouch 6aa4bd2ff5
When resuming a child, resume the whole group
SIGTSTP is sent to the entire foreground process group,
so do the some with our SIGCONT.

Debian's default sh (dash) doesn't replace itself with
the command, even if it's the last one in the -c option.

Of course, we do not need to use /bin/sh for the helpers
at all, though it doesn't cost us much.  We could also
issue an explicit `exec`.
2020-10-08 19:49:07 +02:00
Přemysl Eric Janouch 000315165d
Fix the help in absence of a bindings file 2020-10-08 14:28:49 +02:00
Přemysl Eric Janouch d2e4b91262
Fix showing DEL in the help
And in general fix all CTRL processing to handle the DEL character.
2020-10-08 14:28:24 +02:00
Přemysl Eric Janouch b53a3a0981
Revisit zsh integration
zsh's antisocial behaviour was fairly promptly fixed (thanks to
Stephane Chazelas and his patience).

zle-line-init and zle-line-reset seem to be user-defined widgets
and the order inverted.  Put zle-line-init before reset-prompt
because some people do weird things in there.
2020-10-04 14:27:51 +02:00
Přemysl Eric Janouch cf80a15501
Survive a removed CWD, as well as an empty root
All the omitted error checking sometimes sucks a lot,
and I need to include it later anyway.
2020-10-02 16:35:12 +02:00
Přemysl Eric Janouch 5451eba2a3
Make the outer prompt look more normal
There's a slight issue with the inverted cell representing
the cursor standing out a bit too much amongst the rest of
the characters.

The resulting experience is a lot more consistent, though.
2020-10-01 13:40:52 +02:00
Přemysl Eric Janouch b8c767354e
Show external command line if appropriate
Since I'm already dealing with the fish shell.

All of our supported shells seem to handle cursor position
in Unicode (wide character) codepoints.

It was easiest and most straight-forward to pass the data
through yet-unused program arguments.

The cursor position is marked by a Unicode glyph equivalent
to ACS_DIAMOND, although ncurses doesn't get a chance
to make any ACS translation.
2020-10-01 11:58:32 +02:00
Přemysl Eric Janouch 93172797e1
Set cursor to child when going to parent dir
That is, if it's missing from our history.

This makes for a more consistent experience when traversing
the filesystem.  Arguably, it's only good for when 'h' is
bound to the 'parent' action.

Also make sure that the offset and cursor are reset when
the path is changed.
2020-09-29 03:39:13 +02:00
Přemysl Eric Janouch 1507f2dff9
Cleanup 2020-09-29 02:31:49 +02:00
Přemysl Eric Janouch 9a12fd8021
Add ability to run helpers externally
So far experimental and essentially undocumented.
2020-09-29 01:33:19 +02:00
Přemysl Eric Janouch f596bb8f5e
reload() doesn't really need to know the old path
Just whether it's safe for it to keep an anchor on the current item.

I've left in the safety check for an empty entries array,
for the theoretical case of an empty or entirely filtered-out root
directory.  It will likely crash in that case, anyway,
the cursor may be either -1 or 0.
2020-09-28 22:52:33 +02:00
Přemysl Eric Janouch 67da8d965b
Make anchor processing a bit more obvious 2020-09-28 22:18:17 +02:00
Přemysl Eric Janouch e60ffeeb20
Improve PAGER defaults
We basically need less(1), nothing else will work correctly.

I'm not sure where I took pager(1) from, might be a Debian thing.
2020-09-28 21:34:09 +02:00
Přemysl Eric Janouch 0a66ae4d26
Expand a comment about overstriked underlining 2020-09-28 20:11:38 +02:00
Přemysl Eric Janouch 121d7850fe
Show error output from failed helpers
Usually, when the pager or the editor fail and return a non-zero
exit status, they display a message on the standard error output.

We might also try to redirect this output to show_mesage() but
it might not fit as a whole, so, given the relative rareness
of this situation, this slight inconsistency shouldn't be much
of an issue.

It'd also be possible to redirect the output to run_pager() but
in doing so, we might make the problem recursive.
2020-09-28 20:05:29 +02:00
Přemysl Eric Janouch 98c8dc5b7d
Fix tilde expansion algorithm
In principle correct, in practice completely broken.

I wrongly assumed basic_string::find() would behave like strcspn(),
and also used a nonsensical string index to check for the tilde.
2020-09-28 02:00:29 +02:00
Přemysl Eric Janouch b99f96cf6a
Fix comment: the word "no-op" needs to be split 2020-09-28 01:46:38 +02:00
Přemysl Eric Janouch 5759df156b
Support tilde expansion in the "chdir" action
The tilde may be escaped, and this first escape may be escaped
as well, so all paths should be expressable.

All will just work(TM) for those who need it, and those who start
filenames with backslashes are begging to have their foot shot.

It appears that even Shift JIS, Big5, GB 18030, and GBK are
compatible with Unix paths, meaning they don't redefine the slash
(0x2F), so I'm okay with my direct multibyte string handling in
unknown locales.

Legacy stuff smells.
2020-09-28 01:45:56 +02:00