@@ -300,7 +300,7 @@ void do_window(int nchar, long Prenum, int xchar)
300
300
301
301
// move window to new tab page
302
302
case 'T':
303
-
if (one_window()) {
303
+
if (one_window(curwin)) {
304
304
msg(_(m_onlyone));
305
305
} else {
306
306
tabpage_T *oldtab = curtab;
@@ -2401,23 +2401,24 @@ void close_windows(buf_T *buf, int keep_curwin)
2401
2401
}
2402
2402
}
2403
2403
2404
-
/// Check that current window is the last one.
2404
+
/// Check that the specified window is the last one.
2405
+
/// @param win counted even if floating
2405
2406
///
2406
-
/// @return true if the current window is the only window that exists, false if
2407
-
/// there is another, possibly in another tab page.
2408
-
static bool last_window(void) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
2407
+
/// @return true if the specified window is the only window that exists,
2408
+
/// false if there is another, possibly in another tab page.
2409
+
static bool last_window(win_T *win) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
2409
2410
{
2410
-
return one_window() && first_tabpage->tp_next == NULL;
2411
+
return one_window(win) && first_tabpage->tp_next == NULL;
2411
2412
}
2412
2413
2413
-
/// Check that current tab page contains no more then one window other than
2414
-
/// "aucmd_win". Only counts floating window if it is current.
2415
-
bool one_window(void) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
2414
+
/// Check that current tab page contains no more then one window other than `aucmd_win`.
2415
+
/// @param counted_float counted even if floating, but not if it is `aucmd_win`
2416
+
bool one_window(win_T *counted_float) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
2416
2417
{
2417
2418
bool seen_one = false;
2418
2419
2419
2420
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
2420
-
if (wp != aucmd_win && (!wp->w_floating || wp == curwin)) {
2421
+
if (wp != aucmd_win && (!wp->w_floating || wp == counted_float)) {
2421
2422
if (seen_one) {
2422
2423
return false;
2423
2424
}
@@ -2532,7 +2533,7 @@ int win_close(win_T *win, bool free_buf, bool force)
2532
2533
frame_T *win_frame = win->w_floating ? NULL : win->w_frame->fr_parent;
2533
2534
const bool had_diffmode = win->w_p_diff;
2534
2535
2535
-
if (last_window() && !win->w_floating) {
2536
+
if (last_window(win)) {
2536
2537
emsg(_("E444: Cannot close last window"));
2537
2538
return FAIL;
2538
2539
}
@@ -2545,7 +2546,7 @@ int win_close(win_T *win, bool free_buf, bool force)
2545
2546
emsg(_(e_autocmd_close));
2546
2547
return FAIL;
2547
2548
}
2548
-
if (lastwin == aucmd_win && one_window()) {
2549
+
if (lastwin == aucmd_win && one_window(win)) {
2549
2550
emsg(_("E814: Cannot close window, only autocmd window would remain"));
2550
2551
return FAIL;
2551
2552
}
@@ -2607,7 +2608,7 @@ int win_close(win_T *win, bool free_buf, bool force)
2607
2608
return FAIL;
2608
2609
}
2609
2610
win->w_closing = false;
2610
-
if (last_window()) {
2611
+
if (last_window(win)) {
2611
2612
return FAIL;
2612
2613
}
2613
2614
}
@@ -2617,7 +2618,7 @@ int win_close(win_T *win, bool free_buf, bool force)
2617
2618
return FAIL;
2618
2619
}
2619
2620
win->w_closing = false;
2620
-
if (last_window()) {
2621
+
if (last_window(win)) {
2621
2622
return FAIL;
2622
2623
}
2623
2624
// autocmds may abort script processing
@@ -2686,7 +2687,7 @@ int win_close(win_T *win, bool free_buf, bool force)
2686
2687
}
2687
2688
2688
2689
if (only_one_window() && win_valid(win) && win->w_buffer == NULL
2689
-
&& (last_window() || curtab != prev_curtab
2690
+
&& (last_window(win) || curtab != prev_curtab
2690
2691
|| close_last_window_tabpage(win, free_buf, prev_curtab))
2691
2692
&& !win->w_floating) {
2692
2693
// Autocommands have closed all windows, quit now. Restore
@@ -2706,7 +2707,7 @@ int win_close(win_T *win, bool free_buf, bool force)
2706
2707
2707
2708
// Autocommands may have closed the window already, or closed the only
2708
2709
// other window or moved to another tab page.
2709
-
if (!win_valid(win) || (!win->w_floating && last_window())
2710
+
if (!win_valid(win) || (!win->w_floating && last_window(win))
2710
2711
|| close_last_window_tabpage(win, free_buf, prev_curtab)) {
2711
2712
return FAIL;
2712
2713
}
@@ -3745,7 +3746,7 @@ void close_others(int message, int forceit)
3745
3746
return;
3746
3747
}
3747
3748
3748
-
if (one_window() && !lastwin->w_floating) {
3749
+
if (one_nonfloat() && !lastwin->w_floating) {
3749
3750
if (message
3750
3751
&& !autocmd_busy) {
3751
3752
msg(_(m_onlyone));
@@ -6500,7 +6501,7 @@ char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u
6500
6501
void last_status(bool morewin)
6501
6502
{
6502
6503
// Don't make a difference between horizontal or vertical split.
6503
-
last_status_rec(topframe, (p_ls == 2 || (p_ls == 1 && (morewin || !one_window()))),
6504
+
last_status_rec(topframe, (p_ls == 2 || (p_ls == 1 && (morewin || !one_window(curwin)))),
6504
6505
global_stl_height() > 0);
6505
6506
}
6506
6507
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4