Merge branch 'master' of github.com:deadpixi/sam - 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 c425131154234b972ac1f0954397e3b91da0bcf4
(DIR) parent 7ddcf74307944528f6dd4e4af6c1da0e9c9caa6e
(HTM) Author: Rob King <jking@deadpixi.com>
Date: Wed, 21 Sep 2016 09:43:59 -0500
Merge branch 'master' of github.com:deadpixi/sam
Diffstat:
doc/samrc.5 | 3 ++-
samterm/main.c | 24 +++++++++++++++++++++++-
samterm/samrc.c | 6 ++++--
samterm/samterm.h | 3 ++-
4 files changed, 31 insertions(+), 5 deletions(-)
---
(DIR) diff --git a/doc/samrc.5 b/doc/samrc.5
@@ -250,7 +250,8 @@ lineup Move dot one line up Control-E
linedown Move dot one line down Control-X
delbol Delete to beginning of line Control-U
delword Delete previous word Control-W
-del Delete previous character BackSpace
+delbs Delete previous character BackSpace
+del Delete following character Delete
cut Cut selection Control-Y
snarf Snarf selection Control-C
paste Paste snarf buffer Control-V
(DIR) diff --git a/samterm/main.c b/samterm/main.c
@@ -725,7 +725,7 @@ cmddelbol(Flayer *l, long a, Text *t, const char *arg)
}
static long
-cmddel(Flayer *l, long a, Text *t, const char *arg)
+cmddelbs(Flayer *l, long a, Text *t, const char *arg)
{
if (l->f.p0 > 0 && a > 0)
l->p0 = a - 1;
@@ -746,6 +746,27 @@ cmddel(Flayer *l, long a, Text *t, const char *arg)
return a;
}
+static long
+cmddel(Flayer *l, long a, Text *t, const char *arg)
+{
+ l->p0 = a;
+ if (a < t->rasp.nrunes)
+ l->p1 = a + 1;
+ if (l->p1 != l->p0){
+ if(typestart <= l->p0 && l->p1 <= typeend){
+ t->lock++; /* to call hcut */
+ hcut(t->tag, l->p0, l->p1 - l->p0);
+ /* hcheck is local because we know rasp is contiguous */
+ hcheck(t->tag);
+ }else{
+ flushtyping(0);
+ cut(t, t->front, 0, 1);
+ }
+ }
+
+ return a;
+}
+
int
getlayer(const Flayer *l, const Text *t)
{
@@ -876,6 +897,7 @@ CommandEntry commands[Cmax] ={
[Cexchange] = {cmdexchange, false, false},
[Cdelword] = {cmddelword, true, false},
[Cdelbol] = {cmddelbol, true, false},
+ [Cdelbs] = {cmddelbs, true, true},
[Cdel] = {cmddel, true, true},
[Ceol] = {cmdeol, false, false},
[Cbol] = {cmdbol, false, false},
(DIR) diff --git a/samterm/samrc.c b/samterm/samrc.c
@@ -35,6 +35,7 @@ static Namemapping commandmapping[] ={
{"lineup", Clineup},
{"delword", Cdelword},
{"delbol", Cdelbol},
+ {"delbs", Cdelbs},
{"del", Cdel},
{"snarf", Csnarf},
{"cut", Ccut},
@@ -127,7 +128,7 @@ static Defaultbinding defaultbindings[] ={
{0, XK_Escape, Kcommand, Cescape, NULL},
/* More fundamental stuff: backspace, delete, etc. */
- {0, XK_BackSpace, Kcommand, Cdel, NULL},
+ {0, XK_BackSpace, Kcommand, Cdelbs, NULL},
{0, XK_Delete, Kcommand, Cdel, NULL},
{0, XK_Tab, Kcommand, Ctab, NULL},
{0, XK_Return, Kraw, '\n', NULL},
@@ -152,7 +153,8 @@ static Defaultbinding defaultbindings[] ={
/* Support traditional control sequences. */
{ControlMask, XK_bracketleft, Kcommand, Cescape, NULL},
- {ControlMask, XK_h, Kcommand, Cdel, NULL},
+ {ControlMask, XK_h, Kcommand, Cdelbs, NULL},
+ {ControlMask, XK_Delete, Kcommand, Cdel, NULL},
{ControlMask, XK_i, Kcommand, Ctab, NULL},
{ControlMask, XK_j, Kraw, '\n', NULL},
{ControlMask, XK_m, Kraw, '\r', NULL},
(DIR) diff --git a/samterm/samterm.h b/samterm/samterm.h
@@ -19,7 +19,8 @@ enum{
Clineup, /* move dot up by line */
Cdelword, /* delete word to left of dot */
Cdelbol, /* delete to beginning of line */
- Cdel, /* delete character to left of dot */
+ Cdelbs, /* delete character to left of dot */
+ Cdel, /* delete character to right of dot */
Csnarf, /* snarf dot */
Ccut, /* cut dot */
Cpaste, /* paste from snarf buffer */