[mod] idle detect

This commit is contained in:
Andy Bunce 2025-08-22 17:37:26 +01:00
parent e32e3437a1
commit 1787a8e31f
7 changed files with 2016 additions and 1964 deletions

View file

@ -57,8 +57,8 @@ declare function pos:toPosition($text as xs:string,
$index as pos:num
)
as pos:Position {
let $nl:= if($index=>trace("IN ") ge string-length($text)=>trace("L "))
then error(xs:QName("pos:range"),"out of range")
let $nl:= if($index=>trace("IN ") gt string-length($text)=>trace("L "))
then error(xs:QName("pos:range"),`out of range: index={$index},length={string-length($text)}`)
else index-of(string-to-codepoints($text),10)
let $line:=pos:lineAt($nl,$index)
let $off:=if($line eq 0)