mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: fix weird bug with tabs in string inpertolation
This commit is contained in:
parent
9a77c0ab81
commit
eb68c222fe
@ -88,7 +88,7 @@ fn (mut f Fmt) find_comment(line_nr int) {
|
||||
}
|
||||
*/
|
||||
pub fn (mut f Fmt) write(s string) {
|
||||
if !f.buffering || f.is_inside_interp {
|
||||
if !f.buffering {
|
||||
if f.indent > 0 && f.empty_line {
|
||||
if f.indent < tabs.len {
|
||||
f.out.write(tabs[f.indent])
|
||||
@ -153,6 +153,10 @@ fn (mut f Fmt) adjust_complete_line() {
|
||||
if f.penalties[j] <= 1 && f.precedences[j] == precedence {
|
||||
sub_expr_end_idx = j
|
||||
break
|
||||
} else if f.precedences[j] < precedence {
|
||||
// we cannot form a sensible subexpression
|
||||
len_sub_expr = C.INT32_MAX
|
||||
break
|
||||
} else {
|
||||
len_sub_expr += f.expr_bufs[j+1].len
|
||||
}
|
||||
|
@ -46,6 +46,10 @@ fn main() {
|
||||
if a + b + r * d + a + b + r * d > a + b + r * d + a * b + r {
|
||||
println('ok')
|
||||
}
|
||||
v_str := 'v'
|
||||
s := []string{}
|
||||
s << ' `$v_str`'
|
||||
println(s)
|
||||
}
|
||||
|
||||
fn gen_str_for_multi_return(mut g gen.Gen, info table.MultiReturn, styp, str_fn_name string) {
|
||||
|
@ -56,6 +56,10 @@ fn main() {
|
||||
a*b+r {
|
||||
println('ok')
|
||||
}
|
||||
v_str := 'v'
|
||||
s := []string{}
|
||||
s << ' `$v_str`'
|
||||
println(s)
|
||||
}
|
||||
|
||||
fn gen_str_for_multi_return(mut g gen.Gen,
|
||||
|
Loading…
Reference in New Issue
Block a user