Closed benbaker76 closed 2 years ago
Hmmm, I wasn't able to repro. For me setting text = ''
still results in a _processClipboardContent
call. I also tried clearing my history and was able to copy something immediately afterwards and have it show up.
When you clear history is this._debouncing++
in _setClipboardText
being executed for you?
For me it happens consistently and then causes this check to return for the next copy:
_processClipboardContent(text) {
if (this._debouncing > 0) {
this._debouncing--;
return;
}
I've updated my first post with my setting and I use the paste on selection feature for this issue.
Those settings look like mine. For me, this._debouncing--;
gets called when I clear history. Before the if statement, you could add log(Me.uuid, "_processClipboardContent", this._debouncing);
and then look at the journal: journalctl -f /usr/bin/gnome-shell
to see when it shows up.
So I added some log output as requested:
_clearHistory() {
log(Me.uuid, "_clearHistory _debouncing:", this._debouncing);
log(Me.uuid, "this.currentlySelectedEntry:", this.currentlySelectedEntry);
log(Me.uuid, "this.currentlySelectedEntry.favorite:", this.currentlySelectedEntry.favorite);
if (this.currentlySelectedEntry && !this.currentlySelectedEntry.favorite) {
log(Me.uuid, "_resetSelectedMenuItem");
this._resetSelectedMenuItem();
}
_setClipboardText(text) {
log(Me.uuid, "_setClipboardText _debouncing:", this._debouncing);
if (this._debouncing !== undefined) {
this._debouncing++;
log(Me.uuid, "_setClipboardText _debouncing++:", this._debouncing);
}
_processClipboardContent(text, html) {
log(Me.uuid, "_processClipboardContent _debouncing:", this._debouncing);
if (this._debouncing > 0) {
this._debouncing--;
log(Me.uuid, "_processClipboardContent _debouncing--:", this._debouncing);
return;
}
Here is the output I get:
# Clear history
clipboard-history@alexsaveau.dev, _clearHistory _debouncing:, 0
clipboard-history@alexsaveau.dev, this.currentlySelectedEntry:, [object Object]
clipboard-history@alexsaveau.dev, this.currentlySelectedEntry.favorite:, false
clipboard-history@alexsaveau.dev, _resetSelectedMenuItem
clipboard-history@alexsaveau.dev, _setClipboardText _debouncing:, 0
clipboard-history@alexsaveau.dev, _setClipboardText _debouncing++:, 1
# Copy text
clipboard-history@alexsaveau.dev, _processClipboardContent _debouncing:, 1
clipboard-history@alexsaveau.dev, _processClipboardContent _debouncing--:, 0
I'm not sure how this._debouncing--;
is getting called when you clear history? As far as I can tell processClipboardContent
is never called from _clearHistory
.
I get this:
# Clear history
clipboard-history@alexsaveau.dev, _clearHistory _debouncing:, 0
clipboard-history@alexsaveau.dev, _setClipboardText _debouncing:, 0
clipboard-history@alexsaveau.dev, _processClipboardContent _debouncing:, 1
# Copy text
clipboard-history@alexsaveau.dev, _processClipboardContent _debouncing:, 0
No idea why they're different.
Maybe a different approach to debouncing is to unregister the clipboard change listener before writing to it and then re-register it.
I just tried a clean install and it works fine now. It must have been from a modification I made. My apologies for wasting your time!
No worries!
Describe the bug
When a clear history is performed the next copy will fail due to
_debouncing++
.How To Reproduce
Versions
Additional context (if a crash, provide stack trace)
When
_clearHistory()
is called it calls_resetSelectedMenuItem()
which calls_setClipboardText('')
which in turn increments_debouncing
and causes the next copy to fail.A possible solution is to not increment
_debouncing
if the text is empty: