Comments (4)
Hi - thanks for reporting this issue.
The problem comes from trying to come up with a simple but effective regular expression to 'find' urls within other strings.
At present the code uses: \b\S+://\S+\b
- the problem here is that the trailing slash is interpreted as a word boundary, so is removed.
I've tried other alternatives, such as: \w+:\/\/\S+
- this solves the trailing slash problem - however it instead sees all trailing punctuation as part of the url, so: click the link (http://example.com) please.
results in http://example.com)
The correct solution is probably to implement a match that matches the uri rfcs - however this requires dropping a very large regex into the code - of which there are many examples, each with varying levels of 'correctness' - see for example: https://mathiasbynens.be/demo/url-regex
In this case, I'd suggest that anyone who really wants to perfectly match uris should drop one of these patterns into their patterns
file and disable url matching in the config.
I'm of course very willing to accept a better regex that maintains as much simplicity as possible and removes this bug without introducing any other ones - suggestions welcome!
from clipster.
Would it be possible to use the deduplication feature to mitigate this?
When looking the code, I see:
# Check for growing or shrinking, but ignore duplicates
if last_item and text != last_item and (text in last_item or last_item in text):
Since the issue seems to be that first https://www.google.com
enters the clipboard and then https://www.google.com/
enters the clipboard after it, could we have a check for:
if last_item+'/' == text:
or some such?
Sorry if I am miss interpreting anything here, and thanks for your time.
EDIT:
# Extracted patterns are added to the history before the selection, and the clipbaord buffer is left unchanged.
Makes it sound like the https://www.google.com
is actually extracted... so I guess the above wouldn't be right then... though maybe the uri extraction could have a check for a one char change between original/extracted text?
from clipster.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from clipster.
This may be fixed by #101 since the pattern matching regexes have been updated. Any feedback on whether this fixes things welcome!
from clipster.
Related Issues (20)
- warnings HOT 2
- Infinite loop on re.findall HOT 4
- No Encoding Declared with Python2
- the config file does not work HOT 4
- Empty history JSON file crashes clipster HOT 2
- Clipster crashes when deleting multiple entries quickly from selection window HOT 2
- Clipster doesn't capture when using `Gtk.Clipboard`'s `set_text` to copy (in Python) HOT 1
- Packaging up a 2.0.2 release HOT 3
- --daemon doesn't make clipster run in background HOT 2
- sync_selections + pattern_as_selection = infinite loop HOT 1
- Clear clipboard after a configurable period of time HOT 1
- enable option -N for input HOT 1
- CLI output problems
- Feature request(s): unidirectional sync, sync without history HOT 4
- deprecation warnings when running the deamon HOT 2
- Clipboard is not replaced when selecting item from history HOT 4
- disable middle mouse button as paste HOT 2
- Gtk-WARNING: Theme parsing error HOT 1
- Question: Any plans on python3 ? HOT 1
- [Errno 2] No such file or directory: '/run/user/0/clipster.pid' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clipster.