Closed tbsmn closed 4 years ago
application will open with the file and have the focus
Which application? Is it cli or gui application?
Do you have NNN_OPENER
set?
Are you using the options -c
or -e
?
Thank you for that fast supply! it's with gui applications
NNN_OPENER
ist not set. Should I set it? If yes what would the opener in macOS be?
I'm using neither the -c
or the -e
option
If I use e
to edit the file, vim (command line) opens in the same terminal window (replacing nnn). When I close vim, nnn is back and all files are visible, as it should be.
Should I set it?
You don't have to. On macOS the opener is open(1)
: https://github.com/jarun/nnn#utility-dependencies
Quickstart is here: https://github.com/jarun/nnn#quickstart
Can you test with v3.0 and see if the issue exists?
Can you test with v3.0 and see if the issue exists? Yes. With v3.0 the problem is the same.
How do you start nnn
? Just nnn
?
Also would it be possible to share an asciinema or short video of what's happening?
I just switched back to v3.1 ans now i can't reproduce the error. Seems it is gone. Thank you for the help. If it reapears I wills share a video or asciinema.
Can you check if you were seeing issue #504? This is fixed in 3.1.
This is specific to the case where you use open with
option (not the regular Enter
or left).
I can manage to use open with
with an command line tool (e.g. vim).
When I try a gui-app i get no traversal
I hope this helps.
You do not have to enter the full path to the app as long it's in $PATH
. if you want to optn with mousepad, just type mousepad
and press g
(for gui).
OK I fear my $PATH is pretty messed up :-( But I managed to git it working.
Selecting a .mp4 file.
Pressing o
.
Typing mpv
pressing g
Video starts
Quit mpv
back to nnn eversything is fine
Cool! Thanks for confirming!
I would suggest you take a look at nuke
. You can open mime type in GUI apps as well. Documentation in-file.
Hello @jarun! Unfortunaly the original problem still exists for me. This time I managed to make a short screenrecording demonstrating the issue.
Do you have any ideas?
Can you please test with master? I have added a patch to fix a redraw issue.
If it's still there, please enable debugging: https://github.com/jarun/nnn/wiki/Developer-guides#debugging-nnn
I can think of 2 problems:
KEY_RESIZE
is not available for you and a redraw doesn't happenThe first one you'll need to confirm. Add some wrong code within KEY_RESIZE
handling and see if you get a compilation error. if yes, then you do have KEY_RESIZE defined.
If KEY_RESIZE is defined, share the debug log with us. We need to see which path was entered. Ensure you quit nnn
just after the issue happens with q
without entering any other key.
You may also want to enable the following debugs:
2281 //DPRINTF_D(c);
2282 //DPRINTF_S(keyname(c));
Also, start nnn
as just nnn
. No additional program options.
Adding @0xACE as well.
OK I managed it to compile in Debug-Mode. But I have my problems with the next steps. Sorry could you help me what I need to do to performe these steps?
The first one you'll need to confirm. Add some wrong code within KEY_RESIZE handling and see if you get a compilation error. if yes, then you do have KEY_RESIZE defined.
You may also want to enable the following debugs:
2281 //DPRINTF_D(c); 2282 //DPRINTF_S(keyname(c));
First try once with master. Do you see the issue? if yes, well try the next steps.
I tried with master. The issue is the same.
okk. I am sharing 2 patches:
diff --git a/src/nnn.c b/src/nnn.c
index 80f13a6..ff06402 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -758,6 +758,7 @@ static void clearinfoln(void)
}
#ifdef KEY_RESIZE
+#error
/* Clear the old prompt */
static void clearoldprompt(void)
{
Do you see a compilation error with this?
Now, remove the above patch. Try the following in debug mode:
diff --git a/src/nnn.c b/src/nnn.c
index 80f13a6..3a48cee 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2276,10 +2276,12 @@ static int nextsel(int presel)
// TODO: Do some Haiku declarations
#endif
+ DPRINTF_D(presel);
+
if (c == 0 || c == MSGWAIT) {
c = getch();
- //DPRINTF_D(c);
- //DPRINTF_S(keyname(c));
+ DPRINTF_D(c);
+ DPRINTF_S(keyname(c));
if (c == ERR && presel == MSGWAIT)
c = (cfg.filtermode || filterset()) ? FILTER : CONTROL('L');
@@ -4928,6 +4930,8 @@ static void redraw(char *path)
int i;
char *ptr = path;
+ DPRINTF_S("fast redraw");
+
// Fast redraw
if (g_states & STATE_MOVE_OP) {
g_states &= ~STATE_MOVE_OP;
@@ -5046,6 +5050,8 @@ static bool browse(char *ipath, const char *session)
const uchar opener_flags = (cfg.cliopener ? F_CLI : (F_NOTRACE | F_NOWAIT));
bool watch = FALSE;
+ DPRINTF_D(opener_flags);
+
#ifndef NOMOUSE
MEVENT event;
struct timespec mousetimings[2] = {{.tv_sec = 0, .tv_nsec = 0}, {.tv_sec = 0, .tv_nsec = 0} };
@@ -5637,6 +5643,7 @@ nochange:
switch (sel) {
case SEL_REDRAW:
+ DPRINTF_S("SEL_REDRAW");
refresh = TRUE;
break;
case SEL_RENAMEMUL:
@@ -6258,6 +6265,7 @@ nochange:
default:
r = FALSE;
if (xlines != LINES || xcols != COLS) {
+ DPRINTF_S("terminal resized");
setdirwatch(); /* Terminal resized */
r = TRUE;
} else if (idletimeout && idle == idletimeout)
And share the debug logs.
OK so i get the following error:
cc -std=c11 -Wall -Wextra -O3 -o nnn src/nnn.c -lreadline -lncurses
src/nnn.c:761:2: error:
#error
^
src/nnn.c:771:1: warning: '/*' within block comment [-Wcomment]
/* Messages show up at the bottom */
^
src/nnn.c:823:4: warning: implicit declaration of function
'clearoldprompt' is invalid in C99
[-Wimplicit-function-declaration]
clearoldprompt();
^
src/nnn.c:2497:4: warning: implicit declaration of function
'clearoldprompt' is invalid in C99
[-Wimplicit-function-declaration]
clearoldprompt();
^
src/nnn.c:2770:5: warning: implicit declaration of function
'clearoldprompt' is invalid in C99
[-Wimplicit-function-declaration]
clearoldprompt();
^
src/nnn.c:760:2: error: unterminated conditional directive
#ifdef KEY_RESIZE
^
4 warnings and 2 errors generated.
make: *** [nnn] Error 1
Now I am testing the second patch
:+1:
is your terminal a drop-down one? Why is it disappearing?
OK now I compiled nnn with the second patch and the Problem is still there. But I fear I can't find the logs i checked /tmp/nnndbg
but his does not exist. I cant find something in /usr/local/bin/
either (checked with ls -a | grep nnn
Where else should I look?
The logs may be in the same dir where you ran.
In the video, see at 00:00:08. The terminal becomes half and you can also see the cntext numbers + location bar drawn at middle of the screen.
is your terminal a drop-down one? Why is it disappearing?
What do you mean with drop down? I don't think so its an "normal" terminal. I use https://github.com/kovidgoyal/kitty
In the video, see at 00:00:08. The terminal becomes half and you can also see the cntext numbers + location bar drawn at middle of the screen.
That is my Windowmanager risizing the terminal window i guess. I use Amethyst https://github.com/ianyh/Amethyst
Amethyst
Try without it.
Even i3 does resizing but I never heard of i3 users having this problem.
when i turn the windowmanager of the problem is gone...
can't find the logs... this is the folder i compiled and ran it from
~/sandbox/nnn ls -a
. .github Makefile plugins
.. .gitignore README.md src
.README.md.swp .travis.yml misc
.circleci CHANGELOG nnn
.git LICENSE nnn.1
It has to be either /tmp/nnndbg
or ./nnndbg
.
If you are in a sandbox env your /tmp
may be different.
sandbox
its just a folder
I compiled with 0_DEBUG=1
and than did ./nnn
Did I miss something?
Run make clean
first.
I must retire now. it's late here. ~Wrt. Amethyst I see there are 94 open defects: https://github.com/amethyst/amethyst/issues~ wrong project.
Can you check if similar issue is already seen by someone else as well?
I still can't find the logs sorry. Yeah i guess it has to do with my tiling window manager Thanks for the help so far
No problem! I am closing the defect for now. I have to get similar report from i3 tiling window manager to convince myself this is an nnn
issue. In the video I see the terminal only drawn in half at least 2 times.
@0xACE please have a look when you get to this.
Correct link: https://github.com/ianyh/Amethyst/issues
@0xACE shall KEY_RESIZE be handled in nextsel()
as well? We do a getch there.
TL:DR; nextsel()
doesn't require KEY_RESIZE
as redraw()
will eventually catch it correctly. Though I recommend reading this post because it explains the use of KEY_RESIZE
.
https://github.com/jarun/nnn/blob/7dab9d0d86730f2953edb3c38187ac022b55ec96/src/nnn.c#L5181
None of my editors can figure out where this switch statement ends, I'm having trouble figuring out what this is doing... (Nvm, emacs was capable of finding it, it ends on line 6274 if you are curious)
My initial intuition from reading this thread was that we could add KEY_RESIZE
to nextsel()
because he was describing a error when he wasn't within xreadline()
, get_input()
, filterentries()
, but as I was investigating:
https://github.com/jarun/nnn/blob/7dab9d0d86730f2953edb3c38187ac022b55ec96/src/nnn.c#L2284-L2288
my stomach began grumbling of a great desire to not touch that... Scrambling for any excuse to not implement it there... I came to the conclusion:
What happens with users who don't have KEY_RESIZE
?
I mean KEY_RESIZE
is only used within xreadline()
, get_input()
, filterentries()
... I disabled KEY_RESIZE
on my local build just to try things out, lo and behold, the screen resizes every time, by exiting those functions and relying on redraw()
.
And it seems like a sideeffect of switch(nextsel())
is that redraw()
will be called if LINES
has changed.
Ergo: KEY_RESIZE
will not be required within nextsel()
To further clarify: The roles of KEY_RESIZE
is to resize the display when the user is within xreadline()
, get_input()
, filterentries()
as to not kick them out of those modes.
_To the left, is essentially the vanilla nnn
, relying on redraw()
. KEY_RESIZE
acts within certain functions to support screen resizing within those functions._
I hope you enjoyed this writing and that this clarifies issues related to KEY_RESIZE
in the future.
Thanks for the cool explanation!
What tool do you use to generate a flow like that?
What tool do you use to generate a flow like that?
I'm working on some documents atm so I'm using tikzit
https://github.com/tikzit/tikzit. It's a bit cumbersome to work with but I enjoy it. I think there are tools specifically meant for this.
Thanks for sharing!
Environment details (Put
x
in the checkbox along with the information)[x] Operating System: macOS Mojave 10.14.6 [ ] Desktop Environment: [x] Terminal Emulator: kitty, Terminal [x] Shell: bashm zsh [ ] Custom desktop opener (if applicable): [x] Issue exists on
nnn
masterExact steps to reproduce the issue