keypirinha-snippets icon indicating copy to clipboard operation
keypirinha-snippets copied to clipboard

Improve multiline support

Open at-ng opened this issue 3 years ago • 1 comments

The way multi line works for snippets currently it seems initial white space is ignored. This can be a problem because sometimes you want to start a line with some indentation. One way to solve this would be to change this line from

data[path][snippet_key] = snippet_string

to just something like

data[path][snippet_key] = snippet_string.replace('|||', '')

Then you could start each line where you want to maintain indentation with " |||". Another option would be to do this

data[path][snippet_key] = snippet_string.replace('\\n', '\n')

Then you can maintain the indentation by doing everything on the same line, a bit more annoying to work with though but sometimes it might be better so maybe both could be supported.

at-ng avatar Nov 18 '21 13:11 at-ng

I think the most intuitive way to handle this would be to use surrounding quotes where leading and/or trailing white space needs to be preserved. I'd gladly accept a pull request that implements general use handling of quote enclosed strings.

dozius avatar Dec 19 '21 16:12 dozius