Compare commits
No commits in common. "e60ffeeb206b177211249e26e2cb113e4e302d79" and "98c8dc5b7d43892cfb0d5d4c1ec5eca0ed7ffd49" have entirely different histories.
e60ffeeb20
...
98c8dc5b7d
22
README.adoc
22
README.adoc
@ -89,10 +89,10 @@ bind -x '"\201": sdn-restore'
|
||||
bind '"\eo":"\200\C-m\201"'
|
||||
....
|
||||
|
||||
Colours
|
||||
-------
|
||||
Colors
|
||||
------
|
||||
Here is an example of a '~/.config/sdn/look' file; the format is similar to
|
||||
that of git, only named colours aren't supported:
|
||||
that of git, only named colors aren't supported:
|
||||
|
||||
....
|
||||
cursor 231 202
|
||||
@ -101,7 +101,7 @@ cwd bold
|
||||
input
|
||||
....
|
||||
|
||||
Filename colours are taken from the `LS_COLORS` environment variable.
|
||||
Filename colors are taken from the `LS_COLORS` environment variable.
|
||||
Run `dircolors` to get some defaults.
|
||||
|
||||
Bindings
|
||||
@ -115,20 +115,6 @@ normal l choose
|
||||
normal ? help
|
||||
....
|
||||
|
||||
Helper programs
|
||||
---------------
|
||||
The F3 and F4 keys are normally bound to actions 'view' and 'edit', similarly to
|
||||
Norton Commander and other orthodox file managers. The helper programs used
|
||||
here may be changed by setting the PAGER and VISUAL (or EDITOR) environment
|
||||
variables.
|
||||
|
||||
While it is mostly possible to get 'mcview' working using an invocation like
|
||||
`PAGER='mcview -u' sdn`, beware that this helper cannot read files from its
|
||||
standard input, nor does it enable overstrike processing by default (F9, could
|
||||
be hacked around in 'mc.ext' by turning on the `nroff` switch for a custom file
|
||||
extension, just without actually invoking 'nroff'), and thus it can't show the
|
||||
program help. 'sdn' is currently optimised for 'less' as the pager.
|
||||
|
||||
Similar software
|
||||
----------------
|
||||
* https://elvish.io/ is an entire shell with an integrated ranger-like file
|
||||
|
15
sdn.cpp
15
sdn.cpp
@ -243,8 +243,7 @@ fun capitalize (const string &s) -> string {
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Underlining for teletypes (also called overstriking),
|
||||
/// also imitated in more(1) and less(1)
|
||||
/// Underlining for teletypes, also imitated in more(1) and less(1)
|
||||
fun underline (const string& s) -> string {
|
||||
string result;
|
||||
for (auto c : s)
|
||||
@ -866,12 +865,6 @@ fun run_program (initializer_list<const char*> list, const string &filename) {
|
||||
if (WSTOPSIG (status) == SIGTSTP)
|
||||
kill (child, SIGCONT);
|
||||
tcsetpgrp (STDOUT_FILENO, getpgid (0));
|
||||
|
||||
if (WIFEXITED (status) && WEXITSTATUS (status)) {
|
||||
printf ("Helper returned non-zero exit status %d. "
|
||||
"Press Enter to continue.\n", WEXITSTATUS (status));
|
||||
string dummy; getline (cin, dummy);
|
||||
}
|
||||
}
|
||||
|
||||
refresh ();
|
||||
@ -879,9 +872,7 @@ fun run_program (initializer_list<const char*> list, const string &filename) {
|
||||
}
|
||||
|
||||
fun view (const string &filename) {
|
||||
// XXX: we cannot realistically detect that the pager hasn't made a pause
|
||||
// at the end of the file, so we can't ensure all contents have been seen
|
||||
run_program ({(const char *) getenv ("PAGER"), "less", "cat"}, filename);
|
||||
run_program ({(const char *) getenv ("PAGER"), "pager", "cat"}, filename);
|
||||
}
|
||||
|
||||
fun edit (const string &filename) {
|
||||
@ -905,7 +896,7 @@ fun run_pager (FILE *contents) {
|
||||
dup2 (fileno (contents), STDIN_FILENO);
|
||||
|
||||
// Behaviour copies man-db's man(1), similar to POSIX man(1)
|
||||
for (auto pager : {(const char *) getenv ("PAGER"), "less", "cat"})
|
||||
for (auto pager : {(const char *) getenv ("PAGER"), "pager", "cat"})
|
||||
if (pager) execl ("/bin/sh", "/bin/sh", "-c", pager, NULL);
|
||||
_exit (EXIT_FAILURE);
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user