From 697685d7954474e046afc4477a3ea24f628314e0 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Sat, 20 Jul 2019 17:05:14 -0400 Subject: Handle media copy sequence in shotty This all still feels a bit gross for some reason. --- bin/man1/shotty.1 | 4 ++++ bin/shotty.c | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/bin/man1/shotty.1 b/bin/man1/shotty.1 index 1f747ee8..3ca3ef4b 100644 --- a/bin/man1/shotty.1 +++ b/bin/man1/shotty.1 @@ -35,6 +35,10 @@ and .Ev TERM Ns = Ns Cm xterm-256color as used by .Xr ncurses 3 . +A snapshot of the terminal +is output each time +a media copy sequence occurs, +or once at the end of the capture. . .Pp HTML output uses the classes diff --git a/bin/shotty.c b/bin/shotty.c index fac1e044..41cb4e97 100644 --- a/bin/shotty.c +++ b/bin/shotty.c @@ -74,7 +74,10 @@ static void move(struct Cell *dst, struct Cell *src, uint len) { } static struct { - bool debug, cursor, bright; + bool debug; + bool cursor; + bool bright; + bool done; } opts; static void span(const struct Style *prev, const struct Cell *cell) { @@ -186,6 +189,7 @@ static char updateNUL(wchar_t ch) { X(']', OSC) \ X('d', VPA) \ X('h', SM) \ + X('i', MC) \ X('l', RM) \ X('m', SGR) \ X('r', DECSTBM) @@ -211,6 +215,7 @@ static char updateESC(wchar_t ch) { switch (ch) { case '(': discard = true; return ESC; case '=': return NUL; + case '>': return NUL; case CSI: return CSI; case OSC: return OSC; default: warnx("unhandled ESC %lc", ch); return NUL; @@ -338,8 +343,13 @@ static char updateCSI(wchar_t ch) { scroll.bot = (n > 1 ? ps[1] - 1 : rows - 1); } - break; case 't': // ignore + break; case MC: { + if (ps[0] != 10) break; + opts.done = true; + html(); + } + break; case 't': // ignore break; default: warnx("unhandled CSI %lc", ch); } @@ -432,5 +442,5 @@ int main(int argc, char *argv[]) { } if (ferror(file)) err(EX_IOERR, "getwc"); - html(); + if (!opts.done) html(); } -- cgit 1.4.1 nput type='submit' value='search'/>
path: root/tests/.gitignore (unfollow)
Commit message (Expand)Author
2014-01-23simple-authentication: styleJason A. Donenfeld
2014-01-22makefile: use LUA_PKGCONFIG to set Lua implementationNatanael Copa
2014-01-20tests: only do lua tests if lua is compiled-inJason A. Donenfeld
2014-01-20cgit: add --version argument for printing infoJason A. Donenfeld
2014-01-19cache: use sendfile() instead of a pair of read() + write()Sebastian Andrzej Siewior
2014-01-19README: document pkg-config for luajitJason A. Donenfeld
2014-01-17makefile: bump versionJason A. Donenfeld
2014-01-17mailmap: source before lighttpdJason A. Donenfeld
2014-01-17ui-shared: do not allow negative minutesJason A. Donenfeld
2014-01-17auth: document tweakables in lua scriptJason A. Donenfeld
2014-01-17repolist: make owner clickable to searchJason A. Donenfeld
2014-01-17ui-shared: move about tab all the way to the leftJason A. Donenfeld
2014-01-17filter: don't forget to reap the auth filterJason A. Donenfeld
2014-01-17cgit.c: free tmp variableJason A. Donenfeld
2014-01-17Switch to exclusively using global ctxLukas Fleischer
2014-01-16auth: have cgit calculate login addressJason A. Donenfeld
2014-01-16auth: lua string comparisons are time invariantJason A. Donenfeld
2014-01-16authentication: use hidden form instead of refererJason A. Donenfeld
2014-01-16auth: add basic authentication filter frameworkJason A. Donenfeld
2014-01-16t0111: Additions and fixesLukas Fleischer
2014-01-16parsing.c: Remove leading space from committerLukas Fleischer