Menu

#184 Paste in mode "Rectangular Selection" should paste into rows

open
nobody
core (195)
5
2018-02-22
2007-11-20
Tom Kieffer
No

In "Rectangular Selection" mode, if you paste what you previously copied, new rows are added with the copied content. This is the same than paste in normal selection mode. In rectangular selection mode, paste should insert the copied content at the cursor position into all following rows instead of inserting new rows. See example.

copied rows:

*
*
*

Paste before:
text1
text2
text3

What command does now (normal paste):

*
*
*text1
text2
text3

What command should do (rectangular paste):

*text1
*text2
*text3

Discussion

  • Anonymous

    Anonymous - 2007-11-20

    Logged In: YES
    user_id=1477607
    Originator: NO

    Sorry, but I disagree. I think the current behavior is the one most users would expect. With your suggestion, what would happen in the following case:

    Before pasting:
    abcdefgh
    a
    a
    a

    And now you put the caret after 'e' and paste. What should happen in the following rows, which only contain one character? In my opinion, the behavior you expect can be added as a feature request, as a "special type of paste", but it should not be specified as a bug, and should not replace the current paste behavior but rather extend it. Note that the Rectangular Selection mode is about selection, not about copy & paste. Of course, what you copy is the selection, and when you paste, the pasted text replaces the current selection (or inserts text at the caret location if there is no selection).

     
  • Robert Schwenn

    Robert Schwenn - 2007-11-20
    • labels: 102668 -->
     
  • Robert Schwenn

    Robert Schwenn - 2007-11-20

    Logged In: YES
    user_id=1486645
    Originator: NO

    Of course the current behavior is not a bug, because it has "ever" been so and - so I think - it's also a question of taste and desires.

    But like Tom I'd like to see the inserted rectangular selection appearing as a rectangle rather than anything else. It's more intuitive for me. In UltraEdit the last example/question results in:

    abcde*fgh
    a *
    a *
    a

    This would be fine, wouldn't it? I will change this item to a feature request.

     
  • Robert Schwenn

    Robert Schwenn - 2007-11-20
    • milestone: 101608 -->
     
  • Robert Schwenn

    Robert Schwenn - 2007-11-20
    • labels: --> core
     
  • Dale Anson

    Dale Anson - 2007-11-21

    Logged In: YES
    user_id=187628
    Originator: NO

    I'm not even sure this warrants a feature request. To do what you're trying to you, you need to select a rectangular paste area to match up with your rectangular selection area. It's really no trouble at all to paste the starts in front of the text:

    Copied:
    *
    *
    *

    Paste before:
    text1
    text2
    text3

    Select rectangular (using pipes to represent the selection, but in reality, this is a 0-width selection):
    |text1
    |text2
    |text3

    After paste:
    *text1
    *text2
    *text3

    Since what you want is easily doable, and the default behavior is often desirable, I'm not sure what the request is.

     
  • Anonymous

    Anonymous - 2007-11-21

    Logged In: YES
    user_id=1477607
    Originator: NO

    It does. The example I gave below demonstrates a case where it would not be possible to easily select a rectangular area for the paste action (since the lines need to be enlarged). Also, it is much easier just to place the caret in the position of the paste than to do the rectangular selection even if no further action is required.

     
  • Dale Anson

    Dale Anson - 2007-11-21

    Logged In: YES
    user_id=187628
    Originator: NO

    Shlomy, see Robert's example following your example:

    abcde*fgh
    a *
    a *
    a

    Is that the behavior you expect? If so, this is easily doable right now in jEdit with no changes. This is why I question the need for an enhancement.

     
  • Dale Anson

    Dale Anson - 2007-11-21

    Logged In: YES
    user_id=187628
    Originator: NO

    Hi Shlomy, please see Robert's example following your example:

    abcde*fgh
    a *
    a *
    a

    Is that the behavior you expect? If so, this is easily doable right now in jEdit with no changes. This is why I question the need for an enhancement.

     
  • Anonymous

    Anonymous - 2007-11-21

    Logged In: YES
    user_id=1477607
    Originator: NO

    You are right, sorry, I didn't notice jEdit allows rectangular selection to extend beyond the end of line. Note however that the expected behavior is still much easier to do by just placing the caret at the paste location than by creating yet another rectangular selection for the paste area. Note that in the later case (when you use rectangular selection to be replaced by the paste action), you need to select the exact number of lines, or otherwise you get either a subset of the lines pasted or a wrap-around of the paste content if you selected too many lines. But you're right, this is more-or-less easily achieved with the current jEdit features.

     
  • Tom Kieffer

    Tom Kieffer - 2007-11-21

    Logged In: YES
    user_id=1941546
    Originator: YES

    Interesting points made here. To me there are two things that matter:
    1. It doesn't seem very comfortable to me to make a rectangular selection exactly the same size than the copied area to be able to make a "rectangular paste". But thanks for the hint, because I hadn't noticed this yet.
    2. If you want to make a "normal paste", just change back into normal mode! This is the reason I submitted this as a bug in the first place. There are two possibilities, normal mode and rectangular mode. Why shouldn't they count as well for pasting as for selecting? The "normal paste" isn't lost or something, it's just available only in normal mode, whereas "rectangular paste" is the default in rectangular mode.

    I think the UltraEdit implementation of this feature is optimal and perfecly intuitive.

    @rschwenn A question of tase and desires, yes. But "it has ever been so"? Consider how many things "have ever been so" until they were changed.

     
  • Robert Schwenn

    Robert Schwenn - 2007-11-21

    Logged In: YES
    user_id=1486645
    Originator: NO

    Short summary for now :-)

    Requested is a changed behavior of pasting ***when rectangular selection mode is enabled and no selection is present***.

    The goal is: No need to create a selection for inserting a copied rectangle really as a rectangle.

    This propably changes the meaning of "rectangular selection mode" to simple "rectangular mode" which is used for selection and inserting...

     
  • Anonymous

    Anonymous - 2007-11-21

    Logged In: YES
    user_id=1477607
    Originator: NO

    While what you say seems reasonable, and I guess we can all live happily with it, I'm not sure this is the right way to go. Why does the paste function have to be related to the selection mode? Why should paste in normal selection be different than paste in rectangular selection? And what happens when we're in multiple selection mode and we paste this text?
    The copy action itself could carry some additional attributes with the data it puts on the clipboard (or wherever it stores the copied content), that the paste action can use when pasting. Either that, or provide several "paste" flavors for such cases. Again, what you suggest sounds fine, but I always like things that are more uniform rather than "special cases".
    (And finally, I'm not the one to implement it, I'm just stating my opinion.)

     
  • Blackwell

    Blackwell - 2007-11-21

    Logged In: YES
    user_id=971109
    Originator: NO

    I suggest to rename "rectangular selection mode" to "rectangular mode", and have the rectangular mode behave as in UltraEdit (rectangular selection AND rectangular paste).

    While one can argue that while in rectangular mode one would want to paste like in normal mode, it is easy to think of each mode having its unique behaviors for selection AND paste, and thus to need to switch to the desired mode before performing the operation.

    If someone wants to perform rectangular selection but paste in normal mode maybe that is something to be tackled by a script/macro, if the user is unwilling to switch mode manually before pasting.

     
  • lw2743

    lw2743 - 2018-02-22

    I found this thread while trying to figure out how to make jEdit rectangular paste work the way I expect. What I expect is for a rectangular paste to paste the rectangle I have copied to the clipboard at the cursor position, only inserting new lines if necessary to add lines to handle the pasted rectangle. If my cursor is in insert mode, existing text gets shifted right to make room for the pasted rectangle. If I my cursor is in replace mode, the pasted rectangle over writes any existing text. In any case, the pasted rectangle should remain a rectangle and not shift any of the pasted text to the left margin.

     

Log in to post a comment.