stricter searchMarker filter

This commit is contained in:
Kevin Jahns 2020-07-16 20:44:54 +02:00
parent 270a69fcf6
commit 38eb2e502c
2 changed files with 4 additions and 3 deletions

View File

@ -19,7 +19,7 @@ import * as iterator from 'lib0/iterator.js'
import * as error from 'lib0/error.js' import * as error from 'lib0/error.js'
import * as math from 'lib0/math.js' import * as math from 'lib0/math.js'
const maxSearchMarker = 60 const maxSearchMarker = 80
/** /**
* A unique timestamp that identifies each marker. * A unique timestamp that identifies each marker.
@ -152,11 +152,12 @@ export const findMarker = (yarray, index) => {
// if (marker) { // if (marker) {
// if (window.lengthes == null) { // if (window.lengthes == null) {
// window.lengthes = [] // window.lengthes = []
// window.getLengthes = () => window.lengthes.sort((a, b) => a - b)
// } // }
// window.lengthes.push(marker.index - pindex) // window.lengthes.push(marker.index - pindex)
// console.log('distance', marker.index - pindex, 'len', p && p.parent.length) // console.log('distance', marker.index - pindex, 'len', p && p.parent.length)
// } // }
if (marker !== null && math.abs(marker.index - pindex) < 30) { if (marker !== null && math.abs(marker.index - pindex) < p.parent.length / maxSearchMarker) {
// adjust existing marker // adjust existing marker
overwriteMarker(marker, p, pindex) overwriteMarker(marker, p, pindex)
return marker return marker

View File

@ -209,7 +209,7 @@ export const testFormattingRemovedInMidText = tc => {
* @param {t.TestCase} tc * @param {t.TestCase} tc
*/ */
export const testInsertAndDeleteAtRandomPositions = tc => { export const testInsertAndDeleteAtRandomPositions = tc => {
const N = 10000 const N = 100000
const { text0 } = init(tc, { users: 1 }) const { text0 } = init(tc, { users: 1 })
const gen = tc.prng const gen = tc.prng