Hello,
I'm not sure it is a bug or just a limitation but let me explain the issue:
I have such a text file.
def labelLeft1 aa
def labelRight1 bb
def labelLeft2 aa
def labelRight2 bb
def labelLeft3 aa
def labelRight3 bb
I want to change 'def labelLeft1' and 'def labelLeft2' from 'aa' to 'cc' and leave 'def labelLeft3' unchanged. I select ' def labelLeft' in the first line and choose 'expand selection to word'. Nothing happens. CudaText claims 'cannot find 'def labelLeft'. The 'Highlight Occurences' pluging higlights properly all occurences of selected 'def labelLeft'.
In all other text editors I tried it with (sublime, vscode, atom, pycharm ide) this selection would work.
On the other hand I can select all 'labelLeft' instances in the text by:
1. select 'def labelLeft' in the first line
2. Ctrl+c
3. Ctrl+f
4. Ctrl+v
5. Alt+e
6. Esc
However it would allow only to modify all 'labelLeft' instances, not just first 2. By the way, it would be great to have some shortcut for selecting all instances instead of 6 step procedure. I tried macro, but didn't work. Is there any way to automate above 6 steps?
'Expand selection to word' does not work as expected
New help topic - http://wiki.freepascal.org/CudaText#Macros
Thank you for very prompt replies,
@Alexey
I know how 'exapnd selection to word' works in CudaText, but if my modify my example text like this it won't work anymore (i want to change aa and ab in this case to da and db):
def labelLeft1 aa
def labelRight1 ba
def labelLeft2 ab
def labelRight2 bb
def labelLeft3 ac
def labelRight3 bc
Regarding the macro, I tried but with no success. The problem is that macro records exact text selection I had in the clippoard while recording the macro, not the step of placing my curren clipboard content or even better selection, like below:
# Macro3
ed.cmd(cmds.cCommand_ClipboardCopy)
ed.cmd(cmds.cmd_FinderAction,'findsel\x01def labelLeft\x01\x01')
The last line should look more like this to work:
ed.cmd(cmds.cmd_FinderAction,'findsel(cmds.cCommand_ClipboardPaste)')
@Alexey
I know how 'exapnd selection to word' works in CudaText, but if my modify my example text like this it won't work anymore (i want to change aa and ab in this case to da and db):
def labelLeft1 aa
def labelRight1 ba
def labelLeft2 ab
def labelRight2 bb
def labelLeft3 ac
def labelRight3 bc
Regarding the macro, I tried but with no success. The problem is that macro records exact text selection I had in the clippoard while recording the macro, not the step of placing my curren clipboard content or even better selection, like below:
# Macro3
ed.cmd(cmds.cCommand_ClipboardCopy)
ed.cmd(cmds.cmd_FinderAction,'findsel\x01def labelLeft\x01\x01')
The last line should look more like this to work:
ed.cmd(cmds.cmd_FinderAction,'findsel(cmds.cCommand_ClipboardPaste)')
Thanks Alexey. I quickly took a look at python api and it should make possible what I want. CudaText made really good impression on me so if I find some time I'll try what I can do.Alexey wrote:So "expand selection to word" cmd cannot help in this case.
You need to do Find, and enter some regex, and press [Select all] button.