Commit 2f492532 authored by Diederik van Arkel's avatar Diederik van Arkel
Browse files

Fix bug with start/end detection of colour changes at beginning of document;

parent 6a8d7998
......@@ -248,9 +248,9 @@ where
quickParse :: !Int !Int !(StrictList (!Info,!String)) -> (Int,Int,StrictList (!Info,!String))
quickParse fln lln text
# (beg,end,res) = parseBefore 0 (-1,0,False,False,0) id [] text
# (beg,end,res) = parseBefore 0 (0,0,False,False,0) id [] text
# res = trace_n` ("quickParse",beg,end,fln,lln) res
# beg = if (beg < 0) (trace_n` "FIX BEGIN" 0) beg
// # beg = if (beg < 0) (trace_n` "FIX BEGIN" 0) (beg + 1)
# end = if (end >= slLength res) (trace_n` "FIX END" slLength res - 1) end
= (beg,end,res)
where
......@@ -278,7 +278,7 @@ where
parseDuring cln begin (lev,def,tdec,off) res acc SNil
= (begin,dec cln,res (slFromList acc))
parseDuring cln begin i=:(lev,def,dec,off) res acc rest=:(SCons h=:(_,l) t)
| cln > lln
| cln >= lln
= parseAfter cln begin i res acc rest
| trace_n` ("parseDuring",cln,i,h) False = undef
#! (has_contents,j=:(level`,def`,dec`,off`)) = parseLine i l
......@@ -313,16 +313,16 @@ where
| equal_state new old
#! res = res (slFromList` [(new,l)] SNil)
= (begin,cln,slAppend res t)
= parseDuring (inc cln) begin state` res [(new,l)] t
= parseAfter (inc cln) begin state` res [(new,l)] t
# j` = (lev,def,dec`,off)
= parseDuring cln begin j` (\r -> res (slFromList` [fix s \\ s<- acc] r)) [] rest
= parseAfter cln begin j` (\r -> res (slFromList` [fix s \\ s<- acc] r)) [] rest
| has_contents
#! res = (\r -> res (slFromList` acc r))
| equal_state new old
#! res = res (slFromList` [(new,l)] SNil)
= (begin,cln,slAppend res t)
= parseDuring (inc cln) begin state` res [(new,l)] t
= parseDuring (inc cln) begin state` res (acc ++[(new,l)]) t
= parseAfter (inc cln) begin state` res [(new,l)] t
= parseAfter (inc cln) begin state` res (acc ++[(new,l)]) t
where
fix :: (!Info,!String) -> (!Info,!String)
fix ((c,t,d,o),l) = ((c,False,True,o),l)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment