vfmt: change all '$expr' to '${expr}' (#16428)

This commit is contained in:
yuyi 2022-11-15 21:53:13 +08:00 committed by GitHub
parent 56239b4a23
commit 017ace6ea7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
859 changed files with 7156 additions and 7135 deletions

View file

@ -10,10 +10,10 @@ fn event(e &tui.Event, x voidptr) {
app.tui.clear()
app.tui.set_cursor_position(0, 0)
app.tui.write('V term.input event viewer (press `esc` to exit)\n\n')
app.tui.write('$e')
app.tui.write('\n\nRaw event bytes: "$e.utf8.bytes().hex()" = $e.utf8.bytes()')
app.tui.write('${e}')
app.tui.write('\n\nRaw event bytes: "${e.utf8.bytes().hex()}" = ${e.utf8.bytes()}')
if !e.modifiers.is_empty() {
app.tui.write('\nModifiers: $e.modifiers = ')
app.tui.write('\nModifiers: ${e.modifiers} = ')
if e.modifiers.has(.ctrl) {
app.tui.write('ctrl. ')
}

View file

@ -319,7 +319,7 @@ fn (mut app App) select_color(primary bool, idx int) {
app.secondary_color = color
}
c_str := if primary { 'primary' } else { 'secondary' }
app.show_msg('set $c_str color idx: $idx', 1)
app.show_msg('set ${c_str} color idx: ${idx}', 1)
}
fn (mut app App) set_pixel(x_ int, y_ int, c ui.Color) {
@ -420,11 +420,11 @@ fn (mut app App) draw_header() {
g: 220
b: 220
)
app.ui.draw_text(0, 0, ' $app.msg ')
app.ui.draw_text(0, 0, ' ${app.msg} ')
app.ui.reset()
}
//'tick: $app.ui.frame_count | ' +
app.ui.draw_text(3, 2, 'terminal size: ($app.ui.window_width, $app.ui.window_height) | primary color: $app.primary_color.hex() | secondary color: $app.secondary_color.hex()')
app.ui.draw_text(3, 2, 'terminal size: (${app.ui.window_width}, ${app.ui.window_height}) | primary color: ${app.primary_color.hex()} | secondary color: ${app.secondary_color.hex()}')
app.ui.horizontal_separator(3)
}
@ -452,7 +452,7 @@ fn (mut app App) draw_footer() {
app.ui.reset_bg_color()
app.ui.draw_text(3, wh - 3, select_color)
app.ui.bold()
app.ui.draw_text(3, wh - 1, '$select_size $app.size')
app.ui.draw_text(3, wh - 1, '${select_size} ${app.size}')
app.ui.reset()
// TODO: help button
@ -468,7 +468,7 @@ fn (mut app App) inc_size() {
if app.size < 30 {
app.size++
}
app.show_msg('inc. size: $app.size', 1)
app.show_msg('inc. size: ${app.size}', 1)
}
[inline]
@ -476,7 +476,7 @@ fn (mut app App) dec_size() {
if app.size > 1 {
app.size--
}
app.show_msg('dec. size: $app.size', 1)
app.show_msg('dec. size: ${app.size}', 1)
}
fn (mut app App) footer_click(event &ui.Event) {

View file

@ -119,7 +119,7 @@ fn (mut a App) footer() {
finfo := if a.cfile().len > 0 { ' (' + os.file_name(a.cfile()) + ')' } else { '' }
mut status := a.status
a.tui.draw_text(0, h - 1, ''.repeat(w))
footer := '$finfo Line ${b.cursor.pos_y + 1:4}/${b.lines.len:-4}, Column ${b.cursor.pos_x + 1:3}/${b.cur_line().len:-3} index: ${b.cursor_index():5} (ESC = quit, Ctrl+s = save)'
footer := '${finfo} Line ${b.cursor.pos_y + 1:4}/${b.lines.len:-4}, Column ${b.cursor.pos_x + 1:3}/${b.cur_line().len:-3} index: ${b.cursor_index():5} (ESC = quit, Ctrl+s = save)'
if footer.len < w {
a.tui.draw_text((w - footer.len) / 2, h, footer)
} else if footer.len == w {
@ -140,7 +140,7 @@ fn (mut a App) footer() {
g: 0
b: 0
)
a.tui.draw_text((w + 4 - status.len) / 2, h - 1, ' $status ')
a.tui.draw_text((w + 4 - status.len) / 2, h - 1, ' ${status} ')
a.tui.reset()
a.t -= 33
}
@ -243,7 +243,7 @@ fn (mut b Buffer) put(s string) {
}
$if debug {
flat := s.replace('\n', r'\n')
eprintln(@MOD + '.' + @STRUCT + '::' + @FN + ' "$flat"')
eprintln(@MOD + '.' + @STRUCT + '::' + @FN + ' "${flat}"')
}
}
@ -349,7 +349,7 @@ fn (mut b Buffer) del(amount int) string {
}
$if debug {
flat := removed.replace('\n', r'\n')
eprintln(@MOD + '.' + @STRUCT + '::' + @FN + ' "$flat"')
eprintln(@MOD + '.' + @STRUCT + '::' + @FN + ' "${flat}"')
}
return removed
}

View file

@ -436,7 +436,7 @@ fn (mut a App) draw_debug() {
snake := a.snake
a.termui.draw_text(block_size, 1 * block_size, 'Display_width: ${a.width:04d} Display_height: ${a.height:04d}')
a.termui.draw_text(block_size, 2 * block_size, 'Vx: ${snake.velocity.x:+02d} Vy: ${snake.velocity.y:+02d}')
a.termui.draw_text(block_size, 3 * block_size, 'F: $snake.direction')
a.termui.draw_text(block_size, 3 * block_size, 'F: ${snake.direction}')
snake_head := snake.get_head()
rat := a.rat
a.termui.draw_text(block_size, 4 * block_size, 'Sx: ${snake_head.pos.x:+03d} Sy: ${snake_head.pos.y:+03d}')