ref: 3528b912b5bca3c5aa51a6ca165c5e8d4e6c5b77
parent: d611433ee7c438656bcdeff68eebecf5b645c031
author: qwx <qwx@sciops.net>
date: Sun Aug 25 20:17:29 EDT 2024
set from/to positions independently of current pos modally
--- a/cmd.c
+++ b/cmd.c
@@ -5,6 +5,7 @@
#include "fns.h"
Dot dot;
+int bound;
static int epfd[2];
@@ -292,7 +293,8 @@
{
usize m;
- assert(d->cur >= d->from && d->cur <= d->to);
+ if(d->cur < d->from || d->cur >= d->to)
+ d->cur = d->from;
while(n > 0){
m = d->to - d->cur > n ? n : d->to - d->cur;
n -= m;
--- a/dat.h
+++ b/dat.h
@@ -29,6 +29,7 @@
Chunk *norris;
};
extern Dot dot;
+extern int bound;
extern QLock lsync;
--- a/draw.c
+++ b/draw.c
@@ -436,8 +436,11 @@
{
from &= ~3;
to &= ~3;
+ if(from >= to)
+ return;
dot.from = from;
dot.to = to;
+ /* advance may desync and reset it again */
if(dot.cur < from || dot.cur >= to)
dot.cur = from;
dot.off = -1;
@@ -467,7 +470,7 @@
werrstr("invalid range");
return -1;
}
- if(off < dot.cur)
+ if(bound == 0)
setrange(off, dot.to);
else
setrange(dot.from, off);
--- a/pplay.c
+++ b/pplay.c
@@ -175,6 +175,8 @@
case '=': setzoom(1, 0); break;
case '_': setzoom(-1, 1); break;
case '+': setzoom(1, 1); break;
+ case '1': bound = 0; break;
+ case '2': bound = 1; break;
case 'S': stereo ^= 1; redraw(1); break;
case Kdel:
case 'q': threadexitsall(nil);