Fixed bugs in send logic. - sam - An updated version of the sam text editor. | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 7cc2a4d279f318a4b2288cc31872a1b4cc603545 | |
parent 5cd42f1f67572906665966ba07ce099ae358260e | |
Author: Rob King <[email protected]> | |
Date: Wed, 21 Sep 2016 21:47:08 -0500 | |
Fixed bugs in send logic. | |
Diffstat: | |
samterm/main.c | 17 ++++++++++++----- | |
1 file changed, 12 insertions(+), 5 deletions(-) | |
--- | |
diff --git a/samterm/main.c b/samterm/main.c | |
@@ -1,3 +1,4 @@ | |
+ | |
/* Copyright (c) 1998 Lucent Technologies - All rights reserved. */ | |
#include <u.h> | |
#include <libc.h> | |
@@ -16,9 +17,9 @@ long nscralloc; | |
extern Bitmap screen; | |
unsigned int cursor; | |
Mouse mouse; | |
-Flayer *which = 0; | |
-Flayer *flast = 0; | |
-Flayer *work = 0; | |
+Flayer *which = NULL; | |
+Flayer *flast = NULL; | |
+Flayer *work = NULL; | |
long snarflen; | |
long typestart = -1; | |
long typeend = -1; | |
@@ -851,8 +852,12 @@ cmdtab(Flayer *l, long a, Text *t, const char *arg) | |
static long | |
cmdsend(Flayer *l, long a, Text *t, const char *arg) | |
{ | |
+ bool dojump = (t != &cmd); | |
+ | |
flushtyping(0); | |
- cmdjump(l, a, t, NULL); | |
+ if (dojump) | |
+ cmdjump(l, a, t, NULL); | |
+ | |
for (const char *c = arg; *c; c++){ | |
pushkbd(*c); | |
type(&cmd.l[cmd.front]); | |
@@ -861,7 +866,9 @@ cmdsend(Flayer *l, long a, Text *t, const char *arg) | |
pushkbd('\n'); | |
type(&cmd.l[cmd.front]); | |
flushtyping(0); | |
- cmdjump(l, a, t, NULL); | |
+ | |
+ if (dojump) | |
+ cmdjump(l, a, t, NULL); | |
return a; | |
} |