mirror of
https://github.com/vlang/v.git
synced 2025-09-14 09:56:16 -04:00
v.debug: elminate another import math
that just used the min/max functions
This commit is contained in:
parent
2ba1271a2e
commit
488c2ebfff
@ -4,7 +4,6 @@
|
|||||||
module debug
|
module debug
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import math
|
|
||||||
import readline
|
import readline
|
||||||
import strings
|
import strings
|
||||||
import term
|
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) ! {
|
fn (mut d Debugger) print_context_lines(path string, line int, lines int) ! {
|
||||||
file_content := os.read_file(path)!
|
file_content := os.read_file(path)!
|
||||||
chunks := file_content.split('\n')
|
chunks := file_content.split('\n')
|
||||||
offset := math.max(line - lines, 1)
|
offset := int_max(line - lines, 1)
|
||||||
for n, s in chunks[offset - 1..math.min(chunks.len, line + lines)] {
|
for n, s in chunks[offset - 1..int_min(chunks.len, line + lines)] {
|
||||||
ind := if n + offset == line { '>' } else { ' ' }
|
ind := if n + offset == line { '>' } else { ' ' }
|
||||||
flush_println('${n + offset:04}${ind} ${s}')
|
flush_println('${n + offset:04}${ind} ${s}')
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user