diff options
author | bptato <nincsnevem662@gmail.com> | 2023-12-15 02:25:02 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-12-15 02:25:02 +0100 |
commit | de2a1e6b245f573772d2c69d403271db8ceae2fe (patch) | |
tree | b6c6e0f9e4f85c37b160018d6b288ff0bf153020 /src | |
parent | 16f7b0976a016f91858f612e712c1e7e85ff823f (diff) | |
download | chawan-de2a1e6b245f573772d2c69d403271db8ceae2fe.tar.gz |
container: track ishtml status
This way we can at least view HTML source of x-htmloutput filtered buffers. TODO: make it render the actual source instead.
Diffstat (limited to 'src')
-rw-r--r-- | src/local/container.nim | 3 | ||||
-rw-r--r-- | src/local/pager.nim | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/local/container.nim b/src/local/container.nim index 8a0ae37e..8874c2d0 100644 --- a/src/local/container.nim +++ b/src/local/container.nim @@ -120,6 +120,7 @@ type tmpJumpMark: PagePos jumpMark: PagePos marks: Table[string, PagePos] + ishtml*: bool jsDestructor(Highlight) jsDestructor(Container) @@ -1200,6 +1201,7 @@ proc load(container: Container) = "application/octet-stream", container.config.mimeTypes) if contentType != "application/octet-stream": container.iface.setContentType(contentType) + container.ishtml = contentType == "text/html" container.source.contentType = some(contentType) else: container.source.contentType = some(res.contentType) @@ -1225,6 +1227,7 @@ proc redirectToFd*(container: Container, fdin: FileHandle, wait: bool): proc readFromFd*(container: Container, fdout: FileHandle, ishtml: bool): EmptyPromise = + container.ishtml = ishtml return container.iface.readFromFd(fdout, ishtml) proc quit*(container: Container) = diff --git a/src/local/pager.nim b/src/local/pager.nim index a6a4d77b..ab250986 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -619,7 +619,7 @@ proc toggleSource(pager: Pager) {.jsfunc.} = if pager.container.sourcepair != nil: pager.setContainer(pager.container.sourcepair) else: - let contentType = if pager.container.contentType.get("") == "text/html": + let contentType = if pager.container.ishtml: "text/plain" else: "text/html" |