mirror of
https://github.com/sbrow/envr.git
synced 2026-08-26 18:03:32 -04:00
refactor: re-ordered procs by calling order.
This commit is contained in:
+15
-15
@@ -1,6 +1,5 @@
|
||||
package main
|
||||
|
||||
import "core:fmt"
|
||||
import "core:io"
|
||||
import "core:text/table"
|
||||
|
||||
@@ -18,20 +17,6 @@ decorations := table.Decorations {
|
||||
"─",
|
||||
}
|
||||
|
||||
ansi_aware_width :: proc(str: string) -> int #no_bounds_check {
|
||||
width := 0
|
||||
for i := 0; i < len(str); {
|
||||
if i + 1 < len(str) && str[i] == 0x1b && str[i + 1] == '[' {
|
||||
i += 2
|
||||
for i < len(str) {c := str[i]; i += 1; if c >= 0x40 && c <= 0x7E {break}}
|
||||
} else {
|
||||
width += 1
|
||||
i += 1
|
||||
}
|
||||
}
|
||||
return width
|
||||
}
|
||||
|
||||
write_borderless_table :: proc(w: io.Writer, t: ^table.Table) {
|
||||
table.build(t, ansi_aware_width)
|
||||
|
||||
@@ -64,6 +49,21 @@ write_borderless_table :: proc(w: io.Writer, t: ^table.Table) {
|
||||
write_table_separator(w, t)
|
||||
}
|
||||
|
||||
ansi_aware_width :: proc(str: string) -> int #no_bounds_check {
|
||||
width := 0
|
||||
for i := 0; i < len(str); {
|
||||
if i + 1 < len(str) && str[i] == 0x1b && str[i + 1] == '[' {
|
||||
i += 2
|
||||
for i < len(str) {c := str[i]; i += 1; if c >= 0x40 && c <= 0x7E {break}}
|
||||
} else {
|
||||
width += 1
|
||||
i += 1
|
||||
}
|
||||
}
|
||||
return width
|
||||
}
|
||||
|
||||
|
||||
table_reset :: proc(t: ^table.Table) {
|
||||
clear(&t.cells)
|
||||
clear(&t.colw)
|
||||
|
||||
Reference in New Issue
Block a user