[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Kate plugin for marking text

On Saturday 26 March 2005 03:30 pm, Matej Cepl wrote:
> Can anybody advice me how to do this with the current kate (Kate: 2.3.2,
> KDE: 3.3.2, Qt: 3.3.3) and DCOP-based external scripts? Can I assign a
> shortcut to such script?

If you have to install something, consider Nedit--it's fairly small and fairly 
easy to do what you want, you can even use a list dialog that is sort of a 
poor man's combo box.

The key to using the list dialog which took me a minute to recognize is that 
it returns a string, but then you must insert it.  This is semi-debugged 
(tested for concept), and should be close to what you want.  If you decide to 
go this way and want some help, give a holler:

a = get_selection()
b = list_dialog( "Test", "category\nsomething else\nanother thing\nup to 
seven", "One", "Two", "Three", "Four")
insert_string("{"  b  "}"  a  "{/"  b  "}")

Just copy and paste this into the macro menu, give it a name and a keyboard 
shortcut, and modify the list_dialog to suit.

Nedit hides the macro setup screen at:
Preferences -> Default Settings -> Customize Menus -> Macro Menu...

From nedit's help:

list_dialog( message, text, btn_1_label, btn_2_label, ...&nb sp;): Pop up a 
dialog for prompting the user to choose a line from the given text string. 
The first argument is a message string to be used as a title for the fixed 
text describing the list. The second string provides the list data: this is a 
text string in which list entries are separated by newline characters. Up to 
seven additional optional arguments represent labels for buttons to appear 
along the bottom of the dialog. Returns the line of text selected by the user 
as the function value (without any newline separator) or the empty string if 
none was selected, and number of the button pressed (the first button is 
number 1), in $list_dialog_button. If the user closes the dialog via the 
window close box, the function returns the empty string, and 
$list_dialog_button returns 0. 

hope this helps,
Randy Kramer

Reply to: