CopyQ unable to correctly identify specific character patterns (e.g. CRLF)
- Dominant language
- C++
- Stars
- 12.3k
- Forks
- 593
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 9
Description
**Describe the bug**
CopyQ appears to have challenges correctly identifying specific character patterns. Specifically, a `CRLF` sequence, optionally appended by a null.
**To Reproduce**
1. Import this CopyQ command:
```
[Command]
Name=Ignore CRLF/LF if Sole Content
Match=^\\r?\\n\\x00?$
Automatic=true
Remove=true
Icon=
```
2. Copy a `CRLF` character sequence to the clipboard.
3. Notice that CopyQ doesn't completely ignore it; a notification pops up indicating that 2 lines were copied to the clipboard. On the other hand, an empty item is not created in CopyQ's clipboard history list.
4. Change the command's regex to `.*`
5. Copy anything to the clipboard.
6. Copy a `CRLF` to the clipboard.
7. Same result as 3.
**Expected behavior**
CopyQ to ignore when user tries to copy only an `LF` or `CRLF`, optionally appended by a null.
**Version, OS and Environment**
```
CopyQ 16.0.0
Arch: x86_64-little_endian-llp64
Audio: miniaudio 0.11.25
Compiler: MSVC
KNotifications: 6.23.0
KStatusNotifierItem: 6.23.0
OS: Windows 11 Version 25H2
QCA: 2.3.10
Qt: 6.10.2
QtKeychain: 0.15.0
has-audio: 1
has-encryption: 1
has-global-shortcuts: 1
has-keychain: 1
has-mouse-selection: 0
```
**Additional context**
I use a couple tools that will copy an `LF` or `CRLF` to the clipboard when nothing is selected (one of them appends a `null` afterwards too). This usually occurs when I accidentally press Ctrl+C instead of Ctrl+V to perform a paste operation. Instead of removing the contents of the clipboard and issuing a confusing notification, I would like CopyQ to leave the clipboard unchanged. Ideally, I would also like CopyQ to display an "Empty string not copied to clipboard" notification.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the issue with the imported command using `^\\r?\\n\\x00?$`, then compare it with `.*` as described. Trace CopyQ's handling of clipboard text, regex matching, removal, and notifications for LF/CRLF content. Done means LF or CRLF, optionally followed by a null, leaves the existing clipboard unchanged and reports the expected empty-string behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100