~ecs/mrsh-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH madeline v2] Add ^g to cancel search

Details
Message ID
<20230228224600.15432-1-sebastian@sebsite.pw>
DKIM signature
pass
Download raw message
Patch: +6 -0
^g behaves identically to ^d (when at the end of the line). ^g is
near-universally recognized in readline-esque programs.

Signed-off-by: Sebastian <sebastian@sebsite.pw>
---
Since v1: keep behavior of ^d

 made/line.ha | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/made/line.ha b/made/line.ha
index 7b3344d..94f2d02 100644
--- a/made/line.ha
+++ b/made/line.ha
@@ -58,6 +58,7 @@ export fn line(cfg: (*config | str)) (str | void | io::EOF | error) = {
				delete(s.buf[s.pos..nextchr(s.buf, s.pos)]);
			} else if (s.searching) {
				s.searching = false;
				s.hidx = len(hist(&s));
			} else if (len(s.buf) == 0) {
				return io::EOF;
			};
@@ -69,6 +70,11 @@ export fn line(cfg: (*config | str)) (str | void | io::EOF | error) = {
			} else {
				next(&s, false);
			};
		case '\x07' => // ^g
			if (s.searching) {
				s.searching = false;
				s.hidx = len(hist(&s));
			};
		case '\x08', '\x7f' => // ^h, backspace
			if (s.pos > 0) {
				s.pos = prevchr(s.buf, s.pos);
-- 
2.38.4
Details
Message ID
<CQUMXYLNRXGA.2VWPP9LLTKYR@monch>
In-Reply-To
<20230228224600.15432-1-sebastian@sebsite.pw> (view parent)
DKIM signature
missing
Download raw message
thanks!

To git@git.d2evs.net:~ecs/madeline
   04c2052..872fa27  madeline -> madeline
Reply to thread Export thread (mbox)