Notepad2e icon indicating copy to clipboard operation
Notepad2e copied to clipboard

Feature (or hack) request: ctrl+arrow behavior toggle?

Open Zzooouhh opened this issue 8 years ago • 7 comments
trafficstars

Notepad2 by default features ctrl+arrow left/right hotkeys for "word jumping", just like the original windows Notepad.exe (further referred to as just "Notepad"). However this functionality in Notepad2 is slightly different regarding whether it skips punctuation or not - try for example traversing the following text in both editors with the ctrl+right hotkey from start to end:

go,to.the.bathroom. go, to. the. bathroom. go ,to .the .bathroom . go , to . the . bathroom .

When going through each line one by one, all four lines take 8 ctrl+right strokes to go through on Notepad2, because the jumps stop before and after each period and comma. However in Notepad, it's respectively 1, 4, 5 and 8 strokes for all lines, because the stops happen at the beginning of each word instead. The former behavior undeniably comes useful when editing code featuring a lot of punctuation, however for any other text I find the latter's behaviour preferable, and thus I'd like to ask whether it's possible to implement a toggle between these two "modes" of ctrl+left/right.

I've tried comparing it with Notepad++ (also based on Scintilla) and that one behaves the exact same as Notepad2, so I suspect that this might be related to a core setting of Scintilla and its two SCI_WORDLEFT and SCI_WORDRIGHT functions. If a toggle is too much work to implement or it's possible to alter via a simple hack, I'd like to know at least some pointers on what needs to be altered within the source, so I can benefit from the behavior of Notepad within Notepad2.

Zzooouhh avatar Jan 29 '17 15:01 Zzooouhh

I've tried comparing it with Notepad++ (also based on Scintilla) and that one behaves the exact same as Notepad2

This behaviour is actually more common than Notepad's - Firefox for example does the same. I find it more convenient.

@cshnik There is probably some Scintilla setting with the list of stop symbols, right?

ProgerXP avatar Jan 29 '17 15:01 ProgerXP

There is probably some Scintilla setting with the list of stop symbols, right?

No, there was no such an option in the Scintilla's engine.

Alternative Ctrl+Arrow navigation mode implemented. Corresponding setting and mode switch added: notepad2_ctrlarrow_setting

cshnik avatar Mar 04 '17 19:03 cshnik

@Zzooouhh This seems to be implemented as per your description. Download the EXE from here: https://github.com/ProgerXP/Notepad2e/blob/dev/bin/Win32/Release/Notepad2e.exe

ProgerXP avatar Mar 04 '17 20:03 ProgerXP

This works pretty much perfectly! Thank you very much for this.

Zzooouhh avatar Mar 06 '17 21:03 Zzooouhh

Document:

a
 b (note the leading space)

Regular Ctrl+Right jumps from a| to \n |b while accelerated also jumps to | b. Need to remove this discrepancy (intermediate jump in accelerated mode).

ProgerXP avatar Aug 03 '21 18:08 ProgerXP

Fixed.

cshnik avatar Aug 02 '22 18:08 cshnik

Another discrepancy:

a
b|

Regular Ctrl+Right motions: |b, a|, |a. But accelerated are different: |b, |a (no a|).

ProgerXP avatar Sep 18 '22 18:09 ProgerXP

Cannot reproduce. Tested both Ctrl/Alt+Left/Right on the most recent build from master-branch.

cshnik avatar Oct 30 '22 22:10 cshnik

Strange. Present in de04487 but not in master.

ProgerXP avatar Oct 31 '22 10:10 ProgerXP