Author |
Topic |
|
beylevem
Tomato Guru
102 Posts |
Posted - Oct 06 2007 : 4:24:10 PM
|
I tried changing the definition of {...} to { $end$$selected$ }
When I use the snippet with a selection, I can't get the space before and after the selected text - i.e. it executes as {$end$$selected$}
Is there any way to accomplish this? |
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Oct 08 2007 : 2:52:07 PM
|
Which IDE and version of VA are you using? How are you triggering this snippet? |
zen is the art of being at one with the two'ness |
|
|
beylevem
Tomato Guru
102 Posts |
Posted - Oct 08 2007 : 4:46:01 PM
|
triggered by highlighting text and pressing "{".
Here's another funny: it makes a difference whether you select text left-to-right or right-to-left. When I select right-to-left, I get { selected text } while left to right gives {selected text}
I.e. the right-to-left indents the left brace like I expect, the other doesn't.
Also, I noticed that there are two definitions for {...} in the autotext - why is this?
VA_X.dll file version 10.4.1609.0 built 2007.09.14 MSDev.exe version 6.0.9782.1 Devshl.dll version 6.0.9782.0 Devedit.pkg version 6.0.9782.0 Font: Bitstream Vera Sans Mono 13(Pixels) Comctl32.dll version 5.82.6000.16386 Windows Vista 6.0 Build 6000 2 processors
Platform: Win32 (x86)
|
|
|
beylevem
Tomato Guru
102 Posts |
Posted - Oct 08 2007 : 4:47:39 PM
|
The indentation got lost: ...{ ...selected text ...}
vs.
{selected text}
|
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Oct 09 2007 : 12:20:07 PM
|
The easy bit, there are two snippets since a new one has been added, but the old one has not been automatically removed.
A snippet to control the formatting for surround selection with { } has been added (the new one), but a snippet for surrounding code with { } has existed for quite a while now (the old one).
Are you selecting whole lines of text, including the EOL character? Or are you just selecting bits of text in the "middle" of a line? These are quite different things, even though they sound similar.
If you select whole lines of text (place caret in column 1 and use shift + down arrow) then you should get the formatting you expect. If VA thinks you are only selecting a part of the line then it has to work differently, since indenting the middle of a line of text is clearly not a good idea. |
zen is the art of being at one with the two'ness |
|
|
beylevem
Tomato Guru
102 Posts |
Posted - Oct 09 2007 : 12:43:43 PM
|
The confusion increases. I changed both snippets in the hope that I could identify which one is being used:
The first one which appears below tcc: {/*1*/ $selected$ }
The second one whch appears below #r: {/*2*/ $selected$ }
Using the following line to test: void C10::fn2() { int x = 2; }
Case 1: select int by double clicking, and then press "{"
void C10::fn2() { { int } x = 2; }
All methods of selection appear to give the same outcome.
Case 2: Select the line by left clicking in the margin and then press "{"
{ void C10::fn2() { int x = 2; } }
Case 3: position cursor at start of line, press shift+end, then press "{"
{void C10::fn2() { int x = 2; }}
So: * Selecting partial lines appears to do the "wrong" thing * It appears to make a difference how you slect things * I can't see how the formatting relates to the snippets
|
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Oct 09 2007 : 3:01:46 PM
|
I am also confused, since I was sure I saw this working. I tested this before making my original reply, to check that it was doing what I expected.
However since I did not make very detailed notes on exactly what I did, I am not now sure what I did.
Checking this here, selecting text and pressing "{" does something, but what it does simply ignores the formatting settings in the snippet. So this becomes a feature request, VA should use that formatting, at least for whole line selections, and probably for all selections:
case=9278
Different results when selecting one way instead of another way is a known bug:
case=1521 |
zen is the art of being at one with the two'ness |
|
|
beylevem
Tomato Guru
102 Posts |
Posted - Oct 09 2007 : 3:54:12 PM
|
After a search, it seems that it is the difference between "surround selection" and AutoText/Snippet at work. If I specifically invoke insert snippet, it works as expected.
*However*, even if I bind insert snippet to Alt+S, I must now type Alt+S, then scroll down to the entry, since the list does not allow a keyboard shortcut, and hit enter.
By which time, I could just as easily have typed the braces.
I don't think there is a conflict between the snippet and just surrounding text, since the snippet can be defined to do exactly the same thing as the default behavior. So yes, I would like to be able to customize the behavior of surround text with "{" using snippets
|
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Oct 10 2007 : 01:41:01 AM
|
opened case=9286 for 'selecting partial lines appears to do the "wrong" thing' |
|
|
support
Whole Tomato Software
5566 Posts |
Posted - Apr 10 2008 : 01:27:52 AM
|
case=1521 is fixed in build 1632 |
|
|
|
Topic |
|