diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-08-11 14:17:46 +0200 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-08-11 14:49:21 +0200 |
| commit | a766983bff89b834017c08b252c2de1d3a2c5b4d (patch) | |
| tree | 6043fd1a6f3aaa86ee4d7332cce64248e917e817 /src/local | |
| parent | a0c6f80f76d60bc2bb36942d4162b90e6b5aa2a2 (diff) | |
| download | chawan-a766983bff89b834017c08b252c2de1d3a2c5b4d.tar.gz | |
mailcap: various fixes
* parse last line even if it doesn't end with LF
* parse flags & named fields case-insensitively
* update naming
Diffstat (limited to 'src/local')
| -rw-r--r-- | src/local/pager.nim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/local/pager.nim b/src/local/pager.nim index 354b1dc5..a0c2d221 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -1603,7 +1603,7 @@ proc ansiDecode(pager: Pager; url: URL; ishtml: var bool; fdin: cint): cint = else: discard close(pipefdOutAnsi[1]) discard close(fdin) - ishtml = HTMLOUTPUT in entry.flags + ishtml = mfHtmloutput in entry.flags return pipefdOutAnsi[0] # Pipe input into the mailcap command, then read its output into a buffer. @@ -1800,11 +1800,11 @@ proc checkMailcap(pager: Pager; container: Container; stream: SocketStream; tempfile var canpipe = true let cmd = unquoteCommand(entry.cmd, contentType, outpath, url, canpipe) - var ishtml = HTMLOUTPUT in entry.flags - let needsterminal = NEEDSTERMINAL in entry.flags + var ishtml = mfHtmloutput in entry.flags + let needsterminal = mfNeedsterminal in entry.flags putEnv("MAILCAP_URL", $url) block needsConnect: - if entry.flags * {COPIOUSOUTPUT, HTMLOUTPUT, ANSIOUTPUT} == {}: + if entry.flags * {mfCopiousoutput, mfHtmloutput, mfAnsioutput} == {}: # No output. Resume here, so that blocking needsterminal filters work. pager.loader.resume(istreamOutputId) if canpipe: @@ -1823,7 +1823,7 @@ proc checkMailcap(pager: Pager; container: Container; stream: SocketStream; else: pager.runMailcapReadFile(stream, cmd, outpath, pipefdOut) discard close(pipefdOut[1]) # close write - let fdout = if not ishtml and ANSIOUTPUT in entry.flags: + let fdout = if not ishtml and mfAnsioutput in entry.flags: pager.ansiDecode(url, ishtml, pipefdOut[0]) else: pipefdOut[0] |