Re: [code] [textadept] hidden lines

From: Mitchell <m.att.foicica.com>
Date: Thu, 26 May 2016 20:12:16 -0400 (EDT)

Hi Toba,

On Thu, 26 May 2016, toba wrote:

> Hello,
>
> I have a script that hides some lines in the editor. If I change to another
> file and then back to the first file, the hidden lines will be visible. Like
> if changing the file un-hides the hidden lines. Is there a way to keep the
> hidden lines hidden even after switching the file?

Take a look at Textadept's `core/ui.lua` file around line 358. There's a
couple of functions connected to the `events.BUFFER_BEFORE_SWITCH` and
`events.BUFFER_AFTER_SWITCH` that save buffer properties like the current
fold state. If you make a similar connection that saves and restores
hidden lines, you'll get the desired behavior.

> Another question, is it possible to create variables that are local to a
> given file (buffer)? I'm looking for a way to have some variables that would
> have different values in case of different buffers.

Sure, just put them in the `buffer` table (e.g.
`buffer.my_special_variable = something`).

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 Thu 26 May 2016 - 20:12:16 EDT

This archive was generated by hypermail 2.2.0 : Fri 27 May 2016 - 06:25:26 EDT