ProgerXP / Notepad2e

Word highlighting, simultaneous editing, split views, math evaluation, un/grep, comment reformatting, UAC elevation, complete regexps (PCRE), Lua lexers, DPI awareness and more (XP+)
Other
372 stars 52 forks source link

Copy/Cut to clipboard commands to work on empty selection (next word) #358

Closed ProgerXP closed 1 year ago

ProgerXP commented 3 years ago

If there is no selection, cut or copy the nearest word ("nearest" as understood by #319, #321). Don't change selection after this.

This also affects the toolbar but in Notepad2 Copy toolbar button works like Copy All if there's no selection. Do what is simpler in the code: either keep old behaviour for both (Cut button is disabled on empty selection, Copy works like Copy All) or change both (Cut and Copy work on next word if there's no selection).

cshnik commented 2 years ago

Fixed. Cut and Copy work on next word if there's no selection.

ProgerXP commented 2 years ago

Works but need to improve Cut with no selection: if old caret position was greater than the end of the cut word, place the caret on the start of the cut word after the operation.

some|word other
after Cut:
| other
not:
other|

same, if:
some other |
after Cut (_ = space):
some |_
not:
some ...next line... |

however, if:
| some other
after Cut is still:
|  other

Do what is simpler in the code: either keep old behaviour for both (Cut button is disabled on empty selection, Copy works like Copy All) or change both (Cut and Copy work on next word if there's no selection).

It looks like "change both" was implemented?

cshnik commented 2 years ago

Works but need to improve Cut with no selection: if old caret position was greater than the end of the cut word, place the caret on the start of the cut word after the operation.

Fixed.

It looks like "change both" was implemented?

Correct.

ProgerXP commented 2 years ago

Works but need to improve Cut with no selection: if old caret position was greater than the end of the cut word, place the caret on the start of the cut word after the operation.

Not done:

however, if:
| some other
after Cut is still:
|  other
but now:
 | other
cshnik commented 2 years ago

Fixed.

ProgerXP commented 2 years ago

Works but need to improve Cut with no selection: if old caret position was greater than the end of the cut word, place the caret on the start of the cut word after the operation.

Let's simplify this: for Cut, always put the caret to the beginning of the word that was cut, no matter the original caret position.

|.aa. => .|.
.a|a. => .|.
.aa.| => .|.

Additionally, Copy should not cause document scrolling (similar issue was with Alt+F3: https://github.com/ProgerXP/Notepad2e/issues/321#issuecomment-954056954).

cshnik commented 1 year ago

Fixed.

ProgerXP commented 1 year ago

Additionally, Copy should not cause document scrolling (similar issue was with Alt+F3: #321 (comment)).

Not done.

cshnik commented 1 year ago

Done.