diff options
| author | 2019-01-03 23:43:04 +0530 | |
|---|---|---|
| committer | 2019-01-03 23:43:35 +0530 | |
| commit | 3cbb7dc5dfcbd79b672859959f3e6c6f264df0ec (patch) | |
| tree | 7aff023519073c8e7a37295c9c0fafba74867df9 /src | |
| parent | 5675edebc709c2b3f5f7cabd5c66810997551e28 (diff) | |
| download | nnn-3cbb7dc5dfcbd79b672859959f3e6c6f264df0ec.tar.gz | |
nnn as a file picker
Diffstat (limited to 'src')
| -rw-r--r-- | src/nnn.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -780,13 +780,18 @@ static bool showcplist() /* Initialize curses mode */ static bool initcurses(void) { - if (initscr() == NULL) { + if (cfg.picker) { + if (!newterm(NULL, stderr, stdin)) { + fprintf(stderr, "newterm!\n"); + return FALSE; + } + } else if (!initscr()) { char *term = getenv("TERM"); if (term != NULL) fprintf(stderr, "error opening TERM: %s\n", term); else - fprintf(stderr, "initscr() failed\n"); + fprintf(stderr, "initscr!\n"); return FALSE; } @@ -3592,8 +3597,8 @@ int main(int argc, char *argv[]) } /* Confirm we are in a terminal */ - if (!isatty(0) || !isatty(1)) { - fprintf(stderr, "stdin or stdout is not a tty\n"); + if (!cfg.picker && !(isatty(0) && isatty(1))) { + fprintf(stderr, "stdin/stdout !tty\n"); return 1; } |