@@ -4,8 +4,8 @@ import { endOperation, operation, runInOp, startOperation } from "../display/ope
44import { clipPos , cmp , Pos } from "../line/pos.js"
55import { lineNo , updateLineHeight } from "../line/utils_line.js"
66import { clearLineMeasurementCacheFor , findViewForLine , textHeight } from "../measurement/position_measurement.js"
7- import { seeReadOnlySpans , seeCollapsedSpans } from "../line/saw_special_spans.js"
8- import { addMarkedSpan , conflictingCollapsedRange , getMarkedSpanFor , lineIsHidden , lineLength , MarkedSpan , removeMarkedSpan , visualLine } from "../line/spans.js"
7+ import { seeReadOnlySpans , seeCollapsedSpans , seeIsolateSpans } from "../line/saw_special_spans.js"
8+ import { addMarkedSpan , conflictingCollapsedRange , conflictingIsolateRange , getMarkedSpanFor , lineIsHidden , lineLength , MarkedSpan , removeMarkedSpan , visualLine } from "../line/spans.js"
99import { copyObj , indexOf , lst } from "../util/misc.js"
1010import { signalLater } from "../util/operation_group.js"
1111import { widgetHeight } from "../measurement/widgets.js"
@@ -177,6 +177,12 @@ export function markText(doc, from, to, options, type) {
177177 throw new Error ( "Inserting collapsed marker partially overlapping an existing one" )
178178 seeCollapsedSpans ( )
179179 }
180+ if ( marker . isolate ) {
181+ if ( conflictingIsolateRange ( doc , from . line , from , to , marker ) ||
182+ from . line != to . line && conflictingIsolateRange ( doc , to . line , from , to , marker ) )
183+ { throw new Error ( "Inserting isolate marker partially overlapping an existing one" ) }
184+ seeIsolateSpans ( )
185+ }
180186
181187 if ( marker . addToHistory )
182188 addChangeToHistory ( doc , { from : from , to : to , origin : "markText" } , doc . sel , NaN )
0 commit comments