Template Params edit simultanously lazarus / 9-Editor ---------------------------------------------------------------------- staratel20 · 2016-02-08 13:26 Is it possible to simultaneously replacement parameter of code template? For example I define code template something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $Param(0):=0;while($Param(1)>You can solve this with an editor macro. Yes, that's what I'm plan to do and that's why I create topic about macros to read file - token definitions are comfortable to save separately from macros code. ---------------------------------------------------------------------- Martin_fr · 2016-02-08 23:53 But then its much more than reading the word from a conf file. You need to keep state, and ideally also know if the caret was moved. In detail: * A) If you start with an "i", then you go to "integer", now your macro can find the list, which contains "integer" and it can go to "int", but now it must go back to "i". Where is that stored? Macros have no memory between calls. That also means that the list will need to be loaded each time (slow). You would need to add some storage for this. 1) per editor, since several editors in different windows can all be in different rotations at the same time. 2) global, to store the file you loaded. * B) Ideally but not 100% necessary you want to know if the caret was moved. If it was the current word surely should become permanent? The caret movement callback I do not see happening in macros (not anytime  soon). The rest I am happy to answer question, and possibilities for acceptable patches can be found. However I think there is an easier route for you. Write a SynEditPlugin. You can write your own package. Use the API provided by IDEIntf. If I am right it has a unit SourceEditorIntf, where you can register a callback that tells you about each SynEdit created. And there you can add your plugin to it. (No need to destroy, SynEdit can do that if it is destroyed) The plugin can register new commands for the keystrokes. And you can get callbacks from SynEdit on caret moves. You can write any code you want inside. There are already a few plugins that can serve as sample. Just search for the class name. ---------------------------------------------------------------------- staratel20 · 2016-02-09 19:52 Quote... "integer" and it can go to "int", but now it must go back to "i". Where is that stored? In PythonScript plugin for Notepad++ it stored in a global variables(defined in file startup.py) - where I was store also the caret pos after replacement. But after your answer I understand, that this will not working because of: QuoteMacros have no memory between calls. I read your suggest: QuoteHowever I think there is an easier route for you. ... But it'll takes time to analyze it step by step, and read more thoughtfully and cross-code. Thank you. ---------------------------------------------------------------------- staratel20 · 2016-02-16 10:29 Martin_fr: to avoid same question in future, I register on wiki and add this macros to wiki as Example 3: http://wiki.freepascal.org/index.php?title=IDE_Window:_Code_Templates& action=submit#Example_3_- _Macros_with_simultaneously_editable_parameters ---------------------------------------------------------------------- staratel20 · 2016-02-16 23:00 Martin_fr: at this time I don't see the Example 3 added by me. Why it was cutted? It was bad idea? Or I have to ask someone to add something to wiki and add only after? ---------------------------------------------------------------------- staratel20 · 2016-02-18 17:38 Someone can explain me what the rules to add something to wiki correct? ---------------------------------------------------------------------- Martin_fr · 2016-02-18 17:57 I dont see it being added or removed at all. http://wiki.freepascal.org/index.php?title=IDE_Window:_Code_Templates& action=history So something must have gone wrong when you tried. Anyone should be able to register and edit the wiki. Rules are basic, so long as your content is related to the topic, and not copyrighted by others, then it should be fine. If you add something it should be visible immediately, so you can check for success. And it will also be listed in the history. If your text contains links, a captcha will be displayed, and must be solved. -- EDIT with regards to adding links. that is to other pages in the wiki, to the forum, or the bug tracker. Other external links should not be added. ---------------------------------------------------------------------- staratel20 · 2016-02-18 19:24 A lot of thanks for detail explanation Martin. I check the history and try again.