Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

[Linux Mint] Dysfunctional Copy and Paste #313

Closed
1 of 7 tasks
msglm opened this issue Aug 6, 2020 · 26 comments
Closed
1 of 7 tasks

[Linux Mint] Dysfunctional Copy and Paste #313

msglm opened this issue Aug 6, 2020 · 26 comments
Labels
bug Something isn't working

Comments

@msglm
Copy link

msglm commented Aug 6, 2020

How have you installed cordless

  • Arch User Repository
  • Snap
  • scoop
  • brew
  • go get
  • git clone & go build .
  • Releases

What happened

After installing xclip (also attempting with xsel), and attempting the copy bind, the said text was not copied to the system clipboard

How do you reproduce this bug

Use Linux Mint 20
Install cordless via releases
attempt to copy a segment of text after highlighting
attempt to paste in a multitude of different programs
fails to copy

Error output

Not Appliciable

Hints on what could've happened

Possible mixup/conflict between system and xorg clipboard

System information

| Key | Value |
| - | - | ???

| OS | Linux Mint Version 20 |
| Architecture | amd64 |

Note

This is likely vague and unhelpful (I really do not know what to tell you guys to help), but I am always open to giving new information

@Bios-Marcel
Copy link
Owner

Do you use wayland perhaps?

@msglm
Copy link
Author

msglm commented Aug 6, 2020

confirmed to be x11 with "echo $XDG_SESSION_TYPE".

@msglm
Copy link
Author

msglm commented Aug 7, 2020

If there's any suggestion, tinkering, or work around you can suggest to alliviate the issue, I'm open to suggestions. Not being able to copy and paste makes working in the client difficult.

@Bios-Marcel
Copy link
Owner

What shortcut do xou paste with

@msglm
Copy link
Author

msglm commented Aug 7, 2020

Ctrl+Alt+C

@Bios-Marcel
Copy link
Owner

Is that a cordless shortcut you decided on or something your terminal does?

@msglm
Copy link
Author

msglm commented Aug 7, 2020

cordless shortcut, my terminal is ctrl+shift+C. Using gnome-terminal.

@Bios-Marcel
Copy link
Owner

Have you tried using different terminals to see whether the behaviour differs between them?

@Bios-Marcel Bios-Marcel added the bug Something isn't working label Aug 13, 2020
@msglm
Copy link
Author

msglm commented Aug 14, 2020

I used gnome-terminal and tried with guake, neither work.

@Bios-Marcel
Copy link
Owner

Doesn't guake use the gnome terminal widget? This would mean it's basically the same. Try something completly different. Lie Alacritty, xterm, st or so.

@msglm
Copy link
Author

msglm commented Aug 15, 2020

Tried xterm, similar result as last.

@Bios-Marcel
Copy link
Owner

I am sorry, but I can't reproduce this issue. Can you somehow narrow down the problem?

@msglm
Copy link
Author

msglm commented Aug 16, 2020

Well I don't really know how I could besides system specifications and packages. I have both xsel and xclip installed (due to different scripts needing both), but after removing xclip and xsel and trying with just one, nothing changed. That rules out issues with that. Doubt it'd be a hardware comparability issue, but will provide if requested. X version is following:

X.Org X Server 1.20.8
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.0-184-generic x86_64 Ubuntu
Current Operating System: Linux joybuke-desktop 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.4.0-42-generic root=UUID=e3b14193-c2da-4f84-a3c6-a59e42a7ec24 ro quiet splash
Build Date: 24 June 2020  06:00:21AM
xorg-server 2:1.20.8-2ubuntu2.2 (For technical support please see http://www.ubuntu.com/support) 
Current version of pixman: 0.38.4
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.

@Bios-Marcel
Copy link
Owner

Possible mixup/conflict between system and xorg clipboard

So, you copy in cordless and then paste via your normal system keyboard shortcut? Or do you use middle mouse button (second clipboard?) Or do you perhaps use some clipboard manager or so? Maybe I misunderstood the situation. And what if you try manually outputting the supposedly copied text via xclip on the cli. Also, is there any error in the cordless console?

@msglm
Copy link
Author

msglm commented Aug 16, 2020

To start, there is no error, in console and (to my knowledge) I am not using any clipboard management program. Neither middle mouse or normal system keyboard pastes the copied text. To elaborate more on the issue with this, I highlight someone's message, hit the copy bind, and try either middle click or CTRL + V, incorrect text pastes. The incorrect text is only for CTRL + V and is due to something I had in my clipboard before, so the program is not writing to clipboard. Both in and out of cordless the paste fails to get the right text. Know thinking about it, the issue might be with the fact that cordless doesn't write anything to the xorg clipboard.

@Bios-Marcel
Copy link
Owner

Could you try again with this patch applied:

diff --git a/ui/editor.go b/ui/editor.go
index 735799d..900812f 100644
--- a/ui/editor.go
+++ b/ui/editor.go
@@ -1,6 +1,7 @@
 package ui
 
 import (
+	"log"
 	"unicode"
 
 	"github.com/Bios-Marcel/cordless/tview"
@@ -430,7 +431,11 @@ func NewEditor() *Editor {
 		} else if shortcuts.DeleteWordLeft.Equals(event) {
 			editor.DeleteWordLeft()
 		} else if shortcuts.CopySelection.Equals(event) {
-			clipboard.WriteAll(editor.buffer.Cursor.GetSelection())
+			clipboardError := clipboard.WriteAll(editor.buffer.Cursor.GetSelection())
+			if clipboardError != nil {
+				errorColor := tviewutil.ColorToHex(config.GetTheme().ErrorColor)
+				log.Printf("[%s]Error copying text to clipboard:\n\t[%s]%s\n", errorColor, errorColor, clipboardError)
+			}
 			//Returning nil, as copying won't do anything than filling the
 			//clipboard buffer.
 			return nil

It should show an error in the console.

@msglm
Copy link
Author

msglm commented Aug 17, 2020

How would one go about applying the patch?

@Bios-Marcel
Copy link
Owner

git clone https://github.com/Bios-Marcel/cordless
cd cordless
git apply --
#PASTE PATCH AND HIT Ctrl+D (I think)
go run .

@msglm
Copy link
Author

msglm commented Aug 18, 2020

Applied the patch and ran the patched version. Attempted copy and paste and no error occurred so either your code for error handling is faulty (that I doubt) or something IS being wrote but is configured improperly and therefore it breaks.

@Bios-Marcel
Copy link
Owner

Can you make sure xclip works?

echo "Hello world" | xclip this should be pastable by then. And is your cordless for some reason running on a container or do you run it via SSH or anything? I am kinda out of ideas here. As a last resort i could try live-debugging it with you in a voice-all or so, that is if you wish to do so.

@msglm
Copy link
Author

msglm commented Aug 18, 2020

Well we found the issue, xclip and xsel aren't copying data. Cordless is not running in a container or SSH. Voice calls should be avoided to keep a project's issues orderly and findable. Valuable information could be locked from the public about this program if our discussion isn't public. In case someone else is having the issue, I'd want them to be able to use this as a resource for his or her issue.

@msglm
Copy link
Author

msglm commented Aug 18, 2020

also realized earlier that when you asked what I paste with, I misread that as copy. My paste bind in terminal is CTRL+SHIFT+V, out of is CTRL+V

@Bios-Marcel
Copy link
Owner

I see, so your system setup appears to be faulty?

@msglm
Copy link
Author

msglm commented Aug 18, 2020

not exactly, copy and pasting for all scenarios but this works completely fine. There is likely a variable that you could call that shows the preferred clipboard program of a system. It's late for me so I will be going to bed soon, so I can't get you that research, but that variable (if it exists) might be a better alternative to the current system of xsel or xclip only (as those don't work on some machines) OR the program used for clipboard management on my system is found and either swapped or integrated to function on cordless. Either works and either (in theory) should fix the issue. I'll be heading off now to get some much needed rest, so don't expect a response for some time.

@Bios-Marcel
Copy link
Owner

This might be an issue for https://github.com/atotto/clipboard then

@msglm
Copy link
Author

msglm commented Aug 21, 2020

Will open an issue up there then.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants