SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Cursor misplaced after snippet

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Cursor misplaced after snippet
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Cursor misplaced after snippet Reply with quote
The cursor might get misplaced when triggering the snippet by selecting it from the popup. Consider this one (I call it 'today'):
Code:

'$$SELECT LEFT('$DATE$',10)$$'


The result will be something like:
Code:

'2012.08.09'              |

with the cursor positioned at the pipe, which turns out to be exactly at the end of the raw snippet code. This does not happen when the snippet is triggered by its last character or there is a pipe in the snippet to enforce cursor position:
Code:

'$$SELECT LEFT('$DATE$',10)$$'|

Thu Aug 09, 2012 3:58 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
Please add pipe symbol to the end of the snippet code. Pipe is used as explicit cursor positioning marker.


Code:
'$$SELECT LEFT('$DATE$',10)$$|'


Hope this works for you. I believe you are using SSMS, I tested it with SSMS and it worked for me.
Thu Aug 09, 2012 6:15 pm View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
You must have been exhausted when you've written that reply :)
Fri Aug 10, 2012 5:08 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
Sorry, somehow I didn't see the last part of your post. Not sure what happened, maybe I just didn't scroll the content all the way to the end.

Now I see what you say that if the snippet code is longer than the value it generates, the cursor position matches the length of the snippet code rather the length of the value. I will submit this bug to our issue tracking system. Hope it should be easy to fix it.
Fri Aug 10, 2012 8:37 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
Thank you very much. And I'm sorry, I didn't want to be rude.

I wouldn't even say it is a bug, though one would naturally assume that the cursor would be at the end of the inserted text and not at the end of snippet. Even if there's nothing in the help stating this assumption to be correct. Not to mention that it is easily fixed by adding the pipe to the snippet, which is something that should be done to each and every one of them.

Hmm... You might want put one at the end of the snippet in case there isn't already one there or elsewhere in it and OK or Apply is clicked. Just a suggestion.
Fri Aug 10, 2012 8:53 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
The cursor is misplaced at the end of the inserted text after executing this snippets and not even the pipe symbol is able to enforce its position :(
Code:

$prompt(schema_name,Enter schema name,tipus)$
$prompt(type_name,Enter type name)$
$PROMPT(description,Short description :,No description...)$
CREATE TYPE $schema_name$.$type_name$ FROM |
GO
$$
IF '$description$' != ''
SELECT 'EXEC sys.sp_addextendedproperty @name = N''MS_Description'' ' + char(10)
         + '   ,@value = N''$description$'' ' + char(10)
         + '   ,@level0type = N''SCHEMA'' ' + char(10)
         + '   ,@level0name = N''$schema_name$'' ' + char(10)
         + '   ,@level1type = N''TYPE'' ' + char(10)
         + '   ,@level1name = N''$type_name$''' + char(10) + 'GO' + char(10)
$$

Fri Sep 07, 2012 4:41 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
I'm unable to reproduce the issue. It seems to work fine on my end and the cursor stops after FROM keyword where indicated by the pipe symbol.
Would you please try restarting your editor and testing it again?

PS. Not sure if that is important, I'm currently running one of the pre-release builds from the 6.3 code branch, which might have some additional fixes. I haven't attempted to test this issue with 6.2.112, which is the last released build.
Fri Sep 07, 2012 9:59 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
Hmm, strange. It resembles the same misplacement issue I mentioned in my first post but it looks like that when there's a multi-line snippet involved, a simple pipe symbol does not solve the problem when triggering it from the popup. And to make it weirder, having any text after the $$...$$ section will result in a seemingly blank editor with the cursor blinking on the right side of the screen but after moving the cursor or clicking somewhere into the editor all reverts to normal and all the text is visible again. Except the cursor, which isn't where it's supposed to be.

However, typing it till the last character works properly so there's a workaround.
Fri Sep 07, 2012 10:54 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.