Small feature suggestion

English main discussion
Post Reply
  • Author
  • Message
Offline
Posts: 21
Joined: Mon Mar 14, 2011 1:27 pm

Small feature suggestion

Post by danf84 »

Often when writing, I need to have an empty/new line at the end of the file. So I scroll with the "ARROW DOWN", the cursor often ends up somewhere in the middle of the last line.

Would it be a nice feature that AkelPad detected that if you press ARROW DOWN and the cursor doesn't move (it has nowhere to go), AkelPad creates a new line at the end and puts the cursor there? So in effect, it would be performing END + ENTER.

I know this is picky, but I think this is a really good idea :) Because then you could be holding arrow down, always ensuring you begin typing at a fresh new line.

Merci Beaucoup / Spacibochki

Offline
Posts: 47
Joined: Fri Mar 27, 2015 7:46 am

Post by Akuro »

I am a total newbie, but couldn't you press Ctrl+ArrowDown? Instead of holding down the arrow key until it no longer moves?

Ctrl+ArrowDown should bring you to the very end. To achieve your intended END+Enter in one go, record it as a Macro, click the Record button, then press Ctrl+ArrowDown followed by Enter. Then click the STOP button of the macro recorder. Assign it a keyshortcut or a context menu button or a toolbar button .....

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

danf84

Code: Select all

var hWndEdit=AkelPad.GetEditWnd();
var nSelStart=AkelPad.GetSelStart();
var nSelEnd=AkelPad.GetSelEnd();

if (nSelStart == nSelEnd)
{
  nLine=AkelPad.SendMessage(hWndEdit, 3129 /*AEM_GETLINENUMBER*/, 0 /*AEGL_LINECOUNT*/, 0);
  if (AkelPad.SendMessage(hWndEdit, 3138 /*AEM_GETRICHOFFSET*/, 40 /*AEGI_RICHOFFSETFROMLINE*/, nLine - 1) <= nSelStart)
  {
    AkelPad.SendMessage(hWndEdit, 3044 /*AEM_KEYDOWN*/, 0x23 /*VK_END*/, 0);
    AkelPad.SendMessage(hWndEdit, 258 /*WM_CHAR*/, 0x0D /*VK_RETURN*/, 0);
    WScript.Quit();
  }
}
AkelPad.SendMessage(hWndEdit, 3044 /*AEM_KEYDOWN*/, 0x28 /*VK_DOWN*/, 0);


Add to Hotkeys plugin:

Command on hotkey Down:

Code: Select all

Call("Scripts::Main", 1, "DownNewLine.js")
Post Reply