Skip to content

Commit

Permalink
make DextraSpace effective regardless of DSyncWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Nov 18, 2023
1 parent 3ae7e1f commit fb2ad71
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions decor/decorator.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ const (
// | foo| b| DindentRight is not set
DindentRight = 1 << iota

// DextraSpace bit adds extra space, makes sense with DSyncWidth only.
// When DindentRight bit set, the space will be added to the right,
// otherwise to the left.
// DextraSpace bit adds extra indentation space.
DextraSpace

// DSyncWidth bit enables same column width synchronization.
Expand Down Expand Up @@ -143,11 +141,10 @@ func (wc WC) Format(str string) (string, int) {
viewWidth := runewidth.StringWidth(str)
if wc.W > viewWidth {
viewWidth = wc.W
} else if (wc.C & DextraSpace) != 0 {
viewWidth++
}
if (wc.C & DSyncWidth) != 0 {
if (wc.C & DextraSpace) != 0 {
viewWidth++
}
wc.wsync <- viewWidth
viewWidth = <-wc.wsync
}
Expand Down

0 comments on commit fb2ad71

Please sign in to comment.