diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-16 15:21:53 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-16 15:21:53 +0100 |
commit | cadad89534e46c1465a0b33b6d7c1564afc33a19 (patch) | |
tree | f47cba1ba132df9a7a023414e911bfc06160bc32 /src/display | |
parent | 1f701c31d47f48d86e825f291004a2df8541bdf2 (diff) | |
download | chawan-cadad89534e46c1465a0b33b6d7c1564afc33a19.tar.gz |
discardTree only kills child buffers, fix discardBuffer
Diffstat (limited to 'src/display')
-rw-r--r-- | src/display/pager.nim | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/display/pager.nim b/src/display/pager.nim index 9bce0e48..98b5da25 100644 --- a/src/display/pager.nim +++ b/src/display/pager.nim @@ -427,7 +427,10 @@ proc deleteContainer(pager: Pager, container: Container) = parent.children.insert(child, n + 1) parent.children.delete(n) if container == pager.container: - pager.setContainer(parent) + if n == 0: + pager.setContainer(parent) + else: + pager.setContainer(parent.children[n - 1]) elif container.children.len > 0: let parent = container.children[0] parent.parent = nil @@ -458,9 +461,8 @@ proc discardTree(pager: Pager, container = none(Container)) {.jsfunc.} = if container != nil: for c in container.all_children: pager.deleteContainer(c) - pager.discardBuffer(some(container)) else: - pager.alert("Cannot discard last buffer!") + pager.alert("Buffer has no children!") proc toggleSource*(pager: Pager) {.jsfunc.} = if pager.container.sourcepair != nil: |