Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discard (strings only containing) whitespaces #51

Closed
chron-isch opened this issue Jul 5, 2017 · 3 comments
Closed

Discard (strings only containing) whitespaces #51

chron-isch opened this issue Jul 5, 2017 · 3 comments

Comments

@chron-isch
Copy link
Contributor

Whilte using the primary clipboard it happends quite offen to me that I accidentialy mark way more than I actually want to in a console, or just simply move my mouse a little too much and send 2 or even more lines to the primary clipboard, padded by a whole lot of whitespaces.

It would be awesome if we could filter those extra whitespaces out. The difficult thing would be to not filter out too much.

I guess it could be done with patterns alone, I just wanted to know what you think about it.

@mrichar1
Copy link
Owner

mrichar1 commented Jul 6, 2017

Hi - thanks for this suggestion!

As you said, this can be achieved with patterns - I think for this use case you want something like:

^[ \t]*(.*?)[ \t]*$

(You could instead use \s which would also strip newlines).

The downside with patterns is that currently they only add the extracted pattern to the board, leaving the actual clipboard selection intact. I can see an argument that this should be configurable to replace the last item instead of being in addition to it.

Let me know if making this change would be useful enough, of if you still think that an explicit config option to toggle whitespace stripping is needed.

@chron-isch
Copy link
Contributor Author

Hi, thanks for the quick answer!

I've tried and noticed that behaviour myself allready.

I really like your idea of making it configurable to replace the last item, it's way more versatile than a simple config option to strip whitespaces.

mrichar1 added a commit that referenced this issue Jul 20, 2017
- Pattern matches added to history after selection, instead of before.
- Clipboard buffer is set to pattern.
- Should offer a solution to #51
@mrichar1
Copy link
Owner

The latest release 1.0.4 now has a pattern_as_selection config option.

If set to true, this will make the pattern match be both the last item in the history, and also replace the clipboard buffer.

Combining this with the whitespace pattern above should hopefully do what you want.

Let me know if this solution fixes your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants