domschrei / krunner-symbols

A lightweight KRunner plugin (Plasma 5) to retrieve unicode symbols, or any other string, based on a corresponding keyword.
GNU General Public License v3.0
118 stars 12 forks source link

Multi-line snippets? #8

Closed AndydeCleyre closed 6 years ago

AndydeCleyre commented 7 years ago

Is there a syntax supporting multiline snippets? I don't see that mentioned.

domschrei commented 7 years ago

You can try a definition like this (I just tested it and at least on my system with up-to-date Plasma frameworks this works):

multiline=this definition \n has multiple \n lines of text

(The spaces before and after the \n are just for clarity.)

If this works for you as well, I can add this new-found feature to the README ;)

AndydeCleyre commented 7 years ago

Thanks, it's partially working. There's some funny behavior with trailing spaces (for example, if it ends with an indented, blank line).

domschrei commented 7 years ago

The latest update to krunner appears to have altered the visualization of these multi-line definitions; only the first line of the definition is being displayed. However, triggering the result still has the wished effect of copying the full, multi-line snippet.

As this plugin only returns the content of the matches and has no influence on their graphical representation, I won't be able to change this.

AndydeCleyre commented 7 years ago

To be clear, my previous comment was not regarding the preview. I was noting that if the snippet ends with a new line followed by white space, the inserted snippet does not include that white space.

domschrei commented 6 years ago

Just noticed this issue is still open – sorry I didn't answer anymore back then. For anyone who still wonders how to do this: a non-breaking space (see the definition nbsp) can be added after the last new line, and it should be included in the retrieved string. (I think the KConfig framework does automatic trimming of whitespaces at the beginning and end of each line, so with non-breaking spaces we tell it that we actually care about the spaces – just like html   works.)