This patch modifies backspace behaviour when text is selected so that it doesn't delete the character preceding the selection. diff 61f028fdacb96dddf66d5ff2edeefc530a00cb58 uncommitted --- /sys/src/cmd/acme/text.c +++ /sys/src/cmd/acme/text.c @@ -680,13 +680,35 @@ switch(r){ case Kleft: typecommit(t); - if(t->q0 > 0) - textshow(t, t->q0-1, t->q0-1, TRUE); + if(t->q0 > 0) { + if(t->q0 != t->q1) { + textshow(t, t->q0, t->q0, TRUE); + } + else { + textshow(t, t->q0-1, t->q0-1, TRUE); + } + } + else { + if(t->q0 != t->q1) { + textshow(t, t->q0, t->q0, TRUE); + } + } return; case Kright: typecommit(t); - if(t->q1 < t->file->nc) - textshow(t, t->q1+1, t->q1+1, TRUE); + if(t->q1 < t->file->nc) { + if(t->q0 != t->q1) { + textshow(t, t->q1, t->q1, TRUE); + } + else { + textshow(t, t->q1+1, t->q1+1, TRUE); + } + } + else { + if(t->q0 != t->q1) { + textshow(t, t->file->nc, t->file->nc, TRUE); + } + } return; case Kdown: n = t->maxlines/3;