View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000492 | tcsh | General | public | 2023-12-01 21:51 | 2023-12-02 03:08 |
| Reporter | MProG10 | Assigned To | |||
| Priority | normal | Severity | feature | Reproducibility | N/A |
| Status | new | Resolution | open | ||
| Summary | 0000492: Support for interactive comments. | ||||
| Description | This was requested in the mailing list. I took the time to implement. | ||||
| Additional Information | https://mailman.astron.com/pipermail/tcsh/2023-August/000331.html https://github.com/tcsh-org/tcsh/pull/89 | ||||
| Tags | No tags attached. | ||||
|
|
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.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;
}
|