Mercurial > vim
comparison src/evalfunc.c @ 16241:c1698187c482 v8.1.1125
patch 8.1.1125: libvterm does not handle the window position report
commit https://github.com/vim/vim/commit/fa1e90cd4d1bebd66da22df4625f70963f091f17
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 6 17:47:40 2019 +0200
patch 8.1.1125: libvterm does not handle the window position report
Problem: Libvterm does not handle the window position report.
Solution: Let libvterm call the fallback CSI handler when not handling CSI
sequence. Handle the window position report in Vim.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 06 Apr 2019 18:00:05 +0200 |
parents | 219c58b3879c |
children | 8e168aa08310 |
comparison
equal
deleted
inserted
replaced
16240:96666592655f | 16241:c1698187c482 |
---|---|
5983 int x = -1; | 5983 int x = -1; |
5984 int y = -1; | 5984 int y = -1; |
5985 | 5985 |
5986 if (rettv_list_alloc(rettv) == FAIL) | 5986 if (rettv_list_alloc(rettv) == FAIL) |
5987 return; | 5987 return; |
5988 #ifdef FEAT_GUI | 5988 #if defined(FEAT_GUI) || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) |
5989 if (gui.in_use) | |
5990 (void)gui_mch_get_winpos(&x, &y); | |
5991 # if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE) | |
5992 else | |
5993 # endif | |
5994 #endif | |
5995 #if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE) | |
5996 { | 5989 { |
5997 varnumber_T timeout = 100; | 5990 varnumber_T timeout = 100; |
5998 | 5991 |
5999 if (argvars[0].v_type != VAR_UNKNOWN) | 5992 if (argvars[0].v_type != VAR_UNKNOWN) |
6000 timeout = tv_get_number(&argvars[0]); | 5993 timeout = tv_get_number(&argvars[0]); |
6001 term_get_winpos(&x, &y, timeout); | 5994 |
5995 (void)ui_get_winpos(&x, &y, timeout); | |
6002 } | 5996 } |
6003 #endif | 5997 #endif |
6004 list_append_number(rettv->vval.v_list, (varnumber_T)x); | 5998 list_append_number(rettv->vval.v_list, (varnumber_T)x); |
6005 list_append_number(rettv->vval.v_list, (varnumber_T)y); | 5999 list_append_number(rettv->vval.v_list, (varnumber_T)y); |
6006 } | 6000 } |
6011 */ | 6005 */ |
6012 static void | 6006 static void |
6013 f_getwinposx(typval_T *argvars UNUSED, typval_T *rettv) | 6007 f_getwinposx(typval_T *argvars UNUSED, typval_T *rettv) |
6014 { | 6008 { |
6015 rettv->vval.v_number = -1; | 6009 rettv->vval.v_number = -1; |
6016 #ifdef FEAT_GUI | 6010 #if defined(FEAT_GUI) || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) |
6017 if (gui.in_use) | |
6018 { | 6011 { |
6019 int x, y; | 6012 int x, y; |
6020 | 6013 |
6021 if (gui_mch_get_winpos(&x, &y) == OK) | 6014 if (ui_get_winpos(&x, &y, 100) == OK) |
6022 rettv->vval.v_number = x; | 6015 rettv->vval.v_number = x; |
6023 return; | 6016 } |
6024 } | 6017 #endif |
6025 #endif | 6018 } |
6026 #if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE) | 6019 |
6020 /* | |
6021 * "getwinposy()" function | |
6022 */ | |
6023 static void | |
6024 f_getwinposy(typval_T *argvars UNUSED, typval_T *rettv) | |
6025 { | |
6026 rettv->vval.v_number = -1; | |
6027 #if defined(FEAT_GUI) || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) | |
6027 { | 6028 { |
6028 int x, y; | 6029 int x, y; |
6029 | 6030 |
6030 if (term_get_winpos(&x, &y, (varnumber_T)100) == OK) | 6031 if (ui_get_winpos(&x, &y, 100) == OK) |
6031 rettv->vval.v_number = x; | |
6032 } | |
6033 #endif | |
6034 } | |
6035 | |
6036 /* | |
6037 * "getwinposy()" function | |
6038 */ | |
6039 static void | |
6040 f_getwinposy(typval_T *argvars UNUSED, typval_T *rettv) | |
6041 { | |
6042 rettv->vval.v_number = -1; | |
6043 #ifdef FEAT_GUI | |
6044 if (gui.in_use) | |
6045 { | |
6046 int x, y; | |
6047 | |
6048 if (gui_mch_get_winpos(&x, &y) == OK) | |
6049 rettv->vval.v_number = y; | |
6050 return; | |
6051 } | |
6052 #endif | |
6053 #if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE) | |
6054 { | |
6055 int x, y; | |
6056 | |
6057 if (term_get_winpos(&x, &y, (varnumber_T)100) == OK) | |
6058 rettv->vval.v_number = y; | 6032 rettv->vval.v_number = y; |
6059 } | 6033 } |
6060 #endif | 6034 #endif |
6061 } | 6035 } |
6062 | 6036 |