[kate] [Bug 456846] Kate Snippets: not clear how to work with selected text
https://bugs.kde.org/show_bug.cgi?id=456846 Buovjaga changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED -- You are receiving this mail because: You are watching all bug changes.
[kate] [Bug 456846] Kate Snippets: not clear how to work with selected text
https://bugs.kde.org/show_bug.cgi?id=456846 --- Comment #5 from Buovjaga --- I created https://invent.kde.org/utilities/kate/-/merge_requests/821 -- You are receiving this mail because: You are watching all bug changes.
[kate] [Bug 456846] Kate Snippets: not clear how to work with selected text
https://bugs.kde.org/show_bug.cgi?id=456846 Buovjaga changed: What|Removed |Added Ever confirmed|0 |1 Assignee|kwrite-bugs-n...@kde.org|ilmari.lauhakangas@libreoff ||ice.org Status|REPORTED|ASSIGNED --- Comment #4 from Buovjaga --- (In reply to Thomas Friedrichsmeier from comment #3) > But in fact, if you do not care about adding a default value, in case there > is no selection, you can simply write (snippet tab): > > ${view.selectedText()} > > Would you like to create a merge request adding some illustrative examples? Thanks a lot for these! Yes, I will look into creating a merge request for the docs. -- You are receiving this mail because: You are watching all bug changes.
[kate] [Bug 456846] Kate Snippets: not clear how to work with selected text
https://bugs.kde.org/show_bug.cgi?id=456846 --- Comment #3 from Thomas Friedrichsmeier --- But in fact, if you do not care about adding a default value, in case there is no selection, you can simply write (snippet tab): ${view.selectedText()} Would you like to create a merge request adding some illustrative examples? -- You are receiving this mail because: You are watching all bug changes.
[kate] [Bug 456846] Kate Snippets: not clear how to work with selected text
https://bugs.kde.org/show_bug.cgi?id=456846 --- Comment #2 from Thomas Friedrichsmeier --- In RKWard we use the following in the snippet tab (example): ${rangeCommand("**%%1**", "Bold")} where rangeCommand is defined as (in the scripts tab): function rangeCommand(command, def) { if (view.selectedText().length > 0) { return command.replace("%%1", view.selectedText()); } else { return command.replace("%%1", def); } } This puts the selected text inside "**" markup, or inserts "**Bold**", in case nothing is selected. That took quite some experimenting to figure out, indeed -- You are receiving this mail because: You are watching all bug changes.
[kate] [Bug 456846] Kate Snippets: not clear how to work with selected text
https://bugs.kde.org/show_bug.cgi?id=456846 Buovjaga changed: What|Removed |Added CC||thomas.friedrichsmeier@kdem ||ail.net --- Comment #1 from Buovjaga --- Thomas: excuse me for adding you into the Cc, but I noticed your recent commit to Kate Snippets docs: https://invent.kde.org/utilities/kate/-/commit/bbdb00c136290021d642b6d9b20c0e04a8ecc9bf Maybe you have some insight on this problem. -- You are receiving this mail because: You are watching all bug changes.