diff options
author | bptato <nincsnevem662@gmail.com> | 2025-01-01 16:58:50 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2025-01-01 17:03:50 +0100 |
commit | 6ac50899d942db740797c9d3277d04b7a535159e (patch) | |
tree | fa6f567720ca05a1416fca60227d42285387001d /src | |
parent | 22a5167a13446e0115d4dc7307a51f6472017b56 (diff) | |
download | chawan-6ac50899d942db740797c9d3277d04b7a535159e.tar.gz |
pager: history fixes
* add failed buffers to history too * make buffer.history and siteconf history actually do something * prevent history in dump mode after retry too * disable history in test configs ref. https://todo.sr.ht/~bptato/chawan/39
Diffstat (limited to 'src')
-rw-r--r-- | src/local/pager.nim | 11 | ||||
-rw-r--r-- | src/server/buffer.nim | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/local/pager.nim b/src/local/pager.nim index c3f5e6a4..c3f0f661 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -1814,6 +1814,7 @@ proc applySiteconf(pager: Pager; url: URL; charsetOverride: Charset; images: pager.config.buffer.images, styling: pager.config.buffer.styling, autofocus: pager.config.buffer.autofocus, + history: pager.config.buffer.history, isdump: pager.config.start.headless, charsetOverride: charsetOverride, protocol: pager.config.protocol, @@ -1885,6 +1886,8 @@ proc applySiteconf(pager: Pager; url: URL; charsetOverride: Charset; result.autofocus = sc.autofocus.get if sc.meta_refresh.isSome: result.metaRefresh = sc.meta_refresh.get + if sc.history.isSome: + result.history = sc.history.get loaderConfig.filter.allowschemes .add(pager.config.external.urimethodmap.imageProtos) if result.images: @@ -1928,7 +1931,7 @@ proc gotoURL(pager: Pager; request: Request; prevurl = none(URL); var flags = {cfCanReinterpret, cfUserRequested} if save: flags.incl(cfSave) - if history: + if history and bufferConfig.history: flags.incl(cfHistory) let container = pager.newContainer( bufferConfig, @@ -2585,8 +2588,12 @@ proc fail(pager: Pager; container: Container; errorMessage: string) = pager.deleteContainer(container, container.find(ndAny)) if container.retry.len > 0: discard pager.gotoURL(newRequest(container.retry.pop()), - contentType = container.contentType) + contentType = container.contentType, + history = cfHistory in container.flags) else: + # Add to the history anyway, so that the user can edit the URL. + if cfHistory in container.flags: + pager.lineHist[lmLocation].add($container.url) # Try to fit a meaningful part of the URL and the error message too. # URLs can't include double-width chars, so we can just use string # length for those. (However, error messages can.) diff --git a/src/server/buffer.nim b/src/server/buffer.nim index 3456abb2..aceb5c6e 100644 --- a/src/server/buffer.nim +++ b/src/server/buffer.nim @@ -132,6 +132,7 @@ type images*: bool isdump*: bool autofocus*: bool + history*: bool charsetOverride*: Charset metaRefresh*: MetaRefresh charsets*: seq[Charset] |