Page 1 of 1

behave like Notepad space w/mulitple lines of selected text

Posted: Mon Mar 25, 2013 8:07 am
by Hanging
I love AkelPad but I'm not a programmer or sophisticated technical user. I have replaced Notepad with Akelpad using the Debugger registry key and am sailing merrily along except for one thing: I can't get used to Akelpad's behavior when multiple lines of text are selected and the space bar is pressed. Akelpad selects the entire paragraph (complete line) and then puts a single space at the beginning, whereas decades of use have accustomed me to the behavior of Notepad and every other text editor/word processor I've ever used: the selected text is deleted and only after that is a space added. Akelpad does this if text on a single line is selected, but not if the selection spans multiple lines. How can I make Akelpad's spacebar behave the same on text selections for multiple lines as it does within a single line?

In the Hotkeys plugin I attempted to achieve this by specifying "command(4156) command(4168)", but unfortunately if nothing is selected, the spacebar doesn't move at all (because the two commands cancel each other out, I assume). So I need a way for Akelpad to sense that text is selected, and only then should it do "command(4156) command(4168)". Otherwise it should simply execute command(4168) alone. But I searched through the help and the text file for Hotkeys and didn't find a command that would tell Akelpad whether or not text is selected, whether multiple lines or within a line.

I thought there might be a script available in the very large Scripts thread here, but I did a couple of searches, e.g. "change space hotkey", "space multiple selection" and "make space behave like notepad", but didn't find anything relevant. (If there is one, I assume that the manual tells how to apply a script to a key--otherwise I'll be asking about that too... ;)

Thanks for any help--what an awesome little app. The fact that I can ask this question and know that there's an answer speaks for itself.

Posted: Mon Mar 25, 2013 8:51 am
by Instructor

Posted: Tue Mar 26, 2013 9:30 am
by Hanging
Instructor wrote:Hanging
viewtopic.php?p=18763
Thanks very much. I can't get past a syntax error, however. In the Hotkeys plugin, the correct command to edit, if I'm not mistaken, is IDM_EDIT_INSERT_SPACE. However, when I try to replace the current command with Command: Insert(" "), AkelPad says "Syntax error" and does not make the change (same result if I delete the space between "Command:" and "Insert").

I tried to replace IDM_EDIT_INSERT_SPACE with "Insert space", per the link, but Akelpad then says "Hotkey already assigned to IDM_EDIT_INSERT_SPACE" and I can't proceed. I tried to delete the whole command, but Akelpad won't do that either--the hotkey appears to be gone, but if I press "All keys", it shows up again. (Same with program restart.)

Sorry, I know I'm probably missing something easy, but sincerely don't know what to do next.

Posted: Tue Mar 26, 2013 9:42 am
by Instructor
Hanging
"Command:" it is field name. You should input Insert(" ") in this field :)

Posted: Tue Mar 26, 2013 9:13 pm
by Hanging
Instructor wrote:"Command:" it is field name. You should input Insert(" ") in this field :)
Aha! I was confused because of the native AkelPad commands that use the "Command(xxxx)" syntax. I thought perhaps other commands would also need the string "Command".

Now the space is working the way I want. Excellent! What a wonderful application--thanks very much for creating it.

replace selection on Space?

Posted: Tue Jan 05, 2016 11:17 am
by valexiev
Space replaces the selection if it's single line, but indents it if it's multiline. I find this annoying and want Space to always replace the selection.

I checked the standard key binding of Space (Alt+P, Hotkeys, All keys) and it's Command(4168).
I added a custom binding Command(4169), but there's no effect.

Can you help? Thanks!

BTW, the command descriptions are not very informative. Eg neither of these below says anything about replacing the selection:
4168 Insert space
4169 Insert space only if several lines selected

Posted: Tue Jan 05, 2016 3:00 pm
by opk44
valexiev
Image

Posted: Tue Jan 05, 2016 3:23 pm
by valexiev
Thanks!
For the uninitaited: to make this effective after restarting Akelpad, add this

Code: Select all

/Call("Hotkeys::Main",10)
to \\\reg\HKEY_CURRENT_USER\Software\Akelsoft\AkelPad\Options\CmdLineEnd or the respective akelpad.ini key

Posted: Wed Jan 06, 2016 1:19 am
by opk44
valexiev
just add the plugin to autostart:
Alt+P (Plug-ins...) and select check-box ("Hotkeys::Main") for plugin autoload.

Posted: Wed Jan 06, 2016 8:41 am
by valexiev
Autostart isn't good because it leaves the Hotkeys dialog open.
"10"in the /Call above tells it to keep the dialog hidden.

Posted: Wed Jan 06, 2016 11:29 am
by opk44
valexiev wrote:Autostart isn't good because it leaves the Hotkeys dialog open.
I've never seen that.

Posted: Wed Jan 06, 2016 1:10 pm
by KDJ
valexiev
If you set autoload Hotkeys plugin, it doesn't show this plugin dialog.
Call("Hotkeys::Main", 10) is generally intended for external calls, eg. from the scripts.