Re: [code] [textadept] New Language Server Protocol client module

From: Chris Emerson <c-ta.att.mail.nosreme.org>
Date: Tue, 2 Oct 2018 22:06:50 +0100

Hi Mitchell,

On Mon, Oct 01, 2018 at 06:47:17PM -0400, Mitchell wrote:
> On Mon, 1 Oct 2018, Chris Emerson wrote:
> >Oh, wait - I'm using the Curses version, and if the fix is:
> > https://foicica.com/hg/lspawn/rev/8064e629d12b
> >then it looks like it's inside an #ifdef GTK.
>
> Ack, that would do it :( I'll push a fix that should appear in the next nightly.

That didn't work for me; it returned the first line ok, but only having read
the '\r', not the '\n', and then returned nil instead of an empty line. The
following diff against lspawn hg seems to work for me:

=== begin diff ===
diff -r 80f2aa6ab11b lspawn.c
--- a/lspawn.c Mon Oct 01 18:49:52 2018 -0400
+++ b/lspawn.c Tue Oct 02 22:04:41 2018 +0100
@@ -132,7 +132,7 @@
     while ((n = read(p->fstdout, &ch, 1)) > 0) {
       if ((ch != '\r' && ch != '\n') || *c == 'L' || *c == 'a')
         luaL_addchar(&buf, ch), len++;
- if ((ch == '\r' || ch == '\n') && *c != 'a') break;
+ if ((ch == '\n') && *c != 'a') break;
     }
     if (n < 0 && len == 0) len = n;
     luaL_pushresult(&buf);
@@ -142,7 +142,7 @@
     if ((len = read(p->fstdout, buf, bytes)) > 0) lua_pushlstring(L, buf, len);
     free(buf);
   }
- if (len <= 0) {
+ if (len < 0) {
     lua_pushnil(L);
     if (len == 0) return 1;
     lua_pushinteger(L, errno), lua_pushstring(L, strerror(errno));

=== end diff ===

Chris

-- 
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 Tue 02 Oct 2018 - 17:06:50 EDT

This archive was generated by hypermail 2.2.0 : Wed 03 Oct 2018 - 06:50:47 EDT