diff options
author | lostd <lostd@2f30.org> | 2014-10-22 17:54:13 +0300 |
---|---|---|
committer | lostd <lostd@2f30.org> | 2014-10-22 17:54:13 +0300 |
commit | 5335be58322644e16f6478539b4f5846a1f80ac8 (patch) | |
tree | b23a0b68b7dd820092d2ba6d6f0f36b84d0b495a /noice.c | |
parent | b2970c9516662f62d59ad6ca21f9809b5d1105a2 (diff) | |
download | noice-5335be58322644e16f6478539b4f5846a1f80ac8.tar.gz |
Functions for setting and clearing the prompt
Diffstat (limited to 'noice.c')
-rw-r--r-- | noice.c | 27 |
1 files changed, 19 insertions, 8 deletions
@@ -255,6 +255,21 @@ printerr(int ret, char *prefix) exit(ret); } +/* Clear the last line */ +void +clearprompt(void) +{ + printmsg(""); +} + +/* Print prompt on the last line */ +void +printprompt(char *str) +{ + clearprompt(); + printw(str); +} + /* * Returns 0 normally * On movement it updates *cur @@ -627,12 +642,10 @@ nochange: goto nochange; case SEL_FLTR: /* Read filter */ - printmsg(""); - move(LINES - 1, 0); - printw("filter: "); + printprompt("filter: "); tmp = readln(); if (tmp == NULL) { - printmsg(""); + clearprompt(); goto nochange; } r = setfilter(&re, tmp); @@ -653,12 +666,10 @@ nochange: break; case SEL_CD: /* Read target dir */ - printmsg(""); - move(LINES - 1, 0); - printw("chdir: "); + printprompt("chdir: "); tmp = readln(); if (tmp == NULL) { - printmsg(""); + clearprompt(); goto nochange; } if (testopendir(tmp) == 0) { |