You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a little tricky since both the left- and right-justified text can have complex formatting, but we want to avoid just replicating the same logic twice. Ideally also rightJustify() wouldn't just return an Ansi instance since the right-justified text will have limited functionality (shouldn't be able to call rightJustify() again, no cursor movement, etc.).
I'm also not certain whether this should live in Ansi or AnsiUtils. It feels a little complex for Ansi, but it would fit nicely with it's fluent interface.
One idea would be for rightJustify() to simply record the current buffer length and insert $COLUMNS - rightSide.length() spaces at that index before outputting.
The text was updated successfully, but these errors were encountered:
Original report by Michael Diamond (Bitbucket: dimo414).
Example syntax:
Should ouput (in an 80 column window):
This is a little tricky since both the left- and right-justified text can have complex formatting, but we want to avoid just replicating the same logic twice. Ideally also
rightJustify()
wouldn't just return anAnsi
instance since the right-justified text will have limited functionality (shouldn't be able to callrightJustify()
again, no cursor movement, etc.).I'm also not certain whether this should live in
Ansi
orAnsiUtils
. It feels a little complex forAnsi
, but it would fit nicely with it's fluent interface.One idea would be for
rightJustify()
to simply record the current buffer length and insert$COLUMNS - rightSide.length()
spaces at that index before outputting.The text was updated successfully, but these errors were encountered: