diff options
| author | godalming123 <68993177+godalming123@users.noreply.github.com> | 2025-09-14 15:08:20 +0100 |
|---|---|---|
| committer | godalming123 <68993177+godalming123@users.noreply.github.com> | 2025-09-14 15:08:20 +0100 |
| commit | 5d28d650d819277e6f640cad4ebb81a336372cb1 (patch) | |
| tree | e001832eabbe9b5c4e9e34bff7a65ccf18b4492a /src | |
| parent | e23480a32c5c9089c3449a379226b6334916a322 (diff) | |
Use core:flags instead of custom flag parsing library and fix 2 bugs
- Fixes formatting not working for blank files
- Fixes odinfmt not detecting the config file when `-stdin` is specified because it thinks that it is formatting the `-stdin` path
- Replaces the custom arg parsing code with odin's `core:flags` library
Diffstat (limited to 'src')
| -rw-r--r-- | src/odin/printer/document.odin | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/odin/printer/document.odin b/src/odin/printer/document.odin index f3ef61e..5fba1b9 100644 --- a/src/odin/printer/document.odin +++ b/src/odin/printer/document.odin @@ -447,7 +447,7 @@ format :: proc(width: int, list: ^[dynamic]Tuple, builder: ^strings.Builder, p: if v.amount > 0 { flush_line_suffix(builder, &suffix_builder) // ensure we strip any misplaced trailing whitespace - for builder.buf[len(builder.buf)-1] == ' ' { + for len(builder.buf) > 0 && builder.buf[len(builder.buf) - 1] == ' ' { pop(&builder.buf) } for i := 0; i < v.amount; i += 1 { |