Re: [scinterm] [textadept] Re: [code] [textadept] Sync Curses Cursor for tmux Copy Mode

From: Mitchell <m.att.foicica.com>
Date: Wed, 16 Aug 2017 22:19:56 -0400 (EDT)

Hi Chad,

On Mon, 14 Aug 2017, cavoegele.att.gmail.com wrote:

> Hi Mitchell,
>
> On Mon, Aug 14, 2017 at 02:44:55PM -0400, Mitchell wrote:
>> Hi Chad,
>>
>> On Sun, 13 Aug 2017, cavoegele.att.gmail.com wrote:
>>
>>> Hi Textadept Users!
>>>
>>> One bit of functionality I miss from Vim is the seamless transition from
>>> Vim to tmux copy mode. The tmux cursor starts at the current position of
>>> the Vim cursor. In textadept-curses, the tmux cursor always starts at
>>> the bottom-left corner of the screen.
>>>
>>> I dug into this issue a bit and it's caused by Scintilla drawing the
>>> caret as a single, inverted-color character and hiding the terminal
>>> cursor. Tmux copy mode starts from the position of the terminal cursor.
>>> A workaround in the patch below is to move the terminal cursor to the
>>> current position of the Scintilla caret after painting is finished. This
>>> works for screen and tmux including for split views. However it doesn't
>>> work for the command entry cursor.
>>>
>>> Any chance we can get this patch cleaned up and merged upstream?
>>>
>>> [snip]
>>
>> I think Scinterm[1] is a more appropriate place to put this patch, perhaps in the `NoutRefresh()` function[2]. A potential benefit is that since Textadept's command entry is a Scintilla window, the cursor should be updated on paint.
>>
>> If you want to take a stab at it, go for it. Otherwise I'll see what I can do when I have some time.
>>
>> Cheers,
>> Mitchell
>>
>> [1]: http://foicica.com/scinterm/
>> [2]: http://foicica.com/hg/scinterm/file/938cfedd428a/ScintillaTerm.cxx#l1205
>
> You are a magician! Moving the patch to the scinterm `NoutRefresh()`
> function fixed the command entry issue, simplified the code, and will
> add the functionality for other ScintillaTerm clients.
>
> One issue however is that textadept redraws all panes on refresh. If the
> cursor isn't in the last drawn pane, then the physical cursor ends in
> the wrong spot. This can be remedied by explicitly drawing the
> `focused_view` again last. I'm not sure this approach is good however.

The `ScintillaTerm` class inherits a Scintilla field called `hasFocus`. You can conditionally move the cursor if `hasFocus` is true. Since only one Scintilla window should have focus at a time (assuming the container application handles this, and hopefully Textadept does...), the draw order should not matter.

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 16 Aug 2017 - 22:19:56 EDT

This archive was generated by hypermail 2.2.0 : Thu 17 Aug 2017 - 06:33:39 EDT