mirror of
https://github.com/jarun/nnn.git
synced 2024-11-17 16:39:14 +00:00
make var O_FILEINFO to show file info on hover
This commit is contained in:
parent
c611720cba
commit
3490a959be
5
Makefile
5
Makefile
|
@ -27,6 +27,7 @@ O_NOSSN := 0 # disable session support
|
|||
O_NOUG := 0 # disable user, group name in status bar
|
||||
O_NOX11 := 0 # disable X11 integration
|
||||
O_MATCHFLTR := 0 # allow filters without matches
|
||||
O_FILEINFO := 0 # show file informaiton in info line
|
||||
|
||||
# User patches
|
||||
O_GITSTATUS := 0 # add git status to detail view
|
||||
|
@ -121,6 +122,10 @@ ifeq ($(strip $(O_MATCHFLTR)),1)
|
|||
CPPFLAGS += -DMATCHFLTR
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(O_FILEINFO)),1)
|
||||
CPPFLAGS += -DFILEINFO
|
||||
endif
|
||||
|
||||
ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
|
||||
CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
|
||||
LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs ncursesw)
|
||||
|
|
15
src/nnn.c
15
src/nnn.c
|
@ -847,6 +847,7 @@ static void move_cursor(int target, int ignore_scrolloff);
|
|||
static char *load_input(int fd, const char *path);
|
||||
static int set_sort_flags(int r);
|
||||
static void statusbar(char *path);
|
||||
static bool get_output(char *file, char *arg1, char *arg2, int fdout, bool multi, bool page);
|
||||
#ifndef NOFIFO
|
||||
static void notify_fifo(bool force);
|
||||
#endif
|
||||
|
@ -3156,6 +3157,10 @@ static void showfilterinfo(void)
|
|||
((fnstrstr == &strcasestr) ? "ic" : "noic"));
|
||||
|
||||
clearinfoln();
|
||||
#ifdef FILEINFO
|
||||
if (ndents && get_output("file", "-b", pdents[cur].name, -1, FALSE, FALSE))
|
||||
mvaddstr(xlines - 2, 2, g_buf);
|
||||
#endif
|
||||
mvaddstr(xlines - 2, xcols - xstrlen(info), info);
|
||||
}
|
||||
|
||||
|
@ -6167,9 +6172,15 @@ static void statusbar(char *path)
|
|||
} else
|
||||
ptr = "\b";
|
||||
|
||||
tolastln();
|
||||
attron(COLOR_PAIR(cfg.curctx + 1));
|
||||
|
||||
#ifdef FILEINFO
|
||||
if (get_output("file", "-b", pdents[cur].name, -1, FALSE, FALSE))
|
||||
mvaddstr(xlines - 2, 2, g_buf);
|
||||
#endif
|
||||
|
||||
tolastln();
|
||||
|
||||
printw("%d/%s ", cur + 1, xitoa(ndents));
|
||||
|
||||
if (g_state.selmode || nselected) {
|
||||
|
@ -6215,6 +6226,7 @@ static void statusbar(char *path)
|
|||
}
|
||||
#endif
|
||||
if (S_ISLNK(pent->mode)) {
|
||||
#ifndef FILEINFO
|
||||
i = readlink(pent->name, g_buf, PATH_MAX);
|
||||
addstr(coolsize(i >= 0 ? i : pent->size)); /* Show symlink size */
|
||||
if (i > 1) { /* Show symlink target */
|
||||
|
@ -6226,6 +6238,7 @@ static void statusbar(char *path)
|
|||
g_buf[i] = '\0';
|
||||
addstr(g_buf);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
addstr(coolsize(pent->size));
|
||||
addch(' ');
|
||||
|
|
Loading…
Reference in a new issue