diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-13 17:03:17 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-13 17:03:17 +0100 |
commit | 4b482418c22ea31729ca94583ffd2a6aa167d811 (patch) | |
tree | 9c456555f1b3cfd45d90f28d61d7369ab96e1c5d /src/css | |
parent | 672ab553c4a2b10a703ea40e049eda52db149a93 (diff) | |
download | chawan-4b482418c22ea31729ca94583ffd2a6aa167d811.tar.gz |
Fix stream error handling confusion, title display
Also probably other fixes.
Diffstat (limited to 'src/css')
-rw-r--r-- | src/css/cssparser.nim | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/css/cssparser.nim b/src/css/cssparser.nim index 6f26629b..b4a22e28 100644 --- a/src/css/cssparser.nim +++ b/src/css/cssparser.nim @@ -163,7 +163,10 @@ func peek(state: CSSTokenizerState, i: int = 0): char = proc has(state: var CSSTokenizerState, i: int = 0): bool = if state.at + i >= state.buf.len and not state.stream.atEnd(): - state.buf &= state.stream.readLine() & '\n' + try: + state.buf &= state.stream.readStr(256) + except EOFError: + return false return state.at + i < state.buf.len proc isValidEscape(a, b: char): bool = @@ -210,7 +213,7 @@ proc startsWithNumber(state: var CSSTokenizerState): bool = if state.has(2) and state.peek(2) in AsciiDigit: return true of '.': - if state.peek(1) in AsciiDigit: + if state.has(1) and state.peek(1) in AsciiDigit: return true elif state.peek() in AsciiDigit: return true |