commit 8f410bc65b665a32fce59d8041f7f85f7e4b0e00
parent 0d06bf56e3f6431a42b4c6889edbdee3bc532781
Author: lostd <lostd@2f30.org>
Date: Mon, 15 Sep 2014 23:01:03 +0100
Flag for the fountain visualization to move leftwards
Diffstat:
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/nausea.1 b/nausea.1
@@ -32,6 +32,8 @@ Enable color.
Enable falling peaks in the spectrum visualization.
.It Fl k
Keep state in the fountain visualization.
+.It Fl l
+Go left in the fountain visualization.
.El
.Pp
Exposed runtime options:
@@ -48,4 +50,6 @@ Toggle color.
Toggle falling peaks.
.It k
Toggle keep state.
+.It l
+Toggle direction.
.El
diff --git a/nausea.c b/nausea.c
@@ -23,6 +23,7 @@ static char *argv0;
static int colors;
static int peaks;
static int keep;
+static int left;
static int die;
struct frame {
@@ -371,7 +372,7 @@ draw_fountain(struct frame *fr)
erase();
attron(A_BOLD);
- /* current column wraps around */
+ /* ensure we are inside the frame */
col %= fr->width;
for (i = 0; i < fr->width; i++) {
@@ -397,7 +398,12 @@ draw_fountain(struct frame *fr)
setcolor(0, j);
}
}
- col++;
+
+ /* current column wraps around */
+ if (left)
+ col = (col == 0) ? fr->width - 1 : col - 1;
+ else
+ col = (col == fr->width - 1) ? 0 : col + 1;
attroff(A_BOLD);
refresh();
@@ -460,6 +466,9 @@ main(int argc, char *argv[])
case 'k':
keep = 1;
break;
+ case 'l':
+ left = 1;
+ break;
case 'h':
/* fall-through */
default:
@@ -507,6 +516,9 @@ main(int argc, char *argv[])
case 'k':
keep = !keep;
break;
+ case 'l':
+ left = !left;
+ break;
case '1':
draw = draw_spectrum;
break;