View Issue Details

IDProjectCategoryView StatusLast Update
0000492tcshGeneralpublic2023-12-02 03:08
ReporterMProG10 Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Summary0000492: Support for interactive comments.
DescriptionThis was requested in the mailing list. I took the time to implement.
Additional Informationhttps://mailman.astron.com/pipermail/tcsh/2023-August/000331.html
https://github.com/tcsh-org/tcsh/pull/89
TagsNo tags attached.

Activities

MProG10

2023-12-02 03:08

reporter   ~0003983

sh.lex.c.diff (545 bytes)   
--- a/sh.lex.c
+++ b/sh.lex.c
@@ -148,8 +148,7 @@ lex(struct wordent *hp)
     int     parsehtime = enterhist;
     int	    toolong = 0;
 
-    histvalid = 0;
-    histline.len = 0;
+    histvalid = histline.len = 0;
 
     if (!postcmd_active)
 	btell(&lineloc);
@@ -358,6 +357,13 @@ loop:
 	default:
 	    break;
 	}
+    if (intty && c == '#') {
+	Strbuf_append1(&wbuf, c);
+	while ((c = readc(1)) != CHAR_ERR && c != '\n')
+	    Strbuf_append1(&wbuf, c);
+	unreadc('\n');
+	goto ret;
+    }
     c1 = 0;
     dolflg = DOALL;
     for (;;) {
sh.lex.c.diff (545 bytes)   
sh.parse.c.diff (680 bytes)   
--- a/sh.parse.c
+++ b/sh.parse.c
@@ -207,7 +207,7 @@ syntax(const struct wordent *p1, const struct wordent *p2, int flags)
 {
 
     while (p1 != p2)
-	if (any(";&\n", p1->word[0]))
+	if (any(intty ? ";&\n#" : ";&\n", p1->word[0]))
 	    p1 = p1->next;
 	else
 	    return (syn0(p1, p2, flags));
@@ -273,6 +273,16 @@ syn0(const struct wordent *p1, const struct wordent *p2, int flags)
 	    t->t_dcar = t1;
 	    t->t_dcdr = syntax(p, p2, flags);
 	    return (t);
+
+	case '#':
+	    if (intty) {
+		struct wordent *p1 = p2->prev;
+
+		p1 = p1->prev = p1->prev->prev;
+		xfree(p1->next->word);
+		xfree(p1->next);
+		p = p1->next = p2->prev;
+	    }
 	default:
 	    break;
 	}
sh.parse.c.diff (680 bytes)   

Issue History

Date Modified Username Field Change
2023-12-01 21:51 MProG10 New Issue
2023-12-02 03:08 MProG10 Note Added: 0003983
2023-12-02 03:08 MProG10 File Added: sh.lex.c.diff
2023-12-02 03:08 MProG10 File Added: sh.parse.c.diff