static bool
auto_enable_urls ()
{
-#ifdef __MINGW32__
- return false;
-#else
const char *term, *colorterm;
/* First check the terminal is capable of printing color escapes,
if (!should_colorize ())
return false;
+#ifdef __MINGW32__
+ HANDLE handle;
+ DWORD mode;
+
+ handle = GetStdHandle (STD_ERROR_HANDLE);
+ if ((handle == INVALID_HANDLE_VALUE) || (handle == NULL))
+ return false;
+
+ /* If ansi escape sequences aren't supported by the console, then URLs will
+ print mangled from mingw_ansi_fputs's console API translation. It wouldn't
+ be useful even if this weren't the case. */
+ if (GetConsoleMode (handle, &mode) && !(mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING))
+ return false;
+#endif
+
/* xfce4-terminal is known to not implement URLs at this time.
Recently new installations (0.8) will safely ignore the URL escape
sequences, but a large number of legacy installations (0.6.3) print
return false;
return true;
-#endif
}
/* Determine if URLs should be enabled, based on RULE,