Increasing/Decreasing indent reformats tabbing
Reported by nitsujri | May 16th, 2010 @ 06:58 PM
Currently
Regardless of current tabbing, the auto-formatter changes the tabbing to what it thinks it should be even if the user wanted something else.
Expected
Increasing/Decreasing indent does not change formatting of text.
Reproduce
- Write text:
def my_method func_call({ :arg1 => 1, :arg2 => 2 }) end
- Highlight and decrease indent using ctrl + [
- Text changes to:
def my_method func_call({ :arg1 => 1, :arg2 => 2 }) <- Changed line end
(This example 'kinda' shows what I'm talking about, lighthouse doesn't maintain the exact indenting, sadly.)
Edit: Modified to be more exact based upon findings from conversation below.
Comments and changes to this ticket
-
agmcleod May 16th, 2010 @ 07:33 PM
Just tried this out on my mac. I wrote it like:
def method_name my_var = { :arg => 1, :arg2 => 2 } end
def method_name my_var = { :arg => 1, :arg2 => 2 } end
This worked when i had positioned the :args using spaces or a 2 space tab. It didn't seem to matter.
-
agmcleod May 17th, 2010 @ 02:09 PM
Just gave this a try on my windows work machine as well, and I had no issues. Could you try using the code block declarative as said in: http://help.lighthouseapp.com/faqs/getting-started/how-do-i-format-... to show us how this is specifically going wrong? Just want to make sure I tested it correctly.
-
nitsujri May 18th, 2010 @ 02:19 AM
Sorry, checked it more thoroughly and apparently it only happens with () only when you're using ctrl + [ and not ctrl + ]
def method_name some_func({ :arg1 => 1, :arg2 => 2 }) end
with ctrl + [ ends up as:
def method_name some_func({ :arg1 => 1, :arg2 => 2 }) end
How did you get the color highlighting? I was using the @@@ both times, but apparently naming it rubyonrails is not the way to go.
Thanks for looking into this agmcleod!
Justin
About my setup:
Ubuntu: 10.04 Lucid Lynx
About: Redcar
Version: 0.3.5
Ruby Version: 1.8.7
Jruby version: 1.4.0
Redcar.environment: user
http://redcareditor.com -
agmcleod May 18th, 2010 @ 04:45 PM
I see. I run into that now as well. For instance i just typed:
def method_name some_func({}) end
With my caret between the braces, and i hit enter, it results in your second example. If i enter in the values and have it lined up correctly, select the text there and hit ctrl+[, it moves like you said, and continues to move in that format. I just tested quickly in a javascript file, and this is not a problem. One uses say (function() {}); quite frequently, especially with jquery.
I'll have a look into it after work, see what i can find out.
-
Daniel Lucraft May 26th, 2010 @ 06:13 AM
- State changed from new to open
OK, lets see if I've got this right. You have the cursor at
<c>
and you press enter:some_func({<c>})
What results is
some_func({ <c>})
but what we should get is:
some_func({ <c> })
Which is Textmate's behaviour.
-
nitsujri May 26th, 2010 @ 06:26 AM
Right then
some_func({ <c> })
highlight the block and, press ctrl+[, or even press any combo of ctrl+[ and ctrl+] and the indentation will automatically change at some point when the expected behavior is for it to not change inside the block, but simply increase/decrease indent as a whole block.
Side note, I've actually found a number of bugs with the auto indenter randomly changes indentation since the start of this bug. It happens a lot with HAML because there's no closing tag so it can't tell where things 'should' go. Dan, would you like me to open new ones or add to this one or just leave it for now?
-
Daniel Lucraft May 26th, 2010 @ 10:33 AM
hi nitsujri, Could you comment with the other indentation problems on here:
http://redcar.lighthouseapp.com/projects/25090-redcar/tickets/226-a...I know there are a bunch of issues.
thanks.
-
Mat Schaffer May 17th, 2011 @ 08:19 PM
Ah, I see if you start with
some_function({ })
Then highlight the code and intent with
Ctrl+]
then outdent withCtrl+[
again you get this:some_function({ })
Checked on 2aa40fc7, OS X.
-
Daniel Lucraft May 19th, 2011 @ 09:09 PM
- State changed from open to resolved
This is fixed in: https://github.com/redcar/redcar/commit/25fc2af430f825db9768b9079d9... and will be in 0.12.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
A programmer's text editor for Gnome.