Mercurial > vim
comparison src/buffer.c @ 22699:e82579016863 v8.2.1898
patch 8.2.1898: command modifier parsing always uses global cmdmod
Commit: https://github.com/vim/vim/commit/e10044015841711b989f9a898d427bcc1fdb4c32
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 24 20:49:43 2020 +0200
patch 8.2.1898: command modifier parsing always uses global cmdmod
Problem: Command modifier parsing always uses global cmdmod.
Solution: Pass in cmdmod_T to use. Rename struct fields consistently.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 24 Oct 2020 21:00:05 +0200 |
parents | a422bd80b434 |
children | 92f221ad267c |
comparison
equal
deleted
inserted
replaced
22698:28523bc9ee71 | 22699:e82579016863 |
---|---|
1442 return FAIL; | 1442 return FAIL; |
1443 | 1443 |
1444 if (!forceit && bufIsChanged(buf)) | 1444 if (!forceit && bufIsChanged(buf)) |
1445 { | 1445 { |
1446 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) | 1446 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) |
1447 if ((p_confirm || cmdmod.confirm) && p_write) | 1447 if ((p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)) && p_write) |
1448 { | 1448 { |
1449 dialog_changed(buf, FALSE); | 1449 dialog_changed(buf, FALSE); |
1450 if (!bufref_valid(&bufref)) | 1450 if (!bufref_valid(&bufref)) |
1451 // Autocommand deleted buffer, oops! It's not changed | 1451 // Autocommand deleted buffer, oops! It's not changed |
1452 // now. | 1452 // now. |
1632 * Check if the current buffer may be abandoned. | 1632 * Check if the current buffer may be abandoned. |
1633 */ | 1633 */ |
1634 if (action == DOBUF_GOTO && !can_abandon(curbuf, forceit)) | 1634 if (action == DOBUF_GOTO && !can_abandon(curbuf, forceit)) |
1635 { | 1635 { |
1636 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) | 1636 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) |
1637 if ((p_confirm || cmdmod.confirm) && p_write) | 1637 if ((p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)) && p_write) |
1638 { | 1638 { |
1639 bufref_T bufref; | 1639 bufref_T bufref; |
1640 | 1640 |
1641 set_bufref(&bufref, buf); | 1641 set_bufref(&bufref, buf); |
1642 dialog_changed(curbuf, FALSE); | 1642 dialog_changed(curbuf, FALSE); |
1687 #endif | 1687 #endif |
1688 bufref_T newbufref; | 1688 bufref_T newbufref; |
1689 bufref_T prevbufref; | 1689 bufref_T prevbufref; |
1690 | 1690 |
1691 setpcmark(); | 1691 setpcmark(); |
1692 if (!cmdmod.keepalt) | 1692 if ((cmdmod.cmod_flags & CMOD_KEEPALT) == 0) |
1693 curwin->w_alt_fnum = curbuf->b_fnum; // remember alternate file | 1693 curwin->w_alt_fnum = curbuf->b_fnum; // remember alternate file |
1694 buflist_altfpos(curwin); // remember curpos | 1694 buflist_altfpos(curwin); // remember curpos |
1695 | 1695 |
1696 // Don't restart Select mode after switching to another buffer. | 1696 // Don't restart Select mode after switching to another buffer. |
1697 VIsual_reselect = FALSE; | 1697 VIsual_reselect = FALSE; |
3433 { | 3433 { |
3434 buf_T *buf; | 3434 buf_T *buf; |
3435 | 3435 |
3436 // Create a buffer. 'buflisted' is not set if it's a new buffer | 3436 // Create a buffer. 'buflisted' is not set if it's a new buffer |
3437 buf = buflist_new(ffname, sfname, lnum, 0); | 3437 buf = buflist_new(ffname, sfname, lnum, 0); |
3438 if (buf != NULL && !cmdmod.keepalt) | 3438 if (buf != NULL && (cmdmod.cmod_flags & CMOD_KEEPALT) == 0) |
3439 curwin->w_alt_fnum = buf->b_fnum; | 3439 curwin->w_alt_fnum = buf->b_fnum; |
3440 return buf; | 3440 return buf; |
3441 } | 3441 } |
3442 | 3442 |
3443 /* | 3443 /* |
5066 int p_ea_save; | 5066 int p_ea_save; |
5067 int open_wins = 0; | 5067 int open_wins = 0; |
5068 int r; | 5068 int r; |
5069 int count; // Maximum number of windows to open. | 5069 int count; // Maximum number of windows to open. |
5070 int all; // When TRUE also load inactive buffers. | 5070 int all; // When TRUE also load inactive buffers. |
5071 int had_tab = cmdmod.tab; | 5071 int had_tab = cmdmod.cmod_tab; |
5072 tabpage_T *tpnext; | 5072 tabpage_T *tpnext; |
5073 | 5073 |
5074 if (eap->addr_count == 0) // make as many windows as possible | 5074 if (eap->addr_count == 0) // make as many windows as possible |
5075 count = 9999; | 5075 count = 9999; |
5076 else | 5076 else |
5097 tpnext = curtab->tp_next; | 5097 tpnext = curtab->tp_next; |
5098 for (wp = firstwin; wp != NULL; wp = wpnext) | 5098 for (wp = firstwin; wp != NULL; wp = wpnext) |
5099 { | 5099 { |
5100 wpnext = wp->w_next; | 5100 wpnext = wp->w_next; |
5101 if ((wp->w_buffer->b_nwindows > 1 | 5101 if ((wp->w_buffer->b_nwindows > 1 |
5102 || ((cmdmod.split & WSP_VERT) | 5102 || ((cmdmod.cmod_split & WSP_VERT) |
5103 ? wp->w_height + wp->w_status_height < Rows - p_ch | 5103 ? wp->w_height + wp->w_status_height < Rows - p_ch |
5104 - tabline_height() | 5104 - tabline_height() |
5105 : wp->w_width != Columns) | 5105 : wp->w_width != Columns) |
5106 || (had_tab > 0 && wp != firstwin)) && !ONE_WINDOW | 5106 || (had_tab > 0 && wp != firstwin)) && !ONE_WINDOW |
5107 && !(wp->w_closing || wp->w_buffer->b_locked > 0)) | 5107 && !(wp->w_closing || wp->w_buffer->b_locked > 0)) |
5218 if (aborting()) | 5218 if (aborting()) |
5219 break; | 5219 break; |
5220 #endif | 5220 #endif |
5221 // When ":tab" was used open a new tab for a new window repeatedly. | 5221 // When ":tab" was used open a new tab for a new window repeatedly. |
5222 if (had_tab > 0 && tabpage_index(NULL) <= p_tpm) | 5222 if (had_tab > 0 && tabpage_index(NULL) <= p_tpm) |
5223 cmdmod.tab = 9999; | 5223 cmdmod.cmod_tab = 9999; |
5224 } | 5224 } |
5225 --autocmd_no_enter; | 5225 --autocmd_no_enter; |
5226 win_enter(firstwin, FALSE); // back to first window | 5226 win_enter(firstwin, FALSE); // back to first window |
5227 --autocmd_no_leave; | 5227 --autocmd_no_leave; |
5228 | 5228 |
5545 case 'u': // "unload" | 5545 case 'u': // "unload" |
5546 case 'w': // "wipe" | 5546 case 'w': // "wipe" |
5547 case 'd': return FALSE; // "delete" | 5547 case 'd': return FALSE; // "delete" |
5548 case 'h': return TRUE; // "hide" | 5548 case 'h': return TRUE; // "hide" |
5549 } | 5549 } |
5550 return (p_hid || cmdmod.hide); | 5550 return (p_hid || (cmdmod.cmod_flags & CMOD_HIDE)); |
5551 } | 5551 } |
5552 | 5552 |
5553 /* | 5553 /* |
5554 * Return special buffer name. | 5554 * Return special buffer name. |
5555 * Returns NULL when the buffer has a normal file name. | 5555 * Returns NULL when the buffer has a normal file name. |