Re: [code][textadept] Initialization issue III

From: Mitchell <m.att.foicica.com>
Date: Thu, 16 Nov 2017 20:57:50 -0500 (EST)

Hi Gabriel,

On Wed, 15 Nov 2017, Gabriel Dubatti wrote:

>
> Hi Mitchell,
>
>     I found the problem in lbuf_closure() function @ textadept.c line 1244:
>
> static int lbuf_closure(lua_State *L) {
>
>   Scintilla *view = focused_view;
>
>   if (lua_istable(L, 1)) {
>
>     int result = l_globaldoccompare(L, 1);
>
>     if (result != 0) view = (result > 0) ? dummy_view : command_entry;
>
>
> The test in the last line "(result > 0)" must be replaced with "(result !=
> -1)" because l_globaldoccompare() returns 0, -1 or the Scintilla
> document's pointer.
>
> The issue fires when the returned doc pointer looks like a negative number!!

Thanks for digging into this. While it may be a solution, I don't think it's the correct one. The documentation for `l_globaldoccompare()` is: "Compares the Scintilla document at the given index with the global one and returns 0 if they are equivalent, less than zero if that document belongs to the command entry, and greater than zero otherwise". By changing the conditional to "result != -1", it would not be possible to compare to the command entry.

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 16 Nov 2017 - 20:57:50 EST

This archive was generated by hypermail 2.2.0 : Fri 17 Nov 2017 - 06:27:05 EST