Fixed bugs in send logic. - 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 7cc2a4d279f318a4b2288cc31872a1b4cc603545
(DIR) parent 5cd42f1f67572906665966ba07ce099ae358260e
(HTM) Author: Rob King <jking@deadpixi.com>
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(-)
---
(DIR) 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;
}