fmt: smarter if condition wrapping (#8201)

This commit is contained in:
Lukas Neubert 2021-01-23 09:33:22 +01:00 committed by GitHub
parent 9812230847
commit 8b61891348
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 686 additions and 811 deletions

View file

@ -184,8 +184,8 @@ pub fn (ctx &Context) text_width(s string) int {
mut buf := [4]f32{}
C.fonsTextBounds(ctx.ft.fons, 0, 0, s.str, 0, buf)
if s.ends_with(' ') {
return int((buf[2] - buf[0]) /
ctx.scale) + ctx.text_width('i') // TODO fix this in fontstash?
return int((buf[2] - buf[0]) / ctx.scale) +
ctx.text_width('i') // TODO fix this in fontstash?
}
return int((buf[2] - buf[0]) / ctx.scale)
}