Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indents incorrectly for odd tab_size #94

Open
Quincunx271 opened this issue Jul 21, 2015 · 1 comment
Open

Indents incorrectly for odd tab_size #94

Quincunx271 opened this issue Jul 21, 2015 · 1 comment

Comments

@Quincunx271
Copy link

Beautify Ruby handles a tab-size of 2 very well, but when this is added to the preferences:

"tab_size": 3

Or any other odd number, for that matter, the indentation is completely wrong. As an example:

def test
   if false
      test do
         puts "incorrectly indented"
      end
   end
end

Becomes:

def test
    if false
      test do
          puts "incorrectly indented"
      end
    end
end

It doesn't indent each level at 3! It indents once at 4, then once at 2.

@Quincunx271
Copy link
Author

The exact issue is in lib/line.rb:

def tab_string
  indent_character * (indent_size / @tab_size ) + (indent_size.odd? ? ' ' : '')
end

As a temporary workaround, I'm changing that to

def tab_string
  indent_character * (indent_size / @tab_size ) # + (indent_size.odd? ? ' ' : '')
end

Why would we even want the + (indent_size.odd? ? ' ' : '')?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant