From 2c087d701becb78efc0d40ddbb82e11641df6643 Mon Sep 17 00:00:00 2001 From: bptato Date: Thu, 4 Jul 2024 19:53:29 +0200 Subject: config: add buffer.autofocus Same as [[siteconf]] autofocus. --- doc/config.md | 15 ++++++++++++--- src/config/config.nim | 1 + src/local/pager.nim | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/config.md b/doc/config.md index e1b359f5..b55cf74b 100644 --- a/doc/config.md +++ b/doc/config.md @@ -120,7 +120,8 @@ Following is a list of buffer options: styling boolean Enable/disable author style sheets. Note that disabling this does not affect -user styles set in `[css]`. +user styles set in `[css]`.
+Defaults to true (i.e. enabled). @@ -158,6 +159,14 @@ option disabled, only enabling it for specific sites in `[[siteconf]]`. + +autofocus +boolean +When set to true, elements with an "autofocus" attribute are focused on +automatically after the buffer is loaded.
+Defaults to false + + ## Search @@ -784,8 +793,8 @@ are doing. autofocus boolean -Defaults to false. When set to true, elements with an `autofocus' attribute -are focused on automatically after the buffer is loaded. +When set to true, elements with an "autofocus" attribute are focused on +automatically after the buffer is loaded. Overrides buffer.autofocus. diff --git a/src/config/config.nim b/src/config/config.nim index 4e9d1517..1ab77f01 100644 --- a/src/config/config.nim +++ b/src/config/config.nim @@ -147,6 +147,7 @@ type images* {.jsgetset.}: bool cookie* {.jsgetset.}: bool referer_from* {.jsgetset.}: bool + autofocus* {.jsgetset.}: bool Config* = ref object jsctx: JSContext diff --git a/src/local/pager.nim b/src/local/pager.nim index f3d4d79a..f6345dfb 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -1115,6 +1115,7 @@ proc applySiteconf(pager: Pager; url: var URL; charsetOverride: Charset; charsets: pager.config.encoding.document_charset, images: pager.config.buffer.images, styling: pager.config.buffer.styling, + autofocus: pager.config.buffer.autofocus, isdump: pager.config.start.headless, charsetOverride: charsetOverride, protocol: pager.config.protocol -- cgit