mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Remove repetitive code
This commit is contained in:
parent
0b07b77e85
commit
7cbc79a5fc
26
src/nnn.c
26
src/nnn.c
|
@ -2979,6 +2979,13 @@ static int handle_alt_key(wint_t *wch)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int handle_event(void)
|
||||||
|
{
|
||||||
|
if (nselected && isselfileempty())
|
||||||
|
clearselection();
|
||||||
|
return CONTROL('L');
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns SEL_* if key is bound and 0 otherwise.
|
* Returns SEL_* if key is bound and 0 otherwise.
|
||||||
* Also modifies the run and env pointers (used on SEL_{RUN,RUNARG}).
|
* Also modifies the run and env pointers (used on SEL_{RUN,RUNARG}).
|
||||||
|
@ -3063,10 +3070,7 @@ try_quit:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (event->mask & INOTIFY_MASK) {
|
if (event->mask & INOTIFY_MASK) {
|
||||||
c = CONTROL('L');
|
c = handle_event();
|
||||||
if (nselected && isselfileempty())
|
|
||||||
clearselection();
|
|
||||||
DPRINTF_S("issue refresh");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3079,18 +3083,12 @@ try_quit:
|
||||||
|
|
||||||
memset((void *)event_data, 0x0, sizeof(struct kevent) * NUM_EVENT_SLOTS);
|
memset((void *)event_data, 0x0, sizeof(struct kevent) * NUM_EVENT_SLOTS);
|
||||||
if (kevent(kq, events_to_monitor, NUM_EVENT_SLOTS,
|
if (kevent(kq, events_to_monitor, NUM_EVENT_SLOTS,
|
||||||
event_data, NUM_EVENT_FDS, >imeout) > 0) {
|
event_data, NUM_EVENT_FDS, >imeout) > 0)
|
||||||
c = CONTROL('L');
|
c = handle_event();
|
||||||
if (nselected && isselfileempty())
|
|
||||||
clearselection();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#elif defined(HAIKU_NM)
|
#elif defined(HAIKU_NM)
|
||||||
if (!cfg.blkorder && haiku_nm_active && (idle & 1) && haiku_is_update_needed(haiku_hnd)) {
|
if (!cfg.blkorder && haiku_nm_active && (idle & 1) && haiku_is_update_needed(haiku_hnd))
|
||||||
c = CONTROL('L');
|
c = handle_event();
|
||||||
if (nselected && isselfileempty())
|
|
||||||
clearselection();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
idle = 0;
|
idle = 0;
|
||||||
|
|
Loading…
Reference in a new issue