postfix conditionals #4

Closed
pcapriotti opened this Issue Dec 28, 2010 · 5 comments

Projects

None yet

3 participants

The plugin misbehaves when blocks contain postfix-if expressions. For example, on the following code:

def hello
  foo = 3
  world if foo == bar
  bar
end

placing the cursor on the second line and pressing var selects only that line.

MSch commented Dec 28, 2010

Another example, neither ar nor ir work:

def adjust_format_for_istar
  request.format = :iphone if iphone?
  request.format = :ipad if ipad?
  request.format = :js if request.xhr?
end
Owner

Thanks for reporting this. I can reproduce the behaviour you've described, and I'll look in to it.

Owner

Fixed: 22b3424

Pushing version 0.0.2 with this fix: https://github.com/nelstrom/vim-textobj-rubyblock/tree/0.0.2

MSch commented Dec 29, 2010

Hi, thanks for the quick fix! At first I thought you forgot the unless postfix, but I see you've added that too! Thanks again!

Owner

No problem. It was a pretty crucial oversight, so I made it top priority.

I've added an 'unless' block to my (manual) test file, but I have yet to add it to the list of block-opening delimiters. So if you use a postfix unless, it should cause no problems, but if you use a multi-line unless block, it will be ignored. I'll add support for unless at a later date... One thing at a time.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment