Open jostly opened 8 months ago
Using cuicui_chirp 0.12.0 on Windows, with the following chirp file with CRLF line endings:
fn spacer() { Spacer(height(10px) width(10%) bg(coral)) } Menu(screen_root row) { spacer!() }
yields the following error:
2024-01-10T15:33:30.663376Z ERROR cuicui_chirp::loader::internal: × Invalid chirp file: (0) Tried to call !, but this template doesn't exist., Error: × Tried to call !, but this template doesn't exist. ╭─[ui/main_menu.chirp:2:1] 2 │ Spacer(height(10px) width(10%) bg(coral)) 3 │ } 4 │ Menu(screen_root row) { · ─ 5 │ spacer!() 6 │ } ╰────
Adding a trace logging line to cuicui_chirp parser/interpret.rs line 200-202
let (mut name, span) = tpl.name().read_spanned(inp); trace!("{inp:?} {:?}", std::str::from_utf8(name)); name = &name[..name.len() - 1];
shows the following trace logging:
2024-01-10T15:33:30.662934Z TRACE cuicui_chirp::parser::interpret: "fn spacer() {\r\n Spacer(height(10px) width(10%) bg(coral))\r\n}\r\nMenu(screen_root row) {\r\n spacer!()\r\n}" Ok("\r")
which led me to the following workaround:
Switch the .chirp file to use LF line endings, at which point it loads as expected.
Thanks for the super detailed bug report!
With your help, I think I could figure out where the issue is:
https://github.com/nicopap/cuicui_layout/blob/d234bc7f60ceb52f16145afb5bfa90979132b246/chirp/src/parser/lex.rs#L232
Need to add a \r in there eh.
\r
Yeah, I think that would do it :)
I will push an update Monday with the fix.
Using cuicui_chirp 0.12.0 on Windows, with the following chirp file with CRLF line endings:
yields the following error:
Adding a trace logging line to cuicui_chirp parser/interpret.rs line 200-202
shows the following trace logging:
which led me to the following workaround:
Workaround
Switch the .chirp file to use LF line endings, at which point it loads as expected.