acme: implement Ctrl+s

This commit is contained in:
gutmet 2020-08-27 21:17:49 +02:00
parent d77832937c
commit e64c35c9c5
2 changed files with 16 additions and 7 deletions

View File

@ -48,7 +48,7 @@ index e5658a4e..2c79b387 100644
r = Rect(0, 0, Scrollwid+ButtonBorder, font->height+1); r = Rect(0, 0, Scrollwid+ButtonBorder, font->height+1);
diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c
index 09422dda..fc67ebad 100644 index 09422dda..58e79e15 100644
--- a/src/cmd/acme/text.c --- a/src/cmd/acme/text.c
+++ b/src/cmd/acme/text.c +++ b/src/cmd/acme/text.c
@@ -694,8 +694,16 @@ texttype(Text *t, Rune r) @@ -694,8 +694,16 @@ texttype(Text *t, Rune r)
@ -122,7 +122,7 @@ index 09422dda..fc67ebad 100644
typecommit(t); typecommit(t);
/* go to where ^U would erase, if not already at BOL */ /* go to where ^U would erase, if not already at BOL */
nnb = 0; nnb = 0;
@@ -753,22 +770,25 @@ texttype(Text *t, Rune r) @@ -753,26 +770,33 @@ texttype(Text *t, Rune r)
nnb = textbswidth(t, 0x15); nnb = textbswidth(t, 0x15);
textshow(t, t->q0-nnb, t->q0-nnb, TRUE); textshow(t, t->q0-nnb, t->q0-nnb, TRUE);
return; return;
@ -153,7 +153,16 @@ index 09422dda..fc67ebad 100644
typecommit(t); typecommit(t);
undo(t, nil, nil, FALSE, 0, nil, 0); undo(t, nil, nil, FALSE, 0, nil, 0);
return; return;
@@ -796,7 +816,8 @@ texttype(Text *t, Rune r) -
+ case Kcmd+'s': /* %S: save */
+ case 0x13: /* ^S */
+ typecommit(t);
+ put(&(t->w)->body, nil, nil, XXX, XXX, nil, 0);
+ return;
Tagdown:
/* expand tag to show all text */
if(!t->w->tagexpand){
@@ -796,7 +820,8 @@ texttype(Text *t, Rune r)
} }
/* cut/paste must be done after the seq++/filemark */ /* cut/paste must be done after the seq++/filemark */
switch(r){ switch(r){
@ -163,7 +172,7 @@ index 09422dda..fc67ebad 100644
typecommit(t); typecommit(t);
if(t->what == Body){ if(t->what == Body){
seq++; seq++;
@@ -806,7 +827,8 @@ texttype(Text *t, Rune r) @@ -806,7 +831,8 @@ texttype(Text *t, Rune r)
textshow(t, t->q0, t->q0, 1); textshow(t, t->q0, t->q0, 1);
t->iq1 = t->q0; t->iq1 = t->q0;
return; return;
@ -173,7 +182,7 @@ index 09422dda..fc67ebad 100644
typecommit(t); typecommit(t);
if(t->what == Body){ if(t->what == Body){
seq++; seq++;
@@ -825,7 +847,7 @@ texttype(Text *t, Rune r) @@ -825,7 +851,7 @@ texttype(Text *t, Rune r)
} }
textshow(t, t->q0, t->q0, 1); textshow(t, t->q0, t->q0, 1);
switch(r){ switch(r){
@ -182,7 +191,7 @@ index 09422dda..fc67ebad 100644
case Kins: case Kins:
typecommit(t); typecommit(t);
rp = textcomplete(t); rp = textcomplete(t);
@@ -844,9 +866,15 @@ texttype(Text *t, Rune r) @@ -844,9 +870,15 @@ texttype(Text *t, Rune r)
typecommit(t); typecommit(t);
t->iq1 = t->q0; t->iq1 = t->q0;
return; return;

View File

@ -6,7 +6,7 @@ Changes to acme
- Down and Up now move the cursor to the end of the line below/above - Down and Up now move the cursor to the end of the line below/above
- If you scroll more than 10 lines at a time, the cursor moves along - If you scroll more than 10 lines at a time, the cursor moves along
- switched behavior of Home/End with ^A/^E - switched behavior of Home/End with ^A/^E
- Ctrl+c, Ctrl+x, Ctrl+v now work as expected - Ctrl+c, Ctrl+x, Ctrl+v, Ctrl+s now work as expected
- Ctrl+z for undo, Ctrl+y for redo - Ctrl+z for undo, Ctrl+y for redo
- DELETE key - DELETE key