text navigation by paragraph using ctrl+down
- Author
- Message
-
Offline
- Posts: 10
- Joined: Sat Oct 03, 2015 11:13 am
- Location: nearby to ethiopis
text navigation by paragraph using ctrl+down
Hi Akelpadderrs,
I was trying to navigate by paragraph using ctrl+down, but it moves down line by line. so, is therre any scrript, plugin or setting to enable this kind of cursor movement in the text?
Woreda
I was trying to navigate by paragraph using ctrl+down, but it moves down line by line. so, is therre any scrript, plugin or setting to enable this kind of cursor movement in the text?
Woreda
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
woreda
From AkelPad documentation:
From AkelPad documentation:
From Wikipedia:AkelHelp-Eng.htm wrote:Ctrl+Up - go to start of previous line
Ctrl+Down - go to start of next line
What do you understand by the term "paragraph" in plain text file?Paragraph
...
In computing
...
In plaintext files, there are two common formats. Pre-formatted text will have a newline at the end of every physical line, and two newlines at the end of a paragraph, creating a blank line. An alternative is to only put newlines at the end of each paragraph, and leave word wrapping up to the application that displays or processes the text.
-
Offline
- Posts: 10
- Joined: Sat Oct 03, 2015 11:13 am
- Location: nearby to ethiopis
-
Offline
- Posts: 1250
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Looks like this is the script to be assigned to Ctrl+Down:
and to Ctrl+Up:
The hotkeys can be assigned either from the Scripts plugin's window or from the Hotkeys plugin.
See AkelFiles\Docs\Scripts-Eng.txt and AkelFiles\Docs\Hotkeys-Eng.txt for more details.
Code: Select all
AkelPad.TextFind(0, "(?<=\\n\\n)", 0x00000001|0x00040000|0x00080000);
Code: Select all
AkelPad.TextFind(0, "(?<=\\n\\n)", 0x00100000|0x00040000|0x00080000);
See AkelFiles\Docs\Scripts-Eng.txt and AkelFiles\Docs\Hotkeys-Eng.txt for more details.
-
Offline
- Posts: 1250
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Nope, these assigned hotkeys override the default behaviour which in case of Ctrl+Down and Ctrl+Up seems to be duplicate of Down and Up.woreda wrote:I assigned ctrl+down and ctrl+up, will it be a problem?
There is, however, a thing that could be improved in the code mentioned above. Let's imagine that some of your paragraphs are separated by a line of spaces instead of an empty line. Visually the line of spaces looks similar to an empty line (unless you make the space characters visible via SpecialChar plugin), but the RegEx "(?<=\\n\\n)" does not handle spaces. You could say the RegEx could be changed to "(?<=\\n(\\s*)\\n)" to handle that - but, unluckily, (?<=pattern) supports only fixed length pattern, whereas (\\s*) is obviously non-fixed.
-
Offline
- Site Admin
- Posts: 6311
- Joined: Thu Jul 06, 2006 7:20 am
Single Scripts plugin method call can be done without script (more fast variant):
Code: Select all
"Find next paragraph" Call("Scripts::Main", 7, `AkelPad.TextFind(0, "(?<=\n\n)(?!\n)", 0x80001 /*FRF_DOWN|FRF_REGEXP*/)`)
-
Offline
- Posts: 10
- Joined: Sat Oct 03, 2015 11:13 am
- Location: nearby to ethiopis
I tried to save it as a js file and when I try to use it says:Instructor wrote:Single Scripts plugin method call can be done without script (more fast variant):Code: Select all
"Find next paragraph" Call("Scripts::Main", 7, `AkelPad.TextFind(0, "(?<=\n\n)(?!\n)", 0x80001 /*FRF_DOWN|FRF_REGEXP*/)`)
"Scripts plugin
Script:
E:\Users\SkyDrive\PortableApps\AkelPadPortable\App\AkelPadx64\Ake
lFiles\Plugs\Scripts\next_paragraph.js
Line: 2
Symbol: 26
Error: Invalid character
Code: 800A03F6
Source: Microsoft JScript compilation error"
@DV thank You again.
I'd like that, is there a way to implement it?DV wrote:There is, however, a thing that could be improved in the code mentioned above. Let's imagine that some of your paragraphs are separated by a line of spaces instead of an empty line. Visually the line of spaces looks similar to an empty line (unless you make the space characters visible via SpecialChar plugin), but the RegEx "(?<=\\n\\n)" does not handle spaces. You could say the RegEx could be changed to "(?<=\\n(\\s*)\\n)" to handle that - but, unluckily, (?<=pattern) supports only fixed length pattern, whereas (\\s*) is obviously non-fixed.
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
This code must not be saved in a file.woreda wrote:I tried to save it as a js file and when I try to use it says:Instructor wrote:Single Scripts plugin method call can be done without script (more fast variant):Code: Select all
"Find next paragraph" Call("Scripts::Main", 7, `AkelPad.TextFind(0, "(?<=\n\n)(?!\n)", 0x80001 /*FRF_DOWN|FRF_REGEXP*/)`)
...
It is for immediate use on toolbar, menu or hotkey.
-
Offline
- Posts: 10
- Joined: Sat Oct 03, 2015 11:13 am
- Location: nearby to ethiopis
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
woreda
Name: Find previous paragraph
Command: Call("Scripts::Main", 7, `AkelPad.TextFind(0, "(?<=\n\n)(?!\n)", 0x00180000)`)
Hotkey: Ctrl + Up
About AkelPad.TextFind method read in documentation (Scripts-Eng.txt). For convenience, you can use AkelPadMethodsView.js script.
Name: Find previous paragraph
Command: Call("Scripts::Main", 7, `AkelPad.TextFind(0, "(?<=\n\n)(?!\n)", 0x00180000)`)
Hotkey: Ctrl + Up
About AkelPad.TextFind method read in documentation (Scripts-Eng.txt). For convenience, you can use AkelPadMethodsView.js script.
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
woreda
Try this:
Try this:
Code: Select all
"Find prev paragraph" Call("Scripts::Main", 7, `AkelPad.TextFind(0, "(?<=\n)[ \t]*\n\K(?=[ \t]*\S)|\A[ \t]*\n\K(?=[ \t]*\S)|\A(?=[ \t]*\S)", 0x00180000 /*FRF_UP|FRF_REGEXP*/)`)
"Find next paragraph" Call("Scripts::Main", 7, `AkelPad.TextFind(0, "\A[ \t]*\n\K(?=[ \t]*\S)|(?<=\n)[ \t]*\n\K(?=[ \t]*\S)", 0x00080001 /*FRF_DOWN|FRF_REGEXP*/)`)