cppit / jucipp

A lightweight & cross-platform IDE supporting the most recent C++ standards. This project has moved to https://gitlab.com/cppit/jucipp.
https://gitlab.com/cppit/jucipp
MIT License
882 stars 98 forks source link

copy/cut whole line with cursor if nothing is selected #374

Closed szymonk211 closed 6 years ago

szymonk211 commented 6 years ago

My second feature proposition.

Right now copy/cut operation when nothing is selected is ignored. Wouldn't it be better if in that case whole line with cursor would be copy/cut to clipboard? Selecting whole line with home, end or ctrl-shift arrows is often clumsy. I think proposed feature would be very helpful for those kind of manipulations.

This is not only my idea, but this is default behavior in Intellij editor.

Only downside from this I can think of is possibility of accidental overwriting of clipboard content. But this is very small downside.

eidheim commented 6 years ago

Will look into this in a day or two. Thank you again.

eidheim commented 6 years ago

What should happen when you cut several lines in succession? Should the new lines be added to the clipboard, or replace the clipboard?

szymonk211 commented 6 years ago

Hmm, adding them to clipboard seems like an interesting idea. There would be a problem however, if someone decided to cut one line, and than change his mind and cut another. That could be unexpected to user that now he has two lines in clipboard. And how would he clear the content of clipboard then? He would have to select and copy some meaningless code fragment - that would be clumsy. And there is another problem - when should the content of clipboard be cleared? I mean if you cut some line in given moment, you don't want to past the content of clipboard from an hour ago.

Because of these problems, I think it would be better to keep it simple and cut with replacing.

eidheim commented 6 years ago

Yes it is slightly complicated to implement, as one would have to check if something had happened in between the line cuts, but I think it is common behaviour in nano and emacs for instance. On the other hand, these are console editors and one would expect these to operate slightly different than a GUI editor.

eidheim commented 6 years ago

After some additional though, I'll leave successive line cutting until later in case someone brings it up. Pushing the above commit to master as soon as the CI passes:)

szymonk211 commented 6 years ago

GUI editors that I know don't have that feature, but this is really no argument. If it works in nano and emacs, there is really no reason why it shouldn't work here. If you know how to handle all corner cases than it would be fine.