Giter VIP home page Giter VIP logo

Comments (18)

jarun avatar jarun commented on May 26, 2024

You can't run commands in the filter prompt.
To get the commands prompt, press ]. It's there in the help page.

from nnn.

N-R-K avatar N-R-K commented on May 26, 2024

I think the issue he's describing is different. If you click on the statusbar with the mouse then pretty much all other keybindings stop working.

I was able to reproduce it on my end. But haven't yet looked into what's causing it.

from nnn.

jarun avatar jarun commented on May 26, 2024

I see. It's been ages I have used the mouse with nnn. Reopened.

from nnn.

0xACE avatar 0xACE commented on May 26, 2024

then pretty much all other keybindings stop working.

even ESC doesnt exit filter mode? iirc it happened in my build too, it was related to the filtermode thing in that case...

from nnn.

N-R-K avatar N-R-K commented on May 26, 2024

even ESC doesnt exit filter mode?

It does, but the visual doesn't update. And sometimes clicking on the statusbar doesn't even enable filter mode. And sometimes it shows filter mode being activated but it actually isn't. Something seems to be going pretty wrong somewhere.

from nnn.

fre3nando avatar fre3nando commented on May 26, 2024

By trying to reproduce the issue, I came across the following behaviour:

  1. When activating filter mode using the mouse, and then disabling it by pressing the escape key, filter mode is from then on automatically activated when changing directories.
  2. When activating filter mode using the forward-slash ('/') key, clicking on the prompt once doesn't de-activate it, rather requiring two successive clicks in order to turn filter mode off. In fact, if the escape key is pressed after clicking on the prompt once, the aforementioned problem arises again: changing directories triggers filter mode.
    So, is this what is being discussed here? Is it an entirely separate problem? Is it actually intended behaviour and I'm just dumb?

from nnn.

jarun avatar jarun commented on May 26, 2024

When activating filter mode using the mouse, and then disabling it by pressing the escape key, filter mode is from then on automatically activated when changing directories.

Do you use the program option -n?

from nnn.

jarun avatar jarun commented on May 26, 2024

As per the wiki mouse options:

Left single/double on last 2 rows	Toggle type-to-nav

from nnn.

fre3nando avatar fre3nando commented on May 26, 2024

Do you use the program option -n?

No, I don't. I didn't even know about type-to-nav. It is indeed intended behaviour and not what this issue is about. I apologize.

from nnn.

jarun avatar jarun commented on May 26, 2024

@7ocb or @azuline could any of one you have a look at this if you have the time?

from nnn.

N-R-K avatar N-R-K commented on May 26, 2024

Git bisect shows 2ac22cf to be the commit that introduced the issue. Not really sure what's going on tbh, the mouse handling code seems pretty complicated.

from nnn.

jarun avatar jarun commented on May 26, 2024

Thanks @N-R-K!
@0xACE can you please have a look?

from nnn.

jarun avatar jarun commented on May 26, 2024

@N-R-K The intended behaviour is: if type-to-nav mode is on, single or double click on the last 2 rows should disable it and vice versa.

I don't see anything mentioned about just the filter being on or off. Maybe we can toggle that also but in that case the filter should not show when disabled.

from nnn.

JohnDoeDoe avatar JohnDoeDoe commented on May 26, 2024

oh this happening to me too; commented out so much still couldn't get rid of it; now i know why, silly mouse ...

what a relief commented out clicking last 2 lines ...

from nnn.

N-R-K avatar N-R-K commented on May 26, 2024

Did a bit more debugging on this. In here, it receives another KEY_MOUSE and exits out of the filterentries() function for whatever reason:

nnn/src/nnn.c

Lines 3387 to 3389 in e76d7bb

while ((r = get_wch(ch)) != ERR) {
//DPRINTF_D(*ch);
//DPRINTF_S(keyname(*ch));

log:

ln 3363: __func__=filterentries
ln 3388: *ch=409
ln 3389: keyname(*ch)=KEY_MOUSE

@jarun can we just remove this feature? It's been broken for ~4 years and almost no one noticed - meaning no one actually uses it.

from nnn.

jarun avatar jarun commented on May 26, 2024

Actually I use it on my smartphone and the touch works there! :)
It's super-easy to toggle between filter/non-filter modes that way.

Can you please check if just single/double click works? That is - whether commenting out any of the below snippets work:

7001                         /* Toggle filter mode on left click on last 2 lines */
7002                         if (event.y >= xlines - 2 && event.bstate == BUTTON1_PRESSED) {
7003                                 clearfilter();
7004                                 cfg.filtermode ^= 1;
7005                                 if (cfg.filtermode) {
7006                                         presel = FILTER;
7007                                         goto nochange;
7008                                 }
7009 
7010                                 /* Start watching the directory */
7011                                 watch = TRUE;
7012                                 copycurname();
7013                                 cd = FALSE;
7014                                 goto begin;
7015                         }

OR

7057                         } else {
7058                                 if (cfg.filtermode || filterset())
7059                                         presel = FILTER;
7060                                 copycurname();
7061                                 goto nochange;
7062                         }

from nnn.

jarun avatar jarun commented on May 26, 2024

@N-R-K and others, can you please check if the following patch works? (Ignore the changes due to trailing spaces).

diff --git a/src/nnn.c b/src/nnn.c
index d0938b99..dc3d7cf2 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1312,14 +1312,14 @@ static char *abspath(const char *filepath, char *cwd, char *buf)
 }
 
 /* finds abspath of link pointed by filepath, taking cwd into account */
-static char *bmtarget(const char *filepath, char *cwd, char *buf) 
+static char *bmtarget(const char *filepath, char *cwd, char *buf)
 {
        char target[PATH_MAX + 1];
        ssize_t n = readlink(filepath, target, PATH_MAX);
        if (n != -1) {
                target[n] = '\0';
                return abspath(target, cwd, buf);
-       } 
+       }
        return NULL;
 }
 
@@ -3436,6 +3436,11 @@ static int filterentries(char *path, char *lastname)
                        continue;
 #ifndef NOMOUSE
                case KEY_MOUSE:
+                       MEVENT event = {0};
+                       getmouse(&event);
+                       if (event.bstate == 0)
+                               continue;
+                       ungetmouse(&event);
                        goto end;
 #endif
                case ESC:

from nnn.

jarun avatar jarun commented on May 26, 2024

Appears to be fixed for good in my tests.

@N-R-K @luukvbaal would it be possible to add a check in Makefile or PR CI to detect trailing blank spaces?

from nnn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.