about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buffer/buffer.nim6
-rw-r--r--src/display/pager.nim7
-rw-r--r--src/layout/engine.nim12
3 files changed, 16 insertions, 9 deletions
diff --git a/src/buffer/buffer.nim b/src/buffer/buffer.nim
index 2acf0e6c..b6acf2b0 100644
--- a/src/buffer/buffer.nim
+++ b/src/buffer/buffer.nim
@@ -873,9 +873,11 @@ proc launchBuffer*(config: BufferConfig, source: BufferSource,
     config: config,
     loader: loader,
     bsource: source,
-    sstream: newStringStream()
+    sstream: newStringStream(),
+    viewport: Viewport(window: attrs),
+    width: attrs.width,
+    height: attrs.height - 1
   )
-  buffer.windowChange()
   buffer.selector = newSelector[int]()
   let sstream = connectSocketStream(mainproc, false)
   sstream.swrite(getpid())
diff --git a/src/display/pager.nim b/src/display/pager.nim
index fdce5cc0..a7f4a1d6 100644
--- a/src/display/pager.nim
+++ b/src/display/pager.nim
@@ -581,7 +581,11 @@ proc authorize*(pager: Pager) =
   pager.setLineEdit(readLine("Username: ", pager.attrs.width, config = pager.config, tty = pager.tty), USERNAME)
 
 proc handleEvent*(pager: Pager, container: Container): bool =
-  let event = container.handleEvent()
+  var event: ContainerEvent
+  try:
+    event = container.handleEvent()
+  except IOError:
+    return false
   case event.t
   of FAIL:
     pager.deleteContainer(container)
@@ -589,6 +593,7 @@ proc handleEvent*(pager: Pager, container: Container): bool =
       pager.gotoURL(newRequest(container.retry.pop()), ctype = container.contenttype)
     else:
       pager.alert("Couldn't load " & $container.source.location & " (error code " & $container.code & ")")
+      pager.refreshStatusMsg()
     if pager.container == nil:
       return false
   of SUCCESS:
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 2cdee818..1f2fef98 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -637,18 +637,17 @@ proc preBuildTableRow(pctx: var TableContext, box: TableRowBoxBuilder, parent: B
     pctx.colwidths.setLen(box.children.len)
   var n = 0
   var i = 0
-  var rctx: RowContext
   for child in box.children:
     assert child.computed{"display"} == DISPLAY_TABLE_CELL
     let cellbuilder = TableCellBoxBuilder(child)
     let cell = buildTableCell(cellbuilder, parent)
     ctx.cells[i] = CellWrapper(box: cell, builder: cellbuilder, colspan: cellbuilder.colspan)
     let pwidth = cellbuilder.computed{"width"}
-    if pctx.colwidths.len <= n:
-      pctx.colwidths.setLen(n + 1)
-    if pctx.colwidths_specified.len <= n:
+    if pctx.colwidths.len <= n + cellbuilder.colspan:
+      pctx.colwidths.setLen(n + cellbuilder.colspan)
+    if pctx.colwidths_specified.len <= n + cellbuilder.colspan:
       if not pwidth.auto:
-        pctx.colwidths_specified.setLen(n + 1)
+        pctx.colwidths_specified.setLen(n + cellbuilder.colspan)
     for i in n ..< n + cellbuilder.colspan:
       pctx.colwidths[i] = max(cell.width div cellbuilder.colspan, pctx.colwidths[i])
       if not pwidth.auto:
@@ -1019,6 +1018,7 @@ proc generateTableRowBox(styledNode: StyledNode, viewport: Viewport): TableRowBo
           ibox = getTextBox(styledNode.computed)
           ibox.node = styledNode
         ibox.text.add(child.text)
+  box.generateTableRowChildWrappers()
   return box
 
 proc generateTableRowGroupChildWrappers(box: TableRowGroupBoxBuilder) =
@@ -1047,6 +1047,7 @@ proc generateTableRowGroupBox(styledNode: StyledNode, viewport: Viewport): Table
           ibox = getTextBox(styledNode.computed)
           ibox.node = styledNode
         ibox.text.add(child.text)
+  box.generateTableRowGroupChildWrappers()
   return box
 
 proc generateTableChildWrappers(box: TableBoxBuilder) =
@@ -1071,7 +1072,6 @@ proc generateTableBox(styledNode: StyledNode, viewport: Viewport): TableBoxBuild
     let s = Element(styledNode.node).attr("width")
     box.width = parseDimensionValues(s)
   var ibox: InlineBoxBuilder = nil
-  var listItemCounter = 1
   for child in styledNode.children:
     if child.t == STYLED_ELEMENT:
       generateFromElem(child, blockgroup, viewport, ibox)