mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Feature #534: Support hardware cursor sync
This commit is contained in:
parent
2d5952fef7
commit
1f22da2994
|
@ -16,6 +16,7 @@ _nnn ()
|
||||||
-A
|
-A
|
||||||
-b
|
-b
|
||||||
-c
|
-c
|
||||||
|
-C
|
||||||
-d
|
-d
|
||||||
-e
|
-e
|
||||||
-E
|
-E
|
||||||
|
|
|
@ -15,6 +15,7 @@ complete -c nnn -s a -d 'auto-create NNN_FIFO'
|
||||||
complete -c nnn -s A -d 'disable dir auto-select'
|
complete -c nnn -s A -d 'disable dir auto-select'
|
||||||
complete -c nnn -s b -r -d 'bookmark key to open' -x -a '(echo $NNN_BMS | awk -F: -v RS=\; \'{print $1"\t"$2}\')'
|
complete -c nnn -s b -r -d 'bookmark key to open' -x -a '(echo $NNN_BMS | awk -F: -v RS=\; \'{print $1"\t"$2}\')'
|
||||||
complete -c nnn -s c -d 'cli-only opener'
|
complete -c nnn -s c -d 'cli-only opener'
|
||||||
|
complete -c nnn -s C -d 'hardware cursor mode'
|
||||||
complete -c nnn -s d -d 'start in detail mode'
|
complete -c nnn -s d -d 'start in detail mode'
|
||||||
complete -c nnn -s e -d 'open text files in $VISUAL/$EDITOR/vi'
|
complete -c nnn -s e -d 'open text files in $VISUAL/$EDITOR/vi'
|
||||||
complete -c nnn -s E -d 'use EDITOR for undetached edits'
|
complete -c nnn -s E -d 'use EDITOR for undetached edits'
|
||||||
|
|
|
@ -13,6 +13,7 @@ args=(
|
||||||
'(-A)-A[disable dir auto-select]'
|
'(-A)-A[disable dir auto-select]'
|
||||||
'(-b)-b[bookmark key to open]:key char'
|
'(-b)-b[bookmark key to open]:key char'
|
||||||
'(-c)-c[cli-only opener]'
|
'(-c)-c[cli-only opener]'
|
||||||
|
'(-C)-C[hardware cursor mode]'
|
||||||
'(-d)-d[start in detail mode]'
|
'(-d)-d[start in detail mode]'
|
||||||
'(-e)-e[open text files in $VISUAL/$EDITOR/vi]'
|
'(-e)-e[open text files in $VISUAL/$EDITOR/vi]'
|
||||||
'(-E)-E[use EDITOR for undetached edits]'
|
'(-E)-E[use EDITOR for undetached edits]'
|
||||||
|
|
4
nnn.1
4
nnn.1
|
@ -10,6 +10,7 @@
|
||||||
.Op Ar -A
|
.Op Ar -A
|
||||||
.Op Ar -b key
|
.Op Ar -b key
|
||||||
.Op Ar -c
|
.Op Ar -c
|
||||||
|
.Op Ar -C
|
||||||
.Op Ar -d
|
.Op Ar -d
|
||||||
.Op Ar -e
|
.Op Ar -e
|
||||||
.Op Ar -E
|
.Op Ar -E
|
||||||
|
@ -68,6 +69,9 @@ supports the following options:
|
||||||
.Fl c
|
.Fl c
|
||||||
indicates that the opener is a cli-only opener (overrides -e)
|
indicates that the opener is a cli-only opener (overrides -e)
|
||||||
.Pp
|
.Pp
|
||||||
|
.Fl C
|
||||||
|
place hardware cursor on hovered entry
|
||||||
|
.Pp
|
||||||
.Fl d
|
.Fl d
|
||||||
detail mode
|
detail mode
|
||||||
.Pp
|
.Pp
|
||||||
|
|
18
src/nnn.c
18
src/nnn.c
|
@ -266,9 +266,9 @@ typedef struct {
|
||||||
uint reserved2 : 2;
|
uint reserved2 : 2;
|
||||||
uint nonavopen : 1; /* Open file on right arrow or `l` */
|
uint nonavopen : 1; /* Open file on right arrow or `l` */
|
||||||
uint autoselect : 1; /* Auto-select dir in type-to-nav mode */
|
uint autoselect : 1; /* Auto-select dir in type-to-nav mode */
|
||||||
uint reserved3 : 1;
|
uint cursormode : 1; /* Move hardware cursor with selection */
|
||||||
uint useeditor : 1; /* Use VISUAL to open text files */
|
uint useeditor : 1; /* Use VISUAL to open text files */
|
||||||
uint reserved4 : 3;
|
uint reserved3 : 3;
|
||||||
uint regex : 1; /* Use regex filters */
|
uint regex : 1; /* Use regex filters */
|
||||||
uint x11 : 1; /* Copy to system clipboard and show notis */
|
uint x11 : 1; /* Copy to system clipboard and show notis */
|
||||||
uint timetype : 2; /* Time sort type (0: access, 1: change, 2: modification) */
|
uint timetype : 2; /* Time sort type (0: access, 1: change, 2: modification) */
|
||||||
|
@ -337,9 +337,9 @@ static settings cfg = {
|
||||||
0, /* reserved2 */
|
0, /* reserved2 */
|
||||||
0, /* nonavopen */
|
0, /* nonavopen */
|
||||||
1, /* autoselect */
|
1, /* autoselect */
|
||||||
0, /* reserved3 */
|
0, /* cursormode */
|
||||||
0, /* useeditor */
|
0, /* useeditor */
|
||||||
0, /* reserved4 */
|
0, /* reserved3 */
|
||||||
0, /* regex */
|
0, /* regex */
|
||||||
0, /* x11 */
|
0, /* x11 */
|
||||||
2, /* timetype (T_MOD) */
|
2, /* timetype (T_MOD) */
|
||||||
|
@ -681,6 +681,7 @@ static haiku_nm_h haiku_hnd;
|
||||||
|
|
||||||
/* Function macros */
|
/* Function macros */
|
||||||
#define tolastln() move(xlines - 1, 0)
|
#define tolastln() move(xlines - 1, 0)
|
||||||
|
#define tocursor() move(cur + 2, 0)
|
||||||
#define exitcurses() endwin()
|
#define exitcurses() endwin()
|
||||||
#define printwarn(presel) printwait(strerror(errno), presel)
|
#define printwarn(presel) printwait(strerror(errno), presel)
|
||||||
#define istopdir(path) ((path)[1] == '\0' && (path)[0] == '/')
|
#define istopdir(path) ((path)[1] == '\0' && (path)[0] == '/')
|
||||||
|
@ -5133,6 +5134,9 @@ static void statusbar(char *path)
|
||||||
}
|
}
|
||||||
|
|
||||||
attroff(COLOR_PAIR(cfg.curctx + 1));
|
attroff(COLOR_PAIR(cfg.curctx + 1));
|
||||||
|
|
||||||
|
if (cfg.cursormode)
|
||||||
|
tocursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int adjust_cols(int ncols)
|
static int adjust_cols(int ncols)
|
||||||
|
@ -6821,6 +6825,7 @@ static void usage(void)
|
||||||
" -A no dir auto-select\n"
|
" -A no dir auto-select\n"
|
||||||
" -b key open bookmark key (trumps -s/S)\n"
|
" -b key open bookmark key (trumps -s/S)\n"
|
||||||
" -c cli-only NNN_OPENER (trumps -e)\n"
|
" -c cli-only NNN_OPENER (trumps -e)\n"
|
||||||
|
" -C place HW cursor on hovered\n"
|
||||||
" -d detail mode\n"
|
" -d detail mode\n"
|
||||||
" -e text in $VISUAL/$EDITOR/vi\n"
|
" -e text in $VISUAL/$EDITOR/vi\n"
|
||||||
" -E use EDITOR for undetached edits\n"
|
" -E use EDITOR for undetached edits\n"
|
||||||
|
@ -6992,7 +6997,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
while ((opt = (env_opts_id > 0
|
while ((opt = (env_opts_id > 0
|
||||||
? env_opts[--env_opts_id]
|
? env_opts[--env_opts_id]
|
||||||
: getopt(argc, argv, "aAb:cdeEfFgHKl:nop:P:QrRs:St:T:Vxh"))) != -1) {
|
: getopt(argc, argv, "aAb:cCdeEfFgHKl:nop:P:QrRs:St:T:Vxh"))) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
#ifndef NOFIFO
|
#ifndef NOFIFO
|
||||||
case 'a':
|
case 'a':
|
||||||
|
@ -7031,6 +7036,9 @@ int main(int argc, char *argv[])
|
||||||
cfg.regex = 1;
|
cfg.regex = 1;
|
||||||
filterfn = &visible_re;
|
filterfn = &visible_re;
|
||||||
break;
|
break;
|
||||||
|
case 'C':
|
||||||
|
cfg.cursormode = 1;
|
||||||
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
cfg.showhidden = 1;
|
cfg.showhidden = 1;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue