Re: [code] [textadept] Scroll position in session loading and buffer switching

From: Mitchell <>
Date: Tue, 28 Jan 2014 13:47:34 -0500 (Eastern Standard Time)

Hi Robert,

On Sun, 26 Jan 2014, Robert Gieseke wrote:

> Hi Mitchell,
> Am 1/9/14, 8:38 PM, schrieb Robert Gieseke:
>> Am 1/9/14, 6:39 PM, schrieb Mitchell:
>>> When you say the caret is scrolled out of view, what do you mean? Is
>>> it
>>> above or below the visible lines? Or is it off to the side on a long
>>> line?
>>> In the cases where the selection is on part of a long line not
>>> visible
>>> in the view, `buffer:set_sel()` ensures visibility. Setting `anchor`
>>> and
>>> `current_pos` would definately leave the caret out of view in these
>>> cases -- we do not want that to happen.
>>> I'm not convinced that `buffer:set_sel()` is to blame for your
>>> observations. I have done some brief tests on my machine but have yet
>>> to
>>> reproduce what you describe. What happens when you add
>>> `buffer:scroll_range(anchor, caret)` after line scrolling and
>>> selection
>>> setting?
>> I have word_wrap enabled so I hadn't thought of long lines, where it
>> obviously makes sense to scroll to. Maybe it's the buffer_after_switch
>> event, I have one vertical split, so after restoring all views it's
>> switching back again to the first view?
>> Every time I think I have a reproducible example it's not …
> I think I found a reproducible example:
> In a "clean" userhome I have only
> buffer.wrap_mode = buffer.WRAP_WORD
> in properties.lua.
> Opening textadept.c, centering for example l.100, and switching buffers
> lets wander this line to the top.
> If I add as you suggested
> buffer:scroll_range(buffer._anchor, buffer._current_pos)
> in core/ui.lua on l.347 the line is kept visible at the top of the view.
> Maybe using and restoring first_visible_line could be a fix for this?

Thanks for the follow up. I've looked into this more and identified the
problem. ui.lua:331 needs to have:


instead of just


No other changes were necessary. This will be fixed in the next release.


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Tue 28 Jan 2014 - 13:47:34 EST

This archive was generated by hypermail 2.2.0 : Wed 29 Jan 2014 - 06:39:59 EST