diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2014-05-09 14:37:23 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2014-05-09 14:37:23 -0700 |
commit | fa68c2619fe844395287c33c9109f6decb322410 (patch) | |
tree | eff672bd30febc2f39319201e7d1db87c3d4f600 /screen.cpp | |
parent | 7f2c4cbf8a1c961b06c3801ce00a9233fb78d2d1 (diff) |
Use parm_left_cursor and parm_right_cursor for bulk cursor motions.
Fixes #1448
Diffstat (limited to 'screen.cpp')
-rw-r--r-- | screen.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -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); + } } |