about summary refs log tree commit diff stats
path: root/src/buffer/buffer.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-01-03 04:06:49 +0100
committerbptato <nincsnevem662@gmail.com>2023-01-03 04:07:21 +0100
commita55be67a650d049d01b70514f94fe8ad409f770c (patch)
treed8941f04a3c9b9987d07eb135c9a92b9723796e5 /src/buffer/buffer.nim
parentade7206183ba1ea22c6b3d8c1f02deb489019e69 (diff)
downloadchawan-a55be67a650d049d01b70514f94fe8ad409f770c.tar.gz
buffer: fix infinite loop in getClickable
Diffstat (limited to 'src/buffer/buffer.nim')
-rw-r--r--src/buffer/buffer.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/buffer/buffer.nim b/src/buffer/buffer.nim
index f54158e1..51c09616 100644
--- a/src/buffer/buffer.nim
+++ b/src/buffer/buffer.nim
@@ -263,13 +263,14 @@ func getClickable(styledNode: StyledNode): Element =
     let element = Element(styledNode.node)
     if element.tagType in ClickableElements and (element.tagType != TAG_A or HTMLAnchorElement(element).href != ""):
       return element
-  result = styledNode.node
+  var node = styledNode.node
   while true:
-    result = result.findAncestor(ClickableElements)
+    result = node.findAncestor(ClickableElements)
     if result == nil:
       break
     if result.tagType != TAG_A or HTMLAnchorElement(result).href != "":
       break
+    node = result
 
 func getClickHover(styledNode: StyledNode): string =
   let clickable = styledNode.getClickable()