Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Snippet {...}
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

beylevem
Tomato Guru

102 Posts

Posted - Oct 06 2007 :  4:24:10 PM  Show Profile  Reply with Quote
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
18939 Posts

Posted - Oct 08 2007 :  2:52:07 PM  Show Profile  Reply with Quote
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
Go to Top of Page

beylevem
Tomato Guru

102 Posts

Posted - Oct 08 2007 :  4:46:01 PM  Show Profile  Reply with Quote
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)

Go to Top of Page

beylevem
Tomato Guru

102 Posts

Posted - Oct 08 2007 :  4:47:39 PM  Show Profile  Reply with Quote
The indentation got lost:
...{
...selected text
...}

vs.

{selected text}
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Oct 09 2007 :  12:20:07 PM  Show Profile  Reply with Quote
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
Go to Top of Page

beylevem
Tomato Guru

102 Posts

Posted - Oct 09 2007 :  12:43:43 PM  Show Profile  Reply with Quote
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

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Oct 09 2007 :  3:01:46 PM  Show Profile  Reply with Quote
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
Go to Top of Page

beylevem
Tomato Guru

102 Posts

Posted - Oct 09 2007 :  3:54:12 PM  Show Profile  Reply with Quote
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
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Oct 10 2007 :  01:41:01 AM  Show Profile  Reply with Quote
opened case=9286 for 'selecting partial lines appears to do the "wrong" thing'
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Apr 10 2008 :  01:27:52 AM  Show Profile  Reply with Quote
case=1521 is fixed in build 1632
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000