amp icon indicating copy to clipboard operation
amp copied to clipboard

Unable to copy/paste.

Open nerd190 opened this issue 3 years ago • 5 comments

Hi, first let me start by thanking you, this editor is both easy to use but fully capable, it reminds me of a modal micro. I've switched to modal editing so I want to uninstall emacs and micro then replaced them with nvim and amp. Only problem i've encountered is that I cannot copy/paste when I am using Linux_Android (Termux - ARM64 tablet), Termux uses termux-clipboard-set & termux-clipboard-get, I was wondering if these two values could be added as its the only thing stopping me from making the move. Again, thank you so much! amp is amazing! Its really appreciated! I cant wait to see the future for this editor (I'm really looking forward to plugin support, being able to rewrite a vim plugin for amp will be a game-changer for this editors popularity!) Thank you!

EDIT: Just had a look at clipboard.rs (I have no knowledge of Rust) but it appears you check both "in-app" and "system clipboard", if it helps, on Android there is only one primary clipboard, the only way to access it is via Termux's termux-clipboard-set/get as it uses its Python APi to talk to the Java controlled clipboard, theres no other way for a CLi app to access it. I'm not sure if it may be best to do an OS check to eliminate the search for the secondary clipboard? or as it doesnt have to exist, it shouldnt cause any errors if it doesnt exist, so you could keep it how it is now and just add the termux-relevent commands? (termux-clipboard-set/get)

nerd190 avatar Feb 19 '21 07:02 nerd190

@jmacdonald it appears that its 'clipboard.rs' (your choice in clipboard lib) which is the problem, it doesnt support Android, or Windows. Please use a cross-platform clipboard lib, here is one that supports them: https://github.com/Canop/terminal-clipboard

nerd190 avatar Feb 27 '21 23:02 nerd190

@5c0tt-b0t: The library you linked doesn't support macOS, which would break support for that. I've looked around a fair bit and there doesn't really seem to be a 'catch-all' library for clipboard access. (It should at least support X11, Wayland, macOS, Termux to be viable)

Best thing to do would probably to simply roll our own solution - might be a bit more work, but gets us more complete support and full control over how we want to handle things. Doing this using the available platform-specific crates shouldn't be that much of a hassle in the end, I think. I'll look into this in the next few weeks, especially since I also care about Wayland support.

@jmacdonald: What do you think, is this proposal reasonable?

christoph-heiss avatar Mar 02 '21 09:03 christoph-heiss

@christoph-heiss I think a cross-platform clipboard crate for Rust in general would be a great thing. The copypasta crate from Alacritty was just a placeholder for a long time, but it seems they've finally extracted that logic there. That would get Wayland support working, but wouldn't solve for Termux. Maybe that's an adapter that could be added to the copypasta crate?

jmacdonald avatar Mar 02 '21 13:03 jmacdonald

Thank you so much for looking into this, its really appreciated! This is such a beautiful editor! I will ask @Canop if Mac & Wayland is something he would implement, he was kind enough to add Android/Termux for me last week. If not, atleast his source provides a working example of what is needed for Android/Termux compatability. Again, thank you!

nerd190 avatar Mar 03 '21 23:03 nerd190

I don't want to open a separate issue because I think this is very much related: Copy/paste from system clipboard should temporarily disable auto-indentation. I can currently paste snippets from wl-clipboard using Ctrl-Shift-V, but the formatting becomes corrupted. If there are any current workarounds please let me know.

adigitoleo avatar Apr 08 '22 11:04 adigitoleo