pad

minimal etherpad alternative  https://pad.ce9e.org
git clone https://git.ce9e.org/pad.git

commit
36a19349de7fa60219e7042a27d71a2425602b35
parent
40a35fbb728012a772db8a2684228f951296c477
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2026-10-31 13:51
do not move selection when typing at the exact position

the main benefit is that the cursor end up at the start instead of the
end on initial load

Diffstat

M static/diff.js 4 ++--

1 files changed, 2 insertions, 2 deletions


diff --git a/static/diff.js b/static/diff.js

@@ -1,10 +1,10 @@
    1     1 var _apply = function(text, [pos, before, after], selection) {
    2     2 	if (selection) {
    3     3 		var d = diff(before, after, 0);
    4    -1 		if (pos + d[0] <= selection[0]) {
   -1     4 		if (pos + d[0] < selection[0]) {
    5     5 			selection[0] += after.length - before.length;
    6     6 		}
    7    -1 		if (pos + d[0] <= selection[1]) {
   -1     7 		if (pos + d[0] < selection[1]) {
    8     8 			selection[1] += after.length - before.length;
    9     9 		}
   10    10 	}