From ktexteditor-devel Fri Jan 25 00:07:51 2008 From: Matt Rogers Date: Fri, 25 Jan 2008 00:07:51 +0000 To: ktexteditor-devel Subject: Re: Adding Textmate-like snippets to Kate Message-Id: <200801241807.53938.mattr () kde ! org> X-MARC-Message: https://marc.info/?l=ktexteditor-devel&m=120121974005383 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0806794370==" --===============0806794370== Content-Type: multipart/signed; boundary="nextPart1795796.SGs3YekQkD"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart1795796.SGs3YekQkD Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thursday 24 January 2008 05:10:14 pm Dominik Haumann wrote: > On Thursday 24 January 2008, Matt Rogers wrote: > > On Thu, Jan 24, 2008 at 09:18:07PM +0100, Anders Lund wrote: > > > On Thursday 24 January 2008, Matt Rogers wrote: > > > > Hi, > > > > > > > > I'm in the process of adding textmate-like snippet support to > > > > KTextEditor based implementations in the form of a KTextEditor > > > > plugin. The behavior I want to implement is described at > > > > http://macromates.com/textmate/manual/snippets#snippets. After > > > > looking at how KatePart is implemented, I have a few questions. > > > > > > > > Does the template interface support what I want to do? I think it's > > > > basically the same thing, only rather than working with whole files, > > > > i'm working with little bits of text. > > > > > > The template interface can replace macros in the inserted text, so it > > > looks like you want that for variables. I used it in the kate file > > > template plugin, so look there for an example. > > > > ok, I'll take a look at it. Thanks for the pointer. :) > > > > > > I was initially thinking that I would install an event filter on a > > > > KTextEditor::View object, but since KatePart does that already, will > > > > that work without interfering with other things in KatePart? > > > > > > Why would you want an event filter? for changes in the text, use the > > > textChanged() signal. > > > > Because the textChanged() signal does not exist in the KTextEditor > > interfaces and I'd prefer not to depend exclusively on Kate. > > KTE::View signals > textInserted (KTextEditor::View *view, const KTextEditor::Cursor &positio= n, > const QString &text); > > cursorPositionChanged (KTextEditor::View *view, > const KTextEditor::Cursor &newPosition) > > KTE::Document signals: > textChanged (KTextEditor::Document *document); > textInserted (KTextEditor::Document *document, > const KTextEditor::Range &range); > textRemoved (KTextEditor::Document *document, > const KTextEditor::Range &range); > textChanged (KTextEditor::Document *document, > const KTextEditor::Range &oldRange, const KTextEditor::Range=20 &newRange); > > See also: > http://api.kde.org/4.x-api/kdelibs-apidocs/interfaces/ktexteditor/html/cl= as >sKTextEditor_1_1View.html > hmm, I must have missed those when I looked at the apidocs. > > I also need to know when keys like Tab and Backspace are hit. > > Backspace -> maybe textRemoved? > There is no way afaik to get a TAB keypress but an event filter... > This is what I thought. Thanks. :) =2D- Matt --nextPart1795796.SGs3YekQkD Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBHmShXA6Vv5rghv0cRAr7fAJ4ulD7+C4lpCH6HbHPRz3abkKL8dQCfSOca 0zBPSXTABUhx2sk9/+CoJCs= =IOBo -----END PGP SIGNATURE----- --nextPart1795796.SGs3YekQkD-- --===============0806794370== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ KTextEditor-Devel mailing list KTextEditor-Devel@kde.org https://mail.kde.org/mailman/listinfo/ktexteditor-devel --===============0806794370==--