Author Topic: Code Templates key word-boundary issue  (Read 3136 times)

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Code Templates key word-boundary issue
« on: March 17, 2009, 12:07:22 pm »
Code Templates key word- boundary issue

Just FYI


I have an code template key like "IT".
But this is triggered also if i type "testIT"  (see pic), which is not expected as i guess? 

Should i use something like  "_IT"  as key?
An key like " IT" is no solution. (EDIT: no, it IS an solution too, since this key is replaced by template.)
I think your code should use something like "\b{key}"?

On the other side this issue could be an welcome feature too! if someone needs this.

.
« Last Edit: March 17, 2009, 12:09:01 pm by Stefan »
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Code Templates key word-boundary issue
« Reply #1 on: March 17, 2009, 12:48:02 pm »
This is not always correct, because as template you can use any character sequence (::: or ;; what ever), which are should be boundered by word symbols.

But possible solution for me would be to check that template starts with word symbol or not and use appropriate logic. Would try to correct this newxt beta.

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: Code Templates key word-boundary issue
« Reply #2 on: March 30, 2009, 08:02:18 am »
Beta 1.42 Build 637

The logic is modified. For my example above this works now as expected.
The code template is only triggered if the trigger key is typed as single word (key) and not as last past of an wort (wordkey)
The only exception is, if you start tipping at col 1 and type an addition single char in front (ckey) of trigger key.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Code Templates key word-boundary issue
« Reply #3 on: March 30, 2009, 09:36:00 am »
Quote
The only exception is, if you start tipping at col 1 and type an addition single char in front (ckey) of trigger key.
This is a bug. Would correct it next beta.

Thanks a lof for retest!

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: Code Templates key word-boundary issue
« Reply #4 on: April 01, 2009, 08:48:52 am »
Beta 1.42 Build 637

Sorry Alex, another one:


While modifying the case from "Wscript" to "WScript"  my trigger-key "WS" is triggered. (see pic)

Of course i didn't have to press ENTER or TAB, but... it's not nice the tool tip appears in this situation.

Quote
Explanation:

I had this code:
Wscript.Quit
End If

After changing "Wscript" to "WScript" and pressing ENTER i got this code:
Dim WS
set WS = CreateObject("wscript.Shell")cript.Quit
End If


So i think we need to check if there are chars behind too?
What i mean is: the trigger "WS" should not be detected in such situation, the tool tip should not appear and
even i press ENTER or TAB the template should not be inserted.

« Last Edit: April 01, 2009, 08:58:21 am by Stefan »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Code Templates key word-boundary issue
« Reply #5 on: April 01, 2009, 01:51:20 pm »
Here I am not sure.

Because I have checked another engines (Visual Assist), and see that HE behaves same i nthis case.
But maybe this can be limited to case when next symbol is alphabetic and last char of template is also alphabetic.
Because  I do not know that W was typed before for HE and could not use this info.

 

Related Topics

  Subject / Started by Replies Last post
XML Code templates

Started by JJK « 1 2 » Bug reports

16 Replies
5714 Views
Last post December 04, 2008, 01:42:33 pm
by JJK
2 Replies
1797 Views
Last post December 11, 2008, 12:01:06 pm
by alex
4 Replies
2409 Views
Last post March 04, 2009, 05:25:29 pm
by alex
6 Replies
3666 Views
Last post November 12, 2009, 03:37:48 pm
by Stefan
1 Replies
1451 Views
Last post April 23, 2012, 11:46:11 am
by alex