First time here? Check out the FAQ!
1

Enclosing inner parens produces unwanted grab of outer parens

Hi, In Wing IDE Personal, if you want to enclose [] within () (or other way around), then instead of ([]), it produces ([)], regardless if it's done using keybindings or selecting manually Source -> Enclose.

It only happens if you want to enclose two different types of brackets/parens. Using it on the same type works normally.

Is there a way to fix it/work around this other than first typing (, then enclosing [], then manually closing with )?

KhazAkar's avatar
124
KhazAkar
asked 2022-05-05 03:19:18 -0600
Wingware Support's avatar
4.2k
Wingware Support
updated 2022-05-05 06:54:58 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

0

To summarize the useful bits from the other answer that made an incorrect assumption: The Enclose feature requires selecting the text that should be enclosed.

Also, In Wing Pro with the Editor > Auto-Editing > Apply (), [], {} to Selection preference enabled, you can just select and press ( or [ or { to enclose. Or, since Wing Pro auto-closes those by default typing ( following by [ would get you ([|]) where | is the caret. But the auto-editing suite of functionality is not present in Wing Personal.

Wingware Support's avatar
4.2k
Wingware Support
answered 2022-05-05 07:09:35 -0600, updated 2022-05-05 07:42:41 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

Are you using vi mode? If so, I suspect you need to select one more character to the right since it's not considering the character the block cursor is on to be included in the selection. This is probably a bug. Sometimes we do that sort of thing to match what people have in their finger memories, but I suspect this isn't a case where that would be an issue.

Wingware Support's avatar
4.2k
Wingware Support
answered 2022-05-05 06:54:45 -0600
edit flag offensive 0 remove flag delete link

Comments

Yes, I'm using vi mode. I was not selecting anything, you can get it when you run enclose with (), then right after that enclose with [] :)

PS. I always use vi mode in every editor I use :)

KhazAkar's avatar KhazAkar (2022-05-05 06:57:44 -0600) edit

Ah, I see. You have to select what you want to enclose. I checked and I think vi mode is doing the right thing, in that the character under the block cursor is considered part of the selection for this. So I think it's just the need to select. Are you expecting it to automatically enclose to the matching ) or ] etc if you are before ( or [ etc? Or find the innermost [] or () etc and enclose that? The implementation currently assumes selection but it might make sense to have a default action if there is no selection.

Wingware Support's avatar Wingware Support (2022-05-05 07:02:02 -0600) edit
1

BTW, for clarity for others that might see this: In Wing Pro with the Editor > Auto-Editing > Apply (), [], {} to Selection preference enabled, you can just select and press ( or [ or { to enclose. But the auto-editing suite of functionality is not present in Wing Personal.

Wingware Support's avatar Wingware Support (2022-05-05 07:04:03 -0600) edit

I'm expecting it to automatically enclose right after creation as default behavior when nothing is selected. Example:

test-enclose_with_()--enclose_with_[]- should give me test([*cursor]) instead of test([)*cursor]

I hope that everything what I propose/say is in the right tone :)

KhazAkar's avatar KhazAkar (2022-05-05 07:11:26 -0600) edit

We'll consider adding that for the case where there is no selection. It's what you would get by default in Wing Pro using the auto-editing features that auto-close (, [, and {.

Wingware Support's avatar Wingware Support (2022-05-05 07:41:57 -0600) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer