diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-05-18 10:55:17 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-05-22 08:48:44 +0530 |
commit | 9dc3976533fd468557df4d375b2c3b3530fff695 (patch) | |
tree | a61a0a7d2fbc99fa85b5c30c7696af55d921c2cd /src/nnn.c | |
parent | 84dbec6f3d2e5c903613892f8aa29350ff05ccbb (diff) | |
download | nnn-9dc3976533fd468557df4d375b2c3b3530fff695.tar.gz |
Middle click to visit parent dir
Diffstat (limited to 'src/nnn.c')
-rw-r--r-- | src/nnn.c | 32 |
1 files changed, 18 insertions, 14 deletions
@@ -874,7 +874,7 @@ static bool initcurses(void) nonl(); //intrflush(stdscr, FALSE); keypad(stdscr, TRUE); - mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED, NULL); + mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED | BUTTON2_CLICKED, NULL); curs_set(FALSE); /* Hide cursor */ start_color(); use_default_colors(); @@ -3116,24 +3116,28 @@ nochange: presel = 0; switch (sel) { + case SEL_CLICK: + if (getmouse(&event) != OK) + goto nochange; // fallthrough case SEL_BACK: - dir = visit_parent(path, newpath, &presel); - if (!dir) - goto nochange; + // Handle right click to go to parent + if ((sel == SEL_BACK) + || (sel == SEL_CLICK && event.bstate == BUTTON2_CLICKED)) { + dir = visit_parent(path, newpath, &presel); + if (!dir) + goto nochange; - /* Save last working directory */ - xstrlcpy(lastdir, path, PATH_MAX); + /* Save last working directory */ + xstrlcpy(lastdir, path, PATH_MAX); - /* Save history */ - xstrlcpy(lastname, xbasename(path), NAME_MAX + 1); + /* Save history */ + xstrlcpy(lastname, xbasename(path), NAME_MAX + 1); - xstrlcpy(path, dir, PATH_MAX); + xstrlcpy(path, dir, PATH_MAX); - setdirwatch(); - goto begin; - case SEL_CLICK: - if (getmouse(&event) != OK) - goto nochange; + setdirwatch(); + goto begin; + } // Handle clicking on a context at the top: if (event.y == 0) { |