Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…by=date#dirlist for details
  • Loading branch information
hboetes committed Nov 12, 2022
1 parent 62fe669 commit 5dbacce
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 64 deletions.
84 changes: 42 additions & 42 deletions CVS/Entries
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,52 @@
/fileio.c/1.108/Result of merge//
/region.c/1.39/Result of merge//
/ttyio.c/1.40/Result of merge//
/def.h/1.176/Result of merge//
/dired.c/1.100/Result of merge//
/main.c/1.90/Result of merge//
/re_search.c/1.36/Result of merge//
/README/1.14/Sun Aug 1 20:42:15 2021//
/chrdef.h/1.10/Sun Aug 1 20:42:15 2021//
/cinfo.c/1.18/Sun Aug 1 20:42:15 2021//
/display.c/1.48/Sun Aug 1 20:42:15 2021//
/extend.c/1.75/Sun Aug 1 20:42:15 2021//
/file.c/1.102/Sun Aug 1 20:42:15 2021//
/funmap.h/1.8/Sun Aug 1 20:42:15 2021//
/kbd.h/1.19/Sun Aug 1 20:42:15 2021//
/key.h/1.6/Sun Aug 1 20:42:15 2021//
/macro.c/1.16/Sun Aug 1 20:42:15 2021//
/macro.h/1.7/Sun Aug 1 20:42:15 2021//
/modes.c/1.21/Sun Aug 1 20:42:15 2021//
/paragraph.c/1.46/Sun Aug 1 20:42:15 2021//
/pathnames.h/1.1/Sun Aug 1 20:42:15 2021//
/search.c/1.47/Sun Aug 1 20:42:15 2021//
/spawn.c/1.12/Sun Aug 1 20:42:15 2021//
/version.c/1.10/Sun Aug 1 20:42:15 2021//
/window.c/1.36/Sun Aug 1 20:42:15 2021//
/word.c/1.19/Sun Aug 1 20:42:15 2021//
/autoexec.c/1.18/Sun Nov 21 22:19:09 2021//
/bell.c/1.6/Sun Nov 21 22:19:09 2021//
/buffer.c/1.112/Sun Nov 21 22:19:09 2021//
/dir.c/1.32/Sat Feb 12 21:09:39 2022//
/echo.c/1.68/Sun Nov 21 22:19:09 2021//
/funmap.c/1.63/Sun Nov 21 22:19:09 2021//
/grep.c/1.49/Sun Nov 21 22:19:09 2021//
/help.c/1.36/Sat Feb 12 21:09:39 2022//
/interpreter.c/1.34/Result of merge+Sat Feb 12 21:09:39 2022//
/kbd.c/1.35/Sun Nov 21 22:19:09 2021//
/keymap.c/1.59/Sun Nov 21 22:19:09 2021//
/line.c/1.63/Sun Nov 21 22:19:09 2021//
/log.c/1.12/Sun Nov 21 22:19:09 2021//
/log.h/1.6/Sun Nov 21 22:19:09 2021//
/match.c/1.22/Sun Nov 21 22:19:09 2021//
/tags.c/1.17/Result of merge//
/tty.c/1.39/Sun Nov 21 22:19:09 2021//
/ttykbd.c/1.20/Sun Nov 21 22:19:09 2021//
/yank.c/1.15/Sun Nov 21 22:19:09 2021//
/mg.1/1.126/Thu Mar 31 20:05:13 2022//
/basic.c/1.51/Sat Jun 11 23:27:52 2022//
/cmode.c/1.18/Sat Jun 11 23:27:52 2022//
/cscope.c/1.21/Sat Jun 11 23:27:52 2022//
/util.c/1.44/Sat Jun 11 23:27:52 2022//
/tutorial/1.19/Sat Jul 23 09:28:43 2022//
/README/1.14/Wed Aug 24 19:54:15 2022//
/autoexec.c/1.18/Wed Aug 24 19:54:15 2022//
/basic.c/1.51/Wed Aug 24 19:54:15 2022//
/bell.c/1.6/Wed Aug 24 19:54:15 2022//
/buffer.c/1.112/Wed Aug 24 19:54:15 2022//
/chrdef.h/1.10/Wed Aug 24 19:54:15 2022//
/cinfo.c/1.18/Wed Aug 24 19:54:15 2022//
/cmode.c/1.19/Sat Nov 12 10:02:34 2022//
/cscope.c/1.21/Wed Aug 24 19:54:15 2022//
/def.h/1.177/Result of merge//
/dir.c/1.32/Wed Aug 24 19:54:15 2022//
/dired.c/1.101/Result of merge//
/display.c/1.48/Wed Aug 24 19:54:15 2022//
/echo.c/1.69/Sat Nov 12 10:02:34 2022//
/file.c/1.102/Wed Aug 24 19:54:15 2022//
/funmap.c/1.64/Sat Nov 12 10:02:34 2022//
/funmap.h/1.8/Wed Aug 24 19:54:15 2022//
/grep.c/1.49/Wed Aug 24 19:54:15 2022//
/help.c/1.36/Wed Aug 24 19:54:15 2022//
/kbd.c/1.35/Wed Aug 24 19:54:15 2022//
/kbd.h/1.19/Wed Aug 24 19:54:15 2022//
/key.h/1.6/Wed Aug 24 19:54:15 2022//
/keymap.c/1.60/Sat Nov 12 10:02:34 2022//
/line.c/1.63/Wed Aug 24 19:54:15 2022//
/log.c/1.12/Wed Aug 24 19:54:15 2022//
/log.h/1.6/Wed Aug 24 19:54:15 2022//
/macro.c/1.16/Wed Aug 24 19:54:15 2022//
/macro.h/1.7/Wed Aug 24 19:54:15 2022//
/match.c/1.22/Wed Aug 24 19:54:15 2022//
/mg.1/1.127/Sat Nov 12 10:02:34 2022//
/modes.c/1.21/Wed Aug 24 19:54:15 2022//
/paragraph.c/1.46/Wed Aug 24 19:54:15 2022//
/pathnames.h/1.1/Wed Aug 24 19:54:15 2022//
/search.c/1.48/Sat Nov 12 10:02:35 2022//
/spawn.c/1.12/Wed Aug 24 19:54:15 2022//
/tty.c/1.39/Wed Aug 24 19:54:15 2022//
/ttykbd.c/1.20/Wed Aug 24 19:54:15 2022//
/tutorial/1.19/Wed Aug 24 19:54:15 2022//
/util.c/1.44/Wed Aug 24 19:54:15 2022//
/window.c/1.36/Wed Aug 24 19:54:15 2022//
/word.c/1.19/Wed Aug 24 19:54:15 2022//
/yank.c/1.15/Wed Aug 24 19:54:15 2022//
D
4 changes: 2 additions & 2 deletions cmode.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: cmode.c,v 1.18 2022/05/24 16:24:31 op Exp $ */
/* $OpenBSD: cmode.c,v 1.19 2022/10/15 09:54:29 op Exp $ */
/*
* This file is in the public domain.
*
Expand Down Expand Up @@ -86,7 +86,7 @@ static struct KEYMAPE (3) cmodemap = {
}
};

/* Funtion, Mode hooks */
/* Function, Mode hooks */

void
cmode_init(void)
Expand Down
5 changes: 4 additions & 1 deletion def.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: def.h,v 1.176 2021/05/06 14:16:12 lum Exp $ */
/* $OpenBSD: def.h,v 1.177 2022/10/20 18:59:24 op Exp $ */

/* This file is in the public domain. */

Expand Down Expand Up @@ -662,6 +662,9 @@ int queryrepl(int, int);
int forwsrch(void);
int backsrch(void);
int readpattern(char *);
int zapuptochar(int, int);
int zaptochar(int, int);
int zap(int, int);

/* spawn.c X */
int spawncli(int, int);
Expand Down
4 changes: 2 additions & 2 deletions dired.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: dired.c,v 1.100 2021/05/02 14:13:17 lum Exp $ */
/* $OpenBSD: dired.c,v 1.101 2022/10/15 17:01:14 op Exp $ */

/* This file is in the public domain. */

Expand Down Expand Up @@ -1189,7 +1189,7 @@ gotofile(char *fpth)
ewprintf("File not found %s", fname);
return (FALSE);
} else {
ewprintf("");
eerase();
return (TRUE);
}
}
Expand Down
22 changes: 11 additions & 11 deletions echo.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: echo.c,v 1.68 2021/03/02 15:03:35 lum Exp $ */
/* $OpenBSD: echo.c,v 1.69 2022/10/15 17:01:14 op Exp $ */

/* This file is in the public domain. */

Expand Down Expand Up @@ -67,15 +67,15 @@ eyorn(const char *sp)
for (;;) {
s = getkey(FALSE);
if (s == 'y' || s == 'Y' || s == ' ') {
ewprintf("");
eerase();
return (TRUE);
}
if (s == 'n' || s == 'N' || s == CCHR('M')) {
ewprintf("");
eerase();
return (FALSE);
}
if (s == CCHR('G')) {
ewprintf("");
eerase();
return (ctrlg(FFRAND, 1));
}
ewprintf("Please answer y or n. %s? (y or n) ", sp);
Expand All @@ -101,19 +101,19 @@ eynorr(const char *sp)
for (;;) {
s = getkey(FALSE);
if (s == 'y' || s == 'Y' || s == ' ') {
ewprintf("");
eerase();
return (TRUE);
}
if (s == 'n' || s == 'N' || s == CCHR('M')) {
ewprintf("");
eerase();
return (FALSE);
}
if (s == 'r' || s == 'R') {
ewprintf("");
eerase();
return (REVERT);
}
if (s == CCHR('G')) {
ewprintf("");
eerase();
return (ctrlg(FFRAND, 1));
}
ewprintf("Please answer y, n or r.");
Expand All @@ -137,7 +137,7 @@ eyesno(const char *sp)
EFNUL | EFNEW | EFCR, sp);
for (;;) {
if (rep == NULL) {
ewprintf("");
eerase();
return (ABORT);
}
if (rep[0] != '\0') {
Expand All @@ -149,11 +149,11 @@ eyesno(const char *sp)
free(lp);
}
if (strcasecmp(rep, "yes") == 0) {
ewprintf("");
eerase();
return (TRUE);
}
if (strcasecmp(rep, "no") == 0) {
ewprintf("");
eerase();
return (FALSE);
}
}
Expand Down
4 changes: 3 additions & 1 deletion funmap.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: funmap.c,v 1.63 2021/04/22 19:50:55 lum Exp $ */
/* $OpenBSD: funmap.c,v 1.64 2022/10/20 18:59:24 op Exp $ */

/* This file is in the public domain */

Expand Down Expand Up @@ -138,6 +138,8 @@ static struct funmap functnames[] = {
{killbuffer_cmd, "kill-buffer", 1},
{killline, "kill-line", 1},
{killpara, "kill-paragraph", 1},
{zaptochar, "zap-to-char", 1},
{zapuptochar, "zap-up-to-char", 1},
{killregion, "kill-region", 0},
{delfword, "kill-word", 1},
{toggleleavetmp, "leave-tmpdir-backups", 0},
Expand Down
4 changes: 2 additions & 2 deletions keymap.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: keymap.c,v 1.59 2021/04/20 10:02:50 lum Exp $ */
/* $OpenBSD: keymap.c,v 1.60 2022/10/20 18:59:24 op Exp $ */

/* This file is in the public domain. */

Expand Down Expand Up @@ -290,7 +290,7 @@ static PF metal[] = {
copyregion, /* w */
extend, /* x */
rescan, /* y */
rescan, /* z */
zaptochar, /* z */
gotobop, /* { */
piperegion, /* | */
gotoeop /* } */
Expand Down
11 changes: 9 additions & 2 deletions mg.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" $OpenBSD: mg.1,v 1.126 2022/03/31 17:27:25 naddy Exp $
.\" $OpenBSD: mg.1,v 1.127 2022/10/20 18:59:24 op Exp $
.\" This file is in the public domain.
.\"
.Dd $Mdocdate: March 31 2022 $
.Dd $Mdocdate: October 20 2022 $
.Dt MG 1
.Os
.Sh NAME
Expand Down Expand Up @@ -331,6 +331,8 @@ scroll-down
copy-region-as-kill
.It M-x
execute-extended-command
.It M-z
zap-to-char
.It M-{
backward-paragraph
.It M-|
Expand Down Expand Up @@ -986,6 +988,11 @@ Unlike emacs, the
kill buffer consists only
of the most recent kill.
It is not a ring.
.It zap-to-char
Ask for a character and delete text from the current cursor position
until the next instance of that character, including it.
.It zap-up-to-char
Like zap-to-char but doesn't delete the target character.
.El
.Sh MG DIRED KEY BINDINGS
Specific key bindings are available in dired mode.
Expand Down
73 changes: 72 additions & 1 deletion search.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: search.c,v 1.47 2018/07/11 12:21:37 krw Exp $ */
/* $OpenBSD: search.c,v 1.48 2022/10/20 18:59:24 op Exp $ */

/* This file is in the public domain. */

Expand Down Expand Up @@ -853,3 +853,74 @@ readpattern(char *r_prompt)
retval = FALSE;
return (retval);
}

/*
* Prompt for a character and kill until its next occurrence,
* including it. Mark is cleared afterwards.
*/
int
zaptochar(int f, int n)
{
return (zap(TRUE, n));
}

/* Like zaptochar but stops before the character. */
int
zapuptochar(int f, int n)
{
return (zap(FALSE, n));
}

/*
* Prompt for a charcter and deletes from the point up to, optionally
* including, the first instance of that charcters. Marks is cleared
* afterwards.
*/
int
zap(int including, int n)
{
int s, backward;

backward = n < 0;
if (backward)
n = -n;

if (including)
ewprintf("Zap to char: ");
else
ewprintf("Zap up to char: ");

s = getkey(FALSE);
eerase();
if (s == ABORT || s == CCHR('G'))
return (FALSE);

if (n == 0)
return (TRUE);

pat[0] = (char)s;
pat[1] = '\0';

isetmark();
while (n--) {
s = backward ? backsrch() : forwsrch();
if (s != TRUE) {
dobeep();
ewprintf("Search failed: \"%s\"", pat);
swapmark(FFARG, 0);
clearmark(FFARG, 0);
return (s);
}
}

if (!including) {
if (backward)
forwchar(FFARG, 1);
else
backchar(FFARG, 1);
}

killregion(FFARG, 0);
clearmark(FFARG, 0);
return (TRUE);
}

0 comments on commit 5dbacce

Please sign in to comment.