Ticket #30 (closed enhancement: fixed)
savannah: support for x clipboard wanted
Reported by: | ossi | Owned by: | angel_il |
---|---|---|---|
Priority: | minor | Milestone: | 4.7.4 |
Component: | mcedit | Version: | master |
Keywords: | xclip, clipboard | Cc: | zaytsev |
Blocked By: | Blocking: | ||
Branch state: | merged | Votes for changeset: | committed-master |
Description (last modified by ossi) (diff)
Original: http://savannah.gnu.org/bugs/?13751
Submitted by: | Oswald Buddenhagen <ossi> | Submitted on: | Tue 12 Jul 2005 10:44:23 AM UTC |
Category: | Editor | Severity: | 3 - Normal |
Status: | None | Privacy: | Public |
Assigned to: | None | Open/Closed: | Open |
Release: | current (CVS or snapshot) | Operating System: | All |
Original submission:
another one from the "hey, i'm an x application" department. when running under x, it should be possible to use the x clipboard instead of mc's "proprietary" clip file. there should also be an option to make it the default, at least for the cua keybindings (the ones with shift & ctrl and the cursor block). there is one problem with xterm, though ... it steals us the shift-ins key combo to do X PRIMARY selection pasting itself. so unless there is a way to convince xterm not to do this (or at least a way to hack around it), we have a problem.
Comment 1 by Jan Engelhardt <hirogen2> at Sun 06 Jul 2008 04:19:44 PM UTC:
I run mc/mcedit always with the -d switch to deactivate mc's special mouse handling and get my X clipboard support (i.e. double-click to copy, middle button to paste) back.
Attachments
Change History
comment:2 Changed 15 years ago by ossi
fwiw, overriding xterm's mapping is in fact a FAQ. the solution is to add
XTerm*VT100*translations: #override \nShift <KeyPress?> Insert:insert-eight-bit()
to the ~/.Xresources file (or whatever your setup has).
iow, there is nothing to make this feature unfeasible.
comment:3 follow-up: ↓ 4 Changed 15 years ago by slavazanko
- Milestone changed from 4.7 to future releases
I think, better to support XWindow clipboard more native - for example, pressing ALT+F (in additional) will add to Xclipboard current selection in editor...
comment:4 in reply to: ↑ 3 Changed 15 years ago by ossi
Replying to slavazanko:
I think, better to support XWindow clipboard more native - for example, pressing ALT+F (in additional) will add to Xclipboard current selection in editor...
that's more explicit, but definitely not more native - quite to the contrary even, as the x clipboard is native in an x environment and can be expected to be found under the usual keybindings (that's why xterm has that keybinding in the first place). mc's own clipboard is still reachable via ctrl-f and shift-f5, so why deviate from the intuitive keybindings? one reason could be consistent access from mc instances running in consoles and in xterms at the same time. seems like a corner case which i would not want to sacrifice for better integration into the windowing environment. but that can be configurable as indicated in the original submission.
fwiw, given that you did not choose to use alt-shift-ins for vertical pasting, you could it use now to paste PRIMARY (as opposed to CLIPBOARD with shift-ins).
comment:5 Changed 15 years ago by angel_il
- severity set to no branch
- Milestone changed from future releases to 4.7.0-pre3
comment:6 follow-up: ↓ 7 Changed 15 years ago by xintrea
In path "editcmd.c xclip patch for 4.7.0-pre2" memory leak be present.
In functions edit_copy_to_X_buf_cmd() and edit_cut_to_X_buf_cmd() instead code
char *tmp; tmp = g_strconcat ("xclip -i ",concat_dir_and_file (home_dir, EDIT_CLIP_FILE)," -selection clipboard", NULL ); system (tmp); g_free(tmp);
...must have code
// Work with X-buffer char *tmp; gchar *concat_result=concat_dir_and_file (home_dir, EDIT_CLIP_FILE); tmp = g_strconcat ("xclip -i ", concat_result, " -selection clipboard", NULL ); system (tmp); g_free(tmp); g_free(concat_result);
I don't know, how make path file, but please insert this code correction.
Changed 15 years ago by uchti
- Attachment mc-4.7.0-pre2-editcmd_xclip.patch added
editcmd.c xclip patch for 4.7.0-pre2
comment:7 in reply to: ↑ 6 ; follow-up: ↓ 9 Changed 15 years ago by xintrea
Oops, solving for copy to X-buffer with "xclip" have any problem.
If system locale i.e. KOI-8R, and text file in other codepage (i.e. UTF-8), we select by Ctrl+T UTF-8 codepage. In "copy to X-buffer action", in cooledit.clip file putted text in UTF-8 codepade. Next, running command
xlib -i cooledit.clip
and in buffer inserting UTF-8 text. If paste from buffer this text into MC or into any text editor, we seen bad cyrillic symbol.
Solved this problem - convert cooledit.clip (before run xlib) from editor codepage to system codepage.
For write code, need known:
How get editor codepage as string, i.e. "UTF-8"?
How get system codepage as string, i.e. "KOI-8R"?
comment:9 in reply to: ↑ 7 ; follow-up: ↓ 10 Changed 15 years ago by angel_il
How get editor codepage as string, i.e. "UTF-8"?
How get system codepage as string, i.e. "KOI-8R"?
use "get_codepage_id (source_codepage)"
comment:10 in reply to: ↑ 9 ; follow-up: ↓ 11 Changed 15 years ago by xintrea
Replying to angel_il:
How get editor codepage as string, i.e. "UTF-8"?
How get system codepage as string, i.e. "KOI-8R"?
use "get_codepage_id (source_codepage)"
Im jumble.
Index "source_codepage" - it is current editor codepage?
Index "display_codepage" - it is system codepage?
comment:11 in reply to: ↑ 10 Changed 15 years ago by xintrea
This is bullshit. The official version of xclip uncorrect work with national (cyrillic) symbols.
Prooflink for russian people - http://habrahabr.ru/blogs/linux/48954/
If locale is KOI-8R, and in cooledit.clip put text in KOI-8R, then after command
xclip -i cooledit.clip -selection clipboard
in clipbord put text with bad cyrillic symbols.
What is to do?
comment:14 Changed 14 years ago by angel_il
- Status changed from new to accepted
- severity changed from no branch to on review
- Keywords xclip, clipboard added
- Version set to master
- Milestone changed from 4.7 to 4.7.3
- Owner set to angel_il
- Type changed from task to enhancement
branch: 30_external_clipboard_utility
changeset: a176c37b8460bd326f6dc7cabce576fccc894ded
please review :)
comment:15 Changed 14 years ago by angel_il
branch: 30_external_clipboard_utility (forced update)
changeset: a5fd5ce88c130d6bc4b4061cfc8f4a4536e96ba1
comment:17 Changed 14 years ago by slavazanko
- Votes for changeset changed from andrew_b to andrew_b slavazanko
- severity changed from on review to approved
comment:18 Changed 14 years ago by angel_il
- Status changed from accepted to testing
- Votes for changeset changed from andrew_b slavazanko to commited-master
- Resolution set to fixed
- severity changed from approved to merged
comment:19 Changed 14 years ago by andrew_b
- Status changed from testing to closed
- Description modified (diff)
comment:20 Changed 14 years ago by ossi
line 3987 in mc.1.in contains a copy&paste mistake (somewhat ironic in the context of this ticket :D).
i'm not sure why you chose to invoke an external tool and thus introduce an additional dependency for that. the x11 code to support that is pretty simple; you'd need to copy only a small part from xclip.
at the very least, the xclip calls should be in the default setup. otherwise it's as if the function wasn't there at all (many people miss it, but i don't think anyone would expect it to be actually there, "just needing configuration").
other than that, it works quite nicely, it seems. ;)
comment:21 follow-up: ↓ 22 Changed 14 years ago by zaytsev
- Cc zaytsev added
A bundled "brand new" keymap is on the way. I hope it will make it into master. One day. In what concerns xclip it's more tricky: one needs time and competence to implement this.
Line 3987 is .I xterm_mode. Hmmm?
Patches welcome.
comment:22 in reply to: ↑ 21 Changed 14 years ago by ossi
Replying to zaytsev:
A bundled "brand new" keymap is on the way.
noooo, *don't* add separate key bindings for that! it should work transparently as it does now. it should just be there by default.
Line 3987 is .I xterm_mode. Hmmm?
i meant in the commit that went in (781706...).
comment:23 Changed 14 years ago by zaytsev
- Status changed from closed to reopened
- Votes for changeset commited-master deleted
- Resolution fixed deleted
- severity changed from merged to on review
- Milestone changed from 4.7.3 to 4.7.4
Damn it, damned damn!
Branch: 30_typo_fixup (parent: master)
Changeset: 1b8278da2adf33f01d2dbdf786dc010f9eaf5f67 .
comment:24 Changed 14 years ago by zaytsev
The keymap is not going to be added just for that. It will encompass all the bindings for the new features, that break old behavior.
Right now, I don't see how one can make this working transparently by default without breaking old behavior and dependency on xclip doesn't make things any easier.
comment:25 Changed 14 years ago by ossi
you're right, the non-cua key bindings should not be affected. i even implied that myself in the original submission. :)
comment:27 Changed 14 years ago by angel_il
- Votes for changeset changed from andrew_b to andrew_b angel_il
- severity changed from on review to approved
comment:28 Changed 14 years ago by zaytsev
- Status changed from reopened to closed
- Votes for changeset changed from andrew_b angel_il to committed-master
- Resolution set to fixed
- severity changed from approved to merged
Merged: ae65d8c813c7916d480b28ffc1be2eae7dae1713 .
comment:29 follow-up: ↓ 30 Changed 14 years ago by beroal
Forget me if this is unrelated. There are "clipboard_store" and "clipboard_paste" options in ".mc/ini" file. What keys precisely invoke those commands in "mcedit"? I need to exchange with "Xorg" clipboard, but "mcedit" runs in a text console (i.e. Ctrl+F1 in Linux).
Also there are, I guess, mistakes in man pages:
"clipboard_store This variable contains path (with options) to the external clipboard utility like 'xclip' to read text into X selection from file." --- What file? Perhaps stdin?
"clipboard_paste This variable contains path (with options) to the external clipboard utility like 'xclip' to print the selection to standard out. For example:
clipboard_store=xclip -o" --- Example is unrelated.
comment:30 in reply to: ↑ 29 ; follow-ups: ↓ 31 ↓ 32 Changed 14 years ago by andrew_b
Replying to beroal:
What keys precisely invoke those commands in "mcedit"?
By default, that are common shortcuts ctrl-ins, shift-ins, shift-del. You can redefined it in keymap file
[editor] EditXStore = ctrl-insert EditXPaste = shift-insert EditXCut = shift-delete
"clipboard_store This variable contains path (with options) to the external clipboard utility like 'xclip' to read text into X selection from file." --- What file?
File that is loaded in mcedit.
"clipboard_paste This variable contains path (with options) to the external clipboard utility like 'xclip' to print the selection to standard out. For example:
clipboard_store=xclip -o" --- Example is unrelated.
What is unrelated? xclip prints selection to the its standard out. xclip's stdout is read by mc.
comment:31 in reply to: ↑ 30 Changed 14 years ago by beroal
Replying to andrew_b:
Replying to beroal:
"clipboard_store This variable contains path (with options) to the external clipboard utility like 'xclip' to read text into X selection from file." --- What file?
File that is loaded in mcedit.
Excerpt from "man xclip":
-i, -in read text into X selection from standard input or files (default)
Does "mc" gives the name of that file to the "clipboard_store" command as argument? Or sends text to "stdin" of the process of the "clipboard_store" command?
"clipboard_paste This variable contains path (with options) to the external clipboard utility like 'xclip' to print the selection to standard out. For example:
clipboard_store=xclip -o" --- Example is unrelated.
What is unrelated? xclip prints selection to the its standard out. xclip's stdout is read by mc.
I did not expect that it would be hard to explain. When you write the example for "clipboard_paste", using "clipboard_store" in the example looks meaningless!
Please do not explain here, just fix the man pages.
comment:32 in reply to: ↑ 30 ; follow-up: ↓ 33 Changed 14 years ago by beroal
Replying to andrew_b:
Replying to beroal:
What keys precisely invoke those commands in "mcedit"?
By default, that are common shortcuts ctrl-ins, shift-ins, shift-del. You can redefined it in keymap file
[editor] EditXStore = ctrl-insert EditXPaste = shift-insert EditXCut = shift-delete
So, this keys coincide with those that works with "~/.mc/cedit/cooledit.clip". If I start "mc" with "DISPLAY" variable, should it use "~/.mc/cedit/cooledit.clip" or the Xorg server clipboard?
comment:33 in reply to: ↑ 32 Changed 14 years ago by angel_il
Replying to beroal:
Replying to andrew_b:
Replying to beroal:
What keys precisely invoke those commands in "mcedit"?
By default, that are common shortcuts ctrl-ins, shift-ins, shift-del. You can redefined it in keymap file
[editor] EditXStore = ctrl-insert EditXPaste = shift-insert EditXCut = shift-deleteSo, this keys coincide with those that works with "~/.mc/cedit/cooledit.clip". If I start "mc" with "DISPLAY" variable, should it use "~/.mc/cedit/cooledit.clip" or the Xorg server clipboard?
after you start action EditXStore (ctrl-insert pressed) mc do next steps:
1) write current selection into ~/.mc/cedit/cooledit.clip
2) test DISPLAY
3) get value of clipboard_store (for example "xclip -o")
4) build executable string $clipboard_store + $home_dir + $EDIT_CLIP_FILE + " 2>/dev/null"
in this case "xclip -o" + " " + "/home/username/.mc/cedit/cooledit.clip" + " 2>/dev/null"
5) execute this
for more detail see
... gboolean copy_file_to_ext_clip (void) { char *tmp, *cmd; int res = 0; const char *d = getenv ("DISPLAY"); if (d == NULL || clipboard_store_path == NULL || clipboard_store_path[0] == '\0') return FALSE; tmp = concat_dir_and_file (home_dir, EDIT_CLIP_FILE); cmd = g_strconcat (clipboard_store_path, " ", tmp, " 2>/dev/null", (char *) NULL); if (cmd != NULL) res = my_system (EXECUTE_AS_SHELL, shell, cmd); g_free (cmd); g_free (tmp); return TRUE; } ...
PS: if you understood my explanation please send their corrections to the 'man'.
comment:34 Changed 11 years ago by andrew_b
Ticket #3081 has been marked as a duplicate of this ticket.
comment:35 Changed 11 years ago by pfalcon
- Branch state set to no branch
I don't want to reopen this very old ticket: granted, it was implemented, that can't be challenged. But I have some proposals how to enhance functionality, so I opened new bug #3083.
comment:36 Changed 11 years ago by ossi
- Description modified (diff)
- Reporter changed from slavazanko to ossi