In input.c, several of the input_enter_* functions do this:
ictx->input_len = 0;
This is intended to be the number of characters in ictx->input_buf.
However, a few functions use input_buf without checking input_len. You
can see the effect of this in the following example:
$ echo -e '\e]1;Random junk\e\\'
$ # Nothing appears to happen, until...
$ echo -e '\e_\e\\' # Should clear the title
Instead of setting the title to an empty string, this sets the title
to "1;Random junk".
It's also strange that input_buf isn't handled in the input_clear
function along with iterm_buf and param_buf, so I wrote this patch to
do it that way. The functions that previously set input_len to 0 could
simply be replaced with input_clear, but in the interest of keeping
the debug messages I just made those functions call input_clear.
-Kevin
diff --git a/input.c b/input.c
index 628646b..5da8b6d 100644
--- a/input.c
+++ b/input.c
@@ -812,6 +812,9 @@ input_clear(struct input_ctx *ictx)
*ictx->param_buf = '\0';
ictx->param_len = 0;
+ *ictx->input_buf = '\0';
+ ictx->input_len = 0;
+
ictx->flags &= ~INPUT_DISCARD;
}
@@ -1377,7 +1380,7 @@ input_enter_dcs(struct input_ctx *ictx)
{
log_debug("%s", __func__);
- ictx->input_len = 0;
+ input_clear(ictx);
}
/* DCS terminator (ST) received. */
@@ -1393,7 +1396,7 @@ input_enter_osc(struct input_ctx *ictx)
{
log_debug("%s", __func__);
- ictx->input_len = 0;
+ input_clear(ictx);
}
/* OSC terminator (ST) received. */
@@ -1419,7 +1422,7 @@ input_enter_apc(struct input_ctx *ictx)
{
log_debug("%s", __func__);
- ictx->input_len = 0;
+ input_clear(ictx);
}
/* APC terminator (ST) received. */
@@ -1440,7 +1443,7 @@ input_enter_rename(struct input_ctx *ictx)
{
log_debug("%s", __func__);
- ictx->input_len = 0;
+ input_clear(ictx);
}
/* Rename terminator (ST) received. */
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users