diff options
author | Mark Lumsden <lum@cvs.openbsd.org> | 2019-06-17 11:39:27 +0000 |
---|---|---|
committer | Mark Lumsden <lum@cvs.openbsd.org> | 2019-06-17 11:39:27 +0000 |
commit | 961eee4f9c12f891cb9e0cd40cf5cd58f376134c (patch) | |
tree | 75070241047552adb2a0b0a6b8c17bfe9b18766e /usr.bin | |
parent | f62ad4e2e8b79844bfb36647c4be996dc1078af6 (diff) |
From Leonid Bobrov: add a condition to {beginning,end}-of-buffer to
push mark only if it's not pushed already.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mg/basic.c | 8 | ||||
-rw-r--r-- | usr.bin/mg/mg.1 | 6 | ||||
-rw-r--r-- | usr.bin/mg/region.c | 3 |
3 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/mg/basic.c b/usr.bin/mg/basic.c index a019ff56b9b..57d65a61109 100644 --- a/usr.bin/mg/basic.c +++ b/usr.bin/mg/basic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: basic.c,v 1.48 2019/06/03 16:26:30 lum Exp $ */ +/* $OpenBSD: basic.c,v 1.49 2019/06/17 11:39:26 lum Exp $ */ /* This file is in the public domain */ @@ -124,7 +124,8 @@ forwchar(int f, int n) int gotobob(int f, int n) { - (void) setmark(f, n); + if (!curwp->w_markp) + (void) setmark(f, n); curwp->w_dotp = bfirstlp(curbp); curwp->w_doto = 0; curwp->w_rflag |= WFFULL; @@ -150,7 +151,8 @@ gotoeob(int f, int n) int ln; struct line *lp; - (void) setmark(f, n); + if (!curwp->w_markp) + (void) setmark(f, n); curwp->w_dotp = blastlp(curbp); curwp->w_doto = llength(curwp->w_dotp); curwp->w_dotline = curwp->w_bufp->b_lines; diff --git a/usr.bin/mg/mg.1 b/usr.bin/mg/mg.1 index 33e9e59891c..5426817257b 100644 --- a/usr.bin/mg/mg.1 +++ b/usr.bin/mg/mg.1 @@ -1,7 +1,7 @@ -.\" $OpenBSD: mg.1,v 1.114 2019/06/06 18:17:34 jmc Exp $ +.\" $OpenBSD: mg.1,v 1.115 2019/06/17 11:39:26 lum Exp $ .\" This file is in the public domain. .\" -.Dd $Mdocdate: June 6 2019 $ +.Dd $Mdocdate: June 17 2019 $ .Dt MG 1 .Os .Sh NAME @@ -405,6 +405,7 @@ Paragraphs are delimited by <NL><NL> or <NL><TAB> or <NL><SPACE>. Move cursor backwards by the specified number of words. .It beginning-of-buffer Move cursor to the top of the buffer. +If set, keep mark's position, otherwise set at current position. A numeric argument .Va n will move n/10th of the way from the top. @@ -529,6 +530,7 @@ version string. Stop defining a keyboard macro. .It end-of-buffer Move cursor to the end of the buffer. +If set, keep mark's position, otherwise set at current position. A numeric argument .Va n will move n/10th of the way from the end. diff --git a/usr.bin/mg/region.c b/usr.bin/mg/region.c index 5e04f3f5ba9..bd51fd54825 100644 --- a/usr.bin/mg/region.c +++ b/usr.bin/mg/region.c @@ -1,4 +1,4 @@ -/* $OpenBSD: region.c,v 1.37 2016/09/09 06:05:51 lum Exp $ */ +/* $OpenBSD: region.c,v 1.38 2019/06/17 11:39:26 lum Exp $ */ /* This file is in the public domain. */ @@ -405,6 +405,7 @@ markbuffer(int f, int n) { if (gotoeob(f,n) == FALSE) return (FALSE); + (void) clearmark(f, n); if (gotobob(f,n) == FALSE) return (FALSE); return (TRUE); |