tcd: Use user-provided tab page for getcwd()/haslocaldir()

The initial implementation for `:tcd` always used `curtab` to find the
specified window.  This would result in either inaccurate information or
an unexpected error (e.g., when there are more windows in the
user-specified tab page vs. the current tab page).
This commit is contained in:
James McCoy
2016-06-01 01:01:51 -04:00
parent a3f11ad27a
commit f735ee90c2

View File

@@ -9954,7 +9954,7 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv)
} }
if (scope_number[kCdScopeWindow] > 0) { if (scope_number[kCdScopeWindow] > 0) {
win = find_win_by_nr(&argvars[0], curtab); win = find_win_by_nr(&argvars[0], tp);
if (!win) { if (!win) {
EMSG(_("E5002: Cannot find window number.")); EMSG(_("E5002: Cannot find window number."));
return; return;
@@ -10897,7 +10897,7 @@ static void f_haslocaldir(typval_T *argvars, typval_T *rettv)
} }
if (scope_number[kCdScopeWindow] > 0) { if (scope_number[kCdScopeWindow] > 0) {
win = find_win_by_nr(&argvars[0], curtab); win = find_win_by_nr(&argvars[0], tp);
if (!win) { if (!win) {
EMSG(_("E5002: Cannot find window number.")); EMSG(_("E5002: Cannot find window number."));
return; return;