M config/config => config/config +2 -0
@@ 6,6 6,8 @@ up=k
next=n
previous=p
quit=q
+top=g
+bottom=G
[Posts]
# The maximum width for wrapping the posts
M src/romanpkg/config.nim => src/romanpkg/config.nim +2 -0
@@ 43,6 43,8 @@ proc mustLoadConfig*(): RomanConfig {.raises: [].} =
result.next = strToChar(dict, "Keyboard", "next")
result.previous = strToChar(dict, "Keyboard", "previous")
result.quit = strToChar(dict, "Keyboard", "quit")
+ result.goToTop = strToChar(dict, "Keyboard", "top")
+ result.goToBottom = strToChar(dict, "Keyboard", "bottom")
result.postWidth = strToInt(dict, "Posts", "max-width")
except:
echo "error loading config file: " & getCurrentExceptionMsg()
M src/romanpkg/posts.nim => src/romanpkg/posts.nim +6 -2
@@ 10,6 10,7 @@ import errors
import htmlextractor
import paths
+from config import conf
from types import Post
@@ 46,10 47,13 @@ proc isPostRead(itemGUID: string): bool {.raises: [RomanError].} =
proc displayPost*(p: Post) {.raises: [RomanError].} =
try:
+ var content: string
if p.author.isSome:
- page(p.title & "\n" & p.author.unsafeGet & "\n\n" & p.content)
+ content = p.title & "\n" & p.author.unsafeGet & "\n\n" & p.content
else:
- page(p.title & "\n\n" & p.content)
+ content = p.title & "\n\n" & p.content
+ page(content, goToBottom = conf.goToBottom, goToTop = conf.goToTop,
+ upOne = conf.up, downOne = conf.down, quitChar = conf.quit)
except IOError, ValueError:
let msg = getCurrentExceptionMsg()
raise newException(RomanError, "could not write to the terminal: " & msg)
M src/romanpkg/types.nim => src/romanpkg/types.nim +2 -0
@@ 8,6 8,8 @@ type
next*: char
previous*: char
quit*: char
+ goToTop*: char
+ goToBottom*: char
postWidth*: int
Subscription* = object