about summary refs log tree commit diff stats
path: root/src/server
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-02-13 01:21:39 +0100
committerbptato <nincsnevem662@gmail.com>2024-02-13 01:23:29 +0100
commit955f5baca85203fbf21f9e734828d694a44777b1 (patch)
tree75398feef3b3f0da707121ad5e376421a58290e7 /src/server
parent178a5357136a225136691c78216536d7897ecba6 (diff)
downloadchawan-955f5baca85203fbf21f9e734828d694a44777b1.tar.gz
buffer: fix wrong click behavior with JS
do_reshape could move the target element, and thus call click on the
wrong clickable.
Diffstat (limited to 'src/server')
-rw-r--r--src/server/buffer.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/server/buffer.nim b/src/server/buffer.nim
index a5858e44..d0a50284 100644
--- a/src/server/buffer.nim
+++ b/src/server/buffer.nim
@@ -1545,13 +1545,13 @@ proc click*(buffer: Buffer, cursorx, cursory: int): ClickResult {.proxy.} =
   if buffer.lines.len <= cursory: return
   var called = false
   var canceled = false
+  let clickable = buffer.getCursorClickable(cursorx, cursory)
   if buffer.config.scripting:
     let elem = buffer.getCursorElement(cursorx, cursory)
     (called, canceled) = buffer.dispatchEvent("click", elem)
     if called:
       buffer.do_reshape()
   if not canceled:
-    let clickable = buffer.getCursorClickable(cursorx, cursory)
     if clickable != nil:
       var res = buffer.click(clickable)
       res.repaint = called