ref: c0475eef48546db17305641c745a5925e38fde9f
parent: 2fa0cd4d44ef4e7340576579fca40897041f93fa
author: qwx <qwx@sciops.net>
date: Wed Jan 25 22:00:18 EST 2023
cmd: more sensible range requirements
--- a/cmd.c
+++ b/cmd.c
@@ -170,6 +170,10 @@
{
Chunk *left, *right;
+ if(dot.from == 0 && dot.to == totalsz){
+ werrstr("copy: no range selected");
+ return -1;
+ }
dprint(hold, "cmd/copy %Δ\n", &dot);
splitrange(dot.from, dot.to, &left, &right);
snarf(clone(left, right));
@@ -394,10 +398,6 @@
{
int fd;
- if(dot.to - dot.from == 0){
- werrstr("writeto: dot isn't a range");
- return -1;
- }
if((fd = create(arg, OWRITE, 0664)) < 0){
werrstr("writeto: %r");
return -1;
--- a/pplay.man
+++ b/pplay.man
@@ -140,11 +140,11 @@
The y axis spans the entire range of possible of a sample,
with positive values above the midpoint.
.SS "Editing"
-Editing commands:
+Commands:
.TF "r file"
.TP
.BI <\ cmd
-∗ Pipe output of a shell command replacing dot or inserting at the cursor
+Pipe output of a shell command replacing dot or inserting at the cursor (∗)
.TP
.BI ^\ cmd
Pipe dot to a shell command and read back its output into dot
@@ -153,16 +153,16 @@
Pipe dot to a shell command
.TP
.B c
-Set snarf buffer to the contents of the dot
+Set snarf buffer to the contents of the dot (‡)
.TP
.B d
-Cut dot, replacing snarf buffer
+Cut dot, replacing snarf buffer (‡)
.TP
.B p
-∗ Paste snarf buffer into dot or insert at the cursor
+Paste snarf buffer into dot or insert at the cursor (∗)
.TP
.BI r\ file
-∗ Read file into dot or at the cursor
+Read file into dot or at the cursor (∗)
.TP
.B s
Show dot by piping it to a new
@@ -178,7 +178,7 @@
.B x
Crop to dot (exclusive cut); does
.B not
-touch the snarf buffer
+touch the snarf buffer (‡)
.PD
.PP
Upon typing a key not part of the set of keyboard shortcuts,
@@ -196,9 +196,9 @@
either the left bound of the dot if set, or the cursor's position.
Deletions act on and thus require a valid dot,
smaller than the size of the buffer.
-Commands marked with a star (∗) change their behavior
+Commands above marked with a star (∗) change their behavior
depending on whether the dot is set or not;
-all others always require a valid dot.
+those marked with a dagger (‡) always require a valid dot.
.PP
The
.I u