From e64c35c9c5e2863ef7ec45bdb71f41f0322272ac Mon Sep 17 00:00:00 2001 From: gutmet Date: Thu, 27 Aug 2020 21:17:49 +0200 Subject: [PATCH] acme: implement Ctrl+s --- acme.diff | 21 +++++++++++++++------ acme.txt | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/acme.diff b/acme.diff index 361e332..4f2f7c6 100644 --- a/acme.diff +++ b/acme.diff @@ -48,7 +48,7 @@ index e5658a4e..2c79b387 100644 r = Rect(0, 0, Scrollwid+ButtonBorder, font->height+1); 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 +++ b/src/cmd/acme/text.c @@ -694,8 +694,16 @@ texttype(Text *t, Rune r) @@ -122,7 +122,7 @@ index 09422dda..fc67ebad 100644 typecommit(t); /* go to where ^U would erase, if not already at BOL */ nnb = 0; -@@ -753,22 +770,25 @@ texttype(Text *t, Rune r) +@@ -753,26 +770,33 @@ texttype(Text *t, Rune r) nnb = textbswidth(t, 0x15); textshow(t, t->q0-nnb, t->q0-nnb, TRUE); return; @@ -153,7 +153,16 @@ index 09422dda..fc67ebad 100644 typecommit(t); undo(t, nil, nil, FALSE, 0, nil, 0); 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 */ switch(r){ @@ -163,7 +172,7 @@ index 09422dda..fc67ebad 100644 typecommit(t); if(t->what == Body){ 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); t->iq1 = t->q0; return; @@ -173,7 +182,7 @@ index 09422dda..fc67ebad 100644 typecommit(t); if(t->what == Body){ 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); switch(r){ @@ -182,7 +191,7 @@ index 09422dda..fc67ebad 100644 case Kins: typecommit(t); rp = textcomplete(t); -@@ -844,9 +866,15 @@ texttype(Text *t, Rune r) +@@ -844,9 +870,15 @@ texttype(Text *t, Rune r) typecommit(t); t->iq1 = t->q0; return; diff --git a/acme.txt b/acme.txt index bbdcf0f..f8544af 100644 --- a/acme.txt +++ b/acme.txt @@ -6,7 +6,7 @@ Changes to acme - 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 - 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 - DELETE key