![]() Registered Member ![]()
|
I am trying to extend Kate. I am trying to write a function that will allow the user to highlight some lines, enter some input and have the input prepended to each line in the selection.
I have been following some of the online tutorials, and I have created a myutils.js file with the function 'prepend' in it - Note - this function is hardcoded to replace the selected lines with the # symbol.. function prepend() { //each(function(lines){return lines.sort()}); map(function(l){ return l.replace(/^/, '#'); }); } function action(cmd) { var a = new Object(); if (cmd == "prepend") { a.text = i18n("Prepend Text With"); a.icon = ""; a.category = ""; a.interactive = true; a.shortcut = ""; } return a; } It works.. but I cannot figure out how to use the interactively entered text from the command line. The function displays the command prompt to enter the text but how do I capture that text to be used in the prepend function? I have been looking for hours, and just cannot find an answer. Every example I have found has interactive = false. Is there another way to capture text from the user? Am I going about solving the issue in a bad way? Any help would be greatly appreciated |
Registered users: bartoloni, Bing [Bot], Google [Bot], q.ignora, watchstar