



Based on a suggestion from Nat[1] I updated Trigger with some code to detect tabstops in the snippet and emulate hitting tab the first time:
var name = ko.interpolate.interpolateStrings('%s');
var snippet = ko.projects.findPart('snippet', name, 'container');
if(snippet) {
Snippet_insert(snippet);
var rx = /(«|\%tabstop\:)/g;
if (rx.test(snippet.value)) {
ko.commands.doCommand('cmd_indent');
}
} else {
var msg = "no snippet found named " + snippet;
StatusBar_AddMessage(msg,"debugger",5000,true);
}
} catch(e) {
alert(e);
}
try {
var view = ko.views.manager.currentView;
view.setFocus();
view.scimoz.wordLeftExtend();
var name = ko.interpolate.interpolateStrings('%s');
var snippet = ko.projects.findPart('snippet', name, 'container');
if(snippet) {
Snippet_insert(snippet);
var rx = /(«|\%tabstop\:)/g;
if (rx.test(snippet.value)) {
ko.commands.doCommand('cmd_indent');
}
} else {
var msg = "no snippet found named " + snippet;
StatusBar_AddMessage(msg,"debugger",5000,true);
}
} catch(e) {
alert(e);
}[1] http://community.activestate.com/forum-topic/snippets-problem-tabstops#c...
Update: I corrected the code above to handle all tabstops, not just the older style ones I originally tested with =)
Update: I updated the above snippet with re-written code that only uses the new ko.* api. This version of trigger wil only work with 4.2.0 Beta 7 and later.
| Attachment | Size |
|---|---|
| trigger-tabstops.kpz | 1.23 KB |
| trigger-ko42.kpz | 1.23 KB |