about summary refs log tree commit diff stats
path: root/display.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2021-01-31 22:23:59 +0100
committerbptato <nincsnevem662@gmail.com>2021-01-31 22:23:59 +0100
commite3a2ad473e2239bef3726e3ad6657f5f41c9462c (patch)
treecf2c16ee833c74826eda397780ff8b51d0689e97 /display.nim
parent5d79801b655aae7801fb27fc3a9422bdd5764882 (diff)
downloadchawan-e3a2ad473e2239bef3726e3ad6657f5f41c9462c.tar.gz
New html parser now does things, however pages are rendered upside down
Diffstat (limited to 'display.nim')
-rw-r--r--display.nim9
1 files changed, 4 insertions, 5 deletions
diff --git a/display.nim b/display.nim
index 78401598..da34f6c5 100644
--- a/display.nim
+++ b/display.nim
@@ -172,7 +172,7 @@ proc postAlignNode(buffer: Buffer, node: HtmlNode, state: var RenderState) =
     buffer.flushLine(state)
 
 proc renderNode(buffer: Buffer, node: HtmlNode, state: var RenderState) =
-  if node.isDocument() or node.parentNode == nil:
+  if node.isDocument():
     return
   let elem = node.nodeAttr()
   if elem.tagType == TAG_TITLE:
@@ -275,9 +275,8 @@ proc nrenderHtml*(buffer: Buffer) =
     let currElem = stack.pop()
     buffer.addNode(currElem)
     buffer.renderNode(currElem, state)
-    if currElem.childNodes.len > 0:
-      for item in currElem.childNodes:
-        stack.add(item)
+    for item in currElem.childNodes:
+      stack.add(item)
 
   buffer.setLastHtmlLine(state)
 
@@ -288,7 +287,7 @@ proc drawHtml(buffer: Buffer) =
   buffer.setLastHtmlLine(state)
 
 proc statusMsgForBuffer(buffer: Buffer) =
-  var msg = $buffer.cursory & "/" & $buffer.lastLine() & " (" &
+  var msg = $(buffer.cursory + 1) & "/" & $(buffer.lastLine() + 1) & " (" &
             $buffer.atPercentOf() & "%) " &
             "<" & buffer.title & ">"
   if buffer.hovertext.len > 0: