2016-08-29 22:49:24 +02:00
|
|
|
/* vi:set ts=8 sts=4 sw=4 noet:
|
2004-06-13 20:20:40 +00:00
|
|
|
*
|
|
|
|
* VIM - Vi IMproved by Bram Moolenaar
|
|
|
|
*
|
|
|
|
* Do ":help uganda" in Vim to read copying and usage conditions.
|
|
|
|
* Do ":help credits" in Vim to see a list of people who contributed.
|
|
|
|
* See README.txt for an overview of the Vim source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "vim.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred)
|
|
|
|
* It has been changed beyond recognition since then.
|
|
|
|
*
|
2022-06-23 20:46:27 +01:00
|
|
|
* Differences between version 8.2 and 9.0 can be found with ":help version9".
|
2016-09-12 16:23:34 +02:00
|
|
|
* Differences between version 7.4 and 8.x can be found with ":help version8".
|
|
|
|
* Differences between version 6.4 and 7.x can be found with ":help version7".
|
|
|
|
* Differences between version 5.8 and 6.x can be found with ":help version6".
|
2004-06-13 20:20:40 +00:00
|
|
|
* Differences between version 4.x and 5.x can be found with ":help version5".
|
|
|
|
* Differences between version 3.0 and 4.x can be found with ":help version4".
|
|
|
|
* All the remarks about older versions have been removed, they are not very
|
|
|
|
* interesting.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "version.h"
|
|
|
|
|
2005-06-30 22:04:15 +00:00
|
|
|
char *Version = VIM_VERSION_SHORT;
|
|
|
|
static char *mediumVersion = VIM_VERSION_MEDIUM;
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
#if defined(HAVE_DATE_TIME) || defined(PROTO)
|
|
|
|
# if (defined(VMS) && defined(VAXC)) || defined(PROTO)
|
|
|
|
char longVersion[sizeof(VIM_VERSION_LONG_DATE) + sizeof(__DATE__)
|
|
|
|
+ sizeof(__TIME__) + 3];
|
2013-02-20 16:47:36 +01:00
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
void
|
2018-06-23 16:12:21 +02:00
|
|
|
init_longVersion(void)
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Construct the long version string. Necessary because
|
2019-03-02 10:13:42 +01:00
|
|
|
* VAX C can't concatenate strings in the preprocessor.
|
2004-06-13 20:20:40 +00:00
|
|
|
*/
|
|
|
|
strcpy(longVersion, VIM_VERSION_LONG_DATE);
|
2020-06-05 23:16:29 +02:00
|
|
|
#ifdef BUILD_DATE
|
|
|
|
strcat(longVersion, BUILD_DATE);
|
|
|
|
#else
|
2004-06-13 20:20:40 +00:00
|
|
|
strcat(longVersion, __DATE__);
|
|
|
|
strcat(longVersion, " ");
|
|
|
|
strcat(longVersion, __TIME__);
|
2020-06-05 23:16:29 +02:00
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
strcat(longVersion, ")");
|
|
|
|
}
|
2018-06-23 16:12:21 +02:00
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
# else
|
2021-09-17 20:45:30 +02:00
|
|
|
char *longVersion = NULL;
|
|
|
|
|
2018-06-23 16:12:21 +02:00
|
|
|
void
|
|
|
|
init_longVersion(void)
|
|
|
|
{
|
2023-01-26 12:00:00 +00:00
|
|
|
if (longVersion != NULL)
|
|
|
|
return;
|
|
|
|
|
2020-06-05 23:16:29 +02:00
|
|
|
#ifdef BUILD_DATE
|
2023-01-26 12:00:00 +00:00
|
|
|
char *date_time = BUILD_DATE;
|
2020-06-05 23:16:29 +02:00
|
|
|
#else
|
2023-01-26 12:00:00 +00:00
|
|
|
char *date_time = __DATE__ " " __TIME__;
|
2020-06-05 23:16:29 +02:00
|
|
|
#endif
|
2023-01-26 12:00:00 +00:00
|
|
|
char *msg = _("%s (%s, compiled %s)");
|
|
|
|
size_t len = strlen(msg)
|
|
|
|
+ strlen(VIM_VERSION_LONG_ONLY)
|
|
|
|
+ strlen(VIM_VERSION_DATE_ONLY)
|
|
|
|
+ strlen(date_time);
|
2020-04-13 18:25:33 +02:00
|
|
|
|
2023-01-26 12:00:00 +00:00
|
|
|
longVersion = alloc(len);
|
|
|
|
if (longVersion == NULL)
|
|
|
|
longVersion = VIM_VERSION_LONG;
|
|
|
|
else
|
|
|
|
vim_snprintf(longVersion, len, msg,
|
|
|
|
VIM_VERSION_LONG_ONLY, VIM_VERSION_DATE_ONLY, date_time);
|
2018-06-23 16:12:21 +02:00
|
|
|
}
|
2004-06-13 20:20:40 +00:00
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
char *longVersion = VIM_VERSION_LONG;
|
2018-06-24 14:44:46 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
init_longVersion(void)
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
}
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static char *(features[]) =
|
|
|
|
{
|
2013-08-30 16:35:44 +02:00
|
|
|
#ifdef HAVE_ACL
|
|
|
|
"+acl",
|
|
|
|
#else
|
|
|
|
"-acl",
|
|
|
|
#endif
|
2019-12-21 18:47:26 +01:00
|
|
|
#ifdef AMIGA // only for Amiga systems
|
2004-06-13 20:20:40 +00:00
|
|
|
# ifdef FEAT_ARP
|
|
|
|
"+ARP",
|
|
|
|
# else
|
|
|
|
"-ARP",
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_ARABIC
|
|
|
|
"+arabic",
|
|
|
|
#else
|
|
|
|
"-arabic",
|
|
|
|
#endif
|
|
|
|
"+autocmd",
|
2018-07-27 22:08:59 +02:00
|
|
|
#ifdef FEAT_AUTOCHDIR
|
|
|
|
"+autochdir",
|
|
|
|
#else
|
|
|
|
"-autochdir",
|
|
|
|
#endif
|
2017-11-12 19:21:51 +01:00
|
|
|
#ifdef FEAT_AUTOSERVERNAME
|
|
|
|
"+autoservername",
|
|
|
|
#else
|
|
|
|
"-autoservername",
|
|
|
|
#endif
|
2017-11-18 22:13:31 +01:00
|
|
|
#ifdef FEAT_BEVAL_GUI
|
2004-06-13 20:20:40 +00:00
|
|
|
"+balloon_eval",
|
|
|
|
#else
|
|
|
|
"-balloon_eval",
|
|
|
|
#endif
|
2017-11-18 22:13:31 +01:00
|
|
|
#ifdef FEAT_BEVAL_TERM
|
2017-11-18 18:52:04 +01:00
|
|
|
"+balloon_eval_term",
|
|
|
|
#else
|
|
|
|
"-balloon_eval_term",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_BROWSE
|
|
|
|
"+browse",
|
|
|
|
#else
|
|
|
|
"-browse",
|
|
|
|
#endif
|
|
|
|
"++builtin_terms",
|
|
|
|
#ifdef FEAT_BYTEOFF
|
|
|
|
"+byte_offset",
|
|
|
|
#else
|
|
|
|
"-byte_offset",
|
|
|
|
#endif
|
2016-03-11 22:52:15 +01:00
|
|
|
#ifdef FEAT_JOB_CHANNEL
|
2016-01-25 20:15:45 +01:00
|
|
|
"+channel",
|
|
|
|
#else
|
|
|
|
"-channel",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
"+cindent",
|
|
|
|
#ifdef FEAT_CLIENTSERVER
|
|
|
|
"+clientserver",
|
|
|
|
#else
|
|
|
|
"-clientserver",
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_CLIPBOARD
|
|
|
|
"+clipboard",
|
|
|
|
#else
|
|
|
|
"-clipboard",
|
|
|
|
#endif
|
|
|
|
"+cmdline_compl",
|
|
|
|
"+cmdline_hist",
|
|
|
|
"+cmdline_info",
|
|
|
|
"+comments",
|
2010-06-05 23:22:07 +02:00
|
|
|
#ifdef FEAT_CONCEAL
|
|
|
|
"+conceal",
|
|
|
|
#else
|
|
|
|
"-conceal",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_CRYPT
|
|
|
|
"+cryptv",
|
|
|
|
#else
|
|
|
|
"-cryptv",
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_CSCOPE
|
|
|
|
"+cscope",
|
|
|
|
#else
|
|
|
|
"-cscope",
|
|
|
|
#endif
|
2010-06-05 23:22:07 +02:00
|
|
|
"+cursorbind",
|
2006-01-26 22:25:15 +00:00
|
|
|
#ifdef CURSOR_SHAPE
|
|
|
|
"+cursorshape",
|
|
|
|
#else
|
|
|
|
"-cursorshape",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)
|
|
|
|
"+dialog_con_gui",
|
|
|
|
#else
|
|
|
|
# if defined(FEAT_CON_DIALOG)
|
|
|
|
"+dialog_con",
|
|
|
|
# else
|
|
|
|
# if defined(FEAT_GUI_DIALOG)
|
|
|
|
"+dialog_gui",
|
|
|
|
# else
|
|
|
|
"-dialog",
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_DIFF
|
|
|
|
"+diff",
|
|
|
|
#else
|
|
|
|
"-diff",
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_DIGRAPHS
|
|
|
|
"+digraphs",
|
|
|
|
#else
|
|
|
|
"-digraphs",
|
|
|
|
#endif
|
2019-02-17 17:44:42 +01:00
|
|
|
#ifdef FEAT_GUI_MSWIN
|
2014-08-06 14:52:30 +02:00
|
|
|
# ifdef FEAT_DIRECTX
|
|
|
|
"+directx",
|
|
|
|
# else
|
|
|
|
"-directx",
|
|
|
|
# endif
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_DND
|
|
|
|
"+dnd",
|
|
|
|
#else
|
|
|
|
"-dnd",
|
|
|
|
#endif
|
|
|
|
"-ebcdic",
|
|
|
|
#ifdef FEAT_EMACS_TAGS
|
|
|
|
"+emacs_tags",
|
|
|
|
#else
|
|
|
|
"-emacs_tags",
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_EVAL
|
|
|
|
"+eval",
|
|
|
|
#else
|
|
|
|
"-eval",
|
|
|
|
#endif
|
|
|
|
"+ex_extra",
|
|
|
|
#ifdef FEAT_SEARCH_EXTRA
|
|
|
|
"+extra_search",
|
|
|
|
#else
|
|
|
|
"-extra_search",
|
|
|
|
#endif
|
|
|
|
"-farsi",
|
|
|
|
"+file_in_path",
|
|
|
|
#ifdef FEAT_FIND_ID
|
|
|
|
"+find_in_path",
|
|
|
|
#else
|
|
|
|
"-find_in_path",
|
|
|
|
#endif
|
2008-06-24 21:56:24 +00:00
|
|
|
"+float",
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_FOLDING
|
|
|
|
"+folding",
|
|
|
|
#else
|
|
|
|
"-folding",
|
|
|
|
#endif
|
|
|
|
"-footer",
|
2022-09-04 12:29:28 +01:00
|
|
|
// only interesting on Unix systems
|
2004-06-13 20:20:40 +00:00
|
|
|
#if !defined(USE_SYSTEM) && defined(UNIX)
|
|
|
|
"+fork()",
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_GETTEXT
|
|
|
|
# ifdef DYNAMIC_GETTEXT
|
|
|
|
"+gettext/dyn",
|
|
|
|
# else
|
|
|
|
"+gettext",
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
"-gettext",
|
|
|
|
#endif
|
|
|
|
"-hangul_input",
|
|
|
|
#if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)
|
|
|
|
# ifdef DYNAMIC_ICONV
|
|
|
|
"+iconv/dyn",
|
|
|
|
# else
|
|
|
|
"+iconv",
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
"-iconv",
|
|
|
|
#endif
|
|
|
|
"+insert_expand",
|
2020-04-13 19:04:21 +02:00
|
|
|
#ifdef FEAT_IPV6
|
|
|
|
"+ipv6",
|
|
|
|
#else
|
|
|
|
"-ipv6",
|
|
|
|
#endif
|
2016-03-11 22:52:15 +01:00
|
|
|
#ifdef FEAT_JOB_CHANNEL
|
2016-02-07 14:27:38 +01:00
|
|
|
"+job",
|
|
|
|
#else
|
|
|
|
"-job",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
"+jumplist",
|
|
|
|
#ifdef FEAT_KEYMAP
|
|
|
|
"+keymap",
|
|
|
|
#else
|
|
|
|
"-keymap",
|
|
|
|
#endif
|
2016-07-29 22:50:35 +02:00
|
|
|
#ifdef FEAT_EVAL
|
|
|
|
"+lambda",
|
|
|
|
#else
|
|
|
|
"-lambda",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_LANGMAP
|
|
|
|
"+langmap",
|
|
|
|
#else
|
|
|
|
"-langmap",
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_LIBCALL
|
|
|
|
"+libcall",
|
|
|
|
#else
|
|
|
|
"-libcall",
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_LINEBREAK
|
|
|
|
"+linebreak",
|
|
|
|
#else
|
|
|
|
"-linebreak",
|
|
|
|
#endif
|
|
|
|
"+lispindent",
|
|
|
|
"+listcmds",
|
|
|
|
"+localmap",
|
2010-07-14 23:23:17 +02:00
|
|
|
#ifdef FEAT_LUA
|
|
|
|
# ifdef DYNAMIC_LUA
|
|
|
|
"+lua/dyn",
|
|
|
|
# else
|
|
|
|
"+lua",
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
"-lua",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_MENU
|
|
|
|
"+menu",
|
|
|
|
#else
|
|
|
|
"-menu",
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_SESSION
|
|
|
|
"+mksession",
|
|
|
|
#else
|
|
|
|
"-mksession",
|
|
|
|
#endif
|
|
|
|
"+modify_fname",
|
|
|
|
"+mouse",
|
2019-10-17 23:00:07 +02:00
|
|
|
#ifdef FEAT_MOUSESHAPE
|
2004-06-13 20:20:40 +00:00
|
|
|
"+mouseshape",
|
2019-10-17 23:00:07 +02:00
|
|
|
#else
|
2004-06-13 20:20:40 +00:00
|
|
|
"-mouseshape",
|
|
|
|
#endif
|
2012-10-21 04:00:07 +02:00
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
#if defined(UNIX) || defined(VMS)
|
|
|
|
# ifdef FEAT_MOUSE_DEC
|
|
|
|
"+mouse_dec",
|
|
|
|
# else
|
|
|
|
"-mouse_dec",
|
|
|
|
# endif
|
|
|
|
# ifdef FEAT_MOUSE_GPM
|
2022-02-23 18:07:38 +00:00
|
|
|
# ifdef DYNAMIC_GPM
|
|
|
|
"+mouse_gpm/dyn",
|
|
|
|
# else
|
2004-06-13 20:20:40 +00:00
|
|
|
"+mouse_gpm",
|
2022-02-23 18:07:38 +00:00
|
|
|
# endif
|
2004-06-13 20:20:40 +00:00
|
|
|
# else
|
|
|
|
"-mouse_gpm",
|
|
|
|
# endif
|
|
|
|
# ifdef FEAT_MOUSE_JSB
|
|
|
|
"+mouse_jsbterm",
|
|
|
|
# else
|
|
|
|
"-mouse_jsbterm",
|
|
|
|
# endif
|
|
|
|
# ifdef FEAT_MOUSE_NET
|
|
|
|
"+mouse_netterm",
|
|
|
|
# else
|
|
|
|
"-mouse_netterm",
|
|
|
|
# endif
|
2012-10-21 04:00:07 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __QNX__
|
|
|
|
# ifdef FEAT_MOUSE_PTERM
|
|
|
|
"+mouse_pterm",
|
|
|
|
# else
|
|
|
|
"-mouse_pterm",
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(UNIX) || defined(VMS)
|
|
|
|
"+mouse_sgr",
|
2008-06-24 21:56:24 +00:00
|
|
|
# ifdef FEAT_SYSMOUSE
|
|
|
|
"+mouse_sysmouse",
|
|
|
|
# else
|
|
|
|
"-mouse_sysmouse",
|
|
|
|
# endif
|
2011-10-20 21:09:35 +02:00
|
|
|
# ifdef FEAT_MOUSE_URXVT
|
|
|
|
"+mouse_urxvt",
|
|
|
|
# else
|
|
|
|
"-mouse_urxvt",
|
|
|
|
# endif
|
2012-10-21 04:00:07 +02:00
|
|
|
"+mouse_xterm",
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
2012-10-21 04:00:07 +02:00
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_MBYTE_IME
|
|
|
|
# ifdef DYNAMIC_IME
|
|
|
|
"+multi_byte_ime/dyn",
|
|
|
|
# else
|
|
|
|
"+multi_byte_ime",
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
"+multi_byte",
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_MULTI_LANG
|
|
|
|
"+multi_lang",
|
|
|
|
#else
|
|
|
|
"-multi_lang",
|
|
|
|
#endif
|
2004-07-05 15:58:32 +00:00
|
|
|
#ifdef FEAT_MZSCHEME
|
2005-01-25 22:07:05 +00:00
|
|
|
# ifdef DYNAMIC_MZSCHEME
|
|
|
|
"+mzscheme/dyn",
|
|
|
|
# else
|
2004-07-05 15:58:32 +00:00
|
|
|
"+mzscheme",
|
2005-01-25 22:07:05 +00:00
|
|
|
# endif
|
2004-07-05 15:58:32 +00:00
|
|
|
#else
|
|
|
|
"-mzscheme",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_NETBEANS_INTG
|
|
|
|
"+netbeans_intg",
|
|
|
|
#else
|
|
|
|
"-netbeans_intg",
|
|
|
|
#endif
|
2016-07-01 18:17:26 +02:00
|
|
|
"+num64",
|
2019-02-17 17:44:42 +01:00
|
|
|
#ifdef FEAT_GUI_MSWIN
|
2004-06-13 20:20:40 +00:00
|
|
|
# ifdef FEAT_OLE
|
|
|
|
"+ole",
|
|
|
|
# else
|
|
|
|
"-ole",
|
|
|
|
# endif
|
|
|
|
#endif
|
2018-07-22 05:08:11 +02:00
|
|
|
#ifdef FEAT_EVAL
|
2016-02-21 23:02:49 +01:00
|
|
|
"+packages",
|
2018-07-22 05:08:11 +02:00
|
|
|
#else
|
|
|
|
"-packages",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
"+path_extra",
|
|
|
|
#ifdef FEAT_PERL
|
|
|
|
# ifdef DYNAMIC_PERL
|
|
|
|
"+perl/dyn",
|
|
|
|
# else
|
|
|
|
"+perl",
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
"-perl",
|
|
|
|
#endif
|
2010-05-23 23:34:36 +02:00
|
|
|
#ifdef FEAT_PERSISTENT_UNDO
|
|
|
|
"+persistent_undo",
|
|
|
|
#else
|
|
|
|
"-persistent_undo",
|
|
|
|
#endif
|
2019-11-30 22:48:27 +01:00
|
|
|
#ifdef FEAT_PROP_POPUP
|
|
|
|
"+popupwin",
|
|
|
|
#else
|
|
|
|
"-popupwin",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_PRINTER
|
|
|
|
# ifdef FEAT_POSTSCRIPT
|
|
|
|
"+postscript",
|
|
|
|
# else
|
|
|
|
"-postscript",
|
|
|
|
# endif
|
|
|
|
"+printer",
|
|
|
|
#else
|
|
|
|
"-printer",
|
|
|
|
#endif
|
2005-02-26 23:04:13 +00:00
|
|
|
#ifdef FEAT_PROFILE
|
|
|
|
"+profile",
|
|
|
|
#else
|
|
|
|
"-profile",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_PYTHON
|
|
|
|
# ifdef DYNAMIC_PYTHON
|
|
|
|
"+python/dyn",
|
|
|
|
# else
|
|
|
|
"+python",
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
"-python",
|
|
|
|
#endif
|
2010-07-17 21:19:38 +02:00
|
|
|
#ifdef FEAT_PYTHON3
|
|
|
|
# ifdef DYNAMIC_PYTHON3
|
patch 9.0.1776: No support for stable Python 3 ABI
Problem: No support for stable Python 3 ABI
Solution: Support Python 3 stable ABI
Commits:
1) Support Python 3 stable ABI to allow mixed version interoperatbility
Vim currently supports embedding Python for use with plugins, and the
"dynamic" linking option allows the user to specify a locally installed
version of Python by setting `pythonthreedll`. However, one caveat is
that the Python 3 libs are not binary compatible across minor versions,
and mixing versions can potentially be dangerous (e.g. let's say Vim was
linked against the Python 3.10 SDK, but the user sets `pythonthreedll`
to a 3.11 lib). Usually, nothing bad happens, but in theory this could
lead to crashes, memory corruption, and other unpredictable behaviors.
It's also difficult for the user to tell something is wrong because Vim
has no way of reporting what Python 3 version Vim was linked with.
For Vim installed via a package manager, this usually isn't an issue
because all the dependencies would already be figured out. For prebuilt
Vim binaries like MacVim (my motivation for working on this), AppImage,
and Win32 installer this could potentially be an issue as usually a
single binary is distributed. This is more tricky when a new Python
version is released, as there's a chicken-and-egg issue with deciding
what Python version to build against and hard to keep in sync when a new
Python version just drops and we have a mix of users of different Python
versions, and a user just blindly upgrading to a new Python could lead to
bad interactions with Vim.
Python 3 does have a solution for this problem: stable ABI / limited API
(see https://docs.python.org/3/c-api/stable.html). The C SDK limits the
API to a set of functions that are promised to be stable across
versions. This pull request adds an ifdef config that allows us to turn
it on when building Vim. Vim binaries built with this option should be
safe to freely link with any Python 3 libraies without having the
constraint of having to use the same minor version.
Note: Python 2 has no such concept and this doesn't change how Python 2
integration works (not that there is going to be a new version of Python
2 that would cause compatibility issues in the future anyway).
---
Technical details:
======
The stable ABI can be accessed when we compile with the Python 3 limited
API (by defining `Py_LIMITED_API`). The Python 3 code (in `if_python3.c`
and `if_py_both.h`) would now handle this and switch to limited API
mode. Without it set, Vim will still use the full API as before so this
is an opt-in change.
The main difference is that `PyType_Object` is now an opaque struct that
we can't directly create "static types" out of, and we have to create
type objects as "heap types" instead. This is because the struct is not
stable and changes from version to version (e.g. 3.8 added a
`tp_vectorcall` field to it). I had to change all the types to be
allocated on the heap instead with just a pointer to them.
Other functions are also simply missing in limited API, or they are
introduced too late (e.g. `PyUnicode_AsUTF8AndSize` in 3.10) to it that
we need some other ways to do the same thing, so I had to abstract a few
things into macros, and sometimes re-implement functions like
`PyObject_NEW`.
One caveat is that in limited API, `OutputType` (used for replacing
`sys.stdout`) no longer inherits from `PyStdPrinter_Type` which I don't
think has any real issue other than minor differences in how they
convert to a string and missing a couple functions like `mode()` and
`fileno()`.
Also fixed an existing bug where `tp_basicsize` was set incorrectly for
`BufferObject`, `TabListObject, `WinListObject`.
Technically, there could be a small performance drop, there is a little
more indirection with accessing type objects, and some APIs like
`PyUnicode_AsUTF8AndSize` are missing, but in practice I didn't see any
difference, and any well-written Python plugin should try to avoid
excessing callbacks to the `vim` module in Python anyway.
I only tested limited API mode down to Python 3.7, which seemes to
compile and work fine. I haven't tried earlier Python versions.
2) Fix PyIter_Check on older Python vers / type##Ptr unused warning
For PyIter_Check, older versions exposed them as either macros (used in
full API), or a function (for use in limited API). A previous change
exposed PyIter_Check to the dynamic build because Python just moved it
to function-only in 3.10 anyway. Because of that, just make sure we
always grab the function in dynamic builds in earlier versions since
that's what Python eventually did anyway.
3) Move Py_LIMITED_API define to configure script
Can now use --with-python-stable-abi flag to customize what stable ABI
version to target. Can also use an env var to do so as well.
4) Show +python/dyn-stable in :version, and allow has() feature query
Not sure if the "/dyn-stable" suffix would break things, or whether we
should do it another way. Or just don't show it in version and rely on
has() feature checking.
5) Documentation first draft. Still need to implement v:python3_version
6) Fix PyIter_Check build breaks when compiling against Python 3.8
7) Add CI coverage stable ABI on Linux/Windows / make configurable on Windows
This adds configurable options for Windows make files (both MinGW and
MSVC). CI will also now exercise both traditional full API and stable
ABI for Linux and Windows in the matrix for coverage.
Also added a "dynamic" option to Linux matrix as a drive-by change to
make other scripting languages like Ruby / Perl testable under both
static and dynamic builds.
8) Fix inaccuracy in Windows docs
Python's own docs are confusing but you don't actually want to use
`python3.dll` for the dynamic linkage.
9) Add generated autoconf file
10) Add v:python3_version support
This variable indicates the version of Python3 that Vim was built
against (PY_VERSION_HEX), and will be useful to check whether the Python
library you are loading in dynamically actually fits it. When built with
stable ABI, it will be the limited ABI version instead
(`Py_LIMITED_API`), which indicates the minimum version of Python 3 the
user should have, rather than the exact match. When stable ABI is used,
we won't be exposing PY_VERSION_HEX in this var because it just doesn't
seem necessary to do so (the whole point of stable ABI is the promise
that it will work across versions), and I don't want to confuse the user
with too many variables.
Also, cleaned up some documentation, and added help tags.
11) Fix Python 3.7 compat issues
Fix a couple issues when using limited API < 3.8
- Crash on exit: In Python 3.7, if a heap-allocated type is destroyed
before all instances are, it would cause a crash later. This happens
when we destroyed `OptionsType` before calling `Py_Finalize` when
using the limited API. To make it worse, later versions changed the
semantics and now each instance has a strong reference to its own type
and the recommendation has changed to have each instance de-ref its
own type and have its type in GC traversal. To avoid dealing with
these cross-version variations, we just don't free the heap type. They
are static types in non-limited-API anyway and are designed to last
through the entirety of the app, and we also don't restart the Python
runtime and therefore do not need it to have absolutely 0 leaks.
See:
- https://docs.python.org/3/whatsnew/3.8.html#changes-in-the-c-api
- https://docs.python.org/3/whatsnew/3.9.html#changes-in-the-c-api
- PyIter_Check: This function is not provided in limited APIs older than
3.8. Previously I was trying to mock it out using manual
PyType_GetSlot() but it was brittle and also does not actually work
properly for static types (it will generate a Python error). Just
return false. It does mean using limited API < 3.8 is not recommended
as you lose the functionality to handle iterators, but from playing
with plugins I couldn't find it to be an issue.
- Fix loading of PyIter_Check so it will be done when limited API < 3.8.
Otherwise loading a 3.7 Python lib will fail even if limited API was
specified to use it.
12) Make sure to only load `PyUnicode_AsUTF8AndSize` in needed in limited API
We don't use this function unless limited API >= 3.10, but we were
loading it regardless. Usually it's ok in Unix-like systems where Python
just has a single lib that we load from, but in Windows where there is a
separate python3.dll this would not work as the symbol would not have
been exposed in this more limited DLL file. This makes it much clearer
under what condition is this function needed.
closes: #12032
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-08-20 21:18:38 +02:00
|
|
|
# ifdef DYNAMIC_PYTHON3_STABLE_ABI
|
|
|
|
"+python3/dyn-stable",
|
|
|
|
# else
|
2010-07-17 21:19:38 +02:00
|
|
|
"+python3/dyn",
|
patch 9.0.1776: No support for stable Python 3 ABI
Problem: No support for stable Python 3 ABI
Solution: Support Python 3 stable ABI
Commits:
1) Support Python 3 stable ABI to allow mixed version interoperatbility
Vim currently supports embedding Python for use with plugins, and the
"dynamic" linking option allows the user to specify a locally installed
version of Python by setting `pythonthreedll`. However, one caveat is
that the Python 3 libs are not binary compatible across minor versions,
and mixing versions can potentially be dangerous (e.g. let's say Vim was
linked against the Python 3.10 SDK, but the user sets `pythonthreedll`
to a 3.11 lib). Usually, nothing bad happens, but in theory this could
lead to crashes, memory corruption, and other unpredictable behaviors.
It's also difficult for the user to tell something is wrong because Vim
has no way of reporting what Python 3 version Vim was linked with.
For Vim installed via a package manager, this usually isn't an issue
because all the dependencies would already be figured out. For prebuilt
Vim binaries like MacVim (my motivation for working on this), AppImage,
and Win32 installer this could potentially be an issue as usually a
single binary is distributed. This is more tricky when a new Python
version is released, as there's a chicken-and-egg issue with deciding
what Python version to build against and hard to keep in sync when a new
Python version just drops and we have a mix of users of different Python
versions, and a user just blindly upgrading to a new Python could lead to
bad interactions with Vim.
Python 3 does have a solution for this problem: stable ABI / limited API
(see https://docs.python.org/3/c-api/stable.html). The C SDK limits the
API to a set of functions that are promised to be stable across
versions. This pull request adds an ifdef config that allows us to turn
it on when building Vim. Vim binaries built with this option should be
safe to freely link with any Python 3 libraies without having the
constraint of having to use the same minor version.
Note: Python 2 has no such concept and this doesn't change how Python 2
integration works (not that there is going to be a new version of Python
2 that would cause compatibility issues in the future anyway).
---
Technical details:
======
The stable ABI can be accessed when we compile with the Python 3 limited
API (by defining `Py_LIMITED_API`). The Python 3 code (in `if_python3.c`
and `if_py_both.h`) would now handle this and switch to limited API
mode. Without it set, Vim will still use the full API as before so this
is an opt-in change.
The main difference is that `PyType_Object` is now an opaque struct that
we can't directly create "static types" out of, and we have to create
type objects as "heap types" instead. This is because the struct is not
stable and changes from version to version (e.g. 3.8 added a
`tp_vectorcall` field to it). I had to change all the types to be
allocated on the heap instead with just a pointer to them.
Other functions are also simply missing in limited API, or they are
introduced too late (e.g. `PyUnicode_AsUTF8AndSize` in 3.10) to it that
we need some other ways to do the same thing, so I had to abstract a few
things into macros, and sometimes re-implement functions like
`PyObject_NEW`.
One caveat is that in limited API, `OutputType` (used for replacing
`sys.stdout`) no longer inherits from `PyStdPrinter_Type` which I don't
think has any real issue other than minor differences in how they
convert to a string and missing a couple functions like `mode()` and
`fileno()`.
Also fixed an existing bug where `tp_basicsize` was set incorrectly for
`BufferObject`, `TabListObject, `WinListObject`.
Technically, there could be a small performance drop, there is a little
more indirection with accessing type objects, and some APIs like
`PyUnicode_AsUTF8AndSize` are missing, but in practice I didn't see any
difference, and any well-written Python plugin should try to avoid
excessing callbacks to the `vim` module in Python anyway.
I only tested limited API mode down to Python 3.7, which seemes to
compile and work fine. I haven't tried earlier Python versions.
2) Fix PyIter_Check on older Python vers / type##Ptr unused warning
For PyIter_Check, older versions exposed them as either macros (used in
full API), or a function (for use in limited API). A previous change
exposed PyIter_Check to the dynamic build because Python just moved it
to function-only in 3.10 anyway. Because of that, just make sure we
always grab the function in dynamic builds in earlier versions since
that's what Python eventually did anyway.
3) Move Py_LIMITED_API define to configure script
Can now use --with-python-stable-abi flag to customize what stable ABI
version to target. Can also use an env var to do so as well.
4) Show +python/dyn-stable in :version, and allow has() feature query
Not sure if the "/dyn-stable" suffix would break things, or whether we
should do it another way. Or just don't show it in version and rely on
has() feature checking.
5) Documentation first draft. Still need to implement v:python3_version
6) Fix PyIter_Check build breaks when compiling against Python 3.8
7) Add CI coverage stable ABI on Linux/Windows / make configurable on Windows
This adds configurable options for Windows make files (both MinGW and
MSVC). CI will also now exercise both traditional full API and stable
ABI for Linux and Windows in the matrix for coverage.
Also added a "dynamic" option to Linux matrix as a drive-by change to
make other scripting languages like Ruby / Perl testable under both
static and dynamic builds.
8) Fix inaccuracy in Windows docs
Python's own docs are confusing but you don't actually want to use
`python3.dll` for the dynamic linkage.
9) Add generated autoconf file
10) Add v:python3_version support
This variable indicates the version of Python3 that Vim was built
against (PY_VERSION_HEX), and will be useful to check whether the Python
library you are loading in dynamically actually fits it. When built with
stable ABI, it will be the limited ABI version instead
(`Py_LIMITED_API`), which indicates the minimum version of Python 3 the
user should have, rather than the exact match. When stable ABI is used,
we won't be exposing PY_VERSION_HEX in this var because it just doesn't
seem necessary to do so (the whole point of stable ABI is the promise
that it will work across versions), and I don't want to confuse the user
with too many variables.
Also, cleaned up some documentation, and added help tags.
11) Fix Python 3.7 compat issues
Fix a couple issues when using limited API < 3.8
- Crash on exit: In Python 3.7, if a heap-allocated type is destroyed
before all instances are, it would cause a crash later. This happens
when we destroyed `OptionsType` before calling `Py_Finalize` when
using the limited API. To make it worse, later versions changed the
semantics and now each instance has a strong reference to its own type
and the recommendation has changed to have each instance de-ref its
own type and have its type in GC traversal. To avoid dealing with
these cross-version variations, we just don't free the heap type. They
are static types in non-limited-API anyway and are designed to last
through the entirety of the app, and we also don't restart the Python
runtime and therefore do not need it to have absolutely 0 leaks.
See:
- https://docs.python.org/3/whatsnew/3.8.html#changes-in-the-c-api
- https://docs.python.org/3/whatsnew/3.9.html#changes-in-the-c-api
- PyIter_Check: This function is not provided in limited APIs older than
3.8. Previously I was trying to mock it out using manual
PyType_GetSlot() but it was brittle and also does not actually work
properly for static types (it will generate a Python error). Just
return false. It does mean using limited API < 3.8 is not recommended
as you lose the functionality to handle iterators, but from playing
with plugins I couldn't find it to be an issue.
- Fix loading of PyIter_Check so it will be done when limited API < 3.8.
Otherwise loading a 3.7 Python lib will fail even if limited API was
specified to use it.
12) Make sure to only load `PyUnicode_AsUTF8AndSize` in needed in limited API
We don't use this function unless limited API >= 3.10, but we were
loading it regardless. Usually it's ok in Unix-like systems where Python
just has a single lib that we load from, but in Windows where there is a
separate python3.dll this would not work as the symbol would not have
been exposed in this more limited DLL file. This makes it much clearer
under what condition is this function needed.
closes: #12032
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-08-20 21:18:38 +02:00
|
|
|
# endif
|
2010-07-17 21:19:38 +02:00
|
|
|
# else
|
|
|
|
"+python3",
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
"-python3",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_QUICKFIX
|
|
|
|
"+quickfix",
|
|
|
|
#else
|
|
|
|
"-quickfix",
|
|
|
|
#endif
|
2006-05-02 22:08:30 +00:00
|
|
|
#ifdef FEAT_RELTIME
|
|
|
|
"+reltime",
|
|
|
|
#else
|
|
|
|
"-reltime",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_RIGHTLEFT
|
|
|
|
"+rightleft",
|
|
|
|
#else
|
|
|
|
"-rightleft",
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_RUBY
|
|
|
|
# ifdef DYNAMIC_RUBY
|
|
|
|
"+ruby/dyn",
|
|
|
|
# else
|
|
|
|
"+ruby",
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
"-ruby",
|
|
|
|
#endif
|
|
|
|
"+scrollbind",
|
|
|
|
#ifdef FEAT_SIGNS
|
|
|
|
"+signs",
|
|
|
|
#else
|
|
|
|
"-signs",
|
|
|
|
#endif
|
|
|
|
"+smartindent",
|
2021-06-20 14:02:16 +02:00
|
|
|
#ifdef FEAT_SODIUM
|
2022-02-12 11:18:37 +00:00
|
|
|
# ifdef DYNAMIC_SODIUM
|
|
|
|
"+sodium/dyn",
|
|
|
|
# else
|
2021-06-20 14:02:16 +02:00
|
|
|
"+sodium",
|
2022-02-12 11:18:37 +00:00
|
|
|
# endif
|
2021-06-20 14:02:16 +02:00
|
|
|
#else
|
|
|
|
"-sodium",
|
|
|
|
#endif
|
2019-06-09 13:43:51 +02:00
|
|
|
#ifdef FEAT_SOUND
|
|
|
|
"+sound",
|
|
|
|
#else
|
|
|
|
"-sound",
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_SPELL
|
|
|
|
"+spell",
|
|
|
|
#else
|
|
|
|
"-spell",
|
|
|
|
#endif
|
2009-11-11 13:22:11 +00:00
|
|
|
#ifdef STARTUPTIME
|
|
|
|
"+startuptime",
|
|
|
|
#else
|
|
|
|
"-startuptime",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_STL_OPT
|
|
|
|
"+statusline",
|
|
|
|
#else
|
|
|
|
"-statusline",
|
|
|
|
#endif
|
|
|
|
"-sun_workshop",
|
|
|
|
#ifdef FEAT_SYN_HL
|
|
|
|
"+syntax",
|
|
|
|
#else
|
|
|
|
"-syntax",
|
|
|
|
#endif
|
2019-12-21 18:47:26 +01:00
|
|
|
// only interesting on Unix systems
|
2016-07-16 14:47:36 +02:00
|
|
|
#if defined(USE_SYSTEM) && defined(UNIX)
|
2004-06-13 20:20:40 +00:00
|
|
|
"+system()",
|
|
|
|
#endif
|
|
|
|
"+tag_binary",
|
|
|
|
"-tag_old_static",
|
|
|
|
"-tag_any_white",
|
|
|
|
#ifdef FEAT_TCL
|
|
|
|
# ifdef DYNAMIC_TCL
|
|
|
|
"+tcl/dyn",
|
|
|
|
# else
|
|
|
|
"+tcl",
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
"-tcl",
|
|
|
|
#endif
|
2016-04-29 22:59:22 +02:00
|
|
|
#ifdef FEAT_TERMGUICOLORS
|
|
|
|
"+termguicolors",
|
|
|
|
#else
|
|
|
|
"-termguicolors",
|
|
|
|
#endif
|
2017-07-15 20:05:54 +02:00
|
|
|
#ifdef FEAT_TERMINAL
|
|
|
|
"+terminal",
|
|
|
|
#else
|
|
|
|
"-terminal",
|
|
|
|
#endif
|
2016-07-16 14:47:36 +02:00
|
|
|
#if defined(UNIX)
|
2019-12-21 18:47:26 +01:00
|
|
|
// only Unix can have terminfo instead of termcap
|
2004-06-13 20:20:40 +00:00
|
|
|
# ifdef TERMINFO
|
|
|
|
"+terminfo",
|
|
|
|
# else
|
|
|
|
"-terminfo",
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_TERMRESPONSE
|
|
|
|
"+termresponse",
|
|
|
|
#else
|
|
|
|
"-termresponse",
|
|
|
|
#endif
|
|
|
|
"+textobjects",
|
2019-11-30 22:48:27 +01:00
|
|
|
#ifdef FEAT_PROP_POPUP
|
2018-12-13 22:20:09 +01:00
|
|
|
"+textprop",
|
|
|
|
#else
|
|
|
|
"-textprop",
|
|
|
|
#endif
|
|
|
|
#if !defined(UNIX)
|
2019-12-21 18:47:26 +01:00
|
|
|
// unix always includes termcap support
|
2018-12-13 22:20:09 +01:00
|
|
|
# ifdef HAVE_TGETENT
|
|
|
|
"+tgetent",
|
|
|
|
# else
|
|
|
|
"-tgetent",
|
|
|
|
# endif
|
|
|
|
#endif
|
2016-03-15 23:10:59 +01:00
|
|
|
#ifdef FEAT_TIMERS
|
|
|
|
"+timers",
|
|
|
|
#else
|
|
|
|
"-timers",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
"+title",
|
|
|
|
#ifdef FEAT_TOOLBAR
|
|
|
|
"+toolbar",
|
|
|
|
#else
|
|
|
|
"-toolbar",
|
|
|
|
#endif
|
|
|
|
"+user_commands",
|
2018-06-23 19:23:02 +02:00
|
|
|
#ifdef FEAT_VARTABS
|
|
|
|
"+vartabs",
|
|
|
|
#else
|
|
|
|
"-vartabs",
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
"+vertsplit",
|
2022-01-02 12:06:33 +00:00
|
|
|
"+vim9script",
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_VIMINFO
|
|
|
|
"+viminfo",
|
|
|
|
#else
|
|
|
|
"-viminfo",
|
|
|
|
#endif
|
2022-01-02 12:06:33 +00:00
|
|
|
"+virtualedit",
|
|
|
|
"+visual",
|
|
|
|
"+visualextra",
|
2004-06-13 20:20:40 +00:00
|
|
|
"+vreplace",
|
2019-02-17 17:44:42 +01:00
|
|
|
#ifdef MSWIN
|
2018-02-22 21:07:09 +01:00
|
|
|
# ifdef FEAT_VTP
|
|
|
|
"+vtp",
|
|
|
|
# else
|
|
|
|
"-vtp",
|
|
|
|
# endif
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
"+wildignore",
|
|
|
|
"+wildmenu",
|
|
|
|
"+windows",
|
|
|
|
#ifdef FEAT_WRITEBACKUP
|
|
|
|
"+writebackup",
|
|
|
|
#else
|
|
|
|
"-writebackup",
|
|
|
|
#endif
|
|
|
|
#if defined(UNIX) || defined(VMS)
|
|
|
|
# ifdef FEAT_X11
|
|
|
|
"+X11",
|
|
|
|
# else
|
|
|
|
"-X11",
|
|
|
|
# endif
|
|
|
|
#endif
|
2023-09-30 12:49:18 +02:00
|
|
|
# ifdef FEAT_XATTR
|
|
|
|
"+xattr",
|
|
|
|
# else
|
|
|
|
"-xattr",
|
|
|
|
# endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_XFONTSET
|
|
|
|
"+xfontset",
|
|
|
|
#else
|
|
|
|
"-xfontset",
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_XIM
|
|
|
|
"+xim",
|
|
|
|
#else
|
|
|
|
"-xim",
|
|
|
|
#endif
|
2022-04-05 14:18:44 +01:00
|
|
|
#if defined(MSWIN)
|
2016-08-13 16:39:56 +02:00
|
|
|
# ifdef FEAT_XPM_W32
|
|
|
|
"+xpm_w32",
|
|
|
|
# else
|
|
|
|
"-xpm_w32",
|
|
|
|
# endif
|
2022-04-05 14:18:44 +01:00
|
|
|
#elif defined(HAVE_XPM)
|
2016-08-13 16:39:56 +02:00
|
|
|
"+xpm",
|
2022-04-05 14:18:44 +01:00
|
|
|
#else
|
2016-08-13 16:39:56 +02:00
|
|
|
"-xpm",
|
|
|
|
#endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#if defined(UNIX) || defined(VMS)
|
2022-04-05 14:18:44 +01:00
|
|
|
# if defined(USE_XSMP_INTERACT)
|
2004-06-13 20:20:40 +00:00
|
|
|
"+xsmp_interact",
|
2022-04-05 14:18:44 +01:00
|
|
|
# elif defined(USE_XSMP)
|
2004-06-13 20:20:40 +00:00
|
|
|
"+xsmp",
|
2022-04-05 14:18:44 +01:00
|
|
|
# else
|
2004-06-13 20:20:40 +00:00
|
|
|
"-xsmp",
|
|
|
|
# endif
|
|
|
|
# ifdef FEAT_XCLIPBOARD
|
|
|
|
"+xterm_clipboard",
|
|
|
|
# else
|
|
|
|
"-xterm_clipboard",
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_XTERM_SAVE
|
|
|
|
"+xterm_save",
|
|
|
|
#else
|
|
|
|
"-xterm_save",
|
|
|
|
#endif
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static int included_patches[] =
|
|
|
|
{ /* Add new patch number below this line */
|
2024-02-21 21:00:59 +01:00
|
|
|
/**/
|
|
|
|
124,
|
2024-02-21 20:16:38 +01:00
|
|
|
/**/
|
|
|
|
123,
|
2024-02-21 19:48:37 +01:00
|
|
|
/**/
|
|
|
|
122,
|
2024-02-21 19:40:44 +01:00
|
|
|
/**/
|
|
|
|
121,
|
2024-02-21 00:02:45 +01:00
|
|
|
/**/
|
|
|
|
120,
|
2024-02-20 22:05:10 +01:00
|
|
|
/**/
|
|
|
|
119,
|
2024-02-20 22:00:33 +01:00
|
|
|
/**/
|
|
|
|
118,
|
patch 9.1.0117: Stop split-moving from firing WinNew and WinNewPre autocommands
Problem: win_splitmove fires WinNewPre and possibly WinNew when moving
windows, even though no new windows are created.
Solution: don't fire WinNew and WinNewPre when inserting an existing
window, even if it isn't the current window. Improve the
accuracy of related documentation. (Sean Dewar)
Likewise, before this patch, WinClosed was not fired anyway (even for :wincmd
H/J/K/L, which also didn't fire WinNew, but did still fire WinNewPre), despite
documentation saying windows are "closed". Note that :wincmd T actually indeed
works by creating a new window (and closing the old one), unlike the others.
This also fixes issues where WinNewPre is fired when split-moving while curwin
doesn't yet have a frame or entry in the window list, causing many things to not
work (it's not considered valid at that point). This was guaranteed when using
:wincmd H/J/K/L.
Because WinNewPre is no longer fired when split-moving, this makes restoring the
previous window layout on failure easier, as we can be sure that frames are not
resized from WinNewPre autocommands if win_split_ins fails. This allows us to
use a different strategy in the following commit.
--
In my opinion, this leaves questions about the current usefulness of WinNewPre.
A motivation described in #10635 states how creating a new window can steal room
from other windows, and how WinNewPre will be useful for detecting that, but
this is also true when inserting an existing window, which now doesn't fire it.
Maybe the autocommand should be changed to have a better name?
There are also other issues I found with the current implementation of WinNewPre
that need addressing:
- it allows switching windows and tabpages, which can cause incorrect windows to
be split/moved, and big problems when switching tabpages.
- it fires before win_split_ins checks for room, before it makes any changes to
window sizes or before it considers allocating a new window. This should be
changed or documented.
I hope to address some of this stuff in a different PR, if possible.
related: #14038
Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-20 21:52:31 +01:00
|
|
|
/**/
|
|
|
|
117,
|
2024-02-20 20:28:15 +01:00
|
|
|
/**/
|
|
|
|
116,
|
2024-02-18 18:53:08 +01:00
|
|
|
/**/
|
|
|
|
115,
|
2024-02-18 09:33:54 +01:00
|
|
|
/**/
|
|
|
|
114,
|
2024-02-15 20:17:37 +01:00
|
|
|
/**/
|
|
|
|
113,
|
2024-02-15 20:15:04 +01:00
|
|
|
/**/
|
|
|
|
112,
|
2024-02-15 00:16:02 +01:00
|
|
|
/**/
|
|
|
|
111,
|
2024-02-14 22:30:06 +01:00
|
|
|
/**/
|
|
|
|
110,
|
2024-02-14 21:31:47 +01:00
|
|
|
/**/
|
|
|
|
109,
|
2024-02-14 20:44:28 +01:00
|
|
|
/**/
|
|
|
|
108,
|
2024-02-14 20:34:58 +01:00
|
|
|
/**/
|
|
|
|
107,
|
2024-02-14 20:28:17 +01:00
|
|
|
/**/
|
|
|
|
106,
|
2024-02-13 20:32:04 +01:00
|
|
|
/**/
|
|
|
|
105,
|
2024-02-12 23:12:26 +01:00
|
|
|
/**/
|
|
|
|
104,
|
2024-02-12 22:53:20 +01:00
|
|
|
/**/
|
|
|
|
103,
|
2024-02-12 22:50:26 +01:00
|
|
|
/**/
|
|
|
|
102,
|
2024-02-12 22:14:53 +01:00
|
|
|
/**/
|
|
|
|
101,
|
2024-02-12 20:28:01 +01:00
|
|
|
/**/
|
|
|
|
100,
|
2024-02-12 20:21:26 +01:00
|
|
|
/**/
|
|
|
|
99,
|
2024-02-11 17:52:40 +01:00
|
|
|
/**/
|
|
|
|
98,
|
2024-02-11 17:16:19 +01:00
|
|
|
/**/
|
|
|
|
97,
|
2024-02-11 17:08:29 +01:00
|
|
|
/**/
|
|
|
|
96,
|
2024-02-10 13:50:54 +01:00
|
|
|
/**/
|
|
|
|
95,
|
2024-02-10 13:31:06 +01:00
|
|
|
/**/
|
|
|
|
94,
|
2024-02-10 13:24:03 +01:00
|
|
|
/**/
|
|
|
|
93,
|
2024-02-10 13:17:16 +01:00
|
|
|
/**/
|
|
|
|
92,
|
2024-02-10 13:02:17 +01:00
|
|
|
/**/
|
|
|
|
91,
|
2024-02-09 23:11:54 +01:00
|
|
|
/**/
|
|
|
|
90,
|
2024-02-09 19:39:14 +01:00
|
|
|
/**/
|
|
|
|
89,
|
2024-02-09 19:34:36 +01:00
|
|
|
/**/
|
|
|
|
88,
|
2024-02-09 19:30:26 +01:00
|
|
|
/**/
|
|
|
|
87,
|
2024-02-09 19:24:23 +01:00
|
|
|
/**/
|
|
|
|
86,
|
2024-02-09 19:13:12 +01:00
|
|
|
/**/
|
|
|
|
85,
|
2024-02-09 18:14:12 +01:00
|
|
|
/**/
|
|
|
|
84,
|
2024-02-08 11:37:40 +01:00
|
|
|
/**/
|
|
|
|
83,
|
2024-02-08 11:34:55 +01:00
|
|
|
/**/
|
|
|
|
82,
|
2024-02-08 11:04:21 +01:00
|
|
|
/**/
|
|
|
|
81,
|
2024-02-06 11:03:36 +01:00
|
|
|
/**/
|
|
|
|
80,
|
2024-02-06 10:59:03 +01:00
|
|
|
/**/
|
|
|
|
79,
|
2024-02-06 10:49:14 +01:00
|
|
|
/**/
|
|
|
|
78,
|
2024-02-06 10:43:36 +01:00
|
|
|
/**/
|
|
|
|
77,
|
2024-02-04 10:27:33 +01:00
|
|
|
/**/
|
|
|
|
76,
|
2024-02-03 18:11:13 +01:00
|
|
|
/**/
|
|
|
|
75,
|
2024-02-03 18:08:09 +01:00
|
|
|
/**/
|
|
|
|
74,
|
2024-02-03 18:04:05 +01:00
|
|
|
/**/
|
|
|
|
73,
|
2024-02-03 17:41:54 +01:00
|
|
|
/**/
|
|
|
|
72,
|
2024-02-01 22:05:27 +01:00
|
|
|
/**/
|
|
|
|
71,
|
2024-02-01 21:22:14 +01:00
|
|
|
/**/
|
|
|
|
70,
|
2024-02-01 21:11:16 +01:00
|
|
|
/**/
|
|
|
|
69,
|
2024-02-01 21:07:51 +01:00
|
|
|
/**/
|
|
|
|
68,
|
2024-01-31 22:10:50 +01:00
|
|
|
/**/
|
|
|
|
67,
|
2024-01-31 20:29:07 +01:00
|
|
|
/**/
|
|
|
|
66,
|
2024-01-29 21:46:58 +01:00
|
|
|
/**/
|
|
|
|
65,
|
2024-01-29 20:54:28 +01:00
|
|
|
/**/
|
|
|
|
64,
|
2024-01-29 20:14:01 +01:00
|
|
|
/**/
|
|
|
|
63,
|
2024-01-29 19:32:39 +01:00
|
|
|
/**/
|
|
|
|
62,
|
2024-01-28 23:33:29 +01:00
|
|
|
/**/
|
|
|
|
61,
|
2024-01-28 19:03:00 +01:00
|
|
|
/**/
|
|
|
|
60,
|
2024-01-25 23:07:00 +01:00
|
|
|
/**/
|
|
|
|
59,
|
2024-01-25 22:44:00 +01:00
|
|
|
/**/
|
|
|
|
58,
|
2024-01-25 22:28:37 +01:00
|
|
|
/**/
|
|
|
|
57,
|
2024-01-25 21:50:41 +01:00
|
|
|
/**/
|
|
|
|
56,
|
2024-01-25 21:40:05 +01:00
|
|
|
/**/
|
|
|
|
55,
|
2024-01-25 21:27:13 +01:00
|
|
|
/**/
|
|
|
|
54,
|
2024-01-25 21:23:22 +01:00
|
|
|
/**/
|
|
|
|
53,
|
2024-01-25 20:50:49 +01:00
|
|
|
/**/
|
|
|
|
52,
|
2024-01-25 20:44:49 +01:00
|
|
|
/**/
|
|
|
|
51,
|
2024-01-23 23:19:02 +01:00
|
|
|
/**/
|
|
|
|
50,
|
2023-08-16 17:15:05 +01:00
|
|
|
/**/
|
|
|
|
49,
|
2023-08-16 16:17:31 +01:00
|
|
|
/**/
|
|
|
|
48,
|
2023-08-16 14:17:36 +01:00
|
|
|
/**/
|
|
|
|
47,
|
2024-01-23 21:27:19 +01:00
|
|
|
/**/
|
|
|
|
46,
|
2024-01-23 21:13:58 +01:00
|
|
|
/**/
|
|
|
|
45,
|
2024-01-22 20:28:12 +01:00
|
|
|
/**/
|
|
|
|
44,
|
2024-01-22 20:12:34 +01:00
|
|
|
/**/
|
|
|
|
43,
|
2024-01-21 09:40:22 +01:00
|
|
|
/**/
|
|
|
|
42,
|
2024-01-17 18:37:32 +01:00
|
|
|
/**/
|
|
|
|
41,
|
2024-01-17 21:22:59 +01:00
|
|
|
/**/
|
|
|
|
40,
|
2024-01-17 20:54:49 +01:00
|
|
|
/**/
|
|
|
|
39,
|
2024-01-17 20:52:13 +01:00
|
|
|
/**/
|
|
|
|
38,
|
2024-01-17 20:42:53 +01:00
|
|
|
/**/
|
|
|
|
37,
|
2024-01-17 20:16:05 +01:00
|
|
|
/**/
|
|
|
|
36,
|
2024-01-16 17:25:17 +01:00
|
|
|
/**/
|
|
|
|
35,
|
2024-01-16 17:22:38 +01:00
|
|
|
/**/
|
|
|
|
34,
|
2024-01-16 17:19:59 +01:00
|
|
|
/**/
|
|
|
|
33,
|
2024-01-16 17:14:29 +01:00
|
|
|
/**/
|
|
|
|
32,
|
2024-01-15 22:51:22 +01:00
|
|
|
/**/
|
|
|
|
31,
|
2023-11-15 15:35:49 +01:00
|
|
|
/**/
|
|
|
|
30,
|
2024-01-14 20:19:59 +01:00
|
|
|
/**/
|
|
|
|
29,
|
2024-01-14 20:08:40 +01:00
|
|
|
/**/
|
|
|
|
28,
|
2024-01-13 11:47:33 +01:00
|
|
|
/**/
|
|
|
|
27,
|
2024-01-12 18:09:43 +01:00
|
|
|
/**/
|
|
|
|
26,
|
2024-01-12 18:02:10 +01:00
|
|
|
/**/
|
|
|
|
25,
|
2024-01-12 17:59:18 +01:00
|
|
|
/**/
|
|
|
|
24,
|
2024-01-09 21:05:48 +00:00
|
|
|
/**/
|
|
|
|
23,
|
2024-01-12 17:48:08 +01:00
|
|
|
/**/
|
|
|
|
22,
|
2024-01-12 17:43:05 +01:00
|
|
|
/**/
|
|
|
|
21,
|
2024-01-12 17:36:40 +01:00
|
|
|
/**/
|
|
|
|
20,
|
2024-01-12 17:34:40 +01:00
|
|
|
/**/
|
|
|
|
19,
|
2024-01-12 17:31:07 +01:00
|
|
|
/**/
|
|
|
|
18,
|
2024-01-12 17:21:55 +01:00
|
|
|
/**/
|
|
|
|
17,
|
2024-01-07 15:08:31 +01:00
|
|
|
/**/
|
|
|
|
16,
|
2024-01-05 18:19:52 +01:00
|
|
|
/**/
|
|
|
|
15,
|
2024-01-05 18:11:43 +01:00
|
|
|
/**/
|
|
|
|
14,
|
2024-01-05 17:59:04 +01:00
|
|
|
/**/
|
|
|
|
13,
|
2024-01-05 17:52:49 +01:00
|
|
|
/**/
|
|
|
|
12,
|
2024-01-04 22:54:08 +01:00
|
|
|
/**/
|
|
|
|
11,
|
2024-01-04 22:37:44 +01:00
|
|
|
/**/
|
|
|
|
10,
|
2024-01-04 22:28:46 +01:00
|
|
|
/**/
|
|
|
|
9,
|
2024-01-04 22:14:28 +01:00
|
|
|
/**/
|
|
|
|
8,
|
2024-01-04 21:43:36 +01:00
|
|
|
/**/
|
|
|
|
7,
|
2024-01-04 21:19:04 +01:00
|
|
|
/**/
|
|
|
|
6,
|
2024-01-04 21:01:13 +01:00
|
|
|
/**/
|
|
|
|
5,
|
2024-01-03 19:48:51 +01:00
|
|
|
/**/
|
|
|
|
4,
|
2024-01-03 19:31:05 +01:00
|
|
|
/**/
|
|
|
|
3,
|
2024-01-03 19:18:43 +01:00
|
|
|
/**/
|
|
|
|
2,
|
2024-01-03 18:52:52 +01:00
|
|
|
/**/
|
|
|
|
1,
|
2004-06-13 20:20:40 +00:00
|
|
|
/**/
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2008-11-30 11:15:09 +00:00
|
|
|
/*
|
|
|
|
* Place to put a short description when adding a feature with a patch.
|
|
|
|
* Keep it short, e.g.,: "relative numbers", "persistent undo".
|
|
|
|
* Also add a comment marker to separate the lines.
|
|
|
|
* See the official Vim patches for the diff format: It must use a context of
|
2008-12-24 13:25:14 +00:00
|
|
|
* one line only. Create it by hand or use "diff -C2" and edit the patch.
|
2008-11-30 11:15:09 +00:00
|
|
|
*/
|
|
|
|
static char *(extra_patches[]) =
|
|
|
|
{ /* Add your patch description below this line */
|
|
|
|
/**/
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
int
|
2016-01-30 21:29:58 +01:00
|
|
|
highest_patch(void)
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
2019-06-14 14:39:51 +02:00
|
|
|
// this relies on the highest patch number to be the first entry
|
|
|
|
return included_patches[0];
|
2004-06-13 20:20:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(FEAT_EVAL) || defined(PROTO)
|
|
|
|
/*
|
|
|
|
* Return TRUE if patch "n" has been included.
|
|
|
|
*/
|
|
|
|
int
|
2016-01-30 21:29:58 +01:00
|
|
|
has_patch(int n)
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
2020-11-10 20:54:29 +01:00
|
|
|
int h, m, l;
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2020-11-10 20:54:29 +01:00
|
|
|
// Perform a binary search.
|
|
|
|
l = 0;
|
2021-06-02 13:28:16 +02:00
|
|
|
h = (int)ARRAY_LENGTH(included_patches) - 1;
|
2022-06-30 11:03:39 +01:00
|
|
|
for (;;)
|
2020-11-10 20:54:29 +01:00
|
|
|
{
|
|
|
|
m = (l + h) / 2;
|
|
|
|
if (included_patches[m] == n)
|
2004-06-13 20:20:40 +00:00
|
|
|
return TRUE;
|
2022-06-30 11:03:39 +01:00
|
|
|
if (l == h)
|
|
|
|
break;
|
2020-11-10 20:54:29 +01:00
|
|
|
if (included_patches[m] < n)
|
|
|
|
h = m;
|
|
|
|
else
|
|
|
|
l = m + 1;
|
|
|
|
}
|
2004-06-13 20:20:40 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
2016-01-30 21:29:58 +01:00
|
|
|
ex_version(exarg_T *eap)
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Ignore a ":version 9.99" command.
|
|
|
|
*/
|
|
|
|
if (*eap->arg == NUL)
|
|
|
|
{
|
|
|
|
msg_putchar('\n');
|
|
|
|
list_version();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-20 22:01:41 +02:00
|
|
|
/*
|
|
|
|
* Output a string for the version message. If it's going to wrap, output a
|
|
|
|
* newline, unless the message is too long to fit on the screen anyway.
|
|
|
|
* When "wrap" is TRUE wrap the string in [].
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
version_msg_wrap(char_u *s, int wrap)
|
|
|
|
{
|
2021-10-02 11:26:51 +01:00
|
|
|
int len = vim_strsize(s) + (wrap ? 2 : 0);
|
2018-04-20 22:01:41 +02:00
|
|
|
|
|
|
|
if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
|
|
|
|
&& *s != '\n')
|
|
|
|
msg_putchar('\n');
|
|
|
|
if (!got_int)
|
|
|
|
{
|
|
|
|
if (wrap)
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts("[");
|
|
|
|
msg_puts((char *)s);
|
2018-04-20 22:01:41 +02:00
|
|
|
if (wrap)
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts("]");
|
2018-04-20 22:01:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
version_msg(char *s)
|
|
|
|
{
|
|
|
|
version_msg_wrap((char_u *)s, FALSE);
|
|
|
|
}
|
|
|
|
|
2013-02-20 16:47:36 +01:00
|
|
|
/*
|
|
|
|
* List all features aligned in columns, dictionary style.
|
|
|
|
*/
|
|
|
|
static void
|
2016-01-30 21:29:58 +01:00
|
|
|
list_features(void)
|
2018-04-20 22:01:41 +02:00
|
|
|
{
|
|
|
|
list_in_columns((char_u **)features, -1, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* List string items nicely aligned in columns.
|
|
|
|
* When "size" is < 0 then the last entry is marked with NULL.
|
|
|
|
* The entry with index "current" is inclosed in [].
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
list_in_columns(char_u **items, int size, int current)
|
2013-02-20 16:47:36 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int ncol;
|
|
|
|
int nrow;
|
2019-07-23 23:00:08 +02:00
|
|
|
int cur_row = 1;
|
2018-04-20 22:01:41 +02:00
|
|
|
int item_count = 0;
|
2013-02-20 16:47:36 +01:00
|
|
|
int width = 0;
|
2019-01-02 17:26:35 +01:00
|
|
|
#ifdef FEAT_SYN_HL
|
|
|
|
int use_highlight = (items == (char_u **)features);
|
|
|
|
#endif
|
2013-02-20 16:47:36 +01:00
|
|
|
|
2019-12-21 18:47:26 +01:00
|
|
|
// Find the length of the longest item, use that + 1 as the column
|
|
|
|
// width.
|
2018-04-20 22:01:41 +02:00
|
|
|
for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i)
|
2013-02-20 16:47:36 +01:00
|
|
|
{
|
2021-10-02 11:26:51 +01:00
|
|
|
int l = vim_strsize(items[i]) + (i == current ? 2 : 0);
|
2013-02-20 16:47:36 +01:00
|
|
|
|
|
|
|
if (l > width)
|
|
|
|
width = l;
|
2018-04-20 22:01:41 +02:00
|
|
|
++item_count;
|
2013-02-20 16:47:36 +01:00
|
|
|
}
|
|
|
|
width += 1;
|
|
|
|
|
|
|
|
if (Columns < width)
|
|
|
|
{
|
2019-07-27 21:23:45 +02:00
|
|
|
// Not enough screen columns - show one per line
|
2018-09-18 21:51:47 +02:00
|
|
|
for (i = 0; i < item_count; ++i)
|
2013-02-20 16:47:36 +01:00
|
|
|
{
|
2018-04-20 22:01:41 +02:00
|
|
|
version_msg_wrap(items[i], i == current);
|
2019-07-27 21:23:45 +02:00
|
|
|
if (msg_col > 0 && i < item_count - 1)
|
2013-02-20 16:47:36 +01:00
|
|
|
msg_putchar('\n');
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-07-23 23:00:08 +02:00
|
|
|
// The rightmost column doesn't need a separator.
|
|
|
|
// Sacrifice it to fit in one more column if possible.
|
2013-02-26 15:27:23 +01:00
|
|
|
ncol = (int) (Columns + 1) / width;
|
2022-02-03 13:33:03 +00:00
|
|
|
nrow = item_count / ncol + ((item_count % ncol) ? 1 : 0);
|
2013-02-20 16:47:36 +01:00
|
|
|
|
2019-07-27 21:23:45 +02:00
|
|
|
// "i" counts columns then rows. "idx" counts rows then columns.
|
2013-02-20 16:47:36 +01:00
|
|
|
for (i = 0; !got_int && i < nrow * ncol; ++i)
|
|
|
|
{
|
|
|
|
int idx = (i / ncol) + (i % ncol) * nrow;
|
|
|
|
|
2018-04-20 22:01:41 +02:00
|
|
|
if (idx < item_count)
|
2013-02-20 16:47:36 +01:00
|
|
|
{
|
|
|
|
int last_col = (i + 1) % ncol == 0;
|
|
|
|
|
2018-04-20 22:01:41 +02:00
|
|
|
if (idx == current)
|
|
|
|
msg_putchar('[');
|
2019-01-02 17:26:35 +01:00
|
|
|
#ifdef FEAT_SYN_HL
|
|
|
|
if (use_highlight && items[idx][0] == '-')
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts_attr((char *)items[idx], HL_ATTR(HLF_W));
|
2019-01-02 17:26:35 +01:00
|
|
|
else
|
|
|
|
#endif
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts((char *)items[idx]);
|
2018-04-20 22:01:41 +02:00
|
|
|
if (idx == current)
|
|
|
|
msg_putchar(']');
|
2013-02-20 16:47:36 +01:00
|
|
|
if (last_col)
|
|
|
|
{
|
2019-07-23 23:00:08 +02:00
|
|
|
if (msg_col > 0 && cur_row < nrow)
|
2013-02-20 16:47:36 +01:00
|
|
|
msg_putchar('\n');
|
2019-07-23 23:00:08 +02:00
|
|
|
++cur_row;
|
2013-02-20 16:47:36 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (msg_col % width)
|
|
|
|
msg_putchar(' ');
|
|
|
|
}
|
|
|
|
}
|
2019-07-25 21:52:39 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// this row is out of items, thus at the end of the row
|
2019-07-27 21:23:45 +02:00
|
|
|
if (msg_col > 0)
|
|
|
|
{
|
|
|
|
if (cur_row < nrow)
|
|
|
|
msg_putchar('\n');
|
|
|
|
++cur_row;
|
|
|
|
}
|
2019-07-25 21:52:39 +02:00
|
|
|
}
|
2013-02-20 16:47:36 +01:00
|
|
|
}
|
|
|
|
}
|
2013-02-26 11:25:33 +01:00
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
void
|
2016-01-30 21:29:58 +01:00
|
|
|
list_version(void)
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int first;
|
|
|
|
char *s = "";
|
|
|
|
|
|
|
|
/*
|
|
|
|
* When adding features here, don't forget to update the list of
|
|
|
|
* internal variables in eval.c!
|
|
|
|
*/
|
2018-06-23 16:12:21 +02:00
|
|
|
init_longVersion();
|
2019-01-19 17:43:09 +01:00
|
|
|
msg(longVersion);
|
2019-02-17 17:44:42 +01:00
|
|
|
#ifdef MSWIN
|
|
|
|
# ifdef FEAT_GUI_MSWIN
|
2019-04-28 19:46:49 +02:00
|
|
|
# ifdef VIMDLL
|
|
|
|
# ifdef _WIN64
|
|
|
|
msg_puts(_("\nMS-Windows 64-bit GUI/console version"));
|
|
|
|
# else
|
|
|
|
msg_puts(_("\nMS-Windows 32-bit GUI/console version"));
|
|
|
|
# endif
|
2016-10-12 14:20:24 +02:00
|
|
|
# else
|
2019-04-28 19:46:49 +02:00
|
|
|
# ifdef _WIN64
|
|
|
|
msg_puts(_("\nMS-Windows 64-bit GUI version"));
|
|
|
|
# else
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("\nMS-Windows 32-bit GUI version"));
|
2019-04-28 19:46:49 +02:00
|
|
|
# endif
|
2004-06-13 20:20:40 +00:00
|
|
|
# endif
|
2019-02-17 17:44:42 +01:00
|
|
|
# ifdef FEAT_OLE
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_(" with OLE support"));
|
2019-02-17 17:44:42 +01:00
|
|
|
# endif
|
2004-06-13 20:20:40 +00:00
|
|
|
# else
|
2008-06-20 14:32:41 +00:00
|
|
|
# ifdef _WIN64
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("\nMS-Windows 64-bit console version"));
|
2008-06-20 14:32:41 +00:00
|
|
|
# else
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("\nMS-Windows 32-bit console version"));
|
2008-06-20 14:32:41 +00:00
|
|
|
# endif
|
2004-06-13 20:20:40 +00:00
|
|
|
# endif
|
|
|
|
#endif
|
2017-10-28 21:11:06 +02:00
|
|
|
#if defined(MACOS_X)
|
|
|
|
# if defined(MACOS_X_DARWIN)
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("\nmacOS version"));
|
2017-10-28 21:11:06 +02:00
|
|
|
# else
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("\nmacOS version w/o darwin feat."));
|
2004-06-13 20:20:40 +00:00
|
|
|
# endif
|
2020-12-21 13:05:57 +01:00
|
|
|
# if defined(__arm64__)
|
|
|
|
msg_puts(" - arm64");
|
|
|
|
# elif defined(__x86_64__)
|
|
|
|
msg_puts(" - x86_64");
|
|
|
|
# endif
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef VMS
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("\nOpenVMS version"));
|
2006-11-28 16:43:58 +00:00
|
|
|
# ifdef HAVE_PATHDEF
|
|
|
|
if (*compiled_arch != NUL)
|
|
|
|
{
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(" - ");
|
|
|
|
msg_puts((char *)compiled_arch);
|
2006-11-28 16:43:58 +00:00
|
|
|
}
|
|
|
|
# endif
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
2019-12-21 18:47:26 +01:00
|
|
|
// Print the list of patch numbers if there is at least one.
|
|
|
|
// Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45"
|
2004-06-13 20:20:40 +00:00
|
|
|
if (included_patches[0] != 0)
|
|
|
|
{
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("\nIncluded patches: "));
|
2004-06-13 20:20:40 +00:00
|
|
|
first = -1;
|
2021-06-02 13:28:16 +02:00
|
|
|
i = (int)ARRAY_LENGTH(included_patches) - 1;
|
2004-06-13 20:20:40 +00:00
|
|
|
while (--i >= 0)
|
|
|
|
{
|
|
|
|
if (first < 0)
|
|
|
|
first = included_patches[i];
|
|
|
|
if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)
|
|
|
|
{
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(s);
|
2004-06-13 20:20:40 +00:00
|
|
|
s = ", ";
|
|
|
|
msg_outnum((long)first);
|
|
|
|
if (first != included_patches[i])
|
|
|
|
{
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts("-");
|
2004-06-13 20:20:40 +00:00
|
|
|
msg_outnum((long)included_patches[i]);
|
|
|
|
}
|
|
|
|
first = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-21 18:47:26 +01:00
|
|
|
// Print the list of extra patch descriptions if there is at least one.
|
2008-11-30 11:15:09 +00:00
|
|
|
if (extra_patches[0] != NULL)
|
|
|
|
{
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("\nExtra patches: "));
|
2008-11-30 11:15:09 +00:00
|
|
|
s = "";
|
|
|
|
for (i = 0; extra_patches[i] != NULL; ++i)
|
|
|
|
{
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(s);
|
2008-11-30 11:15:09 +00:00
|
|
|
s = ", ";
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(extra_patches[i]);
|
2008-11-30 11:15:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef MODIFIED_BY
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts("\n");
|
|
|
|
msg_puts(_("Modified by "));
|
|
|
|
msg_puts(MODIFIED_BY);
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_PATHDEF
|
|
|
|
if (*compiled_user != NUL || *compiled_sys != NUL)
|
|
|
|
{
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("\nCompiled "));
|
2004-06-13 20:20:40 +00:00
|
|
|
if (*compiled_user != NUL)
|
|
|
|
{
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("by "));
|
|
|
|
msg_puts((char *)compiled_user);
|
2004-06-13 20:20:40 +00:00
|
|
|
}
|
|
|
|
if (*compiled_sys != NUL)
|
|
|
|
{
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts("@");
|
|
|
|
msg_puts((char *)compiled_sys);
|
2004-06-13 20:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-04-05 14:18:44 +01:00
|
|
|
#if defined(FEAT_HUGE)
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("\nHuge version "));
|
2022-04-05 14:18:44 +01:00
|
|
|
#elif defined(FEAT_NORMAL)
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("\nNormal version "));
|
2022-04-05 14:18:44 +01:00
|
|
|
#else
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("\nTiny version "));
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
2022-04-05 14:18:44 +01:00
|
|
|
#if !defined(FEAT_GUI)
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("without GUI."));
|
2022-04-05 14:18:44 +01:00
|
|
|
#elif defined(FEAT_GUI_GTK)
|
|
|
|
# if defined(USE_GTK3)
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("with GTK3 GUI."));
|
2022-04-05 14:18:44 +01:00
|
|
|
# elif defined(FEAT_GUI_GNOME)
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("with GTK2-GNOME GUI."));
|
2022-04-05 14:18:44 +01:00
|
|
|
# else
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("with GTK2 GUI."));
|
2016-02-23 17:14:37 +01:00
|
|
|
# endif
|
2022-04-05 14:18:44 +01:00
|
|
|
#elif defined(FEAT_GUI_MOTIF)
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("with X11-Motif GUI."));
|
2022-04-05 14:18:44 +01:00
|
|
|
#elif defined(FEAT_GUI_HAIKU)
|
2020-02-26 16:16:53 +01:00
|
|
|
msg_puts(_("with Haiku GUI."));
|
2022-04-05 14:18:44 +01:00
|
|
|
#elif defined(FEAT_GUI_PHOTON)
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("with Photon GUI."));
|
2022-04-05 14:18:44 +01:00
|
|
|
#elif defined(MSWIN)
|
2019-01-19 17:43:09 +01:00
|
|
|
msg_puts(_("with GUI."));
|
2004-06-13 20:20:40 +00:00
|
|
|
#endif
|
|
|
|
version_msg(_(" Features included (+) or not (-):\n"));
|
|
|
|
|
2013-02-20 16:47:36 +01:00
|
|
|
list_features();
|
2019-07-26 19:48:19 +02:00
|
|
|
if (msg_col > 0)
|
|
|
|
msg_putchar('\n');
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
#ifdef SYS_VIMRC_FILE
|
|
|
|
version_msg(_(" system vimrc file: \""));
|
|
|
|
version_msg(SYS_VIMRC_FILE);
|
|
|
|
version_msg("\"\n");
|
|
|
|
#endif
|
|
|
|
#ifdef USR_VIMRC_FILE
|
|
|
|
version_msg(_(" user vimrc file: \""));
|
|
|
|
version_msg(USR_VIMRC_FILE);
|
|
|
|
version_msg("\"\n");
|
|
|
|
#endif
|
|
|
|
#ifdef USR_VIMRC_FILE2
|
|
|
|
version_msg(_(" 2nd user vimrc file: \""));
|
|
|
|
version_msg(USR_VIMRC_FILE2);
|
|
|
|
version_msg("\"\n");
|
|
|
|
#endif
|
|
|
|
#ifdef USR_VIMRC_FILE3
|
|
|
|
version_msg(_(" 3rd user vimrc file: \""));
|
|
|
|
version_msg(USR_VIMRC_FILE3);
|
|
|
|
version_msg("\"\n");
|
|
|
|
#endif
|
|
|
|
#ifdef USR_EXRC_FILE
|
|
|
|
version_msg(_(" user exrc file: \""));
|
|
|
|
version_msg(USR_EXRC_FILE);
|
|
|
|
version_msg("\"\n");
|
|
|
|
#endif
|
|
|
|
#ifdef USR_EXRC_FILE2
|
|
|
|
version_msg(_(" 2nd user exrc file: \""));
|
|
|
|
version_msg(USR_EXRC_FILE2);
|
|
|
|
version_msg("\"\n");
|
|
|
|
#endif
|
|
|
|
#ifdef FEAT_GUI
|
|
|
|
# ifdef SYS_GVIMRC_FILE
|
|
|
|
version_msg(_(" system gvimrc file: \""));
|
|
|
|
version_msg(SYS_GVIMRC_FILE);
|
|
|
|
version_msg("\"\n");
|
|
|
|
# endif
|
|
|
|
version_msg(_(" user gvimrc file: \""));
|
|
|
|
version_msg(USR_GVIMRC_FILE);
|
|
|
|
version_msg("\"\n");
|
|
|
|
# ifdef USR_GVIMRC_FILE2
|
|
|
|
version_msg(_("2nd user gvimrc file: \""));
|
|
|
|
version_msg(USR_GVIMRC_FILE2);
|
|
|
|
version_msg("\"\n");
|
|
|
|
# endif
|
|
|
|
# ifdef USR_GVIMRC_FILE3
|
|
|
|
version_msg(_("3rd user gvimrc file: \""));
|
|
|
|
version_msg(USR_GVIMRC_FILE3);
|
|
|
|
version_msg("\"\n");
|
|
|
|
# endif
|
|
|
|
#endif
|
2016-07-28 22:24:15 +02:00
|
|
|
version_msg(_(" defaults file: \""));
|
|
|
|
version_msg(VIM_DEFAULTS_FILE);
|
|
|
|
version_msg("\"\n");
|
2004-06-13 20:20:40 +00:00
|
|
|
#ifdef FEAT_GUI
|
|
|
|
# ifdef SYS_MENU_FILE
|
|
|
|
version_msg(_(" system menu file: \""));
|
|
|
|
version_msg(SYS_MENU_FILE);
|
|
|
|
version_msg("\"\n");
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_PATHDEF
|
|
|
|
if (*default_vim_dir != NUL)
|
|
|
|
{
|
|
|
|
version_msg(_(" fall-back for $VIM: \""));
|
|
|
|
version_msg((char *)default_vim_dir);
|
|
|
|
version_msg("\"\n");
|
|
|
|
}
|
|
|
|
if (*default_vimruntime_dir != NUL)
|
|
|
|
{
|
|
|
|
version_msg(_(" f-b for $VIMRUNTIME: \""));
|
|
|
|
version_msg((char *)default_vimruntime_dir);
|
|
|
|
version_msg("\"\n");
|
|
|
|
}
|
|
|
|
version_msg(_("Compilation: "));
|
|
|
|
version_msg((char *)all_cflags);
|
|
|
|
version_msg("\n");
|
|
|
|
#ifdef VMS
|
|
|
|
if (*compiler_version != NUL)
|
|
|
|
{
|
|
|
|
version_msg(_("Compiler: "));
|
|
|
|
version_msg((char *)compiler_version);
|
|
|
|
version_msg("\n");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
version_msg(_("Linking: "));
|
|
|
|
version_msg((char *)all_lflags);
|
|
|
|
#endif
|
|
|
|
#ifdef DEBUG
|
|
|
|
version_msg("\n");
|
|
|
|
version_msg(_(" DEBUG BUILD"));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2016-01-29 22:47:03 +01:00
|
|
|
static void do_intro_line(int row, char_u *mesg, int add_version, int attr);
|
2020-04-05 18:56:05 +02:00
|
|
|
static void intro_message(int colon);
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2013-07-04 22:31:03 +02:00
|
|
|
/*
|
|
|
|
* Show the intro message when not editing a file.
|
|
|
|
*/
|
|
|
|
void
|
2016-01-30 21:29:58 +01:00
|
|
|
maybe_intro_message(void)
|
2013-07-04 22:31:03 +02:00
|
|
|
{
|
2017-03-12 18:23:53 +01:00
|
|
|
if (BUFEMPTY()
|
2013-07-04 22:31:03 +02:00
|
|
|
&& curbuf->b_fname == NULL
|
|
|
|
&& firstwin->w_next == NULL
|
|
|
|
&& vim_strchr(p_shm, SHM_INTRO) == NULL)
|
|
|
|
intro_message(FALSE);
|
|
|
|
}
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
/*
|
|
|
|
* Give an introductory message about Vim.
|
|
|
|
* Only used when starting Vim on an empty file, without a file name.
|
|
|
|
* Or with the ":intro" command (for Sven :-).
|
|
|
|
*/
|
2020-04-05 18:56:05 +02:00
|
|
|
static void
|
2016-01-30 21:29:58 +01:00
|
|
|
intro_message(
|
2019-12-21 18:47:26 +01:00
|
|
|
int colon) // TRUE for ":intro"
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int row;
|
|
|
|
int blanklines;
|
|
|
|
int sponsor;
|
|
|
|
char *p;
|
|
|
|
static char *(lines[]) =
|
|
|
|
{
|
|
|
|
N_("VIM - Vi IMproved"),
|
|
|
|
"",
|
|
|
|
N_("version "),
|
|
|
|
N_("by Bram Moolenaar et al."),
|
|
|
|
#ifdef MODIFIED_BY
|
|
|
|
" ",
|
|
|
|
#endif
|
|
|
|
N_("Vim is open source and freely distributable"),
|
|
|
|
"",
|
|
|
|
N_("Help poor children in Uganda!"),
|
|
|
|
N_("type :help iccf<Enter> for information "),
|
|
|
|
"",
|
|
|
|
N_("type :q<Enter> to exit "),
|
|
|
|
N_("type :help<Enter> or <F1> for on-line help"),
|
2022-06-23 20:46:27 +01:00
|
|
|
N_("type :help version9<Enter> for version info"),
|
2004-06-13 20:20:40 +00:00
|
|
|
NULL,
|
|
|
|
"",
|
|
|
|
N_("Running in Vi compatible mode"),
|
|
|
|
N_("type :set nocp<Enter> for Vim defaults"),
|
|
|
|
N_("type :help cp-default<Enter> for info on this"),
|
|
|
|
};
|
|
|
|
#ifdef FEAT_GUI
|
|
|
|
static char *(gui_lines[]) =
|
|
|
|
{
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
#ifdef MODIFIED_BY
|
|
|
|
NULL,
|
|
|
|
#endif
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
N_("menu Help->Orphans for information "),
|
|
|
|
NULL,
|
|
|
|
N_("Running modeless, typed text is inserted"),
|
|
|
|
N_("menu Edit->Global Settings->Toggle Insert Mode "),
|
|
|
|
N_(" for two modes "),
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
N_("menu Edit->Global Settings->Toggle Vi Compatible"),
|
|
|
|
N_(" for Vim defaults "),
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2019-12-21 18:47:26 +01:00
|
|
|
// blanklines = screen height - # message lines
|
2021-06-02 13:28:16 +02:00
|
|
|
blanklines = (int)Rows - (ARRAY_LENGTH(lines) - 1);
|
2004-06-13 20:20:40 +00:00
|
|
|
if (!p_cp)
|
2019-12-21 18:47:26 +01:00
|
|
|
blanklines += 4; // add 4 for not showing "Vi compatible" message
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2019-12-21 18:47:26 +01:00
|
|
|
// Don't overwrite a statusline. Depends on 'cmdheight'.
|
2004-06-13 20:20:40 +00:00
|
|
|
if (p_ls > 1)
|
|
|
|
blanklines -= Rows - topframe->fr_height;
|
|
|
|
if (blanklines < 0)
|
|
|
|
blanklines = 0;
|
|
|
|
|
2019-12-21 18:47:26 +01:00
|
|
|
// Show the sponsor and register message one out of four times, the Uganda
|
|
|
|
// message two out of four times.
|
2005-12-22 22:47:02 +00:00
|
|
|
sponsor = (int)time(NULL);
|
2004-06-13 20:20:40 +00:00
|
|
|
sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
|
|
|
|
|
2019-12-21 18:47:26 +01:00
|
|
|
// start displaying the message lines after half of the blank lines
|
2004-06-13 20:20:40 +00:00
|
|
|
row = blanklines / 2;
|
|
|
|
if ((row >= 2 && Columns >= 50) || colon)
|
|
|
|
{
|
2021-06-02 13:28:16 +02:00
|
|
|
for (i = 0; i < (int)ARRAY_LENGTH(lines); ++i)
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
|
|
|
p = lines[i];
|
|
|
|
#ifdef FEAT_GUI
|
|
|
|
if (p_im && gui.in_use && gui_lines[i] != NULL)
|
|
|
|
p = gui_lines[i];
|
|
|
|
#endif
|
|
|
|
if (p == NULL)
|
|
|
|
{
|
|
|
|
if (!p_cp)
|
|
|
|
break;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (sponsor != 0)
|
|
|
|
{
|
|
|
|
if (strstr(p, "children") != NULL)
|
|
|
|
p = sponsor < 0
|
|
|
|
? N_("Sponsor Vim development!")
|
|
|
|
: N_("Become a registered Vim user!");
|
|
|
|
else if (strstr(p, "iccf") != NULL)
|
|
|
|
p = sponsor < 0
|
|
|
|
? N_("type :help sponsor<Enter> for information ")
|
|
|
|
: N_("type :help register<Enter> for information ");
|
|
|
|
else if (strstr(p, "Orphans") != NULL)
|
|
|
|
p = N_("menu Help->Sponsor/Register for information ");
|
|
|
|
}
|
|
|
|
if (*p != NUL)
|
|
|
|
do_intro_line(row, (char_u *)_(p), i == 2, 0);
|
|
|
|
++row;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-21 18:47:26 +01:00
|
|
|
// Make the wait-return message appear just below the text.
|
2004-06-13 20:20:40 +00:00
|
|
|
if (colon)
|
|
|
|
msg_row = row;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-01-30 21:29:58 +01:00
|
|
|
do_intro_line(
|
|
|
|
int row,
|
|
|
|
char_u *mesg,
|
|
|
|
int add_version,
|
|
|
|
int attr)
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
|
|
|
char_u vers[20];
|
|
|
|
int col;
|
|
|
|
char_u *p;
|
|
|
|
int l;
|
|
|
|
int clen;
|
|
|
|
#ifdef MODIFIED_BY
|
|
|
|
# define MODBY_LEN 150
|
|
|
|
char_u modby[MODBY_LEN];
|
|
|
|
|
|
|
|
if (*mesg == ' ')
|
|
|
|
{
|
2008-01-05 12:59:22 +00:00
|
|
|
vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1);
|
2016-06-01 20:31:43 +02:00
|
|
|
l = (int)STRLEN(modby);
|
2008-01-05 12:59:22 +00:00
|
|
|
vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);
|
2004-06-13 20:20:40 +00:00
|
|
|
mesg = modby;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-12-21 18:47:26 +01:00
|
|
|
// Center the message horizontally.
|
2004-06-13 20:20:40 +00:00
|
|
|
col = vim_strsize(mesg);
|
|
|
|
if (add_version)
|
|
|
|
{
|
|
|
|
STRCPY(vers, mediumVersion);
|
|
|
|
if (highest_patch())
|
|
|
|
{
|
2019-12-21 18:47:26 +01:00
|
|
|
// Check for 9.9x or 9.9xx, alpha/beta version
|
2024-01-04 21:19:04 +01:00
|
|
|
if (SAFE_isalpha((int)vers[3]))
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
2024-01-04 21:19:04 +01:00
|
|
|
int len = (SAFE_isalpha((int)vers[4])) ? 5 : 4;
|
2012-03-07 18:03:10 +01:00
|
|
|
sprintf((char *)vers + len, ".%d%s", highest_patch(),
|
|
|
|
mediumVersion + len);
|
2004-06-13 20:20:40 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
sprintf((char *)vers + 3, ".%d", highest_patch());
|
|
|
|
}
|
|
|
|
col += (int)STRLEN(vers);
|
|
|
|
}
|
|
|
|
col = (Columns - col) / 2;
|
|
|
|
if (col < 0)
|
|
|
|
col = 0;
|
|
|
|
|
2019-12-21 18:47:26 +01:00
|
|
|
// Split up in parts to highlight <> items differently.
|
2004-06-13 20:20:40 +00:00
|
|
|
for (p = mesg; *p != NUL; p += l)
|
|
|
|
{
|
|
|
|
clen = 0;
|
|
|
|
for (l = 0; p[l] != NUL
|
|
|
|
&& (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)
|
|
|
|
{
|
|
|
|
if (has_mbyte)
|
|
|
|
{
|
|
|
|
clen += ptr2cells(p + l);
|
2005-08-10 21:07:57 +00:00
|
|
|
l += (*mb_ptr2len)(p + l) - 1;
|
2004-06-13 20:20:40 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
clen += byte2cells(p[l]);
|
|
|
|
}
|
2017-03-16 17:23:31 +01:00
|
|
|
screen_puts_len(p, l, row, col, *p == '<' ? HL_ATTR(HLF_8) : attr);
|
2004-06-13 20:20:40 +00:00
|
|
|
col += clen;
|
|
|
|
}
|
|
|
|
|
2019-12-21 18:47:26 +01:00
|
|
|
// Add the version number to the version line.
|
2004-06-13 20:20:40 +00:00
|
|
|
if (add_version)
|
|
|
|
screen_puts(vers, row, col, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ":intro": clear screen, display intro screen and wait for return.
|
|
|
|
*/
|
|
|
|
void
|
2016-01-30 21:29:58 +01:00
|
|
|
ex_intro(exarg_T *eap UNUSED)
|
2004-06-13 20:20:40 +00:00
|
|
|
{
|
|
|
|
screenclear();
|
|
|
|
intro_message(TRUE);
|
|
|
|
wait_return(TRUE);
|
|
|
|
}
|