Fix bugs on ctrl-{k,x,e}. - sam - An updated version of the sam text editor. | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 4376931065dc54bed8eb859bd7111660bf3d4923 | |
parent 877f877609612abe756caa865317b88fccc9421b | |
Author: Rob King <[email protected]> | |
Date: Fri, 20 May 2016 10:07:13 -0500 | |
Fix bugs on ctrl-{k,x,e}. | |
Credit for this patch goes to Tommy Pettersson. Thanks! | |
Diffstat: | |
samterm/main.c | 34 ++++++++++++++++---------------- | |
1 file changed, 17 insertions(+), 17 deletions(-) | |
--- | |
diff --git a/samterm/main.c b/samterm/main.c | |
@@ -499,6 +499,7 @@ type(Flayer *l, int res) /* what a bloody mess this … | |
scrollkey = 0; | |
upkey = 0; | |
+ movekey = 0; | |
if(res == RKeyboard) { | |
int pc = qpeekc(); | |
scrollkey = pc==SCROLLKEY; /* ICK */ | |
@@ -610,7 +611,7 @@ type(Flayer *l, int res) /* what a bloody mess this … | |
a--; | |
n0 = a; | |
- a = (n0 + count > n1) ? n1 - 1 : n0 + … | |
+ a = (n0 + count >= n1) ? n1 - 1 : n0 +… | |
flsetselect(l, a, a); | |
center(l, a); | |
} | |
@@ -621,30 +622,29 @@ type(Flayer *l, int res) /* what a bloody mess thi… | |
flsetselect(l, a, a); | |
flushtyping(1); | |
if (a < t->rasp.nrunes){ | |
- long n0, n1, n2, p0, count = 0; | |
+ long p0, count = 0; | |
p0 = a; | |
while (a > 0 && raspc(&t->rasp, a - 1)… | |
- a--; | |
- count++; | |
+ a--; | |
+ count++; | |
} | |
- n0 = a; | |
a = p0; | |
while (a < t->rasp.nrunes && raspc(&t-… | |
- a++; | |
- n1 = ++a; | |
- | |
- a++; | |
- while (a < t->rasp.nrunes && raspc(&t-… | |
- a++; | |
- n2 = a; | |
+ a++; | |
- if (n2 < t->rasp.nrunes && n1 != n2){ | |
- a = (n1 + count > n2) ? n2… | |
+ if (a < t->rasp.nrunes){ | |
+ a++; | |
+ while (a < t->rasp.nru… | |
+ a++; | |
+ count--; | |
+ } | |
+ if (a != p0){ | |
flsetselect(l, a, a); | |
center(l, a); | |
- } | |
+ } | |
+ } | |
} | |
break; | |
} | |
@@ -689,11 +689,11 @@ type(Flayer *l, int res) /* what a bloody mess thi… | |
} | |
} | |
}else if(c==COMMANDKEY){ | |
- if(which == &cmd.l[0]){ | |
+ if(which == &cmd.l[cmd.front]){ | |
if (flast) | |
current(flast); | |
}else{ | |
- l = &cmd.l[0]; | |
+ l = &cmd.l[cmd.front]; | |
Text *t = (Text *)l->user1; | |
flast = which; | |
current(l); |