Re: [code] [textadept] Newbee question: what's in textadept

From: Mitchell <m.att.foicica.com>
Date: Wed, 23 Oct 2013 09:13:26 -0400 (EDT)

Hi Dirk,

On Wed, 23 Oct 2013, Dirk GŁnther wrote:

> Hello again,
>
> I am playing with TA (and the Lua API). I was thinking as an experiment to
> implement a "mark element" function in XML (hopefully it's not in there
> yet).
>
> So what I have is a well-formed document:
>
> <root> -!-
> <whatever >foo</whatever>
> <whatever />
> <another />
> </root>
>
> and the cursor is where -!- is.
>
> What I think I need to do is
>
> 1) go back to the previous start tag (<root>)
> 2) look forward until I get the matching end tag
> 3) put the selection from the start to the end
>
> Is any of the first two points already in textadept? I guess the most
> difficult part will be 2).

The `textadept.editing.select_enclosed()` function goes back to the
previous start tag (#1), but stops at the next '<' instead of the matching
tag. You could use that as a starting point for #2 and #3.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Wed 23 Oct 2013 - 09:13:26 EDT

This archive was generated by hypermail 2.2.0 : Thu 24 Oct 2013 - 06:32:41 EDT