Patch 7.4.757

563 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 25, 2015, 11:03:57 AM6/25/15
to vim...@googlegroups.com

Patch 7.4.757
Problem: Cannot detect the background color of a terminal.
Solution: Add T_RBG to request the background color if possible. (Lubomir
Rintel)
Files: src/main.c, src/term.c, src/term.h, src/proto/term.pro


*** ../vim-7.4.756/src/main.c 2015-04-17 22:08:10.998772925 +0200
--- src/main.c 2015-06-25 17:01:47.917747345 +0200
***************
*** 837,844 ****

starttermcap(); /* start termcap if not done by wait_return() */
TIME_MSG("start termcap");
! #if defined(FEAT_TERMRESPONSE) && defined(FEAT_MBYTE)
may_req_ambiguous_char_width();
#endif

#ifdef FEAT_MOUSE
--- 837,847 ----

starttermcap(); /* start termcap if not done by wait_return() */
TIME_MSG("start termcap");
! #if defined(FEAT_TERMRESPONSE)
! # if defined(FEAT_MBYTE)
may_req_ambiguous_char_width();
+ # endif
+ may_req_bg_color();
#endif

#ifdef FEAT_MOUSE
*** ../vim-7.4.756/src/term.c 2015-03-31 18:30:09.139370916 +0200
--- src/term.c 2015-06-25 16:52:59.359131386 +0200
***************
*** 124,129 ****
--- 124,134 ----
# define U7_SENT 2 /* did send T_U7, waiting for answer */
# define U7_GOT 3 /* received T_U7 response */
static int u7_status = U7_GET;
+ /* Request background color report: */
+ # define RBG_GET 1 /* send T_RBG when switched to RAW mode */
+ # define RBG_SENT 2 /* did send T_RBG, waiting for answer */
+ # define RBG_GOT 3 /* received T_RBG response */
+ static int rbg_status = RBG_GET;
# endif

/*
***************
*** 949,954 ****
--- 954,960 ----
{(int)KS_CWP, IF_EB("\033[3;%d;%dt", ESC_STR "[3;%d;%dt")},
# endif
{(int)KS_CRV, IF_EB("\033[>c", ESC_STR "[>c")},
+ {(int)KS_RBG, IF_EB("\033]11;?\007", ESC_STR "]11;?\007")},
{(int)KS_U7, IF_EB("\033[6n", ESC_STR "[6n")},

{K_UP, IF_EB("\033O*A", ESC_STR "O*A")},
***************
*** 1240,1245 ****
--- 1246,1252 ----
# endif
{(int)KS_CRV, "[CRV]"},
{(int)KS_U7, "[U7]"},
+ {(int)KS_RBG, "[RBG]"},
{K_UP, "[KU]"},
{K_DOWN, "[KD]"},
{K_LEFT, "[KL]"},
***************
*** 3224,3230 ****
* doesn't work in Cooked mode, an external program may get
* them. */
if (tmode != TMODE_RAW && (crv_status == CRV_SENT
! || u7_status == U7_SENT))
(void)vpeekc_nomap();
check_for_codes_from_term();
}
--- 3231,3238 ----
* doesn't work in Cooked mode, an external program may get
* them. */
if (tmode != TMODE_RAW && (crv_status == CRV_SENT
! || u7_status == U7_SENT
! || rbg_status == RBG_SENT))
(void)vpeekc_nomap();
check_for_codes_from_term();
}
***************
*** 3285,3292 ****
if (!gui.in_use && !gui.starting)
# endif
{
! /* May need to discard T_CRV or T_U7 response. */
! if (crv_status == CRV_SENT || u7_status == U7_SENT)
{
# ifdef UNIX
/* Give the terminal a chance to respond. */
--- 3293,3301 ----
if (!gui.in_use && !gui.starting)
# endif
{
! /* May need to discard T_CRV, T_U7 or T_RBG response. */
! if (crv_status == CRV_SENT || u7_status == U7_SENT
! || rbg_status == RBG_SENT)
{
# ifdef UNIX
/* Give the terminal a chance to respond. */
***************
*** 3398,3403 ****
--- 3407,3447 ----
}
# endif

+ #if defined(FEAT_TERMRESPONSE) || defined(PROTO)
+ /*
+ * Check how the terminal treats ambiguous character width (UAX #11).
+ * First, we move the cursor to (1, 0) and print a test ambiguous character
+ * \u25bd (WHITE DOWN-POINTING TRIANGLE) and query current cursor position.
+ * If the terminal treats \u25bd as single width, the position is (1, 1),
+ * or if it is treated as double width, that will be (1, 2).
+ * This function has the side effect that changes cursor position, so
+ * it must be called immediately after entering termcap mode.
+ */
+ void
+ may_req_bg_color()
+ {
+ if (rbg_status == RBG_GET
+ && cur_tmode == TMODE_RAW
+ && termcap_active
+ && p_ek
+ # ifdef UNIX
+ && isatty(1)
+ && isatty(read_cmd_fd)
+ # endif
+ && *T_RBG != NUL
+ && !option_was_set((char_u *)"bg"))
+ {
+ LOG_TR("Sending BG request");
+ out_str(T_RBG);
+ rbg_status = RBG_SENT;
+ /* check for the characters now, otherwise they might be eaten by
+ * get_keystroke() */
+ out_flush();
+ (void)vpeekc_nomap();
+ }
+ }
+ # endif
+
# ifdef DEBUG_TERMRESPONSE
static void
log_tr(char *msg)
***************
*** 4222,4233 ****
* - Cursor position report: <Esc>[{row};{col}R
* The final byte must be 'R'. It is used for checking the
* ambiguous-width character state.
*/
! p = tp[0] == CSI ? tp + 1 : tp + 2;
! if ((*T_CRV != NUL || *T_U7 != NUL)
&& ((tp[0] == ESC && tp[1] == '[' && len >= 3)
|| (tp[0] == CSI && len >= 2))
! && (VIM_ISDIGIT(*p) || *p == '>' || *p == '?'))
{
#ifdef FEAT_MBYTE
int col;
--- 4266,4283 ----
* - Cursor position report: <Esc>[{row};{col}R
* The final byte must be 'R'. It is used for checking the
* ambiguous-width character state.
+ *
+ * - Background color response:
+ * <Esc>]11;rgb:{rrrr}/{gggg}/{bbbb}\007
+ * The final byte must be '\007'.
*/
! char_u *argp = tp[0] == CSI ? tp + 1 : tp + 2;
!
! if ((*T_CRV != NUL || *T_U7 != NUL || *T_RBG != NUL)
&& ((tp[0] == ESC && tp[1] == '[' && len >= 3)
+ || (tp[0] == ESC && tp[1] == ']' && len >= 24)
|| (tp[0] == CSI && len >= 2))
! && (VIM_ISDIGIT(*argp) || *argp == '>' || *argp == '?'))
{
#ifdef FEAT_MBYTE
int col;
***************
*** 4363,4368 ****
--- 4413,4439 ----
key_name[1] = (int)KE_IGNORE;
slen = i + 1;
}
+ else if (*T_RBG != NUL && len >= 24 - (tp[0] == CSI)
+ && argp[0] == '1' && argp[1] == '1'
+ && argp[2] == ';' && argp[3] == 'r' && argp[4] == 'g'
+ && argp[5] == 'b' && argp[6] == ':'
+ && argp[11] == '/' && argp[16] == '/'
+ && argp[21] == '\007')
+ {
+ LOG_TR("Received RBG");
+ rbg_status = RBG_GOT;
+ if (!option_was_set((char_u *)"bg"))
+ {
+ set_option_value((char_u *)"bg", 0L, (char_u *)(
+ (3 * '6' < argp[7] + argp[12] + argp[17])
+ ? "light" : "dark"), 0);
+ reset_option_was_set((char_u *)"bg");
+ redraw_asap(CLEAR);
+ }
+ key_name[0] = (int)KS_EXTRA;
+ key_name[1] = (int)KE_IGNORE;
+ slen = 24;
+ }
}

/* Check for '<Esc>P1+r<hex bytes><Esc>\'. A "0" instead of the
*** ../vim-7.4.756/src/term.h 2015-03-31 18:30:09.143370872 +0200
--- src/term.h 2015-06-25 16:21:55.222506530 +0200
***************
*** 79,84 ****
--- 79,85 ----
KS_CWP, /* set window position in pixels */
KS_CWS, /* set window size in characters */
KS_CRV, /* request version string */
+ KS_RBG, /* request background color */
KS_CSI, /* start insert mode (bar cursor) */
KS_CEI, /* end insert mode (block cursor) */
KS_CSR, /* start replace mode (underline cursor) */
***************
*** 162,167 ****
--- 163,169 ----
#define T_CEI (term_str(KS_CEI)) /* end insert mode */
#define T_CSR (term_str(KS_CSR)) /* start replace mode */
#define T_CRV (term_str(KS_CRV)) /* request version string */
+ #define T_RBG (term_str(KS_RBG)) /* request background RGB */
#define T_OP (term_str(KS_OP)) /* original color pair */
#define T_U7 (term_str(KS_U7)) /* request cursor position */

*** ../vim-7.4.756/src/proto/term.pro 2014-07-30 17:21:53.819518506 +0200
--- src/proto/term.pro 2015-06-25 16:39:46.095228111 +0200
***************
*** 36,41 ****
--- 36,42 ----
void stoptermcap __ARGS((void));
void may_req_termresponse __ARGS((void));
void may_req_ambiguous_char_width __ARGS((void));
+ void may_req_bg_color __ARGS((void));
int swapping_screen __ARGS((void));
void setmouse __ARGS((void));
int mouse_has __ARGS((int c));
*** ../vim-7.4.756/src/version.c 2015-06-25 16:13:37.779750062 +0200
--- src/version.c 2015-06-25 16:20:48.475209933 +0200
***************
*** 743,744 ****
--- 743,746 ----
{ /* Add new patch number below this line */
+ /**/
+ 757,
/**/

--
We are the Borg of GNU GPL. We will assimilate your source code.
Resistance is futile.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Bram Moolenaar

unread,
Jun 25, 2015, 11:48:10 AM6/25/15
to Lubomir Rintel, vim...@googlegroups.com

Note that I changed the original patch from Lubomir, but was unable to
test it on a terminal that returns the special escape sequence.
Lubomir, please check that it actually works.


--
hundred-and-one symptoms of being an internet addict:
149. You find your computer sexier than your girlfriend

Kent Sibilev

unread,
Jun 25, 2015, 12:20:57 PM6/25/15
to vim...@googlegroups.com
This patch crashes vim for me when I'm starting it from tmux:

$ lldb vim
(lldb) target create "vim"
Current executable set to 'vim' (x86_64).
(lldb) run
Process 16364 launched: '/usr/local/bin/vim' (x86_64)
Process 16364 stopped
* thread #1: tid = 0x4f71ea, 0x0000000100193d13 vim`may_req_bg_color + 99 at term.c:3429, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x0000000100193d13 vim`may_req_bg_color + 99 at term.c:3429
3426 && p_ek
3427 # ifdef UNIX
3428 && isatty(1)
-> 3429 && isatty(read_cmd_fd)
3430 # endif
3431 && *T_RBG != NUL
3432 && !option_was_set((char_u *)"bg"))
(lldb)


Kent.

Kent Sibilev

unread,
Jun 25, 2015, 12:55:51 PM6/25/15
to vim...@googlegroups.com
On Thursday, June 25, 2015 at 12:20:57 PM UTC-4, Kent Sibilev wrote:
> This patch crashes vim for me when I'm starting it from tmux:
>
> $ lldb vim
> (lldb) target create "vim"
> Current executable set to 'vim' (x86_64).
> (lldb) run
> Process 16364 launched: '/usr/local/bin/vim' (x86_64)
> Process 16364 stopped
> * thread #1: tid = 0x4f71ea, 0x0000000100193d13 vim`may_req_bg_color + 99 at term.c:3429, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
> frame #0: 0x0000000100193d13 vim`may_req_bg_color + 99 at term.c:3429
> 3426 && p_ek
> 3427 # ifdef UNIX
> 3428 && isatty(1)
> -> 3429 && isatty(read_cmd_fd)
> 3430 # endif
> 3431 && *T_RBG != NUL
> 3432 && !option_was_set((char_u *)"bg"))
> (lldb)
>
>
> Kent.

This diff fixes the crash, but i'm not sure it is correct way to fix the problem:

diff --git a/src/term.c b/src/term.c
index 0d684e0..9dace0b 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3428,7 +3428,7 @@ may_req_bg_color()
&& isatty(1)
&& isatty(read_cmd_fd)
# endif
- && *T_RBG != NUL
+ && T_RBG != NUL && *T_RBG != NUL


&& !option_was_set((char_u *)"bg"))

{

Bram Moolenaar

unread,
Jun 25, 2015, 1:13:24 PM6/25/15
to Kent Sibilev, vim...@googlegroups.com
Thanks for reporting this. No, this is not the right solution.
An entry for T_RBG is missing in options.c. I'll make a patch.

--
hundred-and-one symptoms of being an internet addict:
152. You find yourself falling for someone you've never seen or hardly
know, but, boy can he/she TYPE!!!!!!

Christ van Willegen

unread,
Jun 25, 2015, 1:22:26 PM6/25/15
to vim...@googlegroups.com
On Thu, Jun 25, 2015 at 5:03 PM, Bram Moolenaar <Br...@moolenaar.net> wrote:
> Patch 7.4.757
> Problem: Cannot detect the background color of a terminal.
> Solution: Add T_RBG to request the background color if possible. (Lubomir
> Rintel)
> Files: src/main.c, src/term.c, src/term.h, src/proto/term.pro
> + #if defined(FEAT_TERMRESPONSE) || defined(PROTO)
> + /*
> + * Check how the terminal treats ambiguous character width (UAX #11).
> + * First, we move the cursor to (1, 0) and print a test ambiguous character
> + * \u25bd (WHITE DOWN-POINTING TRIANGLE) and query current cursor position.
> + * If the terminal treats \u25bd as single width, the position is (1, 1),
> + * or if it is treated as double width, that will be (1, 2).
> + * This function has the side effect that changes cursor position, so
> + * it must be called immediately after entering termcap mode.
> + */
> + void
> + may_req_bg_color()
> + {
> + if (rbg_status == RBG_GET

That comment looks wrong for that function.

Christ van Willegen
--
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0

Bram Moolenaar

unread,
Jun 25, 2015, 2:09:01 PM6/25/15
to Christ van Willegen, vim...@googlegroups.com
Right, somehow I missed that.

--
hundred-and-one symptoms of being an internet addict:
153. You find yourself staring at your "inbox" waiting for new e-mail
to arrive.

h_east

unread,
Jul 2, 2015, 12:29:24 AM7/2/15
to vim...@googlegroups.com
Hi Bram,

2015-6-26(Fri) 00:03:57 UTC+9 Bram Moolenaar:

The OSC(Operating System Controls) can be terminated with a ST. Same as a BEL.
Please see this url.
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Controls

Actually, Tera Term[1] returns The Background color response as:
<Esc>]11;rgb:{rrrr}/{gggg}/{bbbb}ST

This causes a problem. (Vim startup after displayed 'g')

So I was allowed to ST (0x9c or ESC\) the termination character of Background color response.
Please check an attached patch.

[1]: http://ttssh2.osdn.jp/index.html.en
--
Best regards,
Hirohito Higashi

rbg_fix.patch

Bram Moolenaar

unread,
Jul 2, 2015, 5:19:59 AM7/2/15
to h_east, vim...@googlegroups.com

Hirohito Higashi wrote:

> Hi Bram,
>
> 2015-6-26(Fri) 00:03:57 UTC+9 Bram Moolenaar:
> > Patch 7.4.757
> > Problem: Cannot detect the background color of a terminal.
> > Solution: Add T_RBG to request the background color if possible. (Lubomir
> > Rintel)
> > Files: src/main.c, src/term.c, src/term.h, src/proto/term.pro

[...]

> The OSC(Operating System Controls) can be terminated with a ST. Same as a BEL.
> Please see this url.
> http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Controls
>
> Actually, Tera Term[1] returns The Background color response as:
> <Esc>]11;rgb:{rrrr}/{gggg}/{bbbb}ST
>
> This causes a problem. (Vim startup after displayed 'g')
>
> So I was allowed to ST (0x9c or ESC\) the termination character of Background color response.
> Please check an attached patch.
>
> [1]: http://ttssh2.osdn.jp/index.html.en

Thanks. I had been wondering about whether this works everywhere.
Those requested escape sequences can cause trouble.

--
In Joseph Heller's novel "Catch-22", the main character tries to get out of a
war by proving he is crazy. But the mere fact he wants to get out of the war
only shows he isn't crazy -- creating the original "Catch-22".

Benjamin Kellner

unread,
Jul 4, 2015, 9:05:23 PM7/4/15
to vim...@googlegroups.com
This change seems to be causing issues with transparent rxvt-unicode terminals when assigning background transparency in .Xresources

Issue has been reported here:

https://bbs.archlinux.org/viewtopic.php?pid=1542046

Christian Brabandt

unread,
Jul 5, 2015, 7:30:03 AM7/5/15
to vim...@googlegroups.com
Hi Benjamin!
Can you check, if 7.4.766 fixes the problem for you?

Best,
Christian
--
Probleme sind Gelegenheiten zu zeigen, was man kann.
-- Duke Ellington

h_east

unread,
Jul 5, 2015, 8:43:28 AM7/5/15
to vim...@googlegroups.com
Hi Benjamin, Christian.B and List

2015-7-5(Sun) 20:30:03 UTC+9 Christian Brabandt:


> Hi Benjamin!
>
> On Sa, 04 Jul 2015, Benjamin Kellner wrote:
>
> > This change seems to be causing issues with transparent rxvt-unicode terminals when assigning background transparency in .Xresources
> >
> > Issue has been reported here:
> >
> > https://bbs.archlinux.org/viewtopic.php?pid=1542046
>
> Can you check, if 7.4.766 fixes the problem for you?

Perhaps, this problem is not resolved in 7.4.766.

Vim(7.4.766 or later) supported Background color response is:
ESC]11;rgb:rrrr/gggg/bbbbBEL
Or
ESC]11;rgb:rrrr/gggg/bbbbST

But, rxvt-unicode returns this, when alpha value is not 0xffff. [1]
ESC]11;rgba;aaaa/rrrr/gggg/bbbbST

I think this behavior is proprietary extension of rxvt-unicode.

And rxvt-unicode document says below:
http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.1.pod#ALPHA_CHANNEL_SUPPORT
> Please note that due to bugs in Xft, specifying alpha values might result in
> garbage being displayed when the X-server does not support the RENDER
> extension.

What do you think?


[1]: http://dist.schmorp.de/rxvt-unicode/rxvt-unicode-9.21.tar.bz2
command.C : 3341 (in function rxvt_term::process_color_seq())

--
Best regards,
Hirohito Higashi (a.k.a h_east)

Simon T.

unread,
Jul 5, 2015, 2:36:26 PM7/5/15
to vim...@googlegroups.com
7.4.766 did not fix the problem for me.

Anatol Pomozov

unread,
Jul 6, 2015, 7:20:43 PM7/6/15
to vim...@googlegroups.com
Is HEAD vim revision still broken? Could developers loos at this bug? Many Arch developers report this issue and we would like to release working version of vim.

h_east

unread,
Jul 7, 2015, 12:29:13 AM7/7/15
to vim...@googlegroups.com
Hi Bram, Anatol and Vim developers!

2015-7-7(Tue) 8:20:43 UTC+9 Anatol Pomozov:


> Is HEAD vim revision still broken? Could developers loos at this bug? Many Arch developers report this issue and we would like to release working version of vim.

I think that is no need to correspond to the "rgba:".
But, Vim is not good to output garbage being displayed which could not be interpreted the "Background color response".

So, I wrote a patch.
This patch is suppress to output garbage being displayed, when unknown background color response received. (e.g. "11;rgba:aaaa/rrrr/gggg/bbbb")

Please confirm this.

rbg_fix2.patch

Bram Moolenaar

unread,
Jul 7, 2015, 1:08:03 PM7/7/15
to h_east, vim...@googlegroups.com
It's a bit tricky.

> diff -r bfc3682510d6 src/term.c
> --- a/src/term.c Sat Jul 04 15:05:14 2015 +0200
> +++ b/src/term.c Tue Jul 07 13:08:17 2015 +0900
> @@ -4272,7 +4272,7 @@
>
> if ((*T_CRV != NUL || *T_U7 != NUL || *T_RBG != NUL)
> && ((tp[0] == ESC && tp[1] == '[' && len >= 3)
> - || (tp[0] == ESC && tp[1] == ']' && len >= 24)
> + || (tp[0] == ESC && tp[1] == ']' && len >= 3)
> || (tp[0] == CSI && len >= 2))
> && (VIM_ISDIGIT(*argp) || *argp == '>' || *argp == '?'))
> {

I think the length check should be len >= 5, since that's what is used
below.


> + j = 2 - (tp[0] == CSI);
> + for (i = j; i < len; ++i)
> + if (tp[i] == '\007'
> + || (tp[0] == CSI ? tp[i] == STERM
> + : i + 1 < len && tp[i] == ESC && tp[i + 1] == '\\'))
> + {
> + LOG_TR("Received unknown RBG");
> + key_name[0] = (int)KS_EXTRA;
> + key_name[1] = (int)KE_IGNORE;
> + slen = i + 1 + (tp[i] == ESC);
> + break;
> + }
> +
> + if (i == len)
> + {
> + LOG_TR("not enough characters for RB");
> + return -1; /* not enough characters */
> + }
> + }

If the terminating character is missing, or the specific terminal uses
another character to terminate the sequence, then this will eat
everything.

It's probably better to check for the specific code returned. When we
find another variant we can add it.


--
A bad peace is better than a good war. - Yiddish Proverb

h_east

unread,
Jul 7, 2015, 10:39:19 PM7/7/15
to vim...@googlegroups.com, h.eas...@gmail.com
Hi Bram,

2015-7-8(Wed) 2:08:03 UTC+9 Bram Moolenaar:

No problem. Because it checked in src/term.c:L4414.
(Note: Line number is the after applying my patch)

4413 else if (*T_RBG != NUL
4414 && len >= 5 - (tp[0] == CSI)
4415 && argp[0] == '1' && argp[1] == '1' && argp[2] == ';')
4416 {

>
>
> > + j = 2 - (tp[0] == CSI);
> > + for (i = j; i < len; ++i)
> > + if (tp[i] == '\007'
> > + || (tp[0] == CSI ? tp[i] == STERM
> > + : i + 1 < len && tp[i] == ESC && tp[i + 1] == '\\'))
> > + {
> > + LOG_TR("Received unknown RBG");
> > + key_name[0] = (int)KS_EXTRA;
> > + key_name[1] = (int)KE_IGNORE;
> > + slen = i + 1 + (tp[i] == ESC);
> > + break;
> > + }
> > +
> > + if (i == len)
> > + {
> > + LOG_TR("not enough characters for RB");
> > + return -1; /* not enough characters */
> > + }
> > + }
>
> If the terminating character is missing, or the specific terminal uses
> another character to terminate the sequence, then this will eat
> everything.

This patch discard only the following pattern. ('*' is any character string)
ESC]11;*BEL
ESC]11;*ESC\
CSI11;*BEL
CSI11;*ST

So, I think the problem is less likely to occur.

>
> It's probably better to check for the specific code returned. When we
> find another variant we can add it.

I dislike to accept it in each time the terminal emulator proprietary implementation.

Thanks.

Bram Moolenaar

unread,
Jul 8, 2015, 3:55:17 PM7/8/15
to h_east, vim...@googlegroups.com
But then we will search for the whole escape sequence.
But when we get ESC]11; and then no BEL or ESC\ follows, we never get
out of this loop, we run into the "not enough characters" part forever.

--
hundred-and-one symptoms of being an internet addict:
189. You put your e-mail address in the upper left-hand corner of envelopes.

h_east

unread,
Jul 8, 2015, 9:47:12 PM7/8/15
to vim...@googlegroups.com, h.eas...@gmail.com
Hi Bram!

2015-7-9(Thu) 4:55:17 UTC+9 Bram Moolenaar:

Sorry. I have big mistake.
Patch 7.4.757 has confused the CSI(0x9b) and OSC(0x9d).
And, I did not notice it.

Please wait for a few days, because I refactor the term.c.

Thanks

h_east

unread,
Jul 9, 2015, 12:59:11 AM7/9/15
to vim...@googlegroups.com
Hi Bram and list!

2015-7-9(Thu) 10:47:12 UTC+9 h_east:

Done.

Changed contents:
- Defined the OSC in the same way as CSI, DCS.
- CSI, OSC and DCS check process was clearly separated.

Please confirm again.


BTW...


> > But when we get ESC]11; and then no BEL or ESC\ follows, we never get
> > out of this loop, we run into the "not enough characters" part forever.

This problem is also in the process of the current of CSI and DCS.
Find and check for below string in term.c
"Not enough characters for CRV"
"not enough characters for XT"

rbg_fix3.patch

h_east

unread,
Jul 9, 2015, 1:20:53 AM7/9/15
to vim...@googlegroups.com
Patch update. (a bit modified)
rbg_fix4.patch

Bram Moolenaar

unread,
Jul 9, 2015, 5:30:55 AM7/9/15
to h_east, vim...@googlegroups.com
Thanks, I'll look into it.

> BTW...
> > > But when we get ESC]11; and then no BEL or ESC\ follows, we never get
> > > out of this loop, we run into the "not enough characters" part forever.
>
> This problem is also in the process of the current of CSI and DCS.
> Find and check for below string in term.c
> "Not enough characters for CRV"
> "not enough characters for XT"

We might need to find a generic solution. A timeout is probably
appropriate, these escape sequences should be completely received within
a short time. Although on a slow connection it might get split (the
"entering a tunnel" problem).

--
What is the difference between a professional and an amateur?
The ark was built by an amateur; professionals gave us the Titanic.

h_east

unread,
Jul 9, 2015, 6:34:43 PM7/9/15
to vim...@googlegroups.com, h.eas...@gmail.com
Hi Bram,

2015-7-9(Thu) 18:30:55 UTC+9 Bram Moolenaar:

Sure.
This matter is corresponding later.

I updated a patch. (BELL termination check were missing for RBG)

And I received a review from Hayaki Saito.
He says:
- 8-bit response can not received. (Contains mouse input)
- may_req_bg_color() call timing is too early. Should Called after t_CRV response received and switch to 8-bit mode.

The findings, I would try to correspond to the weekend.

These are the issues from before.
So, it might be good to include rbg_fix5.patch first :-)

Thanks.
--
Best regards,
Hirohito Higashi (a.k.a h_east)

rbg_fix5.patch

Bram Moolenaar

unread,
Jul 10, 2015, 7:06:15 AM7/10/15
to h_east, vim...@googlegroups.com

Hirohito Higashi wrote:

[...]

> > > BTW...
> > > > > But when we get ESC]11; and then no BEL or ESC\ follows, we never get
> > > > > out of this loop, we run into the "not enough characters" part forever.
> > >
> > > This problem is also in the process of the current of CSI and DCS.
> > > Find and check for below string in term.c
> > > "Not enough characters for CRV"
> > > "not enough characters for XT"
> >
> > We might need to find a generic solution. A timeout is probably
> > appropriate, these escape sequences should be completely received within
> > a short time. Although on a slow connection it might get split (the
> > "entering a tunnel" problem).
>
> Sure.
> This matter is corresponding later.
>
> I updated a patch. (BELL termination check were missing for RBG)
>
> And I received a review from Hayaki Saito.
> He says:
> - 8-bit response can not received. (Contains mouse input)
> - may_req_bg_color() call timing is too early. Should Called after t_CRV response received and switch to 8-bit mode.
>
> The findings, I would try to correspond to the weekend.
>
> These are the issues from before.
> So, it might be good to include rbg_fix5.patch first :-)

OK, let's first make it a bit more consistent. I think it's good to
check the first characters after DCS and OSC to avoid eating an escape
sequence that someone might map. Hopefully we don't let anything
through that causes problems, we'll have to see if someone complains.

This also reduces the chance of looping to get more characters for
anything that starts with DCS or OSC that ends in another way than we
expect. So perhaps the timeout isn't needed.

--
Some of the well known MS-Windows errors:
EHUH Unexpected error
EUSER User error, not our fault!
EGOD Horrible problem, god knows what has happened
EERR Errornous error: nothing wrong
Reply all
Reply to author
Forward
0 new messages