FredrikNoren / ungit

The easiest way to use git. On any platform. Anywhere.
MIT License
10.43k stars 636 forks source link

Prevent selection of leading space in diffs when copying and pasting #1430

Closed simonwiles closed 3 years ago

simonwiles commented 3 years ago

I (and, it seems, at least some others!) often find myself wanting to copy text from diffs in the commit history or in the staging area. In fact, I had a PR merged last year that prevented selection of line number to make this process easier (#1215, thanks!).

This PR just adds a little to that idea, by preventing the selection of the leading space that still gets copied when selecting multiple lines (this is not generally a problem when using JS and Prettier on paste, for example, but for copying Python code, for example, it's a pain).

Hopefully this proves to be more straightforward than my other recent PR! Thanks!

simonwiles commented 3 years ago

Earlier this year @rtfpessoa and I were working on some fixes regarding text selection see rtfpessoa/diff2html#304 rtfpessoa/diff2html#306 rtfpessoa/diff2html#307

Cool -- yes, the first of these is a migration of my earlier PR that was merged into this repo. I did notice that the lines I'd added were no longer necessary in ungit because they'd made their way upstream, but I hadn't realized you'd been involved in that :)

Do you think it would be more appropriate to close this, then, and raise an issue and/or PR against diff2html?

campersau commented 3 years ago

@simonwiles Yes, please raise an issue / PR in the diff2html repo and after these changes are released we can just update our diff2html dependency. Thanks!

campersau commented 3 years ago

Superseded by https://github.com/FredrikNoren/ungit/pull/1438