Skip to content

Commit fd3f27b

Browse files
committed
refactor: merge bufIsChangedNotTerm into bufIsChanged
... As the latter just calls the former.
1 parent c6ee366 commit fd3f27b

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

src/ex_cmds.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,13 +1563,8 @@ void do_shell(
15631563
msg_putchar('\n'); // may shift screen one line up
15641564

15651565
// warning message before calling the shell
1566-
if (p_warn && !autocmd_busy && msg_silent == 0)
1567-
FOR_ALL_BUFFERS(buf)
1568-
if (bufIsChangedNotTerm(buf))
1569-
{
1566+
if (p_warn && !autocmd_busy && msg_silent == 0 && anyBufIsChanged())
15701567
msg_puts(_("[No write since last change]\n"));
1571-
break;
1572-
}
15731568

15741569
// This windgoto is required for when the '\n' resulted in a "delete line
15751570
// 1" command to the terminal.

src/proto/undo.pro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ void u_undoline(void);
2626
void u_blockfree(buf_T *buf);
2727
int bufIsChanged(buf_T *buf);
2828
int anyBufIsChanged(void);
29-
int bufIsChangedNotTerm(buf_T *buf);
3029
int curbufIsChanged(void);
3130
void u_eval_tree(u_header_T *first_uhp, list_T *list);
3231
/* vim: set ft=c : */

src/undo.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3148,13 +3148,13 @@ void u_blockfree(buf_T *buf)
31483148
* Check if the 'modified' flag is set, or 'ff' has changed (only need to
31493149
* check the first character, because it can only be "dos", "unix" or "mac").
31503150
* "nofile" and "scratch" type buffers are considered to always be unchanged.
3151-
* Also considers a buffer changed when a terminal window contains a running
3152-
* job.
31533151
*/
31543152
int bufIsChanged(buf_T *buf)
31553153
{
31563154

3157-
return bufIsChangedNotTerm(buf);
3155+
// In a "prompt" buffer we do respect 'modified', so that we can control
3156+
// closing the window by setting or resetting that option.
3157+
return (!bt_dontwrite(buf) || bt_prompt(buf)) && (buf->b_changed || file_ff_differs(buf, TRUE));
31583158
}
31593159

31603160
/*
@@ -3170,16 +3170,6 @@ int anyBufIsChanged(void)
31703170
return FALSE;
31713171
}
31723172

3173-
/*
3174-
* Like bufIsChanged() but ignoring a terminal window.
3175-
*/
3176-
int bufIsChangedNotTerm(buf_T *buf)
3177-
{
3178-
// In a "prompt" buffer we do respect 'modified', so that we can control
3179-
// closing the window by setting or resetting that option.
3180-
return (!bt_dontwrite(buf) || bt_prompt(buf)) && (buf->b_changed || file_ff_differs(buf, TRUE));
3181-
}
3182-
31833173
int curbufIsChanged(void)
31843174
{
31853175
return bufIsChanged(curbuf);

0 commit comments

Comments
 (0)