From 2c1cfbc701d3377e783f58505bee39c5cfdc9225 Mon Sep 17 00:00:00 2001 From: Charlotte Som Date: Wed, 5 Mar 2025 13:35:50 +0000 Subject: [PATCH] restore scrollTop maybe ? --- client/main.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/main.ts b/client/main.ts index 49ea4ff..c87b62d 100644 --- a/client/main.ts +++ b/client/main.ts @@ -16,8 +16,13 @@ pt.onevent = (event, textIndex, affectedLength) => { if (textIndex <= start) start += affectedLength; if (textIndex <= end) end += affectedLength; + const scrollTop = textarea.scrollTop; + // TODO: check if scrolled to bottom + textarea.value = pt.render()[0]; textarea.setSelectionRange(start, end); + + textarea.scrollTop = scrollTop; }; const socket = new WebSocket("/api/connect");