Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marked text needs to be copyable #6095

Closed
sasumner opened this issue Aug 26, 2019 · 13 comments
Closed

Marked text needs to be copyable #6095

sasumner opened this issue Aug 26, 2019 · 13 comments
Assignees

Comments

@sasumner
Copy link
Contributor

sasumner commented Aug 26, 2019

Description of the Issue

When I use the Mark... feature to mark some large amount of text, often I want to copy only that marked text to a different place. Currently there is no easy way to do that.

Steps to Reproduce the Issue

  1. Create the following text in a new Notepad++ editing view tab:

    A baseball team from the fictional town of "Mudville" (implied to be the home
    team) is losing by two runs in its last inning. Both the team and its fans
    (a crowd of 5,000, according to the poem) believe they can win if Casey,
    Mudville's star player, gets to bat. However, Casey is scheduled to be the
    fifth batter of the inning, and the first two batters (Cooney and Barrows)
    fail to get on base. The next two batters (Flynn and Jimmy Blake) are
    perceived to be weak hitters with little chance of reaching base to allow
    Casey a chance to bat. Surprisingly, Flynn hits a single, and Blake follows
    with a double that allows Flynn to reach third base. Both runners are now in
    scoring position and Casey represents the potential winning run. Casey is so
    sure of his abilities that he does not swing at the first two pitches, both
    called strikes. On the last pitch, the overconfident Casey strikes out
    swinging, ending the game and sending the crowd home unhappy.

  2. Invoke the Search > Mark... function.

  3. In the Find what box enter (?-s)\bb.*?\b

  4. Tick the Wrap around box.

  5. Select Regular expression for Search mode.

  6. All other options unticked.

  7. Press the Mark All button.

  8. Observe text marked like so:

image

Expected Behavior

I expected to find a way to copy my marked text to the clipboard.

Actual Behavior

No easy way to copy marked text to the clipboard for use elsewhere.

Debug Information

Notepad++ v7.7.1 (32-bit)
Build time : Jun 16 2019 - 21:14:50
Path : C:.........\npp.7.7.1.bin\notepad++.exe
Admin mode : OFF
Local Conf mode : ON
OS : Windows 10 (64-bit)
Plugins : ColumnTools.dll Explorer.dll LocationNavigate.dll MarkdownViewerPlusPlus.dll mimeTools.dll NppConverter.dll NppExec.dll NppExport.dll PythonScript.dll

@sasumner
Copy link
Contributor Author

Some workarounds are discussed here: https://notepad-plus-plus.org/community/topic/12710/marked-text-manipulation/

Workarounds include:

  • a Pythonscript solution
  • a (destructive) regular expression replacement solution (that is undoable, thus mitigating the destructive nature)

But the workarounds use techniques that are a bit advanced for the typical Notepad++ user, even a user that is familiar with scripting and/or regular expression operations. There should be an easier method.

@sasumner
Copy link
Contributor Author

Possible menu addition:

image

@sasumner
Copy link
Contributor Author

Delimiter between marked matches:

So for the presented regular expression marking operation, (?-s)\bb.*?\b, a reasonable result after copying and pasting the marked result might be:

baseball
be
by
Both
believe
bat
be
batter
batters
Barrows
base
batters
Blake
be
base
bat
Blake
base
Both
both

where a line-ending serves as the delimiter between matches.

However if we change the regular expression to something that matches across line-boundaries, say (?si)\bbase.*?both\b, this results:

image

Because that has embedded line-endings in the match, is a line-ending a good choice for a delimiter between matches?:

baseball team from the fictional town of "Mudville" (implied to be the home
team) is losing by two runs in its last inning.  Both
base.  The next two batters (Flynn and Jimmy Blake) are
perceived to be weak hitters with little chance of reaching base to allow
Casey a chance to bat.  Surprisingly, Flynn hits a single, and Blake follows
with a double that allows Flynn to reach third base.  Both

Or would it be best in this case to have a double line-ending to really emphasize where one match ends and the next begins?:

baseball team from the fictional town of "Mudville" (implied to be the home
team) is losing by two runs in its last inning.  Both

base.  The next two batters (Flynn and Jimmy Blake) are
perceived to be weak hitters with little chance of reaching base to allow
Casey a chance to bat.  Surprisingly, Flynn hits a single, and Blake follows
with a double that allows Flynn to reach third base.  Both

...Or...some other way of doing it?

@Ekopalypse
Copy link
Contributor

... as long as copy and paste is only done inside npp you can add whatever you want to separate each match but if this should be usable in other applications as well you need to stay close to the
defacto formats.

@sasumner
Copy link
Contributor Author

sasumner commented Aug 26, 2019

@Ekopalypse Not sure I'm following you. I hadn't thought about it to this point, but I'm sure the format would be CF_UNICODETEXT. I was talking about what, if anything, should delimit the chunks of marked text. First thought is that a line-ending would be best, but as pointed out above, it has some limitations. Further thoughts from you on this are definitely encouraged. [It should be assumed that we aren't simply staying "inside npp" with such a feature...an outside target for the paste is very reasonable.]

@Ekopalypse
Copy link
Contributor

Then from my point of view, the only reasonable approach would be to append an CRLF on each match, to get multiple lines when pasting, I don't assume one wants to get the matches merged into a single string. This should ensure that the data is still CF_UNICODETEXT compliant.

@sasumner
Copy link
Contributor Author

Unconsidered to this point, but maybe the text styled with 1st Style, 2nd Style, ... , 5th Style should be copyable as well? (Styling is a bit different from Marking, so if it should be copyable we'll make that a separate issue.)

@Ekopalypse
Copy link
Contributor

From my point of view it doesn't make sense to make StyleX copyable.
I mean it is used to mark the same text why should one want to have multiple lines from the same text.
And as the users have to mark the text prior to styling it, it can be already copied.

@sasumner
Copy link
Contributor Author

...doesn't make sense to make StyleX copyable...it is used to mark the same text...

True, maybe not a valuable additional feature. I was thinking of the user that would "style" unique text (so there's only ONE occurrence of it) for some sort of later followup...then do a bunch of that in the same color...then only later realize that it would be valuable to be able to "copy out" what they've extensively styled -- and realize that it isn't possible. [I think you have convinced me that it isn't something that is needed -- thank you @Ekopalypse ].

@sasumner
Copy link
Contributor Author

I suppose I never finished implementing this because I didn't have a great feeling about where it should be put in the menus.

Here's another possibility, which I would like a LOT if it were Copy / Paste Special instead of just Paste Special (it clearly is currently more than just a "paster"):

image

@f6fvy
Copy link

f6fvy commented May 19, 2020

Edit / Copy to clipboard seems more adapted. To me, Copy / Paste Special is related to "content conversion".

@sasumner
Copy link
Contributor Author

Or maybe the command to copy marked text belongs on the Search menu (similar to the way bookmark handling is -- could be right below the Bookmark entry).

Or maybe it should (also) be a button right on the Mark tab.

@f6fvy
Copy link

f6fvy commented May 19, 2020

To me, anything related to the clipboard (all Copy and Paste operations, among others) should be at least in the Edit menu. But that's just me...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants