mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Middle click to visit parent dir
This commit is contained in:
parent
84dbec6f3d
commit
9dc3976533
12
README.md
12
README.md
|
@ -50,7 +50,7 @@ It runs on Linux, macOS, Raspberry Pi, BSD, Cygwin, Linux subsystem for Windows
|
||||||
- [Quickstart](#quickstart)
|
- [Quickstart](#quickstart)
|
||||||
- [Usage](#usage)
|
- [Usage](#usage)
|
||||||
- [Cmdline options](#cmdline-options)
|
- [Cmdline options](#cmdline-options)
|
||||||
- [Keyboard shortcuts](#keyboard-shortcuts)
|
- [Keyboard and mouse](#keyboard-and-mouse)
|
||||||
- [Leader key](#leader-key)
|
- [Leader key](#leader-key)
|
||||||
- [Contexts](#contexts)
|
- [Contexts](#contexts)
|
||||||
- [Context-specific color](#context-specific-color)
|
- [Context-specific color](#context-specific-color)
|
||||||
|
@ -230,7 +230,7 @@ optional args:
|
||||||
-h show help
|
-h show help
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Keyboard shortcuts
|
#### Keyboard and mouse
|
||||||
|
|
||||||
Press <kbd>?</kbd> in `nnn` to see the list anytime.
|
Press <kbd>?</kbd> in `nnn` to see the list anytime.
|
||||||
|
|
||||||
|
@ -270,7 +270,13 @@ Press <kbd>?</kbd> in `nnn` to see the list anytime.
|
||||||
|
|
||||||
Note: Help & settings, file details, media info and archive listing are shown in the PAGER. Use the PAGER-specific keys in these screens.
|
Note: Help & settings, file details, media info and archive listing are shown in the PAGER. Use the PAGER-specific keys in these screens.
|
||||||
|
|
||||||
#### Leader key
|
| Mouse click | Function |
|
||||||
|
|:---:| --- |
|
||||||
|
| Left single | Select context or entry |
|
||||||
|
| Left double | Select context or open file/directory |
|
||||||
|
| Middle single | Visit parent directory |
|
||||||
|
|
||||||
|
##### Leader key
|
||||||
|
|
||||||
The Leader key provides a powerful multi-functional navigation mechanism. It is case-sensitive and understands contexts, bookmarks and location shortcuts.
|
The Leader key provides a powerful multi-functional navigation mechanism. It is case-sensitive and understands contexts, bookmarks and location shortcuts.
|
||||||
|
|
||||||
|
|
12
src/nnn.c
12
src/nnn.c
|
@ -874,7 +874,7 @@ static bool initcurses(void)
|
||||||
nonl();
|
nonl();
|
||||||
//intrflush(stdscr, FALSE);
|
//intrflush(stdscr, FALSE);
|
||||||
keypad(stdscr, TRUE);
|
keypad(stdscr, TRUE);
|
||||||
mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED, NULL);
|
mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED | BUTTON2_CLICKED, NULL);
|
||||||
curs_set(FALSE); /* Hide cursor */
|
curs_set(FALSE); /* Hide cursor */
|
||||||
start_color();
|
start_color();
|
||||||
use_default_colors();
|
use_default_colors();
|
||||||
|
@ -3116,7 +3116,13 @@ nochange:
|
||||||
presel = 0;
|
presel = 0;
|
||||||
|
|
||||||
switch (sel) {
|
switch (sel) {
|
||||||
|
case SEL_CLICK:
|
||||||
|
if (getmouse(&event) != OK)
|
||||||
|
goto nochange; // fallthrough
|
||||||
case SEL_BACK:
|
case SEL_BACK:
|
||||||
|
// Handle right click to go to parent
|
||||||
|
if ((sel == SEL_BACK)
|
||||||
|
|| (sel == SEL_CLICK && event.bstate == BUTTON2_CLICKED)) {
|
||||||
dir = visit_parent(path, newpath, &presel);
|
dir = visit_parent(path, newpath, &presel);
|
||||||
if (!dir)
|
if (!dir)
|
||||||
goto nochange;
|
goto nochange;
|
||||||
|
@ -3131,9 +3137,7 @@ nochange:
|
||||||
|
|
||||||
setdirwatch();
|
setdirwatch();
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_CLICK:
|
}
|
||||||
if (getmouse(&event) != OK)
|
|
||||||
goto nochange;
|
|
||||||
|
|
||||||
// Handle clicking on a context at the top:
|
// Handle clicking on a context at the top:
|
||||||
if (event.y == 0) {
|
if (event.y == 0) {
|
||||||
|
|
Loading…
Reference in a new issue