patch 8.0.1563: timeout of getwinposx() can be too short
Problem: Timeout of getwinposx() can be too short. (lilydjwg)
Solution: Add getwinpos(). (closes #2689)
diff --git a/src/term.c b/src/term.c
index 12c4f2e..7dbbefa 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2789,7 +2789,7 @@
* Returns OK or FAIL.
*/
int
-term_get_winpos(int *x, int *y)
+term_get_winpos(int *x, int *y, varnumber_T timeout)
{
int count = 0;
@@ -2801,8 +2801,8 @@
OUT_STR(T_CGP);
out_flush();
- /* Try reading the result for 100 msec. */
- while (count++ < 10)
+ /* Try reading the result for "timeout" msec. */
+ while (count++ < timeout / 10)
{
(void)vpeekc_nomap();
if (winpos_x >= 0 && winpos_y >= 0)