about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--res/config.toml2
-rw-r--r--src/display/pager.nim7
2 files changed, 8 insertions, 1 deletions
diff --git a/res/config.toml b/res/config.toml
index bf2d231c..cfb267eb 100644
--- a/res/config.toml
+++ b/res/config.toml
@@ -61,7 +61,7 @@ C-k = 'pager.load("ddg:")'
 U = 'pager.reload()'
 r = 'pager.redraw()'
 R = 'pager.reshape()'
-C-c = 'pager.cancel()'
+M-D = 'pager.cancel()'
 1G = 'pager.cursorFirstLine()'
 g = 'pager.cursorFirstLine()'
 G = 'pager.cursorLastLine()'
diff --git a/src/display/pager.nim b/src/display/pager.nim
index eff8c322..464e7323 100644
--- a/src/display/pager.nim
+++ b/src/display/pager.nim
@@ -666,6 +666,10 @@ proc handleEvent0(pager: Pager, container: Container, event: ContainerEvent): bo
       return false
   of SUCCESS:
     if container.replace != nil:
+      let n = container.replace.children.find(container)
+      if n != -1:
+        container.replace.children.delete(n)
+        container.parent = nil
       container.children.add(container.replace.children)
       for child in container.children:
         child.parent = container
@@ -675,8 +679,11 @@ proc handleEvent0(pager: Pager, container: Container, event: ContainerEvent): bo
         let n = container.replace.parent.children.find(container.replace)
         assert n != -1, "Container not a child of its parent"
         container.parent.children[n] = container
+        container.replace.parent = nil
       if pager.container == container.replace:
         pager.setContainer(container)
+      pager.deleteContainer(container.replace)
+      container.replace = nil
   of LOADED:
     dec pager.numload
   of NEEDS_AUTH: