Skip to content

Commit

Permalink
feat: add NoTabConversion const for disabling tab-to-space conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Jul 24, 2023
1 parent 77b441c commit 361d3e5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions set.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,15 @@ func (s Style) MaxHeight(n int) Style {
return o
}

// NoTabConversion can be passed to Style.TabWidth to disable the replacement
// of tabs with spaces at render time.
const NoTabConversion = -1

// TabWidth sets the number of spaces that a tab (/t) should be rendered as.
// When set to 0, tabs will be removed. To disable the replacement of tabs with
// spaces entirely, set this to -1.
// spaces entirely, set this to [NoTabConversion].
//
// By default, tabs will be removed and replaced with 4 spaces.
// By default, tabs will be replaced with 4 spaces.
func (s Style) TabWidth(n int) Style {
if n <= -1 {
n = -1
Expand Down

0 comments on commit 361d3e5

Please sign in to comment.