Ask Your Question
1

Enclosing inner parens produces unwanted grab of outer parens

asked 2022-05-05 03:19:18 -0500

KhazAkar's avatar

updated 2022-05-05 06:54:58 -0500

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 )?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2022-05-05 07:09:35 -0500

updated 2022-05-05 07:42:41 -0500

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.

edit flag offensive delete link more
0

answered 2022-05-05 06:54:45 -0500

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.

edit flag offensive delete link more

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 -0500 )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 -0500 )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 -0500 )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 -0500 )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 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2022-05-05 03:19:18 -0500

Seen: 53 times

Last updated: May 05