Ticket #321 (closed enhancement: fixed)

Opened 16 years ago

Last modified 15 years ago

Trouble with mc's clipboard paste.

Reported by: angel_il Owned by: angel_il
Priority: minor Milestone: 4.7
Component: mcedit Version: 4.6.2
Keywords: commited-master Cc:
Blocked By: Blocking:
Branch state: Votes for changeset:

Description (last modified by angel_il) (diff)

mc's clipboard does not know whether something comes from a vertical or flowed selection (shift-f5 insertions are always flowed).

it's trouble if you want insert vertical block from mc clipboard file.

I think we need hotkey for change insertion mode: vertical/flowed.

for example file
~/.mc/cedit/cooledit.clip
have text

111
111
111

we edit file testfile.txt

222
222
222

we want insert vertical block after first char line #1
if mc in vertical mode of paste
result of insertion will be

211122
211122
211122

else

2111
111
111
22
222
222

Change History

comment:1 Changed 16 years ago by angel_il

  • Description modified (diff)

comment:2 follow-up: ↓ 3 Changed 16 years ago by ossi

a mode switch is the wrong idea, as it is inconsistent with how the selection and copying into the clipboard work.
if you really want to decouple the input and output format of the clipboard (i can see how this could make sense, though not exactly often), then you should make it congruent with the planned vertical selection actions - alt-shift-insert (and let's say shift-f6 as the alternative keybinding).

comment:3 in reply to: ↑ 2 Changed 16 years ago by angel_il

Replying to ossi:

a mode switch is the wrong idea

ok, maybe...

and let's say shift-f6 as the alternative keybinding

i vote for this, me like alternative hotkey for paste vertical block.

comment:4 follow-up: ↓ 6 Changed 16 years ago by angel_il

Replying to angel_il:

Replying to ossi:

Replying to angel_il:

Replying to ossi:

shift-f3 is different from kate's vertical selection mode, as it is an exclusive mode with a very limited lifetime ("modal mode", heh).

what do you mean?

it is comparable to the caps-lock, only that it is limited to the current windows. that means that while some particular behavior is altered, the application is generally used the same way in both modes.

mcedit's (shift-)f3 selection is a short-lived state.

ok, I've understood you, i like that as it now in mc... and rework all its great work, nobody want do it :)

is solvable via an extension of the clipboard format.

I against it. We should not invent new clipbord engine.

while i do not insist on the format extension, this argument against it is "a bit". weak

ok, maybe you right :) i need more time to think about this :)

Now behind a cup of coffee I have thought :)

What a char may tell to mc what type block in cooledit.clip.
It can will be "M" (0х0D) at eol.

comment:5 Changed 16 years ago by angel_il

*It can will be "M" (0х0D) at eol.
ups.
It can will be ^M (0х0D) at eol.

comment:6 in reply to: ↑ 4 ; follow-up: ↓ 7 Changed 16 years ago by andrew_b

Replying to angel_il:

What a char may tell to mc what type block in cooledit.clip.
It can will be "M" (0х0D) at eol.

Alternate solution: let place some char at the beginning of clipboard. For example, '0' for normal block and '1' for vertical one. Other symbols can be used to throw an error messsage.

Normal block:

0
111 222 333

Vertical block:

1
111
222
333

Error:

a
111

comment:7 in reply to: ↑ 6 Changed 16 years ago by angel_il

Replying to andrew_b:

Replying to angel_il:

What a char may tell to mc what type block in cooledit.clip.
It can will be "M" (0х0D) at eol.

Alternate solution: let place some char at the beginning of clipboard. For example, '0' for normal block and '1' for vertical one.

ok, i vote for.

Other symbols can be used to throw an error messsage.

no, simply paste as is.

comment:8 Changed 16 years ago by angel_il

Addition for "Alternate solution": let put char 0x01 at the beginning of clipboard if it's vertical block, else is flowed block.

comment:9 follow-ups: ↓ 10 ↓ 11 ↓ 18 Changed 16 years ago by ossi

it is a very bad idea to mess with the clipboard file, as shift-f5 actually means "insert file" and just defaults to the clipboard file. it would be way better to create an empty "stamp" file cooledit.clip.vertical or something like that.

anyway, the more i think about it, the less i actually like the idea of storing this information in the clipboard. kate doesn't, either - how the text is inserted depends only on the mode it is currently in, not in what mode the text was copied. actually, if mcedit ever integrates with the x clipboard, the file format trick won't be even possible any more (now, that's a convincing variation of the "not invent own format" argument raised before ;). consequently, the alt-shift-insert and shift-f6 approach looks like the best option now.

comment:10 in reply to: ↑ 9 ; follow-up: ↓ 12 Changed 16 years ago by andrew_b

Replying to ossi:

it is a very bad idea to mess with the clipboard file, as shift-f5 actually means "insert file" and just defaults to the clipboard file.

Clipboard is not a regular text file. Clipboard should be a file with special format.

it would be way better to create an empty "stamp" file cooledit.clip.vertical or something like that.

IMHO, it's a bad idea to create more files.

anyway, the more i think about it, the less i actually like the idea of storing this information in the clipboard. kate doesn't,

Why kate? Kate is not only one editor in universe.

either - how the text is inserted depends only on the mode it is currently in, not in what mode the text was copied.

Look to vim instead of kate.

if mcedit ever integrates with the x clipboard,

Actually, mcedit is not integrated with X clipboard at all.

comment:11 in reply to: ↑ 9 ; follow-up: ↓ 13 Changed 16 years ago by angel_il

Replying to ossi:

it is a very bad idea to mess with the clipboard file

why not?!
vertical block (not trough clip file) at now inserted correctly, we have trouble with only when paste from file.

, as shift-f5 actually means "insert file" and just defaults to the clipboard file. it would be way better to create an empty "stamp" file cooledit.clip.vertical or something like that.

What this file is not removed (by any reason), what then will be?! User anytime will be vertical insertion. :)

And in general it is the extremely bad idea to create not coherent attributes thus that the attribute should exist only in a context of this clipboard

anyway, the more i think about it, the less i actually like the idea of storing this information in the clipboard.

if mcedit ever integrates with the x clipboard, the file format trick won't be even possible any more

no, clip file remains, it will simply be added still X-clip pushing.

for example: when user press hotkey for copy selected text then mc do next:
copy text to clip file (not all have X11)
copy text to X-clip

when user press hotkey for paste text then mc do next:
if it shift+f5 paste from file
if if terminal shift+ins terminal paste as is

consequently, the alt-shift-insert and shift-f6

why not, i do alternative paste by shift-f6 (shift-f6 paste vertical block).

comment:12 in reply to: ↑ 10 Changed 16 years ago by ossi

Replying to andrew_b:

Replying to ossi:

it is a very bad idea to mess with the clipboard file, as shift-f5 actually means "insert file" and just defaults to the clipboard file.

Clipboard is not a regular text file. Clipboard should be a file with special format.

but it isn't. mc's creator(s) decided to make "paste clipboard" the default action for "insert any file". what do you want to do? rely on regular text files never having the 0x1 marker? special-case the file name?

anyway, the more i think about it, the less i actually like the idea of storing this information in the clipboard. kate doesn't,

Why kate? Kate is not only one editor in universe.

kate happens to be a fairly powerful programmer's editor with a rather typical (state of the art, even if a bit crowded) user interface. it is a good reference.

either - how the text is inserted depends only on the mode it is currently in, not in what mode the text was copied.

Look to vim instead of kate.

vim is fundamentally different from about everything else. it is about the last reference you should cite in the context of mcedit.

if mcedit ever integrates with the x clipboard,

Actually, mcedit is not integrated with X clipboard at all.

but you do understand the phrase "if ... ever", right?
integration with the x clipboard is a long-standing wish from many users. it would be plain stupid to implement other things in ways that are known to later conflict with it.

comment:13 in reply to: ↑ 11 ; follow-ups: ↓ 14 ↓ 16 Changed 16 years ago by ossi

Replying to angel_il:

Replying to ossi:

it would be way better to create an empty "stamp" file cooledit.clip.vertical or something like that.

What this file is not removed (by any reason), what then will be?! User anytime will be vertical insertion. :)

this argument makes no sense. inserting into the clipboard would always adjust the state of both files. and if something goes wrong at some point, it will be fixed by the next insertion.

if mcedit ever integrates with the x clipboard, the file format trick won't be even possible any more

no, clip file remains, it will simply be added still X-clip pushing.

for example: when user press hotkey for copy selected text then mc do next:
copy text to clip file (not all have X11)
copy text to X-clip

yes, and? you can't store the 0x1-prefixed content into the x clipboard, because mcedit would be the only editor to understand it. that wouldn't be exactly "integration".

consequently, the alt-shift-insert and shift-f6

why not, i do alternative paste by shift-f6 (shift-f6 paste vertical block).

this sounds pretty much like an approval. i wonder why the above discussion, then? ;)

comment:14 in reply to: ↑ 13 ; follow-up: ↓ 15 Changed 16 years ago by angel_il

Replying to ossi:

Replying to angel_il:

Replying to ossi:

if mcedit ever integrates with the x clipboard, the file format trick won't be even possible any more

no, clip file remains, it will simply be added still X-clip pushing.

for example: when user press hotkey for copy selected text then mc do next:
copy text to clip file (not all have X11)
copy text to X-clip

yes, and? you can't store the 0x1-prefixed content into the x clipboard, because mcedit would be the only editor to understand it. that wouldn't be exactly "integration".

we no need push 0x01 into clipboard, we push 0x01 only cooledit.clip at BOF.

consequently, the alt-shift-insert and shift-f6

why not, i do alternative paste by shift-f6 (shift-f6 paste vertical block).

this sounds pretty much like an approval. i wonder why the above discussion, then? ;)

Without the given discussion there would be no decision.

comment:15 in reply to: ↑ 14 ; follow-up: ↓ 17 Changed 16 years ago by ossi

Replying to angel_il:

Replying to ossi:

yes, and? you can't store the 0x1-prefixed content into the x clipboard, because mcedit would be the only editor to understand it. that wouldn't be exactly "integration".

we no need push 0x01 into clipboard, we push 0x01 only cooledit.clip at BOF.

that would lead to different insertion behavior depending on whether the x clipboard is used or not. that's again an unnecessary environment-specific behavior change.

consequently, the alt-shift-insert and shift-f6

why not, i do alternative paste by shift-f6 (shift-f6 paste vertical block).

this sounds pretty much like an approval. i wonder why the above discussion, then? ;)

Without the given discussion there would be no decision.

huh? it makes no sense to discuss the implementation details of one approach when an entirely different one is chosen in the end. the shift-f6/alt-shift-ins proposal does not require saving additional state in the clipboard and thus makes the entire discussion about it irrelevant. that's one of the two core arguments for using it, after all.

comment:16 in reply to: ↑ 13 Changed 16 years ago by andrew_b

Replying to ossi:

yes, and? you can't store the 0x1-prefixed content into the x clipboard, because mcedit would be the only editor to understand it. that wouldn't be exactly "integration".

I don't know how, but Vim detect the type of block copied to X clipboard.

  1. Open vim. Type any text. Select vertical block. Copy it to the X clipboard: "*y
  2. Open second vim. Paste text from the X clipboard: "*p. The vertical (?) block is pasted.
  3. Move cursor to the any place inside of pasted text. Paste from clipboard again. The vertical (!) block is pasted.

comment:17 in reply to: ↑ 15 Changed 16 years ago by angel_il

Replying to ossi:
ok, i try make patch and you try use it. After we restart discussion... ok? :)

comment:19 Changed 16 years ago by angel_il

branch:321_enhanced_clipboard

comment:20 Changed 16 years ago by angel_il

  • Keywords review added

comment:21 Changed 16 years ago by angel_il

  • Status changed from new to assigned
  • Owner set to angel_il

comment:22 Changed 16 years ago by angel_il

  • Status changed from assigned to accepted

comment:23 Changed 15 years ago by angel_il

branch: 321_enhanced_clipboard_file (parent: master)
changeset: a0ca3781bdcd2b8caff09b784e01bcf43385f0ae

comment:24 Changed 15 years ago by andrew_b

  • Keywords andrew_b added

comment:25 Changed 15 years ago by angel_il

branch: 321_enhanced_clipboard_file (forced update)
changeset: 3bb5f67bc886b5b0ab54b6fcbe2bb768d003bd75

comment:26 Changed 15 years ago by angel_il

branch: 321_enhanced_clipboard_file (forced update)
changeset: c2d0d161ca96567cd70921c5c3b761428d4cebac

comment:27 Changed 15 years ago by slyfox

  • Keywords vote-andrew_b vote-slyfox approved added; review andrew_b removed

comment:28 Changed 15 years ago by angel_il

  • Keywords commited-master added; vote-andrew_b vote-slyfox approved removed
  • Status changed from accepted to testing
  • Resolution set to fixed

comment:29 Changed 15 years ago by slavazanko

  • Status changed from testing to closed

comment:31 Changed 15 years ago by andrew_b

  • severity changed from no branch to merged
Note: See TracTickets for help on using tickets.