Ticket #30 (closed enhancement: fixed) — at Version 19

Opened 15 years ago

Last modified 10 years ago

savannah: support for x clipboard wanted

Reported by: slavazanko 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: commited-master

Description (last modified by andrew_b) (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:EditorSeverity:3 - Normal
Status:NonePrivacy:Public
Assigned to:NoneOpen/Closed:Open
Release:current (CVS or snapshot)Operating System:All

Discussion:

Sun 06 Jul 2008 04:19:44 PM UTC, comment #1:
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.
	Jan Engelhardt <hirogen2>
Tue 12 Jul 2005 10:44:23 AM UTC, 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.

Change History

comment:1 Changed 15 years ago by styx

  • Milestone set to 4.7

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).

Changed 15 years ago by angel_il

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

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:8 Changed 15 years ago by iNode

Use enca, Luke.

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:12 Changed 15 years ago by angel_il

  • Milestone changed from 4.7.0-pre3 to 4.7.0-pre4

comment:13 Changed 14 years ago by slavazanko

  • Milestone changed from 4.7.0-pre4 to 4.7

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:16 Changed 14 years ago by andrew_b

  • Votes for changeset set to andrew_b

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)
Note: See TracTickets for help on using tickets.