comparison src/ex_cmds.c @ 16021:5417a7f802ff v8.1.1016

patch 8.1.1016: MS-Windows: No color in shell when using "!" in 'guioptions commit https://github.com/vim/vim/commit/049ca59236d5a981f23cf5dfe40f54536fe7cad2 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 17 16:59:44 2019 +0100 patch 8.1.1016: MS-Windows: No color in shell when using "!" in 'guioptions Problem: MS-Windows: No color in shell when using "!" in 'guioptions. Solution: Don't stop termcap when using a terminal window for the shell. (vim-jp, closes #4117)
author Bram Moolenaar <Bram@vim.org>
date Sun, 17 Mar 2019 17:00:13 +0100
parents f581167d59bf
children 9994c50f7879
comparison
equal deleted inserted replaced
16020:9c0e120c9fe3 16021:5417a7f802ff
1540 #ifndef FEAT_GUI_MSWIN 1540 #ifndef FEAT_GUI_MSWIN
1541 int save_nwr; 1541 int save_nwr;
1542 #endif 1542 #endif
1543 #ifdef MSWIN 1543 #ifdef MSWIN
1544 int winstart = FALSE; 1544 int winstart = FALSE;
1545 int keep_termcap = FALSE;
1545 #endif 1546 #endif
1546 1547
1547 /* 1548 /*
1548 * Disallow shell commands for "rvim". 1549 * Disallow shell commands for "rvim".
1549 * Disallow shell commands from .exrc and .vimrc in current directory for 1550 * Disallow shell commands from .exrc and .vimrc in current directory for
1555 return; 1556 return;
1556 } 1557 }
1557 1558
1558 #ifdef MSWIN 1559 #ifdef MSWIN
1559 /* 1560 /*
1560 * Check if ":!start" is used. 1561 * Check if ":!start" is used. This implies not stopping termcap mode.
1561 */ 1562 */
1562 if (cmd != NULL) 1563 if (cmd != NULL)
1563 winstart = (STRNICMP(cmd, "start ", 6) == 0); 1564 keep_termcap = winstart = (STRNICMP(cmd, "start ", 6) == 0);
1565
1566 # if defined(FEAT_GUI) && defined(FEAT_TERMINAL)
1567 // Don't stop termcap mode when using a terminal window for the shell.
1568 if (gui.in_use && vim_strchr(p_go, GO_TERMINAL) != NULL)
1569 keep_termcap = TRUE;
1570 # endif
1564 #endif 1571 #endif
1565 1572
1566 /* 1573 /*
1567 * For autocommands we want to get the output on the current screen, to 1574 * For autocommands we want to get the output on the current screen, to
1568 * avoid having to type return below. 1575 * avoid having to type return below.
1569 */ 1576 */
1570 msg_putchar('\r'); /* put cursor at start of line */ 1577 msg_putchar('\r'); // put cursor at start of line
1571 if (!autocmd_busy) 1578 if (!autocmd_busy)
1572 { 1579 {
1573 #ifdef MSWIN 1580 #ifdef MSWIN
1574 if (!winstart) 1581 if (!keep_termcap)
1575 #endif 1582 #endif
1576 stoptermcap(); 1583 stoptermcap();
1577 } 1584 }
1578 #ifdef MSWIN 1585 #ifdef MSWIN
1579 if (!winstart) 1586 if (!winstart)
1580 #endif 1587 #endif
1581 msg_putchar('\n'); /* may shift screen one line up */ 1588 msg_putchar('\n'); // may shift screen one line up
1582 1589
1583 /* warning message before calling the shell */ 1590 // warning message before calling the shell
1584 if (p_warn && !autocmd_busy && msg_silent == 0) 1591 if (p_warn && !autocmd_busy && msg_silent == 0)
1585 FOR_ALL_BUFFERS(buf) 1592 FOR_ALL_BUFFERS(buf)
1586 if (bufIsChangedNotTerm(buf)) 1593 if (bufIsChangedNotTerm(buf))
1587 { 1594 {
1588 #ifdef FEAT_GUI_MSWIN 1595 #ifdef FEAT_GUI_MSWIN
1589 if (!winstart) 1596 if (!keep_termcap)
1590 starttermcap(); /* don't want a message box here */ 1597 starttermcap(); // don't want a message box here
1591 #endif 1598 #endif
1592 msg_puts(_("[No write since last change]\n")); 1599 msg_puts(_("[No write since last change]\n"));
1593 #ifdef FEAT_GUI_MSWIN 1600 #ifdef FEAT_GUI_MSWIN
1594 if (!winstart) 1601 if (!keep_termcap)
1595 stoptermcap(); 1602 stoptermcap();
1596 #endif 1603 #endif
1597 break; 1604 break;
1598 } 1605 }
1599 1606
1600 /* This windgoto is required for when the '\n' resulted in a "delete line 1607 // This windgoto is required for when the '\n' resulted in a "delete line
1601 * 1" command to the terminal. */ 1608 // 1" command to the terminal.
1602 if (!swapping_screen()) 1609 if (!swapping_screen())
1603 windgoto(msg_row, msg_col); 1610 windgoto(msg_row, msg_col);
1604 cursor_on(); 1611 cursor_on();
1605 (void)call_shell(cmd, SHELL_COOKED | flags); 1612 (void)call_shell(cmd, SHELL_COOKED | flags);
1606 did_check_timestamps = FALSE; 1613 did_check_timestamps = FALSE;
1630 * to read before redrawing, so call wait_return(). 1637 * to read before redrawing, so call wait_return().
1631 */ 1638 */
1632 #ifndef FEAT_GUI_MSWIN 1639 #ifndef FEAT_GUI_MSWIN
1633 if (cmd == NULL 1640 if (cmd == NULL
1634 # ifdef MSWIN 1641 # ifdef MSWIN
1635 || (winstart && !need_wait_return) 1642 || (keep_termcap && !need_wait_return)
1636 # endif 1643 # endif
1637 ) 1644 )
1638 { 1645 {
1639 if (msg_silent == 0) 1646 if (msg_silent == 0)
1640 redraw_later_clear(); 1647 redraw_later_clear();
1657 no_wait_return = save_nwr; 1664 no_wait_return = save_nwr;
1658 } 1665 }
1659 #endif /* FEAT_GUI_MSWIN */ 1666 #endif /* FEAT_GUI_MSWIN */
1660 1667
1661 #ifdef MSWIN 1668 #ifdef MSWIN
1662 if (!winstart) /* if winstart==TRUE, never stopped termcap! */ 1669 if (!keep_termcap) // if keep_termcap is TRUE didn't stop termcap
1663 #endif 1670 #endif
1664 starttermcap(); /* start termcap if not done by wait_return() */ 1671 starttermcap(); // start termcap if not done by wait_return()
1665 1672
1666 /* 1673 /*
1667 * In an Amiga window redrawing is caused by asking the window size. 1674 * In an Amiga window redrawing is caused by asking the window size.
1668 * If we got an interrupt this will not work. The chance that the 1675 * If we got an interrupt this will not work. The chance that the
1669 * window size is wrong is very small, but we need to redraw the 1676 * window size is wrong is very small, but we need to redraw the