initial add of four patches to repo

This commit is contained in:
Scott Flowers 2025-10-03 18:36:43 +00:00
parent aabd8a8cca
commit 14625a9b31
4 changed files with 166 additions and 0 deletions

44
acme-backspace.patch Normal file
View File

@ -0,0 +1,44 @@
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;

55
rio-backspace.patch Normal file
View File

@ -0,0 +1,55 @@
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:

20
upas-Mail-comp.patch Normal file
View File

@ -0,0 +1,20 @@
This patch uses the acme window dirty flag to prompt a user to Put when Del-ing a dirty mail compose window.
diff 3a1a463df4f4c5c8fc8eb1ac023c73713415eb2c uncommitted
--- a/sys/src/cmd/upas/Mail/comp.c
+++ b/sys/src/cmd/upas/Mail/comp.c
@@ -97,8 +97,14 @@
static void
compquit(Comp *c, char **, int)
{
- if(c->quitting == 0)
+ /* Read acme dirty flag from compose window ctl file */
+ char d;
+ pread(c->ctl, &d, 1, 58);
+
+ if(d == '1' && c->quitting == 0)
fprint(2, "composing message\n");
+ if(d != '1')
+ c->quitting++;
c->quitting++;
}

47
upas-Mail-wind.patch Normal file
View File

@ -0,0 +1,47 @@
This patch fixes a bug where hitting Del on a Mail window that wasn't saved would error, but not allow itself to be saved. After this patch, hitting Del informs the user the window is dirty, but still allows the Put command to succeed.
diff 3a1a463df4f4c5c8fc8eb1ac023c73713415eb2c uncommitted
--- a/sys/src/cmd/upas/Mail/mail.h
+++ b/sys/src/cmd/upas/Mail/mail.h
@@ -146,6 +146,7 @@
int view;
int nopen;
char *path;
+ int quitting;
};
extern Mbox mbox;
--- a/sys/src/cmd/upas/Mail/mbox.c
+++ b/sys/src/cmd/upas/Mail/mbox.c
@@ -451,6 +451,7 @@
{
int i, n, fd;
Dir *d;
+ mbox.quitting = 0;
mbox.mesgsz = 128;
mbox.hashsz = 128;
@@ -796,6 +797,7 @@
{
Mesg *m;
Comp *c;
+ char d;
if(mbox.nopen > 0 && !mbox.canquit){
fprint(2, "Del: %d open messages\n", mbox.nopen);
@@ -806,7 +808,15 @@
fprint(m->ctl, "del\n");
for(c = mbox.opencomp; c != nil; c = c->qnext)
fprint(c->ctl, "del\n");
- fprint(mbox.ctl, "del\n");
+ /* check if mbox has unsaved changes by reading dirty flag before closing */
+ pread(mbox.ctl, &d, 1, 58);
+ if(d == '1' && mbox.quitting == 0){
+ fprint(2, "unsaved changes in mailbox\n");
+ mbox.quitting++;
+ return;
+ }
+ else
+ fprint(mbox.ctl, "delete\n");
threadexitsall(nil);
}