How to receive live text change notifications in an AkelPad plugin?

English main discussion
Post Reply
  • Author
  • Message
Offline
Posts: 293
Joined: Thu Sep 10, 2015 9:53 am
Location: Deutschland

How to receive live text change notifications in an AkelPad plugin?

Post by sexy96 »

Hello,

I'm writing a C++ plugin for AkelPad 4.9.9 (Unicode).

The plugin needs to work live, i.e. it should be notified whenever the document changes:

typing a character,
Backspace/Delete,
Paste,
Undo/Redo.

The goal is to rebuild an internal word list immediately after the text changes.

I already have:

access to PLUGINDATA,
the AkelEditW window handle,
successful WM_GETTEXT (I can read the whole document correctly),
a working DLL loaded by AkelPad.

I first tried subclassing AkelEditW with SetWindowLongPtr(GWLP_WNDPROC, ...), but that caused instability, so I don't think this is the correct approach.

Then I found the SDK example for:

AKD_SETMAINPROCRET

with:

WNDPROCRETDATA *wprd = NULL;

void CALLBACK NewMainProcRet(CWPRETSTRUCT *cwprs)
{
if (cwprs->message == WM_NOTIFY)
{
...
}

if (wprd->NextProc)
wprd->NextProc(cwprs);
}

However, I don't know which notification is generated when the document text changes.

My questions are:

What is the recommended way for a plugin to detect every text modification in AkelPad?
Should I use AKD_SETMAINPROCRET, AKD_SETEDITPROCRET, or something else?
Which notification/message is generated after:
typing,
deleting,
pasting,
undo/redo?
Is there an AEN_* notification or another event intended specifically for text changes?

I would appreciate a small example of the recommended solution.

Thank you!


Offline
Posts: 293
Joined: Thu Sep 10, 2015 9:53 am
Location: Deutschland

Re: How to receive live text change notifications in an AkelPad plugin?

Post by sexy96 »

Thank you
Post Reply