summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lumsden <lum@cvs.openbsd.org>2015-10-10 09:13:15 +0000
committerMark Lumsden <lum@cvs.openbsd.org>2015-10-10 09:13:15 +0000
commita43deb7435d1a49ba60fcbeb36f7a488269ee201 (patch)
tree6ebd8450132b9862e066430c8cd4b7e0ff697db1
parentf7e921060c378444c872c59da6ca9f3652da2398 (diff)
Make functions that accept multiple iterations via C-u N, honour 0.
Except C-k which has a defined behaviour. In mg, C-t doesn't complete n iterations if requested, but probably should, hence it has been included in this diff.
-rw-r--r--usr.bin/mg/basic.c8
-rw-r--r--usr.bin/mg/paragraph.c14
-rw-r--r--usr.bin/mg/util.c5
3 files changed, 24 insertions, 3 deletions
diff --git a/usr.bin/mg/basic.c b/usr.bin/mg/basic.c
index 56cc517d3ef..85d9f70fce6 100644
--- a/usr.bin/mg/basic.c
+++ b/usr.bin/mg/basic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: basic.c,v 1.46 2015/09/26 21:51:58 jasper Exp $ */
+/* $OpenBSD: basic.c,v 1.47 2015/10/10 09:13:14 lum Exp $ */
/* This file is in the public domain */
@@ -28,6 +28,9 @@
int
gotobol(int f, int n)
{
+ if (n == 0)
+ return (TRUE);
+
curwp->w_doto = 0;
return (TRUE);
}
@@ -72,6 +75,9 @@ backchar(int f, int n)
int
gotoeol(int f, int n)
{
+ if (n == 0)
+ return (TRUE);
+
curwp->w_doto = llength(curwp->w_dotp);
return (TRUE);
}
diff --git a/usr.bin/mg/paragraph.c b/usr.bin/mg/paragraph.c
index 14d695143fc..ed94b2261f0 100644
--- a/usr.bin/mg/paragraph.c
+++ b/usr.bin/mg/paragraph.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: paragraph.c,v 1.40 2015/09/26 15:03:15 lum Exp $ */
+/* $OpenBSD: paragraph.c,v 1.41 2015/10/10 09:13:14 lum Exp $ */
/* This file is in the public domain. */
@@ -142,6 +142,9 @@ fillpara(int f, int n)
struct line *eopline; /* pointer to line just past EOP */
char wbuf[MAXWORD]; /* buffer for current word */
+ if (n == 0)
+ return (TRUE);
+
undo_boundary_enable(FFRAND, 0);
/* record the pointer to the line just past the EOP */
@@ -267,6 +270,9 @@ killpara(int f, int n)
{
int lineno, status;
+ if (n == 0)
+ return (TRUE);
+
if (findpara() == FALSE)
return (TRUE);
@@ -298,6 +304,9 @@ markpara(int f, int n)
{
int i = 0;
+ if (n == 0)
+ return (TRUE);
+
clearmark(FFARG, 0);
if (findpara() == FALSE)
@@ -326,6 +335,9 @@ transposepara(int f, int n)
int i = 0, status;
char flg;
+ if (n == 0)
+ return (TRUE);
+
/* find a paragraph, set mark, then goto the end */
gotobop(FFRAND, 1);
curwp->w_markp = curwp->w_dotp;
diff --git a/usr.bin/mg/util.c b/usr.bin/mg/util.c
index d5b5a06af14..64e9d7659e4 100644
--- a/usr.bin/mg/util.c
+++ b/usr.bin/mg/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.36 2015/09/29 03:19:24 guenther Exp $ */
+/* $OpenBSD: util.c,v 1.37 2015/10/10 09:13:14 lum Exp $ */
/* This file is in the public domain. */
@@ -117,6 +117,9 @@ twiddle(int f, int n)
struct line *dotp;
int doto, cr;
+ if (n == 0)
+ return (TRUE);
+
dotp = curwp->w_dotp;
doto = curwp->w_doto;