56 lines
1.1 KiB
Diff
56 lines
1.1 KiB
Diff
This patch modifies backspace behaviour when text is selected so that it doesn't delete the character preceding the selection.
|
|
diff 61f028fdacb96dddf66d5ff2edeefc530a00cb58 uncommitted
|
|
--- a/sys/src/cmd/rio/wind.c
|
|
+++ b/sys/src/cmd/rio/wind.c
|
|
@@ -892,16 +892,44 @@
|
|
return;
|
|
case Kleft:
|
|
if(w->q0 > 0){
|
|
- q0 = w->q0-1;
|
|
- wsetselect(w, q0, q0);
|
|
- wshow(w, q0);
|
|
+ if(w->q1 != w->q0) {
|
|
+ q0 = w->q0;
|
|
+ wsetselect(w, q0, q0);
|
|
+ wshow(w, q0);
|
|
+ }
|
|
+ else {
|
|
+ q0 = w->q0-1;
|
|
+ wsetselect(w, q0, q0);
|
|
+ wshow(w, q0);
|
|
+ }
|
|
}
|
|
+ else {
|
|
+ if(w->q1 != w->q0) {
|
|
+ q0 = 0;
|
|
+ wsetselect(w, q0, q0);
|
|
+ wshow(w, q0);
|
|
+ }
|
|
+ }
|
|
return;
|
|
case Kright:
|
|
if(w->q1 < w->nr){
|
|
- q1 = w->q1+1;
|
|
- wsetselect(w, q1, q1);
|
|
- wshow(w, q1);
|
|
+ if(w->q1 != w->q0) {
|
|
+ q1 = w->q1;
|
|
+ wsetselect(w, q1, q1);
|
|
+ wshow(w, q1);
|
|
+ }
|
|
+ else {
|
|
+ q1 = w->q1+1;
|
|
+ wsetselect(w, q1, q1);
|
|
+ wshow(w, q1);
|
|
+ }
|
|
+ }
|
|
+ else {
|
|
+ if(w->q1 != w->q0) {
|
|
+ q1 = w->nr;
|
|
+ wsetselect(w, q1, q1);
|
|
+ wshow(w, q1);
|
|
+ }
|
|
}
|
|
return;
|
|
case Khome:
|