Added the Cwrite keybinding. - sam - An updated version of the sam text editor.
(HTM) git clone git://vernunftzentrum.de/sam.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 0014b586d268d7f0511fee21d4c600690a29a49c
(DIR) parent 5ec62bf406a1c2aaffb1d54315c91b5ef871447d
(HTM) Author: Rob King <jking@deadpixi.com>
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(-)
---
(DIR) 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
(DIR) diff --git a/include/commands.h b/include/commands.h
@@ -26,6 +26,7 @@ enum{
Ccut,
Cpaste,
Cexchange,
+ Cwrite,
Cmax
}; /* virtual command keystrokes */
(DIR) 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