Mercurial > vim
comparison src/autocmd.c @ 16778:eda4d65f232c v8.1.1391
patch 8.1.1391: no popup window support
commit https://github.com/vim/vim/commit/4d784b21d14fc66e98a2b07f70343cdd4acd62aa
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 25 19:51:39 2019 +0200
patch 8.1.1391: no popup window support
Problem: No popup window support.
Solution: Add initial code for popup windows. Add the 'wincolor' option.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 25 May 2019 20:00:08 +0200 |
parents | ef00b6bc186b |
children | ce04ebdf26b8 |
comparison
equal
deleted
inserted
replaced
16777:20d51e99dd6a | 16778:eda4d65f232c |
---|---|
1347 * gives problems when the autocommands make changes to the list of | 1347 * gives problems when the autocommands make changes to the list of |
1348 * buffers or windows... | 1348 * buffers or windows... |
1349 */ | 1349 */ |
1350 FOR_ALL_BUFFERS(buf) | 1350 FOR_ALL_BUFFERS(buf) |
1351 { | 1351 { |
1352 if (buf->b_ml.ml_mfp != NULL) | 1352 if (buf->b_ml.ml_mfp != NULL && !bt_popup(buf)) |
1353 { | 1353 { |
1354 // find a window for this buffer and save some values | 1354 // find a window for this buffer and save some values |
1355 aucmd_prepbuf(&aco, buf); | 1355 aucmd_prepbuf(&aco, buf); |
1356 set_bufref(&bufref, buf); | 1356 set_bufref(&bufref, buf); |
1357 | 1357 |
1421 | 1421 |
1422 // Allocate "aucmd_win" when needed. If this fails (out of memory) fall | 1422 // Allocate "aucmd_win" when needed. If this fails (out of memory) fall |
1423 // back to using the current window. | 1423 // back to using the current window. |
1424 if (win == NULL && aucmd_win == NULL) | 1424 if (win == NULL && aucmd_win == NULL) |
1425 { | 1425 { |
1426 win_alloc_aucmd_win(); | 1426 aucmd_win = win_alloc_popup_win(); |
1427 if (aucmd_win == NULL) | 1427 if (aucmd_win == NULL) |
1428 win = curwin; | 1428 win = curwin; |
1429 } | 1429 } |
1430 if (win == NULL && aucmd_win_used) | 1430 if (win == NULL && aucmd_win_used) |
1431 // Strange recursive autocommand, fall back to using the current | 1431 // Strange recursive autocommand, fall back to using the current |
1449 // effects, insert it in the current tab page. | 1449 // effects, insert it in the current tab page. |
1450 // Anything related to a window (e.g., setting folds) may have | 1450 // Anything related to a window (e.g., setting folds) may have |
1451 // unexpected results. | 1451 // unexpected results. |
1452 aco->use_aucmd_win = TRUE; | 1452 aco->use_aucmd_win = TRUE; |
1453 aucmd_win_used = TRUE; | 1453 aucmd_win_used = TRUE; |
1454 aucmd_win->w_buffer = buf; | 1454 |
1455 #if defined(FEAT_SYN_HL) || defined(FEAT_SPELL) | 1455 win_init_popup_win(aucmd_win, buf); |
1456 aucmd_win->w_s = &buf->b_s; | 1456 |
1457 #endif | |
1458 ++buf->b_nwindows; | |
1459 win_init_empty(aucmd_win); // set cursor and topline to safe values | |
1460 | |
1461 // Make sure w_localdir and globaldir are NULL to avoid a chdir() in | |
1462 // win_enter_ext(). | |
1463 VIM_CLEAR(aucmd_win->w_localdir); | |
1464 aco->globaldir = globaldir; | 1457 aco->globaldir = globaldir; |
1465 globaldir = NULL; | 1458 globaldir = NULL; |
1466 | |
1467 | 1459 |
1468 // Split the current window, put the aucmd_win in the upper half. | 1460 // Split the current window, put the aucmd_win in the upper half. |
1469 // We don't want the BufEnter or WinEnter autocommands. | 1461 // We don't want the BufEnter or WinEnter autocommands. |
1470 block_autocmds(); | 1462 block_autocmds(); |
1471 make_snapshot(SNAP_AUCMD_IDX); | 1463 make_snapshot(SNAP_AUCMD_IDX); |
1618 char_u *fname, // NULL or empty means use actual file name | 1610 char_u *fname, // NULL or empty means use actual file name |
1619 char_u *fname_io, // fname to use for <afile> on cmdline | 1611 char_u *fname_io, // fname to use for <afile> on cmdline |
1620 int force, // when TRUE, ignore autocmd_busy | 1612 int force, // when TRUE, ignore autocmd_busy |
1621 buf_T *buf) // buffer for <abuf> | 1613 buf_T *buf) // buffer for <abuf> |
1622 { | 1614 { |
1615 if (bt_popup(buf)) | |
1616 return FALSE; | |
1623 return apply_autocmds_group(event, fname, fname_io, force, | 1617 return apply_autocmds_group(event, fname, fname_io, force, |
1624 AUGROUP_ALL, buf, NULL); | 1618 AUGROUP_ALL, buf, NULL); |
1625 } | 1619 } |
1626 | 1620 |
1627 /* | 1621 /* |