NewLineAsCR - nonkit/SmallWikiPad GitHub Wiki

NewLineAsCR

Use following workaround to avoid new line missing issue on browser with Silverlight environment.

CR = Text.GetCharacter(13)
LF = Text.GetCharacter(10)
Sub GetLine
  ' param buf - text buffer
  ' param p - current pointer to buf
  ' return line
  eol = Text.GetIndexOf(Text.GetSubTextToEnd(buf, p), CR)
  If 0 < eol Then ' eol found
    line = Text.GetSubText(buf, p, eol - 1)
    p = p + eol
    If Text.GetSubText(buf, p, 1) = LF Then
      p = p + 1
    EndIf
  Else ' eol not found
    line = Text.GetSubTextToEnd(buf, p)
    p = Text.GetLength(buf) + 1
  EndIf
EndSub

Other Resources