text-object with single quoted string

2015-04-29 Thread mattn

call s:foo_func("\%(foo\)")
call s:foo_func('\%(foo\)')

When type "vi(" on '%' in above, it should select like below.

http://go-gyazo.appspot.com/ce98f67480ace7b0.png

but not selected in latest of vim. And when type "vi(" on 'f', it should not 
select anything because it contains "\%()".

This behavior caused that the string is quoted by single-quote. I'm thinking 
vim have better to handle single-quote and double-quote for text-object on 
string literals.

https://gist.github.com/mattn/5f388e4fdba9a69a49a2

This patch handle single quote as same as double quote for text-object on 
string literals.

How do you think?

- mattn

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: text-object with single quoted string

2015-04-29 Thread Ben Fritz
On Wednesday, April 29, 2015 at 11:06:20 AM UTC-5, mattn wrote:
> call s:foo_func("\%(foo\)")
> call s:foo_func('\%(foo\)')
> 
> When type "vi(" on '%' in above, it should select like below.
> 
> http://go-gyazo.appspot.com/ce98f67480ace7b0.png
> 
> but not selected in latest of vim. 

I can confirm this, I would expect the whole outer parenthesis content to be 
selected, instead, nothing at all happens on the second line. The first line 
works as expected.

> And when type "vi(" on 'f', it should not select anything because it contains 
> "\%()".
> 

You lost me here. I would either expect this to select "foo\", or if it's 
smart, to do the same as before and select just the outer parenthesis. Neither 
happens. In the first line (double quote case) nothing at all happens. In the 
second line, "foo\)'" is selected, which is obviously wrong here.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: text-object with single quoted string

2015-04-30 Thread mattn
On Thursday, April 30, 2015 at 6:30:23 AM UTC+9, Ben Fritz wrote:
> I can confirm this, I would expect the whole outer parenthesis content to be 
> selected, instead, nothing at all happens on the second line. The first line 
> works as expected.
> 
> > And when type "vi(" on 'f', it should not select anything because it 
> > contains "\%()".
> > 
> 
> You lost me here. I would either expect this to select "foo\", or if it's 
> smart, to do the same as before and select just the outer parenthesis. 
> Neither happens. In the first line (double quote case) nothing at all 
> happens. In the second line, "foo\)'" is selected, which is obviously wrong 
> here.

I'm thinking it should work only for cpo+=M.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: text-object with single quoted string

2015-04-30 Thread Ben Fritz
On Thursday, April 30, 2015 at 2:27:30 AM UTC-5, mattn wrote:
> > 
> > You lost me here. I would either expect this to select "foo\", or if it's 
> > smart, to do the same as before and select just the outer parenthesis. 
> > Neither happens. In the first line (double quote case) nothing at all 
> > happens. In the second line, "foo\)'" is selected, which is obviously wrong 
> > here.
> 
> I'm thinking it should work only for cpo+=M.

OK I think I get why the second line (with single quotes) selects the wrong 
text. Vim is smart enough to match backslashes, but not smart enough to treat 
"\%(" as a backslashed parenthesis. Maybe this needs fixing somehow?

But, why does the first line (with double quotes) not select anything at all?

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: text-object with single quoted string

2015-04-30 Thread Ben Fritz
On Thursday, April 30, 2015 at 9:17:33 AM UTC-5, Ben Fritz wrote:
> On Thursday, April 30, 2015 at 2:27:30 AM UTC-5, mattn wrote:
> > > 
> > > You lost me here. I would either expect this to select "foo\", or if it's 
> > > smart, to do the same as before and select just the outer parenthesis. 
> > > Neither happens. In the first line (double quote case) nothing at all 
> > > happens. In the second line, "foo\)'" is selected, which is obviously 
> > > wrong here.
> > 
> > I'm thinking it should work only for cpo+=M.
> 
> OK I think I get why the second line (with single quotes) selects the wrong 
> text. Vim is smart enough to match backslashes, but not smart enough to treat 
> "\%(" as a backslashed parenthesis. Maybe this needs fixing somehow?
> 
> But, why does the first line (with double quotes) not select anything at all?

Also, why would you expect it to not select anything at all, rather than 
selecting the outermost parens?

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.