From: krw Date: Wed, 11 Jul 2018 12:21:37 +0000 (+0000) Subject: When in incremental search handle ^M (a.k.a. ) like ^[ (a.k.a. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5b6ba03a9429768e9d788597969ec8a50a7b9817;p=openbsd When in incremental search handle ^M (a.k.a. ) like ^[ (a.k.a. ). i.e. exit incremental search and set the mark. This is what emacs does. pointers, suggestions and ok florian@ --- diff --git a/usr.bin/mg/search.c b/usr.bin/mg/search.c index 2339688699e..fa12b4094aa 100644 --- a/usr.bin/mg/search.c +++ b/usr.bin/mg/search.c @@ -1,4 +1,4 @@ -/* $OpenBSD: search.c,v 1.46 2017/08/06 04:39:45 bcallah Exp $ */ +/* $OpenBSD: search.c,v 1.47 2018/07/11 12:21:37 krw Exp $ */ /* This file is in the public domain. */ @@ -159,10 +159,11 @@ backisearch(int f, int n) /* * Incremental Search. * dir is used as the initial direction to search. + * ^M exit from Isearch, set mark * ^S switch direction to forward * ^R switch direction to reverse * ^Q quote next character (allows searching for ^N etc.) - * exit from Isearch + * exit from Isearch, set mark * undoes last character typed. (tricky job to do this correctly). * other ^ exit search, don't set mark * else accumulate into search string @@ -213,6 +214,8 @@ isearch(int dir) */ if (ttwait(300) == FALSE) ungetkey(c); + /* FALLTHRU */ + case CCHR('M'): srch_lastdir = dir; curwp->w_markp = clp; curwp->w_marko = cbo; @@ -360,9 +363,6 @@ isearch(int dir) case CCHR('Q'): c = (char)getkey(FALSE); goto addchar; - case CCHR('M'): - c = CCHR('J'); - goto addchar; default: if (ISCTRL(c)) { ungetkey(c);