multiple edits with keyboard
-
Hi
Imagine the following scenario. A “-” sign should be inserted into some gaps of the text shown on the picture below
You see, that those are same lines in different languages of the same dialogs, so whenever a “-” sing should be entered into German line two others must be inserted in French and English
Now, I got to click each and every place with a mouse.
I know that Alt+Shirt allows using the keyboard in order to move the multicursor down to the next line. Unfortunately, it only works with the place last selected. So, if I first select 3 gaps on a German line with the mouse and the use Alt+Shirt expecting all three cursor to be moved below it does not happen, instead the only last place is multiplied below
Should it be the case, it would be possible to simplify editing of the text by recording a macro that would spare quite some time.
Would someone suggest a workaround allowing to extend multicursor selection to the lines below? -
@Nick-Kat
schreenshot below better represents the text being edited -
First, I will say, with multi-select as complicated as you described, I am assuming you either have the Better MultiSelect Plugin, or you have Notepad++ v8.6 which natively has a drastically-improved multi-selection capability. Without one of those two, what you are describing is not likely possible.
Now, I got to click each and every place with a mouse.
I assume you mean
Ctrl+Click
, because a normal click would just move the cursor rather than add to a multi-selectI know that Alt+Shirt allows using the keyboard in order to move the multicursor down to the next line. Unfortunately, it only works with the place last selected.
Alt+Shift+Arrow
actually extends a column selection down, it doesn’t just move the multi-cursor down.In fact, the
Alt
puts it into column mode, and even with Notepad++ v8.6, I cannot make a multi-selection with successiveCtrl+Click
and then extend it into multiple simultaneous column mode usingAlt+Shift+Arrow
. (I haven’t used Better MultiSelect enough to know whether it can handle that or not)So if you really want to start with multi-select, and then extend into multiple columns, you should try the plugin, and if that doesn’t work, you might consider an alternative.
If, however, you can get away with doing a multi-select, then typing the
-
, then just moving the multi-select down a line and typing another-
, that will work just fine: do the multi-select usingCtrl+Click
, then type the-
, then down-arrow (noShift
orAlt
necessary), then you can type another-
if needed on this second line. -
@PeterJones Thank you for your answer!
On this page link text a way is described for getting a rectangular selection, but what would help here really is a way to get several rectangular selections at once. Probably, the plug-in does not provide it, because selections can easily overlap…
Also, trying to figure out some other way to achieve it I found that macro screws multiple cursors
To be specific
To reproduce- with Ctrl+mouse select 3 places
- click “record macro” (3 cursors are blinking)
- push “-” button
- stop macro recording
- with Ctrl+mouse select 3 other places
- push “replay macro”
you only get 1 “-”
-
@Nick-Kat, I believe you can do what you desire with a regular expression.
I don’t know if you are using spaces or tabs to separate the groups and so account for either using:
Search:(\t|\x20{3})(?=\u)
Replace:\1-
Replace all will insert the - at the front of every line in the groups. It will cause the text to shift to the right at times meaning the groups won’t be visually lined up.If the desire is to only insert the
-
in the first lines of the groups then try:
Search:^([0-9][0-9]:[0-9][0-9]:[0-9][0-9],[0-9]+ --> [0-9][0-9]:[0-9][0-9]:[0-9][0-9],[0-9]+\R.+?)(\t|\x20{3})(?=\u)
Replace:\1\2-
The first time you do a replace-all it will only fix the first group and so you will need to do replace-all a few times until the count of changes reaches zero.With both of these the search is looking for a prefix or leader immediately followed by a letter. The prefix/leader can either be three spaces in a row or a tab. I decided on three spaces as you may have two spaces in a row within your text.
-
@mkupper thanks for the suggestion )
Unfortunately, not every instance has to be replaced. Depends on whether the phrase is said by other personage