mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	| @@ -13,6 +13,7 @@ | |||||||
| #include "nvim/memory.h" | #include "nvim/memory.h" | ||||||
| #include "nvim/message.h" | #include "nvim/message.h" | ||||||
| #include "nvim/option.h" | #include "nvim/option.h" | ||||||
|  | #include "nvim/os/os.h" | ||||||
| #include "nvim/tui/terminfo.h" | #include "nvim/tui/terminfo.h" | ||||||
| #include "nvim/tui/terminfo_defs.h" | #include "nvim/tui/terminfo_defs.h" | ||||||
|  |  | ||||||
| @@ -33,6 +34,24 @@ bool terminfo_is_term_family(const char *term, const char *family) | |||||||
|     && ('\0' == term[flen] || '-' == term[flen]); |     && ('\0' == term[flen] || '-' == term[flen]); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | bool terminfo_is_bsd_console(const char *term) | ||||||
|  | { | ||||||
|  | #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \ | ||||||
|  |   || defined(__DragonFly__) | ||||||
|  |   if (strequal(term, "vt220")         // OpenBSD | ||||||
|  |       || strequal(term, "vt100")) {   // NetBSD | ||||||
|  |     return true; | ||||||
|  |   } | ||||||
|  | # if defined(__FreeBSD__) | ||||||
|  |   // FreeBSD console sets TERM=xterm, but it does not support xterm features | ||||||
|  |   // like cursor-shaping. Assume that TERM=xterm is degraded. #8644 | ||||||
|  |   return strequal(term, "xterm") && !!os_getenv("XTERM_VERSION"); | ||||||
|  | # endif | ||||||
|  | #else | ||||||
|  |   return false; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
| /// Loads a built-in terminfo db when we (unibilium) failed to load a terminfo | /// Loads a built-in terminfo db when we (unibilium) failed to load a terminfo | ||||||
| /// record from the environment (termcap systems, unrecognized $TERM, …). | /// record from the environment (termcap systems, unrecognized $TERM, …). | ||||||
| /// We do not attempt to detect xterm pretenders here. | /// We do not attempt to detect xterm pretenders here. | ||||||
|   | |||||||
| @@ -1477,6 +1477,7 @@ static void patch_terminfo_bugs(TUIData *data, const char *term, | |||||||
|     || terminfo_is_term_family(term, "nsterm"); |     || terminfo_is_term_family(term, "nsterm"); | ||||||
|   bool kitty = terminfo_is_term_family(term, "xterm-kitty"); |   bool kitty = terminfo_is_term_family(term, "xterm-kitty"); | ||||||
|   bool linuxvt = terminfo_is_term_family(term, "linux"); |   bool linuxvt = terminfo_is_term_family(term, "linux"); | ||||||
|  |   bool bsdvt = terminfo_is_bsd_console(term); | ||||||
|   bool rxvt = terminfo_is_term_family(term, "rxvt"); |   bool rxvt = terminfo_is_term_family(term, "rxvt"); | ||||||
|   bool teraterm = terminfo_is_term_family(term, "teraterm"); |   bool teraterm = terminfo_is_term_family(term, "teraterm"); | ||||||
|   bool putty = terminfo_is_term_family(term, "putty"); |   bool putty = terminfo_is_term_family(term, "putty"); | ||||||
| @@ -1497,7 +1498,7 @@ static void patch_terminfo_bugs(TUIData *data, const char *term, | |||||||
|     && strstr(colorterm, "gnome-terminal"); |     && strstr(colorterm, "gnome-terminal"); | ||||||
|   bool mate_pretending_xterm = xterm && colorterm |   bool mate_pretending_xterm = xterm && colorterm | ||||||
|     && strstr(colorterm, "mate-terminal"); |     && strstr(colorterm, "mate-terminal"); | ||||||
|   bool true_xterm = xterm && !!xterm_version; |   bool true_xterm = xterm && !!xterm_version && !bsdvt; | ||||||
|  |  | ||||||
|   char *fix_normal = (char *)unibi_get_str(ut, unibi_cursor_normal); |   char *fix_normal = (char *)unibi_get_str(ut, unibi_cursor_normal); | ||||||
|   if (fix_normal) { |   if (fix_normal) { | ||||||
| @@ -1670,7 +1671,7 @@ static void patch_terminfo_bugs(TUIData *data, const char *term, | |||||||
|   if (-1 == data->unibi_ext.set_cursor_style) { |   if (-1 == data->unibi_ext.set_cursor_style) { | ||||||
|     // DECSCUSR (cursor shape) is widely supported. |     // DECSCUSR (cursor shape) is widely supported. | ||||||
|     // https://github.com/gnachman/iTerm2/pull/92 |     // https://github.com/gnachman/iTerm2/pull/92 | ||||||
|     if ((!konsolev || konsolev >= 180770) |     if ((!bsdvt && (!konsolev || konsolev >= 180770)) | ||||||
|         && ((xterm && !vte_version)  // anything claiming xterm compat |         && ((xterm && !vte_version)  // anything claiming xterm compat | ||||||
|             // per MinTTY 0.4.3-1 release notes from 2009 |             // per MinTTY 0.4.3-1 release notes from 2009 | ||||||
|             || putty |             || putty | ||||||
| @@ -1754,7 +1755,10 @@ static void augment_terminfo(TUIData *data, const char *term, | |||||||
|                              long konsolev, bool iterm_env) |                              long konsolev, bool iterm_env) | ||||||
| { | { | ||||||
|   unibi_term *ut = data->ut; |   unibi_term *ut = data->ut; | ||||||
|   bool xterm = terminfo_is_term_family(term, "xterm"); |   bool xterm = terminfo_is_term_family(term, "xterm") | ||||||
|  |     // Treat Terminal.app as generic xterm-like, for now. | ||||||
|  |     || terminfo_is_term_family(term, "nsterm"); | ||||||
|  |   bool bsdvt = terminfo_is_bsd_console(term); | ||||||
|   bool dtterm = terminfo_is_term_family(term, "dtterm"); |   bool dtterm = terminfo_is_term_family(term, "dtterm"); | ||||||
|   bool rxvt = terminfo_is_term_family(term, "rxvt"); |   bool rxvt = terminfo_is_term_family(term, "rxvt"); | ||||||
|   bool teraterm = terminfo_is_term_family(term, "teraterm"); |   bool teraterm = terminfo_is_term_family(term, "teraterm"); | ||||||
| @@ -1770,7 +1774,7 @@ static void augment_terminfo(TUIData *data, const char *term, | |||||||
|   bool iterm_pretending_xterm = xterm && iterm_env; |   bool iterm_pretending_xterm = xterm && iterm_env; | ||||||
|  |  | ||||||
|   const char *xterm_version = os_getenv("XTERM_VERSION"); |   const char *xterm_version = os_getenv("XTERM_VERSION"); | ||||||
|   bool true_xterm = xterm && !!xterm_version; |   bool true_xterm = xterm && !!xterm_version && !bsdvt; | ||||||
|  |  | ||||||
|   // Only define this capability for terminal types that we know understand it. |   // Only define this capability for terminal types that we know understand it. | ||||||
|   if (dtterm         // originated this extension |   if (dtterm         // originated this extension | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Justin M. Keyes
					Justin M. Keyes