aboutsummaryrefslogtreecommitdiffhomepage
path: root/screen.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-05-09 14:37:23 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-05-09 14:37:23 -0700
commitfa68c2619fe844395287c33c9109f6decb322410 (patch)
treeeff672bd30febc2f39319201e7d1db87c3d4f600 /screen.cpp
parent7f2c4cbf8a1c961b06c3801ce00a9233fb78d2d1 (diff)
Use parm_left_cursor and parm_right_cursor for bulk cursor motions.
Fixes #1448
Diffstat (limited to 'screen.cpp')
-rw-r--r--screen.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/screen.cpp b/screen.cpp
index 2fd7cc96..96fe0f2a 100644
--- a/screen.cpp
+++ b/screen.cpp
@@ -638,18 +638,32 @@ static void s_move(screen_t *s, data_buffer_t *b, int new_x, int new_y)
x_steps = 0;
}
+ char *multi_str = NULL;
if (x_steps < 0)
{
str = cursor_left;
+ multi_str = parm_left_cursor;
}
else
{
str = cursor_right;
+ multi_str = parm_right_cursor;
}
-
- for (i=0; i<abs(x_steps); i++)
+
+ // Use the bulk ('multi') output for cursor movement if it is supported and it would be shorter
+ // Note that this is required to avoid some visual glitches in iTerm (#1448)
+ bool use_multi = (multi_str != NULL && multi_str[0] != '\0' && abs(x_steps) * strlen(str) > strlen(multi_str));
+ if (use_multi)
{
- writembs(str);
+ char *multi_param = tparm(multi_str, abs(x_steps));
+ writembs(multi_param);
+ }
+ else
+ {
+ for (i=0; i<abs(x_steps); i++)
+ {
+ writembs(str);
+ }
}