From 33961a0b3f09a0e612147cfac38d80bb8604ddc5 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 11 Dec 2023 03:26:33 +0300 Subject: [PATCH] experimenting... Signed-off-by: Alex A. Naanou --- experiments/outline-editor/editor.js | 25 +++++++++++++++++++++++++ experiments/outline-editor/index.html | 1 + 2 files changed, 26 insertions(+) diff --git a/experiments/outline-editor/editor.js b/experiments/outline-editor/editor.js index 08b31c0..e5b468b 100755 --- a/experiments/outline-editor/editor.js +++ b/experiments/outline-editor/editor.js @@ -246,6 +246,31 @@ var offsetMap = function(A, B, m=[]){ +// find all common sections... +// XXX test... +function cs(A, B){ + var map = [] + for(var i=0; i < A.length; i++){ + for(var j=0; j < B.length; j++){ + var l = 0 + while(A[i+j+l] == B[j+l] + && j+l < B.length){ + l++ } + if(l > 0){ + map.push([i, j, l]) + // Q: can we skip here? ...will skipping + // prevent matching "ababc" with "abc"?? + j += l } } } + return map } + +// build chains of blocks with their lengths... +function comb(map){ + XXX +} + + + + //--------------------------------------------------------------------- // Plugins... diff --git a/experiments/outline-editor/index.html b/experiments/outline-editor/index.html index 7f30e1d..b56ab35 100755 --- a/experiments/outline-editor/index.html +++ b/experiments/outline-editor/index.html @@ -49,6 +49,7 @@ var setup = function(){ - ## Bugs: focused:: true - BUG: caret positioning broken + - new strategy: try and build offset maps on parse... - *TODO*:: - ``` text text text