v.debug: elminate another import math that just used the min/max functions

This commit is contained in:
Delyan Angelov 2024-11-18 23:05:25 +02:00
parent 2ba1271a2e
commit 488c2ebfff
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -4,7 +4,6 @@
module debug
import os
import math
import readline
import strings
import term
@ -156,8 +155,8 @@ fn (mut d Debugger) parse_input(input string, is_ctrl bool) (string, string) {
fn (mut d Debugger) print_context_lines(path string, line int, lines int) ! {
file_content := os.read_file(path)!
chunks := file_content.split('\n')
offset := math.max(line - lines, 1)
for n, s in chunks[offset - 1..math.min(chunks.len, line + lines)] {
offset := int_max(line - lines, 1)
for n, s in chunks[offset - 1..int_min(chunks.len, line + lines)] {
ind := if n + offset == line { '>' } else { ' ' }
flush_println('${n + offset:04}${ind} ${s}')
}