Commit Graph

138 Commits

Author SHA1 Message Date
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
Přemysl Eric Janouch 91df92f49a
Make F3 change directories
Best complemented with a less(1) configuration that also quits on F3,
just like mcview.  Or invoke sdn with PAGER=mcview, even though you
lose the ability to view the help that way (but gain filters).
2020-09-27 23:33:10 +02:00
Přemysl Eric Janouch bff886841b
Always accept ^? as well as ^H as backspace 2020-09-21 21:15:15 +02:00
Přemysl Eric Janouch 98da5f6d35
Add an action to go to the parent directory 2020-09-15 19:15:30 +02:00
Přemysl Eric Janouch b8344f215c
Name change 2020-08-28 18:23:46 +02:00
Přemysl Eric Janouch 623c4914d1
Work around an infinite loop issue 2020-04-19 22:40:57 +02:00
Přemysl Eric Janouch 571ec74706
Guard against ^Z in helper programs
Resume them immediately, we are not a shell.
2019-12-09 19:01:16 +01:00
Přemysl Eric Janouch 7cce0cc2fd
Fix change notifications
Another embarrassing 71fbaca regression.
2019-09-27 23:06:12 +02:00
Přemysl Eric Janouch bf38e4e9ea
Position indicator like in vi 2019-09-27 22:38:48 +02:00
Přemysl Eric Janouch 2c847fb4a3
Add actions imitating L/M/H in vi 2019-09-27 21:08:12 +02:00
Přemysl Eric Janouch 296c0cc66f
Fixes for previous commits
".." used to be hidden together with hidden files,
and the symlink patch introduced a compiler warning.
2018-12-09 05:29:59 +01:00
Přemysl Eric Janouch 71fbaca9e5
Embrace paths with symbolic links 2018-12-08 01:41:41 +01:00
Přemysl Eric Janouch 4ce6454ebb
Add Norton Commander-like actions for F3 and F4 2018-12-03 22:05:00 +01:00
Přemysl Eric Janouch 315b662581
Don't show .. in the root directory 2018-12-03 22:04:35 +01:00
Přemysl Eric Janouch 4a2a49312b
Fix formatting 2018-12-03 00:11:00 +01:00
Přemysl Eric Janouch 7174b507d3
Fix crash on unknown groups 2018-12-01 15:57:35 +01:00
Přemysl Eric Janouch aae9c392fa
Also sort symlinks to directories first 2018-11-10 01:32:59 +01:00
Přemysl Eric Janouch fad0d264a5
Support old libstdc++ 4.9
Now sdn can be built under Debian jessie with clang++ and libstdc++.
2018-11-04 19:46:06 +01:00
Přemysl Eric Janouch 85ada4dd2b
Fix build on not-my-system 2018-11-03 15:23:31 +01:00
Přemysl Eric Janouch c065238e75
Reliability improvement 2018-11-03 15:01:19 +01:00
Přemysl Eric Janouch 579e4c9a34
Make confirming a search choose the item 2018-11-02 22:12:34 +01:00
Přemysl Eric Janouch 081b4db5c3
Fix level popping 2018-11-02 20:22:50 +01:00
Přemysl Eric Janouch 36454fb90c
Fix history loading 2018-11-02 18:30:36 +01:00
Přemysl Eric Janouch 6b1ff048b8
Flash column when sorting is changed 2018-11-02 18:30:35 +01:00
Přemysl Eric Janouch 3790f8dfa0
Allow changing the sort column
Directories always come first and the .. entry even before that.
2018-11-02 18:07:06 +01:00
Přemysl Eric Janouch 5c086016b5
Allow hiding so-called hidden files 2018-11-02 17:45:18 +01:00
Přemysl Eric Janouch 232ecffa2d
Allow reversing the sort 2018-11-02 17:25:10 +01:00
Přemysl Eric Janouch f3fffe4b25
Add an action to quit without chdir
Also fixed ACTION_CHOOSE_FULL to quote properly.
2018-11-02 15:50:58 +01:00
Přemysl Eric Janouch 5f2eaa88e0
Create the config directory if needed 2018-11-02 15:37:56 +01:00
Přemysl Eric Janouch d6846e6327
Add an action for chdir 2018-11-02 15:09:27 +01:00
Přemysl Eric Janouch 314ba114a1
Implement messages to the user 2018-11-02 15:05:04 +01:00
Přemysl Eric Janouch 4de89faf7e
Store runtime and configuration to a file
Added a toggle for gravity, now turned off by default.
2018-11-02 14:48:16 +01:00
Přemysl Eric Janouch beee2e2683
Unnecessary c_str() 2018-11-02 12:35:03 +01:00
Přemysl Eric Janouch 4ab0db3c04
Make sure to quote empty strings 2018-11-02 12:08:43 +01:00
Přemysl Eric Janouch 3624636c2f
New config parser
Basically a subset of Bourne shell.
2018-11-01 22:42:49 +01:00
Přemysl Eric Janouch e80c56e249
Cleanup 2018-11-01 22:19:31 +01:00
Přemysl Eric Janouch 2c595100ae
Fix setcchar invocation 2018-11-01 20:05:06 +01:00
Přemysl Eric Janouch e4af5b4147
Remember cursor position in ancestor directories 2018-11-01 19:40:05 +01:00
Přemysl Eric Janouch c9bffc6046
Fix uninitialized iterator 2018-11-01 19:29:43 +01:00
Přemysl Eric Janouch 292829852e
Implement simple in-application help
It could be made more complicated but I guess it's fine for now.

We've learnt to run pagers.
2018-11-01 16:03:17 +01:00
Přemysl Eric Janouch db051698e6
Use words for prompts, not cryptic characters 2018-11-01 12:33:47 +01:00
Přemysl Eric Janouch 51ed172d5d
Only quote output when necessary 2018-10-27 21:26:11 +02:00
Přemysl Eric Janouch ffa5754b59
Cleanup 2018-10-26 07:51:44 +02:00
Přemysl Eric Janouch 6f66aa3c06
Configurable key bindings 2018-10-25 23:05:34 +02:00
Přemysl Eric Janouch 86b520006c
Look up bindings through a map 2018-10-25 23:05:34 +02:00
Přemysl Eric Janouch 2484c94b39
Fix key binding collisions
Still not fixed in handle_editor() though.
2018-10-25 23:05:33 +02:00
Přemysl Eric Janouch 6e34f480a9
Finish copying the GNU ls coloring algorithm 2018-10-25 23:05:33 +02:00
Přemysl Eric Janouch 1ba2709fda
Align modification time right
To reflect GNU ls.
2018-10-25 14:58:53 +02:00
Přemysl Eric Janouch 3e40137f7a
Handle stat() errors, slight refactor
Symlink target information is now stored in entries.
2018-10-25 14:58:53 +02:00
Přemysl Eric Janouch 6aa1e5d8a5
Show symlink targets
Rudimentary, needs a refactor.
2018-10-24 13:07:14 +02:00
Přemysl Eric Janouch 6e879c9db9
Defer keypad() invocation 2018-10-24 10:23:37 +02:00
Přemysl Eric Janouch 45f79abf9c
Load users, groups and current time once per refresh
Avoids plenty of costly syscalls per loaded entry.
2018-10-24 10:23:26 +02:00
Přemysl Eric Janouch 1b74b1976a
Update copyright years 2018-10-24 07:45:23 +02:00
Přemysl Eric Janouch 638d570cbd
Add & and ~ chdir shortcuts
& goes to the starting directory, ~ goes home.
2018-10-24 05:16:22 +02:00
Přemysl Eric Janouch ae310d1380
Use Doxygen field comments 2018-10-24 05:05:26 +02:00
Přemysl Eric Janouch edf94db8df
Limit inotify to visible events 2018-10-24 04:51:16 +02:00
Přemysl Eric Janouch 4b4277b306
Make sure to fill the view when possible
When there were more items than would fit on the screen and the cursor
was at the end of the list, a reload causing items to disappear or
a vertical terminal enlargement would fail to adjust the start offset.
2018-06-22 19:51:05 +02:00
Přemysl Eric Janouch 1c47cf7908
Relicense to 0BSD, update mail address
I've come to the conclusion that copyright mostly just stands in the way
of software development.  In my jurisdiction I cannot give up my own
copyright and 0BSD seems to be the closest thing to public domain.

The updated mail address, also used in my author/committer lines,
is shorter and looks nicer.  People rarely interact anyway.
2018-06-22 19:50:56 +02:00
Přemysl Eric Janouch 5bc64e25ae
Fix build on not-my-setup 2017-07-17 23:11:13 +02:00
Přemysl Eric Janouch 0cf63744a7
Factor out ls_format(), comments 2017-07-15 22:18:45 +02:00
Přemysl Eric Janouch 53ab5290e0
Fix POSIX ACLs detection on symlinks 2017-07-15 14:01:26 +02:00
Přemysl Eric Janouch a66e5ab457
Initial LS_COLORS support 2017-07-15 02:57:58 +02:00
Přemysl Eric Janouch fb73fc8292
Mark files that make use of POSIX ACLs 2017-07-14 21:49:32 +02:00
Přemysl Eric Janouch 8c658475b4
Factor out choose() 2017-06-30 23:33:52 +02:00
Přemysl Eric Janouch 571447298a
Switch output mode also on 't' 2017-06-30 21:52:43 +02:00
Přemysl Eric Janouch 596b490992
Fix inotify display 2017-06-30 21:34:11 +02:00
Přemysl Eric Janouch 4a9662b00a
Configurable colors 2017-06-30 21:29:10 +02:00
Přemysl Eric Janouch c90fa0a060
Properly align all columns 2017-06-30 08:25:47 +02:00
Přemysl Eric Janouch be77f6fa46
Use SI units, slight refactor 2017-06-30 07:37:03 +02:00
Přemysl Eric Janouch 182ba280dd
Refactor output, handle controls 2017-06-30 07:01:45 +02:00
Přemysl Eric Janouch 82764010f9
Some refactoring 2017-06-30 02:06:22 +02:00
Přemysl Eric Janouch 5d9246a38a
Show more file information
Yet to be properly aligned.
2017-06-30 01:39:49 +02:00
Přemysl Eric Janouch c8498c9165
Move contents to the bottom of the screen
Maybe this should have a switch.
2017-06-29 21:13:51 +02:00
Přemysl Eric Janouch a55fc17f31
Initial commit 2017-06-29 04:32:37 +02:00