diff options
author | bptato <nincsnevem662@gmail.com> | 2024-03-16 20:42:58 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-03-16 20:44:51 +0100 |
commit | 3ba8a90c72c3dcc635eda57329d2dc6e950f9d2a (patch) | |
tree | 8605b54c0710d82daa55409dc2313ea3470679a8 /src/local | |
parent | 9aa8e20bd5552916c6b382659224f1003b02dbc7 (diff) | |
download | chawan-3ba8a90c72c3dcc635eda57329d2dc6e950f9d2a.tar.gz |
pager: fix disappearing buffers when reload fails
we do have logic for this in replace(), but it was not working because setContainer changed the buffer too early.
Diffstat (limited to 'src/local')
-rw-r--r-- | src/local/pager.nim | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/local/pager.nim b/src/local/pager.nim index 5c56643b..9ad854c4 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -728,6 +728,7 @@ proc deleteContainer(pager: Pager; container: Container) = if container.sourcepair != nil: container.sourcepair.sourcepair = nil container.sourcepair = nil + var setTarget: Container = nil if container.parent != nil: let parent = container.parent let n = parent.children.find(container) @@ -737,29 +738,27 @@ proc deleteContainer(pager: Pager; container: Container) = child.parent = container.parent parent.children.insert(child, n + 1) parent.children.delete(n) - if container == pager.container: - if n == 0: - pager.setContainer(parent) - else: - pager.setContainer(parent.children[n - 1]) + if n == 0: + setTarget = parent + else: + setTarget = parent.children[n - 1] elif container.children.len > 0: let parent = container.children[0] parent.parent = nil for i in 1..container.children.high: container.children[i].parent = parent parent.children.add(container.children[i]) - if container == pager.container: - pager.setContainer(parent) + setTarget = parent else: for child in container.children: child.parent = nil - if container == pager.container: - pager.setContainer(nil) container.parent = nil container.children.setLen(0) if container.replace != nil: pager.replace(container, container.replace) container.replace = nil + elif pager.container == container: + pager.setContainer(setTarget) pager.unreg.add(container) if container.process != -1: pager.forkserver.removeChild(container.process) |