Added the Cwrite keybinding. - sam - An updated version of the sam text editor. | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 0014b586d268d7f0511fee21d4c600690a29a49c | |
parent 5ec62bf406a1c2aaffb1d54315c91b5ef871447d | |
Author: Rob King <[email protected]> | |
Date: Fri, 12 Aug 2016 15:20:53 -0500 | |
Added the Cwrite keybinding. | |
Diffstat: | |
commands.h.def | 1 + | |
include/commands.h | 1 + | |
samterm/main.c | 12 +++++++++++- | |
3 files changed, 13 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/commands.h.def b/commands.h.def | |
@@ -29,6 +29,7 @@ | |
* Cpaste - paste text from the snarf buffer | |
* Ccut - cut text to the snarf buffer | |
* Cexchange - exchange operating system and sam snarf buffers | |
+ * Cwrite - write the current file to disk | |
* | |
* The default configuration shipped with sam has the keyboard commands mapped | |
* to the "classic" Unix sam of the 1980s, plus the WordStar Diamond for cursor | |
diff --git a/include/commands.h b/include/commands.h | |
@@ -26,6 +26,7 @@ enum{ | |
Ccut, | |
Cpaste, | |
Cexchange, | |
+ Cwrite, | |
Cmax | |
}; /* virtual command keystrokes */ | |
diff --git a/samterm/main.c b/samterm/main.c | |
@@ -736,6 +736,15 @@ cmdpaste(Flayer *l, long a, Text *t) | |
return a; | |
} | |
+static long | |
+cmdwrite(Flayer *l, long a, Text *t) | |
+{ | |
+ flushtyping(0); | |
+ outTs(Twrite, ((Text *)l->user1)->tag); | |
+ setlock(); | |
+ return a; | |
+} | |
+ | |
typedef long (*Commandfunc)(Flayer *, long, Text *); | |
typedef struct CommandEntry CommandEntry; | |
struct CommandEntry{ | |
@@ -758,7 +767,8 @@ CommandEntry commands[Cmax] ={ | |
[Cexchange] = {cmdexchange, 0}, | |
[Cdelword] = {cmddelword, 1}, | |
[Cdelbol] = {cmddelbol, 1}, | |
- [Cdel] = {cmddel, 1} | |
+ [Cdel] = {cmddel, 1}, | |
+ [Cwrite] = {cmdwrite, 1} | |
}; | |
void |