diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2022-08-20 12:54:35 +0200 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2022-08-20 12:54:35 +0200 |
| commit | 8e8360dba88feb0334a222e9f990250cf65f32bf (patch) | |
| tree | ff2867bb8556e49daa1a2e0cd01dc2353402643d /src | |
| parent | e81700ba2c2c84b14fd62449964ba7efc2d3a20d (diff) | |
odinfmt: change how index is formatted when in break mode
Diffstat (limited to 'src')
| -rw-r--r-- | src/odin/printer/visit.odin | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/odin/printer/visit.odin b/src/odin/printer/visit.odin index 49de704..43e4321 100644 --- a/src/odin/printer/visit.odin +++ b/src/odin/printer/visit.odin @@ -700,7 +700,7 @@ visit_stmt :: proc(p: ^Printer, stmt: ^ast.Stmt, block_type: Block_Type = .Gener } if v.cond != nil && v.init != nil { - if_document = cons_with_opl(if_document, group(visit_expr(p, v.cond))) + if_document = cons(if_document, group(cons(break_with_space(), visit_expr(p, v.cond)))) } else if v.cond != nil { if_document = cons_with_nopl(if_document, group(visit_expr(p, v.cond))) } @@ -1342,7 +1342,14 @@ visit_expr :: proc(p: ^Printer, expr: ^ast.Expr, called_from: Expr_Called_Type = document = cons( visit_expr(p, v.expr), text("["), - group(align(visit_expr(p, v.index))), + nest( + cons( + break_with("", true), + group(visit_expr(p, v.index)), + if_break(" \\"), + ), + ), + break_with("", true), text("]"), ) case ^Proc_Group: |