Re: [code] Textadept: trying to script "hover tips"..

From: Mitchell <m.att.foicica.com>
Date: Fri, 2 Nov 2018 13:39:19 -0400 (EDT)

Hi Phil,

On Fri, 2 Nov 2018, Phil S. wrote:

> Just discovered TA shortly ago and am depressed I haven't encountered it
> years ago =) it seems mostly "a dev's dream editor" because unlike my
> previous choices in recent years, SublimeText and VScode, one can "own it and
> mold it" for years to come, not worry about the editor-dev's proprietary
> shenanigans or future bloat etc, even run it on BSDs, fine-tune most-every
> aspect, and have a much saner (imho) scripting choice than ST's Python or
> VSC's Nodejs. Kudos! Brilliant.
>
> In daily editor use I tend to involve the mouse somewhat, particularly for
> hover tips (ie. what your Ctrl+H does but on mouse-dwell). I wrote a little
> script for that which "mostly works" but requires the following changes to
> modules/textadept/editing.lua:
>
> - show_documentation() is renamed to show_documentation_at(buffer_pos), with
> all occurrences of `buffer.current_pos` changed to `buffer_pos`
>
> - reintroduce show_documentation() and have it call
> show_documentation_at(buffer.current_pos)
>
> - BUT further below (just following the above) at
> `events.connect(events.CALL_TIP_CLICK, function(position)....` the
> buffer.current_pos would need to be replaced with the current call-tip pos! I
> would have thought that `buffer.call_tip_pos_start(buffer)` could do the
> trick here but alas, still the "new"/"next" tip pops up at the
> current-caret-pos instead of re-using its current tip pos! Any ideas why, or
> how one would approach this better? Am a newb to TA Lua scripting =)

In the `events.CALL_TIP_CLICK` handler you need to modify the call to `buffer:call_tip_show()` to pass in your desired position instead of `buffer.current_pos`.

> Thanks for creating this & looking forward to learning more.
>
> Bonus question, probably more of a Scintilla than TA one, but is there a
> smooth-scrolling-of-sorts option? Scrolling the-page-by-pixels instead of
> line-sized-jumps would improve UX quite a bit for us folks coming from other
> modern editors, I feel =)

I feel like this is a known limitation to Scintilla, that it only supports scrolling by lines, not pixels, but I cannot find the documentation to back up that statement at present. If Scintilla supported it, I'd imagine it would be working like that by default.

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 Fri 02 Nov 2018 - 13:39:19 EDT

This archive was generated by hypermail 2.2.0 : Sat 03 Nov 2018 - 06:42:02 EDT