Mercurial > vim
comparison src/buffer.c @ 17095:10e0d7d96cb0 v8.1.1547
patch 8.1.1547: functionality of bt_nofile() is confusing
commit https://github.com/vim/vim/commit/26910de8b0da6abab87bd5a397330f9cbe483309
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 15 19:37:15 2019 +0200
patch 8.1.1547: functionality of bt_nofile() is confusing
Problem: Functionality of bt_nofile() is confusing.
Solution: Split into bt_nofile() and bt_nofilename().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 15 Jun 2019 19:45:06 +0200 |
parents | d5e1e09a829f |
children | ebe9aab81898 |
comparison
equal
deleted
inserted
replaced
17094:8ca56a5c3141 | 17095:10e0d7d96cb0 |
---|---|
5696 /* | 5696 /* |
5697 * Return TRUE if "buf" is a "nofile", "acwrite", "terminal" or "prompt" | 5697 * Return TRUE if "buf" is a "nofile", "acwrite", "terminal" or "prompt" |
5698 * buffer. This means the buffer name is not a file name. | 5698 * buffer. This means the buffer name is not a file name. |
5699 */ | 5699 */ |
5700 int | 5700 int |
5701 bt_nofile(buf_T *buf) | 5701 bt_nofilename(buf_T *buf) |
5702 { | 5702 { |
5703 return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f') | 5703 return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f') |
5704 || buf->b_p_bt[0] == 'a' | 5704 || buf->b_p_bt[0] == 'a' |
5705 || buf->b_p_bt[0] == 't' | 5705 || buf->b_p_bt[0] == 't' |
5706 || buf->b_p_bt[0] == 'p'); | 5706 || buf->b_p_bt[0] == 'p'); |
5707 } | |
5708 | |
5709 /* | |
5710 * Return TRUE if "buf" has 'buftype' set to "nofile". | |
5711 */ | |
5712 int | |
5713 bt_nofile(buf_T *buf) | |
5714 { | |
5715 return buf != NULL && buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f'; | |
5707 } | 5716 } |
5708 | 5717 |
5709 /* | 5718 /* |
5710 * Return TRUE if "buf" is a "nowrite", "nofile", "terminal" or "prompt" | 5719 * Return TRUE if "buf" is a "nowrite", "nofile", "terminal" or "prompt" |
5711 * buffer. | 5720 * buffer. |
5770 } | 5779 } |
5771 #endif | 5780 #endif |
5772 | 5781 |
5773 /* There is no _file_ when 'buftype' is "nofile", b_sfname | 5782 /* There is no _file_ when 'buftype' is "nofile", b_sfname |
5774 * contains the name as specified by the user. */ | 5783 * contains the name as specified by the user. */ |
5775 if (bt_nofile(buf)) | 5784 if (bt_nofilename(buf)) |
5776 { | 5785 { |
5777 #ifdef FEAT_TERMINAL | 5786 #ifdef FEAT_TERMINAL |
5778 if (buf->b_term != NULL) | 5787 if (buf->b_term != NULL) |
5779 return term_get_status_text(buf->b_term); | 5788 return term_get_status_text(buf->b_term); |
5780 #endif | 5789 #endif |