diff -Nru vim-8.0.1453/debian/changelog vim-8.0.1766/debian/changelog --- vim-8.0.1453/debian/changelog 2018-05-03 13:09:33.000000000 +0000 +++ vim-8.0.1766/debian/changelog 2018-06-05 21:42:14.000000000 +0000 @@ -1,3 +1,51 @@ +vim (2:8.0.1766-1ubuntu1) cosmic; urgency=medium + + * Merge with Debian; remaining changes: + - debian/runtime/vimrc: + + "syntax on" is a sane default for non-tiny vim. + - debian/patches/debian/ubuntu-grub-syntax.patch: + + Add Ubuntu-specific "quiet" keyword. + - debian/patches/debian/update-upstart-syntax.patch: + + Add setuid and setgid to syntax file. + - debian/patches/ubuntu-series-support.patch: + + Drop vivid, wily, and yakkety, and zesty. + + Add bionic and cosmic. + - debian/patches/ubuntu-mouse-off.patch: + + Mouse mode is actively harmful in some chroots. + + -- Adam Conrad Tue, 05 Jun 2018 15:42:14 -0600 + +vim (2:8.0.1766-1) unstable; urgency=medium + + [ David Rabel ] + * d/copyright: Fix path to tee.c + + [ upstream ] + * 8.0.1477: Avoid cursor flicker when changing (de)focusing the terminal. + (Closes: #890642) + * 8.0.1491: New 'pumwidth' option allows controlling the width of the popup + menu. (Closes: #450481) + * 8.0.1744: Skip Test_writefile_sync_dev_stdout when /dev/stdout isn't + writable. (Closes: #894565) + * syntax/config.vim: Fix highlighting matching paren for AC_MSG_* syntax + items. (Closes: #881654) + * syntax/debcontrol.vim: Recognize Testsuite and Testsuite-Triggers fields. + (Closes: #886230) + * syntax/sh.vim: Do not highlight substring processing as an error for POSIX + sh. (Closes: #885938) + + [ James McCoy ] + * watch: Track git tags instead of major releases + * Declare compliance with Policy 4.1.4, no changes needed + * control: Use 11~ for minimum debhelper version to ease backporting + * rules: + + Fold config.mk handling into autoconf-stamp target + + Use C.UTF-8 locale when running tests to avoid an upstream bug in the + tests. When not run in a UTF-8 locale, a child Vim used by the tests + displays some unicode characters incorrectly, breaking the test. + + -- James McCoy Thu, 26 Apr 2018 22:08:08 -0400 + vim (2:8.0.1453-1ubuntu3) cosmic; urgency=medium * No-change rebuild for ncurses soname changes. diff -Nru vim-8.0.1453/debian/changelog.upstream vim-8.0.1766/debian/changelog.upstream --- vim-8.0.1453/debian/changelog.upstream 2018-02-02 20:37:32.000000000 +0000 +++ vim-8.0.1766/debian/changelog.upstream 2018-04-27 02:08:08.000000000 +0000 @@ -1477,3 +1477,316 @@ 11285 8.0.1451 difficult to set the python home directories properly 2615 8.0.1452 terminal test fails on some systems 2322 8.0.1453 terminal test fails on some slow terminals + 2035 8.0.1454 when in silent mode too much output is buffered + 7224 8.0.1455 if $SHELL contains a space then 'shell' is incorrect + 1748 8.0.1456 timer test on travis Mac is still flaky + 2209 8.0.1457 clojure now supports a shebang line + 2860 8.0.1458 filetype detection test does not check all scripts + 12936 8.0.1459 cannot handle change of directory + 1883 8.0.1460 (after 8.0.1459) missing file in patch + 2194 8.0.1461 (after 8.0.1459) missing another file in patch + 2026 8.0.1462 (after 8.0.1459) missing yet another file in patch + 1430 8.0.1463 (after 8.0.1459) test fails without 'autochdir' option + 2539 8.0.1464 completing directory after :find does not add slash + 2897 8.0.1465 python2 and python3 detection not tested + 3431 8.0.1466 older GTK versions don't have gtk_entry_get_text_length() + 2805 8.0.1467 libvterm doesn't handle illegal byte sequence correctly + 3755 8.0.1468 illegal memory access in del_bytes() + 13514 8.0.1469 when package path is a symlink 'runtimepath' is wrong + 4847 8.0.1470 integer overflow when using regexp pattern + 1824 8.0.1471 on MS-Windows CursorIM highlighting no longer works + 2264 8.0.1472 MS-Windows: nsis installer is a bit slow + 1703 8.0.1473 MS-Windows: D&D fails between 32 and 64 bit apps + 1960 8.0.1474 Visual C 2017 has multiple MSVCVER numbers + 5965 8.0.1475 invalid memory access in read_redo() + 1924 8.0.1476 screen isn't always updated right away + 7925 8.0.1477 redraw flicker when moving mouse outside of terminal window + 1889 8.0.1478 unnecessary condition + 20824 8.0.1479 insert mode completion state is confusing + 1428 8.0.1480 (after 8.0.1479) patch missing change + 5741 8.0.1481 clearing a pointer takes two lines + 7077 8.0.1482 using feedkeys() does not work to test completion + 1715 8.0.1483 searchpair() might return an invalid value on timeout + 2376 8.0.1484 reduntant conditions + 2381 8.0.1485 weird autocmd may cause arglist to be changed recursively + 2343 8.0.1486 accessing invalid memory with "it" + 1617 8.0.1487 (after 8.0.1486) test 14 fails + 2750 8.0.1488 emacs tags no longer work + 5662 8.0.1489 there is no easy way to get the global directory + 5542 8.0.1490 number of spell regions is spread out through the code + 7383 8.0.1491 the minimum width of the popup menu is hard coded + 2175 8.0.1492 memory leak in balloon_split() + 8925 8.0.1493 completion items cannot be annotated + 11487 8.0.1494 no autocmd triggered in Insert mode with visible popup menu + 5808 8.0.1495 having 'pumwidth' default to zero has no merit + 85726 8.0.1496 clearing a pointer takes two lines + 11296 8.0.1497 getting the jump list requires parsing the output of :jumps + 9584 8.0.1498 getjumplist() returns duplicate entries + 1552 8.0.1499 out-of-memory situation not correctly handled + 3041 8.0.1500 possible NULL pointer dereference + 1479 8.0.1501 out-of-memory situation not correctly handled + 2444 8.0.1502 in out-of-memory situation character is not restored + 3183 8.0.1503 access memory beyond end of string + 1954 8.0.1504 Win32: the screen may be cleared on startup + 31021 8.0.1505 debugger can't break on a condition + 1565 8.0.1506 new version of HP NonStop (Tandem) doesn't like a header + 1651 8.0.1507 timer test is a bit flaky + 7496 8.0.1508 the :drop command is not always available + 1774 8.0.1509 (after 8.0.1508) failing drag-n-drop command no longer fails + 7815 8.0.1510 cannot test if a command causes a beep + 16317 8.0.1511 some code for the debugger watch expression is clumsy + 1704 8.0.1512 warning for possibly using NULL pointer + 5925 8.0.1513 the jumplist is not always properly cleaned up + 8338 8.0.1514 getting the list of changes is not easy + 1872 8.0.1515 BufWinEnter event fired when opening hidden terminal + 8482 8.0.1516 errors for job options are not very specific + 1946 8.0.1517 invalid memory acces with pattern using look-behind match + 2520 8.0.1518 error messages suppressed after ":silent! try" + 3239 8.0.1519 getchangelist() does not use argument as bufname() + 2322 8.0.1520 cursor in wrong line when using a WinBar in Terminal window + 1928 8.0.1521 Shift-Tab does not work in a terminal window + 2793 8.0.1522 popup menu is positioned in the wrong place + 40889 8.0.1523 cannot write and read terminal screendumps + 2229 8.0.1524 (after 8.0.1523) compiler warnings for uninitialized vars + 4212 8.0.1525 using :wqa exits even if a job runs in a terminal window + 22552 8.0.1526 no test using a screen dump yet + 1634 8.0.1527 screen dump test fails on MS-Windows + 3078 8.0.1528 dead code found + 1834 8.0.1529 assert_equalfile() does not close file descriptors + 1429 8.0.1530 dump test fails when using a shadow directory + 39989 8.0.1531 cannot use 24 bit colors in MS-Windows console + 4729 8.0.1532 compiler warnings without termguicolors feature + 3450 8.0.1533 libterm doesn't support requesting fg and bg color + 2754 8.0.1534 C syntax test fails when using gvim + 5446 8.0.1535 C syntax test still fails when using gvim + 3141 8.0.1536 quotestar test is flaky when using the GUI + 1729 8.0.1537 xxd does not skip NUL lines when using ebcdic + 2221 8.0.1538 popupmenu is too far left when completion is long + 16942 8.0.1539 no test for the popup menu positioning + 8935 8.0.1540 popup menu positioning fails with longer string + 3867 8.0.1541 synpat_T is taking too much memory + 15839 8.0.1542 terminal screen dump does not include cursor position + 5634 8.0.1543 with 'termguicolors' Normal color doesn't work correctly + 9215 8.0.1544 when using 'termguicolors' SpellBad doesn't show + 1510 8.0.1545 screen dumps not included in distribution + 3333 8.0.1546 using feedkeys() in a terminal may trigger mappings + 4106 8.0.1547 undo in the options window makes it empty + 1791 8.0.1548 screen dump test script not included in distribution + 7551 8.0.1549 various small problems in test files + 23615 8.0.1550 various small problems in source files + 4136 8.0.1551 on Mac 'maxmemtot' is set to a weird value + 4882 8.0.1552 may leak file descriptors when executing job + 23409 8.0.1553 cannot see what digraph is used to insert a character + 8362 8.0.1554 custom plugins loaded with --clean + 1724 8.0.1555 build error for some combination of features + 4155 8.0.1556 may not parse the t_RS response correctly + 2139 8.0.1557 printf() does not work with only one argument + 23458 8.0.1558 no right-click menu in a terminal + 1742 8.0.1559 build failure without GUI + 1791 8.0.1560 build failure without GUI on MS-Windows + 1793 8.0.1561 crash with rust syntax highligting + 14604 8.0.1562 the terminal debugger can't set a breakpoint with the mouse + 8036 8.0.1563 timeout of getwinposx() can be too short +235754 8.0.1564 too many #ifdefs + 2261 8.0.1565 can't build Mac version without GUI + 24857 8.0.1566 too many #ifdefs + 3613 8.0.1567 cannot build Win32 GUI without IME + 1453 8.0.1568 can't build on older Mac, header file is missing + 1583 8.0.1569 warning for uninitialized variable from gcc + 6508 8.0.1570 can't use :popup for a menu in the terminal + 1464 8.0.1571 can't build without GUI + 2315 8.0.1572 Mac: getting memory size doesn't work everywhere + 6160 8.0.1573 getwinpos(1) may cause response to be handled as command + 4650 8.0.1574 show cursor in wrong place when using popup menu + 4448 8.0.1575 crash when using virtual replace + 1677 8.0.1576 Perl VIM::Buffers() does not find every buffer + 2427 8.0.1577 virtual replace test fails on MS-Windows + 5699 8.0.1578 no test for :popup in terminal + 2250 8.0.1579 virtual replace test fails in GUI + 1623 8.0.1580 FEAT_CURSORBIND and FEAT_SCROLLBIND are unused + 2433 8.0.1581 cannot build Win32 GUI without +eval + 4143 8.0.1582 in the MS-Windows console mouse movement is not used + 1569 8.0.1583 using C99 comment + 2100 8.0.1584 using C99 in Mac file gives compiler warning messages + 1829 8.0.1585 enabling beval_term feature in Win32 GUI + 2113 8.0.1586 imactivatefunc does not work on non-GUI Mac + 7224 8.0.1587 inserting from the clipboard doesn't work literally + 2321 8.0.1588 popup menu hangs after typing CTRL-C + 1790 8.0.1589 error for setting 'modifiable' when resetting it + 2980 8.0.1590 padding in list type wastes memory + 2708 8.0.1591 MS-Windows: when reparsing the arguments 'wildignore' matters + 19693 8.0.1592 terminal windows in a session are not properly restored + 29800 8.0.1593 :qall never exits with an active terminal window + 2188 8.0.1594 :confirm qall not tested with active terminal window + 9983 8.0.1595 no autocommand triggered before exiting + 9739 8.0.1596 no autocommand specifically for opening a terminal window + 12646 8.0.1597 autocommand events are not sorted + 11990 8.0.1598 cannot select text in a terminal with the mouse + 3052 8.0.1599 no error message when gdb does not support debugger + 2198 8.0.1600 crash when setting t_Co to zero when 'termguicolors' is set + 1904 8.0.1601 highlight test fails on Win32 + 2743 8.0.1602 crash in parsing JSON + 1614 8.0.1603 cannot build with +terminal but without +menu + 2258 8.0.1604 paste test may fail if $DISPLAY is not set + 5618 8.0.1605 terminal test is a bit flaky + 6238 8.0.1606 singular/plural variants not translated + 2596 8.0.1607 --clean loads user settings from .gvimrc + 4484 8.0.1608 Win32: directx not enabled by default + 35628 8.0.1609 shell commands in the GUI use a dumb terminal + 1816 8.0.1610 cannot build without GUI + 1852 8.0.1611 CTRL-W in system terminal does not go to job + 6624 8.0.1612 need to close terminal after shell stopped + 1651 8.0.1613 warning for unused variable in tiny build + 2085 8.0.1614 "make tags" doesn't include libvterm + 3692 8.0.1615 term_dumpload() does not use the right colors + 4121 8.0.1616 Win32: shell commands in the GUI open a new console + 2889 8.0.1617 Win32: :shell command in the GUI crashes + 1979 8.0.1618 color Grey50 is missing in the compiled-in table + 1856 8.0.1619 Win32 GUI: crash when winpty is not installed + 4096 8.0.1620 reading spell file has no good EOF detection + 1763 8.0.1621 using invalid default value for highlight attribute + 1568 8.0.1622 possible NULL pointer dereference + 4752 8.0.1623 terminal kill tests are flaky + 7333 8.0.1624 options for term_dumpdiff()/term_dumpload() not implemented + 2602 8.0.1625 test_quotestar is flaky when run in GTK GUI + 1613 8.0.1626 compiler warning for possible loss of data + 1641 8.0.1627 compiler warning for visibility attribute not supported + 1454 8.0.1628 channel log doesn't mention exiting + 1601 8.0.1629 Mac: getpagesize() is deprecated + 7132 8.0.1630 trimming white space is not that easy + 1599 8.0.1631 testing with Vim running in terminal is a bit flaky + 1722 8.0.1632 in a terminal dump NUL and space are different + 3093 8.0.1633 a TextChanged autocmd triggers when it is defined + 18286 8.0.1634 the ex_vimgrep() function is too long + 1510 8.0.1635 undefining _POSIX_THREADS causes problems with Python 3 + 2284 8.0.1636 no test for term_dumpload() and term_dumpdiff() + 2384 8.0.1637 no test for term_dumpdiff() options argument + 1692 8.0.1638 popup test fails depending on environment variable + 43093 8.0.1639 libvterm code lags behind master + 1456 8.0.1640 Test_cwd() is flaky + 20844 8.0.1641 job in terminal can't communicate with Vim + 2871 8.0.1642 running Vim in terminal fails with two windows + 2452 8.0.1643 terminal API tests fail + 5701 8.0.1644 terminal API tests still fail + 2618 8.0.1645 test for terminal response to escape sequence may fail + 1739 8.0.1646 MS-Windows: executable contains unreferenced functions + 5981 8.0.1647 terminal API may call any user function + 2823 8.0.1648 resource fork tool doesn't work on Python 3 + 5088 8.0.1649 no completion for argument list commands + 20303 8.0.1650 too many #ifdefs + 5649 8.0.1651 cannot filter :ls output for terminal buffers + 2677 8.0.1652 term_dumpwrite() does not output composing characters + 4767 8.0.1653 screen dump is made too soon + 6388 8.0.1654 warnings for conversion of void to function pointer + 2355 8.0.1655 outdated gdb message in terminal debugger unclear + 4403 8.0.1656 no option to have xxd produce upper case variable names + 1695 8.0.1657 crash when reading a channel + 19674 8.0.1658 xxd capitalize argument not available in long form + 1897 8.0.1659 scroll events not recognized for some xterm emulators + 16349 8.0.1660 the terminal API "drop" command doesn't support options + 2352 8.0.1661 warnings from 64 bit compiler + 4790 8.0.1662 showing dump diff doesn't mention both file names + 1500 8.0.1663 cannot build without multi-byte feature + 1600 8.0.1664 test failure because of not allocating enough space + 3188 8.0.1665 when running a terminal from the GUI 'term' is not useful + 2699 8.0.1666 % argument in ch_log() causes trouble + 1963 8.0.1667 terminal window tests are flaky + 6038 8.0.1668 terminal debugger: can't re-open source code window + 8785 8.0.1669 :vimgrep may add entries to the wrong quickfix list + 1754 8.0.1670 terminal window tests are still a bit flaky + 3794 8.0.1671 crash when passing non-dict argument as env to job_start() + 2303 8.0.1672 error during completion causes command to be cancelled + 1780 8.0.1673 terminal window tests are still a bit flaky + 2512 8.0.1674 libvterm can't handle an OSC string split + 1782 8.0.1675 unused macro argument in libvterm + 4108 8.0.1676 no compiler warning for wrong printf format + 11085 8.0.1677 no compiler warning for wrong format in vim_snprintf() + 3007 8.0.1678 errorformat "%r" implies "%>" + 1639 8.0.1679 compiler warning for printf format + 3600 8.0.1680 memory allocated by libvterm is not profiled + 3265 8.0.1681 the format attribute fails with MinGW + 4361 8.0.1682 auto indenting breaks inserting a block + 6221 8.0.1683 Python upgrade breaks Vim when defining PYTHON_HOME + 1574 8.0.1684 ml_get errors when using terminal window for shell command + 19535 8.0.1685 can't set ANSI colors of a terminal window + 5751 8.0.1686 Python does not work when configuring with specific dir + 1904 8.0.1687 64 bit compiler warnings + 18434 8.0.1688 some macros are used without a semicolon + 6574 8.0.1689 no tests for xxd + 3365 8.0.1690 not easy to run one test with gvim instead of vim + 4183 8.0.1691 xxd test sometimes fails + 5048 8.0.1692 Python may not work when using statically linked library + 1903 8.0.1693 xxd is excluded from coverage statistics + 1690 8.0.1694 terminal API test is a bit flaky + 6338 8.0.1695 xxd test not run on MS-Windows + 1910 8.0.1696 coverage statistics don't work + 8816 8.0.1697 various tests are still a bit flaky + 1913 8.0.1698 coverage statistics don't work on coveralls + 9739 8.0.1699 leftover stuff for Python 1.4 + 1891 8.0.1700 coverage statistics still don't work on coveralls + 5197 8.0.1701 can disable COLOR_EMOJI with MSVC but not MinGW + 1512 8.0.1702 leaking memory when autocommands make quickfix list invalid + 1578 8.0.1703 in the tutor 'showcmd' is not set + 2979 8.0.1704 'backupskip' default doesn't work for Mac + 3012 8.0.1705 when making a vertical split the mode message isn't updated + 3144 8.0.1706 cannot sent CTRL-\ to a terminal window + 2370 8.0.1707 when 'wfh' is set ":bel 10new" scrolls window + 4108 8.0.1708 mkdir with 'p' flag fails on existing directory + 9679 8.0.1709 some non-C89 code may slip through + 2312 8.0.1710 building with Ruby fails + 9142 8.0.1711 term_setsize() is not implemented yet + 7466 8.0.1712 terminal scrollback is not limited + 4642 8.0.1713 terminal debugger doesn't handle arguments + 2876 8.0.1714 term_setsize() does not give an error in a normal buffer + 1618 8.0.1715 terminal buffer can be 1 more than 'terminalscroll' lines + 1783 8.0.1716 test for term_setsize() does not give a good error message + 2700 8.0.1717 C89 check causes too much trouble + 1924 8.0.1718 terminal scrollback test fails on MS-Windows + 8076 8.0.1719 cannot specify which Python executable configure should use + 7718 8.0.1720 when a timer is running a terminal window may not close + 3396 8.0.1721 no test for using the 'termsize' option + 14106 8.0.1722 cannot specify a minimal size for a terminal window + 11869 8.0.1723 using one item array size declaration is misleading + 1882 8.0.1724 declarations cannot be halfway a block + 10242 8.0.1725 terminal debugger doesn't handle command arguments + 2344 8.0.1726 older MSVC doesn't support declarations halfway a block + 15561 8.0.1727 qf_get_properties() function is too long + 1445 8.0.1728 condition always false, useless code + 4510 8.0.1729 no comma after last enum item + 7572 8.0.1730 no configure check for the used C99 features + 2862 8.0.1731 characters deleted on completion + 6775 8.0.1732 crash when terminal API call deletes the buffer + 1602 8.0.1733 incomplete testing for completion fix + 3164 8.0.1734 package directory not added to 'rtp' if prefix matches + 14458 8.0.1735 flexible array member feature not supported by HP-UX + 18191 8.0.1736 check for C99 features is incomplete + 1701 8.0.1737 fchown() used when it is not supported + 8943 8.0.1738 ":args" output is hard to read + 2070 8.0.1739 MS-Windows with msys2 cannot build Ruby statically + 2102 8.0.1740 warning for signed-unsigned incompatibility + 1804 8.0.1741 MS-Windows with msys2 cannot build Ruby statically + 8433 8.0.1742 cannot get a list of all the jobs + 28730 8.0.1743 terminal window options are named inconsistently + 1641 8.0.1744 on some systems /dev/stdout isn't writable + 11649 8.0.1745 build failure on MS-Windows + 2322 8.0.1746 MS-Windows: channel tests fail + 6438 8.0.1747 MS-Windows: term_start() does not set job_info() cmd + 2677 8.0.1748 CmdlineEnter command uses backslash instead of slash + 2574 8.0.1749 VMS: 100% CPU use, redefining mch_open() fails + 2915 8.0.1750 crash when clearing location list in autocommand + 2102 8.0.1751 #ifdef causes bad highlighting + 13220 8.0.1752 qf_set_properties() is to long + 6467 8.0.1753 various warnings from a static analyser + 11291 8.0.1754 ex_helpgrep() is too long + 3970 8.0.1755 MS-Windows: high unicode char received as two utf-16 words + 1844 8.0.1756 GUI: after prompting for a number the mouse shape is wrong + 86726 8.0.1757 unnecessary changes in libvterm + 4384 8.0.1758 open_line() returns TRUE/FALSE for success/failure + 2728 8.0.1759 memory leak from duplicate options + 1762 8.0.1760 wrong number of arguments to vms_read() + 7999 8.0.1761 job in terminal window with no output channel is killed + 14341 8.0.1762 terminal debug logging is a bit complicated + 5638 8.0.1763 :argedit does not reuse an empty unnamed buffer + 1797 8.0.1764 lgtm considers tutor.es to be EcmaScript + 2606 8.0.1765 CTRL-G j in Insert mode is incorrect when 'virtualedit' set + 2264 8.0.1766 expanding abbreviation doesn't work diff -Nru vim-8.0.1453/debian/control vim-8.0.1766/debian/control --- vim-8.0.1453/debian/control 2018-04-10 21:31:58.000000000 +0000 +++ vim-8.0.1766/debian/control 2018-06-05 21:41:47.000000000 +0000 @@ -5,11 +5,11 @@ XSBC-Original-Maintainer: Debian Vim Maintainers Uploaders: James McCoy , -Standards-Version: 4.1.3 +Standards-Version: 4.1.4 Rules-Requires-Root: no Build-Depends: autoconf, - debhelper (>= 11), + debhelper (>= 11~), # SOURCE_DATE_EPOCH provided by pkg-info.mk dpkg-dev (>= 1.18.8), libacl1-dev, diff -Nru vim-8.0.1453/debian/copyright vim-8.0.1766/debian/copyright --- vim-8.0.1453/debian/copyright 2018-02-02 20:37:32.000000000 +0000 +++ vim-8.0.1766/debian/copyright 2018-04-27 02:08:08.000000000 +0000 @@ -76,7 +76,7 @@ Copyright: Copyright (c) 1989-1993 The Regents of the University of California. License: UC -Files: src/tee.c +Files: src/tee/tee.c Copyright: 1996, Paul Slootman License: public-domain diff -Nru vim-8.0.1453/debian/.gitlab-ci.yml vim-8.0.1766/debian/.gitlab-ci.yml --- vim-8.0.1453/debian/.gitlab-ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/debian/.gitlab-ci.yml 2018-04-27 02:08:08.000000000 +0000 @@ -0,0 +1,25 @@ +.build_template: &build + only: + - branches + before_script: + - apt-get -q update + - env DEBIAN_FRONTEND=noninteractive apt-get -q -y -o Debug::pkgProblemResolver=yes build-dep . + - env DEBIAN_FRONTEND=noninteractive apt-get -q -y -o Debug::pkgProblemResolver=yes install --no-install-recommends gitpkg fakeroot + - rm -rf ../deb-packages/vim + - export UPSTREAM_VERSION=$(dpkg-parsechangelog -SVersion | sed -e 's/^[0-9]*://' -e 's/\(.*\)-[^-]*/\1/') + - gitpkg --keep-unpacked-source "$CI_COMMIT_SHA" v"$UPSTREAM_VERSION" + script: + - cd ../deb-packages/vim/vim-"$UPSTREAM_VERSION" + - dpkg-buildpackage -us -uc + +test:unstable: + <<: *build + image: debian:unstable + +test:testing: + <<: *build + image: debian:testing + +test:ubuntu-devel: + <<: *build + image: ubuntu:devel diff -Nru vim-8.0.1453/debian/patches/debian/Detect-the-rst-filetype-using-the-contents-of-the-file.patch vim-8.0.1766/debian/patches/debian/Detect-the-rst-filetype-using-the-contents-of-the-file.patch --- vim-8.0.1453/debian/patches/debian/Detect-the-rst-filetype-using-the-contents-of-the-file.patch 2018-02-02 20:37:32.000000000 +0000 +++ vim-8.0.1766/debian/patches/debian/Detect-the-rst-filetype-using-the-contents-of-the-file.patch 2018-04-27 02:08:08.000000000 +0000 @@ -8,10 +8,10 @@ 1 file changed, 8 insertions(+) diff --git a/runtime/scripts.vim b/runtime/scripts.vim -index 18263e2..d769c98 100644 +index ab66c0c..a755bc7 100644 --- a/runtime/scripts.vim +++ b/runtime/scripts.vim -@@ -348,6 +348,14 @@ else +@@ -356,6 +356,14 @@ else elseif s:line1 =~# 'exec\s\+\S*scheme' || s:line2 =~# 'exec\s\+\S*scheme' set ft=scheme diff -Nru vim-8.0.1453/debian/patches/debian/Document-Debian-s-decision-to-disable-modelines-by-defaul.patch vim-8.0.1766/debian/patches/debian/Document-Debian-s-decision-to-disable-modelines-by-defaul.patch --- vim-8.0.1453/debian/patches/debian/Document-Debian-s-decision-to-disable-modelines-by-defaul.patch 2018-02-02 20:37:32.000000000 +0000 +++ vim-8.0.1766/debian/patches/debian/Document-Debian-s-decision-to-disable-modelines-by-defaul.patch 2018-04-27 02:08:08.000000000 +0000 @@ -15,10 +15,10 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt -index 41f621b..a851dd7 100644 +index b7f9869..b0581c8 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt -@@ -5286,7 +5286,7 @@ A jump table for the options with a short description can be found at |Q_op|. +@@ -5293,7 +5293,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'modeline'* *'ml'* *'nomodeline'* *'noml'* 'modeline' 'ml' boolean (Vim default: on (off for root), diff -Nru vim-8.0.1453/debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch vim-8.0.1766/debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch --- vim-8.0.1453/debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch 2018-02-02 20:37:32.000000000 +0000 +++ vim-8.0.1766/debian/patches/debian/Support-sourcing-a-vimrc.tiny-when-Vim-is-invoked-as-vi.patch 2018-04-27 02:08:08.000000000 +0000 @@ -17,10 +17,10 @@ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c -index e8006c3..27e5949 100644 +index 3b366b5..58df28a 100644 --- a/src/main.c +++ b/src/main.c -@@ -1771,6 +1771,10 @@ parse_command_name(mparm_T *parmp) +@@ -1767,6 +1767,10 @@ parse_command_name(mparm_T *parmp) } else if (STRNICMP(initstr, "vim", 3) == 0) initstr += 3; @@ -31,7 +31,7 @@ /* Catch "[r][g]vimdiff" and "[r][g]viewdiff". */ if (STRICMP(initstr, "diff") == 0) -@@ -3021,7 +3025,12 @@ source_startup_scripts(mparm_T *parmp) +@@ -3009,7 +3013,12 @@ source_startup_scripts(mparm_T *parmp) * Get system wide defaults, if the file name is defined. */ #ifdef SYS_VIMRC_FILE @@ -45,7 +45,7 @@ #endif #ifdef MACOS_X (void)do_source((char_u *)"$VIMRUNTIME/macmap.vim", FALSE, DOSO_NONE); -@@ -3056,6 +3065,9 @@ source_startup_scripts(mparm_T *parmp) +@@ -3044,6 +3053,9 @@ source_startup_scripts(mparm_T *parmp) && do_source((char_u *)USR_EXRC_FILE, FALSE, DOSO_NONE) == FAIL #ifdef USR_EXRC_FILE2 && do_source((char_u *)USR_EXRC_FILE2, FALSE, DOSO_NONE) == FAIL @@ -56,7 +56,7 @@ && !has_dash_c_arg) { diff --git a/src/os_unix.h b/src/os_unix.h -index 695affa..b6e7e59 100644 +index 4146529..465153a 100644 --- a/src/os_unix.h +++ b/src/os_unix.h @@ -213,6 +213,9 @@ typedef struct dsc$descriptor DESC; @@ -70,10 +70,10 @@ # define SYS_VIMRC_FILE "$VIM/vimrc" #endif diff --git a/src/structs.h b/src/structs.h -index 6aaccc5..cce8926 100644 +index 8f35a73..3b23bc2 100644 --- a/src/structs.h +++ b/src/structs.h -@@ -3348,6 +3348,9 @@ typedef struct +@@ -3364,6 +3364,9 @@ typedef struct #ifdef FEAT_DIFF int diff_mode; /* start with 'diff' set */ #endif diff -Nru vim-8.0.1453/debian/patches/series vim-8.0.1766/debian/patches/series --- vim-8.0.1453/debian/patches/series 2018-04-10 21:31:58.000000000 +0000 +++ vim-8.0.1766/debian/patches/series 2018-06-05 21:41:47.000000000 +0000 @@ -3,8 +3,6 @@ debian/Detect-the-rst-filetype-using-the-contents-of-the-file.patch debian/Add-recognition-of-more-LaTeX-commands-for-tex-filetype-d.patch debian/Document-Debian-s-decision-to-disable-modelines-by-defaul.patch -upstream/syntax-deb-source-changelog-.vim-Update-release-names.patch -syntax-debcontrol.vim-Fix-highlighting-of-javascript-Sect.patch ubuntu-grub-syntax.patch update-upstart-syntax.patch ubuntu-mouse-off.patch diff -Nru vim-8.0.1453/debian/patches/syntax-debcontrol.vim-Fix-highlighting-of-javascript-Sect.patch vim-8.0.1766/debian/patches/syntax-debcontrol.vim-Fix-highlighting-of-javascript-Sect.patch --- vim-8.0.1453/debian/patches/syntax-debcontrol.vim-Fix-highlighting-of-javascript-Sect.patch 2018-02-02 20:37:32.000000000 +0000 +++ vim-8.0.1766/debian/patches/syntax-debcontrol.vim-Fix-highlighting-of-javascript-Sect.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -From: James McCoy -Date: Sun, 17 Dec 2017 22:15:58 -0500 -Subject: syntax/debcontrol.vim: Fix highlighting of javascript Section - -When converting to the use of lists instead of long regexps, the -handling of java/javascript was accidentally dropped. - -Signed-off-by: James McCoy ---- - runtime/syntax/debcontrol.vim | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/runtime/syntax/debcontrol.vim b/runtime/syntax/debcontrol.vim -index b879074..0f5d8d1 100644 ---- a/runtime/syntax/debcontrol.vim -+++ b/runtime/syntax/debcontrol.vim -@@ -3,7 +3,7 @@ - " Maintainer: Debian Vim Maintainers - " Former Maintainers: Gerfried Fuchs - " Wichert Akkerman --" Last Change: 2017 Nov 04 -+" Last Change: 2017 Dec 17 - " URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debcontrol.vim - - " Standard syntax initialization -@@ -52,7 +52,7 @@ let s:sections = [ - \, 'devel', 'doc', 'editors', 'education', 'electronics', 'embedded' - \, 'fonts', 'games', 'gnome', 'gnustep', 'gnu-r', 'golang', 'graphics' - \, 'hamradio', 'haskell', 'httpd', 'interpreters', 'introspection' -- \, 'java', 'javascript', 'kde', 'kernel', 'libs', 'libdevel', 'lisp' -+ \, 'java\%(script\)\=', 'kde', 'kernel', 'libs', 'libdevel', 'lisp' - \, 'localization', 'mail', 'math', 'metapackages', 'misc', 'net' - \, 'news', 'ocaml', 'oldlibs', 'otherosfs', 'perl', 'php', 'python' - \, 'ruby', 'rust', 'science', 'shells', 'sound', 'text', 'tex' diff -Nru vim-8.0.1453/debian/patches/upstream/Support-defining-compilation-date-in-SOURCE_DATE_EPOCH.patch vim-8.0.1766/debian/patches/upstream/Support-defining-compilation-date-in-SOURCE_DATE_EPOCH.patch --- vim-8.0.1453/debian/patches/upstream/Support-defining-compilation-date-in-SOURCE_DATE_EPOCH.patch 2018-02-02 20:37:32.000000000 +0000 +++ vim-8.0.1766/debian/patches/upstream/Support-defining-compilation-date-in-SOURCE_DATE_EPOCH.patch 2018-04-27 02:08:08.000000000 +0000 @@ -37,12 +37,12 @@ #undef HAVE_ATTRIBUTE_UNUSED diff --git a/src/configure.ac b/src/configure.ac -index 0883cb7..f844404 100644 +index 7f55281..75e766a 100644 --- a/src/configure.ac +++ b/src/configure.ac -@@ -29,6 +29,16 @@ dnl in autoconf needs it, where it uses STDC_HEADERS. - AC_HEADER_STDC - AC_HEADER_SYS_WAIT +@@ -62,6 +62,16 @@ if test x"$ac_cv_prog_cc_c99" != xno; then + fi + fi +dnl If $SOURCE_DATE_EPOCH is present in the environment, use that as the +dnl "compiled" timestamp in :version's output. Attempt to get the formatted @@ -58,7 +58,7 @@ AC_MSG_CHECKING(--enable-fail-if-missing argument) diff --git a/src/version.c b/src/version.c -index ba65a54..4e176df 100644 +index a18394a..7fa308d 100644 --- a/src/version.c +++ b/src/version.c @@ -44,11 +44,17 @@ make_version(void) diff -Nru vim-8.0.1453/debian/patches/upstream/syntax-deb-source-changelog-.vim-Update-release-names.patch vim-8.0.1766/debian/patches/upstream/syntax-deb-source-changelog-.vim-Update-release-names.patch --- vim-8.0.1453/debian/patches/upstream/syntax-deb-source-changelog-.vim-Update-release-names.patch 2018-02-02 20:37:32.000000000 +0000 +++ vim-8.0.1766/debian/patches/upstream/syntax-deb-source-changelog-.vim-Update-release-names.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -From: James McCoy -Date: Sat, 28 Oct 2017 23:07:40 -0400 -Subject: syntax/deb{source,changelog}.vim: Update release names - -Add new bionic release for Ubuntu. -Move yakkety and squeeze to unsupported. - -Signed-off-by: James McCoy ---- - runtime/syntax/debchangelog.vim | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim -index 6e6ed19..0d3f872 100644 ---- a/runtime/syntax/debchangelog.vim -+++ b/runtime/syntax/debchangelog.vim -@@ -3,7 +3,7 @@ - " Maintainer: Debian Vim Maintainers - " Former Maintainers: Gerfried Fuchs - " Wichert Akkerman --" Last Change: 2017 Apr 23 -+" Last Change: 2017 Oct 26 - " URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debchangelog.vim - - " Standard syntax initialization -@@ -21,7 +21,7 @@ let s:binNMU='binary-only=yes' - syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ " - exe 'syn match debchangelogFirstKV contained "; \('.s:urgency.'\|'.s:binNMU.'\)"' - exe 'syn match debchangelogOtherKV contained ", \('.s:urgency.'\|'.s:binNMU.'\)"' --syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|%(wheezy|jessie)%(-backports%(-sloppy)=|-security)=|stretch%(-backports|-security)=|%(devel|precise|trusty|vivid|wily|xenial|yakkety|zesty|artful)%(-%(security|proposed|updates|backports|commercial|partner))=)+" -+syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|%(wheezy|jessie)%(-backports%(-sloppy)=|-security)=|stretch%(-backports|-security)=|%(devel|precise|trusty|vivid|wily|xenial|yakkety|zesty|artful|bionic)%(-%(security|proposed|updates|backports|commercial|partner))=)+" - syn match debchangelogVersion contained "(.\{-})" - syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*" - syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s*#\d\+\)*" diff -Nru vim-8.0.1453/debian/rules vim-8.0.1766/debian/rules --- vim-8.0.1453/debian/rules 2018-02-02 20:37:32.000000000 +0000 +++ vim-8.0.1766/debian/rules 2018-04-27 02:08:08.000000000 +0000 @@ -207,7 +207,7 @@ build-indep: build-stamp-indep build-stamp-indep: export DH_OPTIONS=-pvim-doc -build-stamp-indep: src/auto/config.mk +build-stamp-indep: autoconf-stamp dh_testdir dh_prep $(MAKE) -C runtime/doc html @@ -227,9 +227,12 @@ $(MAKE) -C src/vim-basic xxd/xxd touch $@ -autoconf-stamp: src/auto/config.mk +autoconf-stamp: dh_testdir [ -f debian/configure.dist ] || cp src/auto/configure debian/configure.dist +# src/Makefile includes src/auto/config.mk, so we need to ensure it exists. +# distclean will then wipe it out and re-copy it. + [ -f src/auto/config.mk ] || cp src/config.mk.dist src/auto/config.mk # The autoconf target generates a new configure, and touches some other # configure-related things. Need to run distclean afterward or timestamps # will be off and the next make that runs will think it needs to run @@ -240,19 +243,10 @@ $(MAKE) distclean touch $@ -# As of 7.3.122, src/auto/config.mk is generated by copying src/config.mk.dist -# but src/Makefile depends on its existence and will automatically run -# configure if it doesn't. So, to not break parallel building (multiple -# top-level configure instances running at once explode, as mentioned in -# autoconf-stamp target), we need to ensure src/auto/config.mk exists before -# running configure. -src/auto/config.mk: - cp src/config.mk.dist src/auto/config.mk - configure-stamp-%: SHADOWDIR=$* # When configure.in is being patched by Debian, autoconf-stamp needs to be a # prerequisite for this target and autoconf needs to be added to Build-Depends -configure-stamp-%: src/auto/config.mk autoconf-stamp +configure-stamp-%: autoconf-stamp dh_testdir @echo "*** DEBIAN *** CONFIGURING VARIANT $*" $(MAKE) -C src shadow SHADOWDIR=$(SHADOWDIR) @@ -269,7 +263,7 @@ @echo "*** DEBIAN *** BUILDING VARIANT $*" $(MAKE) -C src/$(SHADOWDIR) # Ensure $TERM is set to a sane value for testing - [ $(MAKETEST) != "yes" ] || env TERM=xterm $(MAKE) -j1 -C src/$(SHADOWDIR) test + [ $(MAKETEST) != "yes" ] || env LANG=C.UTF-8 TERM=xterm $(MAKE) -j1 -C src/$(SHADOWDIR) test touch $@ install: install-stamp-xxd $(foreach v,$(VARIANTS),install-stamp-$(v)) diff -Nru vim-8.0.1453/debian/watch vim-8.0.1766/debian/watch --- vim-8.0.1453/debian/watch 2018-02-02 20:37:32.000000000 +0000 +++ vim-8.0.1766/debian/watch 2018-04-27 02:08:08.000000000 +0000 @@ -1,3 +1,4 @@ -version=3 -opts=pasv,dversionmangle=s/\.\d+$// \ - ftp://ftp.vim.org/pub/vim/unix/vim-(\d+\.\d+)\.tar\.bz2 +version=4 +opts=filenamemangle=s%(?:.*?)?v(\d[\d.]+)\.tar\.gz%vim-$1.tar.gz% \ + https://github.com/vim/vim/tags \ + (?:.*?)?v(\d[\d.]+)\.tar\.gz diff -Nru vim-8.0.1453/Filelist vim-8.0.1766/Filelist --- vim-8.0.1453/Filelist 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/Filelist 2018-04-26 20:30:33.000000000 +0000 @@ -4,6 +4,7 @@ # source files for all source archives SRC_ALL = \ .hgignore \ + .lgtm.yml \ .travis.yml \ appveyor.yml \ src/appveyor.bat \ @@ -110,6 +111,7 @@ src/testdir/sautest/autoload/*.vim \ src/testdir/runtest.vim \ src/testdir/shared.vim \ + src/testdir/screendump.vim \ src/testdir/view_util.vim \ src/testdir/setup.vim \ src/testdir/gui_init.vim \ @@ -134,6 +136,7 @@ src/testdir/pyxfile/*.py \ src/testdir/bench*.in \ src/testdir/bench*.vim \ + src/testdir/dumps/*.dump \ src/testdir/samples/*.txt \ src/testdir/samples/test000 \ src/testdir/if_ver*.vim \ diff -Nru vim-8.0.1453/.lgtm.yml vim-8.0.1766/.lgtm.yml --- vim-8.0.1453/.lgtm.yml 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/.lgtm.yml 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,4 @@ +# Format of this file: https://lgtm.com/help/lgtm/lgtm.yml-configuration-file +path_classifiers: + documentation: + - runtime/tutor/tutor* diff -Nru vim-8.0.1453/nsis/gvim.nsi vim-8.0.1766/nsis/gvim.nsi --- vim-8.0.1453/nsis/gvim.nsi 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/nsis/gvim.nsi 2018-04-26 20:30:33.000000000 +0000 @@ -89,6 +89,11 @@ UninstPage uninstConfirm UninstPage instfiles +# Reserve files +# Needed for showing the _vimrc setting page faster. +ReserveFile /plugin InstallOptions.dll +ReserveFile vimrc.ini + ########################################################## # Functions @@ -475,14 +480,12 @@ # Display the InstallOptions dialog # Check if a _vimrc should be created - SectionGetFlags ${sec_vimrc_id} $0 - IntOp $0 $0 & 1 - StrCmp $0 "1" +2 0 + SectionGetFlags ${sec_vimrc_id} $3 + IntOp $3 $3 & 1 + StrCmp $3 "1" +2 0 Abort - Push $3 - InstallOptions::dialog "$PLUGINSDIR\vimrc.ini" - Pop $3 + InstallOptions::dialog "$PLUGINSDIR\vimrc.ini" Pop $3 FunctionEnd diff -Nru vim-8.0.1453/runtime/doc/autocmd.txt vim-8.0.1766/runtime/doc/autocmd.txt --- vim-8.0.1453/runtime/doc/autocmd.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/autocmd.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 8.0. Last change: 2018 Jan 31 +*autocmd.txt* For Vim version 8.0. Last change: 2018 Apr 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -21,7 +21,6 @@ 11. Disabling autocommands |autocmd-disable| {Vi does not have any of these commands} -{only when the |+autocmd| feature has not been disabled at compile time} ============================================================================== 1. Introduction *autocmd-intro* @@ -33,7 +32,7 @@ features, such as editing compressed files (see |gzip-example|). The usual place to put autocommands is in your .vimrc or .exrc file. - *E203* *E204* *E143* *E855* *E937* + *E203* *E204* *E143* *E855* *E937* *E952* WARNING: Using autocommands is very powerful, and may lead to unexpected side effects. Be careful not to destroy your text. - It's a good idea to do some testing on an expendable copy of a file first. @@ -57,6 +56,8 @@ Add {cmd} to the list of commands that Vim will execute automatically on {event} for a file matching {pat} |autocmd-patterns|. + Note: A quote character is seen as argument to the + :autocmd and won't start a comment. Vim always adds the {cmd} after existing autocommands, so that the autocommands execute in the order in which they were given. See |autocmd-nested| for [nested]. @@ -92,7 +93,8 @@ that you can easily clear them: > augroup vimrc - autocmd! " Remove all vimrc autocommands + " Remove all vimrc autocommands + autocmd! au BufNewFile,BufRead *.html so :h/html.vim augroup END @@ -146,6 +148,8 @@ plugins, syntax highlighting, etc. :au[tocmd]! [group] Remove ALL autocommands. + Note: a quote will be seen as argument to the :autocmd + and won't start a comment. Warning: You should normally not do this without a group, it breaks plugins, syntax highlighting, etc. @@ -258,6 +262,7 @@ |BufCreate| just after adding a buffer to the buffer list |BufDelete| before deleting a buffer from the buffer list |BufWipeout| before completely deleting a buffer +|TerminalOpen| after a terminal buffer was created |BufFilePre| before changing the name of the current buffer |BufFilePost| after changing the name of the current buffer @@ -286,7 +291,8 @@ |GUIFailed| after starting the GUI failed |TermResponse| after the terminal response to |t_RV| is received -|QuitPre| when using `:quit`, before deciding whether to quit +|QuitPre| when using `:quit`, before deciding whether to exit +|ExitPre| when using a command that may make Vim exit |VimLeavePre| before exiting Vim, before writing the viminfo file |VimLeave| before exiting Vim, after writing the viminfo file @@ -295,6 +301,8 @@ |FileChangedShellPost| After handling a file changed since editing started |FileChangedRO| before making the first change to a read-only file +|DirChanged| after the working directory has changed + |ShellCmdPost| after executing a shell command |ShellFilterPost| after filtering with a shell command @@ -322,6 +330,10 @@ |CmdwinEnter| after entering the command-line window |CmdwinLeave| before leaving the command-line window +|CmdlineChanged| after a change was made to the command-line text +|CmdlineEnter| after the cursor moves to the command line +|CmdlineLeave| before the cursor leaves the command line + |InsertEnter| starting Insert mode |InsertChange| when typing while in Insert or Replace mode |InsertLeave| when leaving Insert mode @@ -330,6 +342,9 @@ |TextChanged| after a change was made to the text in Normal mode |TextChangedI| after a change was made to the text in Insert mode + when popup menu is not visible +|TextChangedP| after a change was made to the text in Insert mode + when popup menu visible |TextYankPost| after text is yanked or deleted |ColorScheme| after loading a color scheme @@ -501,9 +516,9 @@ always define the user command and have it invoke an autoloaded function. See |autoload|. *CmdlineChanged* -CmdlineChanged After a change was made to the text inside - command line. Be careful not to mess up the - command line, it may cause Vim to lock up. +CmdlineChanged After a change was made to the text in the + command line. Be careful not to mess up + the command line, it may cause Vim to lock up. is set to a single character, indicating the type of command-line. |cmdwin-char| @@ -633,6 +648,21 @@ *E881* If the number of lines changes saving for undo may fail and the change will be aborted. + *DirChanged* +DirChanged The working directory has changed in response + to the |:cd| or |:lcd| commands, or as a + result of the 'autochdir' option. + The pattern can be: + "window" to trigger on `:lcd + "global" to trigger on `:cd` + "auto" to trigger on 'autochdir'. + "drop" to trigger on editing a file + is set to the new directory name. + *ExitPre* +ExitPre When using `:quit`, `:wq` in a way it makes + Vim exit, or using `:qall`, just after + |QuitPre|. Can be used to close any + non-essential window. *FileChangedShell* FileChangedShell When Vim notices that the modification time of a file has changed since editing started. @@ -770,7 +800,7 @@ inserted literally. It is not allowed to change the text |textlock|. The event is not triggered when 'paste' is - set. + set. {only with the +eval feature} *InsertEnter* InsertEnter Just before starting Insert mode. Also for Replace mode and Virtual Replace mode. The @@ -848,6 +878,7 @@ or quits Vim. Can be used to close any non-essential window if the current window is the last ordinary window. + Also see |ExitPre|. *RemoteReply* RemoteReply When a reply from a Vim that functions as server was received |server2client()|. The @@ -916,6 +947,7 @@ It is not allowed to change to another buffer, change a buffer name or change directory here. + {only available with the +eval feature} *Syntax* Syntax When the 'syntax' option has been set. The pattern is matched against the syntax name. @@ -942,6 +974,11 @@ for re-loading the syntax file to update the colors, fonts and other terminal-dependent settings. Executed for all loaded buffers. + *TerminalOpen* +TerminalOpen Just after a terminal buffer was created, with + `:terminal` or |term_start()|. This event is + triggered even if the buffer is created + without a window, with the ++hidden option. *TermResponse* TermResponse After the response to |t_RV| is received from the terminal. The value of |v:termresponse| @@ -964,6 +1001,11 @@ current buffer in Insert mode. Not triggered when the popup menu is visible. Otherwise the same as TextChanged. + *TextChangedP* +TextChangedP After a change was made to the text in the + current buffer in Insert mode, only when the + popup menu is visible. Otherwise the same as + TextChanged. *TextYankPost* TextYankPost After text has been yanked or deleted in the current buffer. The following values of @@ -983,10 +1025,15 @@ called recursively. It is not allowed to change the buffer text, see |textlock|. + {only when compiled with the +eval feature} *User* User Never executed automatically. To be used for autocommands that are only executed with ":doautocmd". + Note that when `:doautocmd User MyEvent` is + used while there are no matching autocommands, + you will get an error. If you don't want + that, define a dummy autocommand yourself. *UserGettingBored* UserGettingBored When the user presses the same key 42 times. Just kidding! :-) @@ -1031,9 +1078,10 @@ If the window is for another buffer, Vim executes the BufEnter autocommands after the WinEnter autocommands. - Note: When using ":split fname" the WinEnter - event is triggered after the split but before - the file "fname" is loaded. + Note: For split and tabpage commands the + WinEnter event is triggered after the split + or tab command but before the file is loaded. + *WinLeave* WinLeave Before leaving a window. If the window to be entered next is for a different buffer, Vim diff -Nru vim-8.0.1453/runtime/doc/change.txt vim-8.0.1766/runtime/doc/change.txt --- vim-8.0.1453/runtime/doc/change.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/change.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*change.txt* For Vim version 8.0. Last change: 2017 Feb 12 +*change.txt* For Vim version 8.0. Last change: 2018 Apr 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -533,6 +533,7 @@ If the 'smartindent' option is on, or 'cindent' is on and 'cinkeys' contains '#' with a zero value, shift right does not affect lines starting with '#' (these are supposed to be C preprocessor lines that must stay in column 1). +This can be changed with the 'cino' option, see |cino-#|. When the 'expandtab' option is off (this is the default) Vim uses s as much as possible to make the indent. You can use ">><<" to replace an indent diff -Nru vim-8.0.1453/runtime/doc/channel.txt vim-8.0.1766/runtime/doc/channel.txt --- vim-8.0.1453/runtime/doc/channel.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/channel.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*channel.txt* For Vim version 8.0. Last change: 2017 Aug 11 +*channel.txt* For Vim version 8.0. Last change: 2018 Apr 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -55,7 +55,7 @@ Common combination are: - Using a job connected through pipes in NL mode. E.g., to run a style checker and receive errors and warnings. -- Using a deamon, connecting over a socket in JSON mode. E.g. to lookup +- Using a daemon, connecting over a socket in JSON mode. E.g. to lookup cross-references in a database. ============================================================================== diff -Nru vim-8.0.1453/runtime/doc/develop.txt vim-8.0.1766/runtime/doc/develop.txt --- vim-8.0.1453/runtime/doc/develop.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/develop.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*develop.txt* For Vim version 8.0. Last change: 2017 Jul 31 +*develop.txt* For Vim version 8.0. Last change: 2018 Apr 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -185,9 +185,40 @@ C COMPILER *style-compiler* The minimal C compiler version supported is C89, also known as ANSI C. -Later standards don't add much and C89 is the widest supported. +Later standards, such as C99, are not widely supported, or at least not 100% +supported. Therefore we use only some of the C99 features and disallow some +(at least for now). -One restriction that this implies: no // comments, only /* comments */. +Please don't make changes everywhere to use the C99 features, it causes merge +problems for existing patches. Only use them for new and changed code. + +Comments ~ + +Traditionally Vim uses /* comments */. We intend to keep it that way, +especially for file and function headers. For new code or lines of code that +change, it is allowed to use // comments. Especially when it comes after +code: + int some_var; // single line comment useful here + +Enums ~ + +The last item in an enum may have a trailing comma. C89 didn't allow this. + +Types ~ + +"long long" is allowed and can be expected to be 64 bits. Use %lld in printf +formats. Also "long long unsigned" with %llu. + +Not to be used ~ + +These C99 features are not to be used, because not enough compilers support +them: +- Declaration after Statements (MSVC 2012 does not support it). All + declarations need to be at the start of the block. +- Variable length arrays (even in C11 this is an optional feature). +- _Bool and _Complex types. +- "inline" (it's hardly ever needed, let the optimizer do its work) +- flexible array members: Not supported by HP-UX C compiler (John Marriott) USE OF COMMON FUNCTIONS *style-functions* diff -Nru vim-8.0.1453/runtime/doc/editing.txt vim-8.0.1766/runtime/doc/editing.txt --- vim-8.0.1453/runtime/doc/editing.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/editing.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 8.0. Last change: 2017 Nov 16 +*editing.txt* For Vim version 8.0. Last change: 2018 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -424,6 +424,15 @@ argument, for example: > :next `find . -name ver\\*.c -print` :view `ls -t *.patch \| head -n1` +Vim will run the command in backticks using the 'shell' and use the standard +output as argument for the given Vim command (error messages from the shell +command will be discarded). +To see what shell command Vim is running, set the 'verbose' option to 4. When +the shell command returns a non-zero exit code, an error message will be +displayed and the Vim command will be aborted. To avoid this make the shell +always return zero like so: > + :next `find . -name ver\\*.c -print \|\| true` + The backslashes before the star are required to prevent the shell from expanding "ver*.c" prior to execution of the find program. The backslash before the shell pipe symbol "|" prevents Vim from parsing it as command @@ -650,8 +659,7 @@ There is no check for duplicates, it is possible to add a file to the argument list twice. The currently edited file is not changed. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} Note: you can also use this method: > :args ## x < This will add the "x" item and sort the new list. @@ -665,8 +673,7 @@ when it's deleted from the argument list. Example: > :argdel *.obj -< {not in Vi} {not available when compiled without the - |+listcmds| feature} +< {not in Vi} :[range]argd[elete] Delete the {range} files from the argument list. Example: > @@ -681,8 +688,7 @@ < Removes all the files from the arglist. When the last number in the range is too high, up to the last argument is deleted. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} *:argu* *:argument* :[count]argu[ment] [count] [++opt] [+cmd] @@ -691,16 +697,14 @@ when changes have been made and Vim does not want to |abandon| the current buffer. Also see |++opt| and |+cmd|. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} :[count]argu[ment]! [count] [++opt] [+cmd] Edit file [count] in the argument list, discard any changes to the current buffer. When [count] is omitted the current entry is used. Also see |++opt| and |+cmd|. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} :[count]n[ext] [++opt] [+cmd] *:n* *:ne* *:next* *E165* *E163* Edit [count] next file. This fails when changes have @@ -823,7 +827,6 @@ LOCAL ARGUMENT LIST {not in Vi} -{not available when compiled without the |+windows| or |+listcmds| features} *:arglocal* :argl[ocal] Make a local copy of the global argument list. @@ -875,8 +878,7 @@ autocommand event is disabled by adding it to 'eventignore'. This considerably speeds up editing each file. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} Also see |:windo|, |:tabdo|, |:bufdo|, |:cdo|, |:ldo|, |:cfdo| and |:lfdo| @@ -1202,7 +1204,8 @@ :wqa[ll]! [++opt] :xa[ll]! Write all changed buffers, even the ones that are readonly, and exit Vim. If there are buffers without a file name or - which cannot be written for another reason, Vim will not quit. + which cannot be written for another reason, or there is a + terminal with a running job, Vim will not quit. {not in Vi} ============================================================================== diff -Nru vim-8.0.1453/runtime/doc/eval.txt vim-8.0.1766/runtime/doc/eval.txt --- vim-8.0.1453/runtime/doc/eval.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/eval.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.0. Last change: 2018 Jan 28 +*eval.txt* For Vim version 8.0. Last change: 2018 Apr 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1246,8 +1246,8 @@ *closure* Lambda expressions can access outer scope variables and arguments. This is often called a closure. Example where "i" and "a:arg" are used in a lambda -while they exist in the function scope. They remain valid even after the -function returns: > +while they already exist in the function scope. They remain valid even after +the function returns: > :function Foo(arg) : let i = 3 : return {x -> x + i - a:arg} @@ -1256,7 +1256,10 @@ :echo Bar(6) < 5 -See also |:func-closure|. Lambda and closure support can be checked with: > +Note that the variables must exist in the outer scope before the lamba is +defined for this to work. See also |:func-closure|. + +Lambda and closure support can be checked with: > if has('lambda') Examples for using a lambda expression with |sort()|, |map()| and |filter()|: > @@ -2017,8 +2020,11 @@ arglistid([{winnr} [, {tabnr}]]) Number argument list id argv({nr}) String {nr} entry of the argument list argv() List the argument list +assert_beeps({cmd}) none assert {cmd} causes a beep assert_equal({exp}, {act} [, {msg}]) none assert {exp} is equal to {act} +assert_equalfile({fname-one}, {fname-two}) + none assert file contents is equal assert_exception({error} [, {msg}]) none assert {error} is in v:exception assert_fails({cmd} [, {error}]) none assert {cmd} fails @@ -2151,6 +2157,7 @@ List lines {lnum} to {end} of buffer {expr} getbufvar({expr}, {varname} [, {def}]) any variable {varname} in buffer {expr} +getchangelist({expr}) List list of change list items getchar([expr]) Number get one character from the user getcharmod() Number modifiers for the last typed character getcharsearch() Dict last character search @@ -2167,6 +2174,8 @@ getfsize({fname}) Number size in bytes of file {fname} getftime({fname}) Number last modification time of file getftype({fname}) String description of type of file {fname} +getjumplist([{winnr} [, {tabnr}]]) + List list of jump list items getline({lnum}) String line {lnum} of current buffer getline({lnum}, {end}) List lines {lnum} to {end} of current buffer getloclist({nr} [, {what}]) List list of location list items @@ -2183,8 +2192,9 @@ gettabwinvar({tabnr}, {winnr}, {name} [, {def}]) any {name} in {winnr} in tab page {tabnr} getwininfo([{winid}]) List list of windows -getwinposx() Number X coord in pixels of GUI Vim window -getwinposy() Number Y coord in pixels of GUI Vim window +getwinpos([{timeout}]) List X and Y coord in pixels of the Vim window +getwinposx() Number X coord in pixels of the Vim window +getwinposy() Number Y coord in pixels of the Vim window getwinvar({nr}, {varname} [, {def}]) any variable {varname} in window {nr} glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) @@ -2224,7 +2234,7 @@ isnan({expr}) Number |TRUE| if {expr} is NaN items({dict}) List key-value pairs in {dict} job_getchannel({job}) Channel get the channel handle for {job} -job_info({job}) Dict get information about {job} +job_info([{job}]) Dict get information about {job} job_setoptions({job}, {options}) none set options for {job} job_start({command} [, {options}]) Job start a job @@ -2406,7 +2416,14 @@ tan({expr}) Float tangent of {expr} tanh({expr}) Float hyperbolic tangent of {expr} tempname() String name for a temporary file +term_dumpdiff({filename}, {filename} [, {options}]) + Number display difference between two dumps +term_dumpload({filename} [, {options}]) + Number displaying a screen dump +term_dumpwrite({buf}, {filename} [, {options}]) + none dump terminal window contents term_getaltscreen({buf}) Number get the alternate screen flag +term_getansicolors({buf}) List get ANSI palette in GUI color mode term_getattr({attr}, {what}) Number get the value of attribute {what} term_getcursor({buf}) List get the cursor position of a terminal term_getjob({buf}) Job get the job associated with a terminal @@ -2419,6 +2436,12 @@ term_list() List get the list of terminal buffers term_scrape({buf}, {row}) List get row of a terminal screen term_sendkeys({buf}, {keys}) none send keystrokes to a terminal +term_setansicolors({buf}, {colors}) + none set ANSI palette in GUI color mode +term_setkill({buf}, {how}) none set signal to stop job in terminal +term_setrestore({buf}, {command}) none set command to restore terminal +term_setsize({buf}, {rows}, {cols}) + none set the size of a terminal term_start({cmd}, {options}) Job open a terminal window and run a job term_wait({buf} [, {time}]) Number wait for screen to be updated test_alloc_fail({id}, {countdown}, {repeat}) @@ -2445,6 +2468,7 @@ toupper({expr}) String the String {expr} switched to uppercase tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr} to chars in {tostr} +trim({text}[, {mask}]) String trim characters in {mask} from {text} trunc({expr}) Float truncate Float {expr} type({name}) Number type of variable {name} undofile({name}) String undo file name for {name} @@ -2566,6 +2590,11 @@ < Without the {nr} argument a |List| with the whole |arglist| is returned. +assert_beeps({cmd}) *assert_beeps()* + Run {cmd} and add an error message to |v:errors| if it does + NOT produce a beep or visual bell. + Also see |assert_fails()|. + *assert_equal()* assert_equal({expected}, {actual} [, {msg}]) When {expected} and {actual} are not equal an error message is @@ -2581,6 +2610,14 @@ < Will result in a string to be added to |v:errors|: test.vim line 12: Expected 'foo' but got 'bar' ~ + *assert_equalfile()* +assert_equalfile({fname-one}, {fname-two}) + When the files {fname-one} and {fname-two} do not contain + exactly the same text an error message is added to |v:errors|. + When {fname-one} or {fname-two} does not exist the error will + mention that. + Mainly useful with |terminal-diff|. + assert_exception({error} [, {msg}]) *assert_exception()* When v:exception does not contain the string {error} an error message is added to |v:errors|. @@ -2598,6 +2635,8 @@ Run {cmd} and add an error message to |v:errors| if it does NOT produce an error. When {error} is given it must match in |v:errmsg|. + Note that beeping is not considered an error, and some failing + commands only beep. Use |assert_beeps()| for those. assert_false({actual} [, {msg}]) *assert_false()* When {actual} is not false an error message is added to @@ -3139,8 +3178,8 @@ char2nr("ABC") returns 65 < When {utf8} is omitted or zero, the current 'encoding' is used. Example for "utf-8": > - char2nr("á") returns 225 - char2nr("á"[0]) returns 195 + char2nr("á") returns 225 + char2nr("á"[0]) returns 195 < With {utf8} set to 1, always treat as utf-8 characters. A combining character is a separate character. |nr2char()| does the opposite. @@ -4268,6 +4307,22 @@ :let bufmodified = getbufvar(1, "&mod") :echo "todo myvar = " . getbufvar("todo", "myvar") < +getchangelist({expr}) *getchangelist()* + Returns the |changelist| for the buffer {expr}. For the use + of {expr}, see |bufname()| above. If buffer {expr} doesn't + exist, an empty list is returned. + + The returned list contains two entries: a list with the change + locations and the current position in the list. Each + entry in the change list is a dictionary with the following + entries: + col column number + coladd column offset for 'virtualedit' + lnum line number + If buffer {expr} is the current buffer, then the current + position refers to the position in the list. For other + buffers, it is set to the length of the list. + getchar([expr]) *getchar()* Get a single character from the user or input stream. If [expr] is omitted, wait until a character is available. @@ -4419,6 +4474,7 @@ specifies what for. The following completion types are supported: + arglist file names in argument list augroup autocmd groups buffer buffer names behave :behave suboptions @@ -4484,10 +4540,13 @@ Without arguments, for the current window. With {winnr} return the local current directory of this window - in the current tab page. + in the current tab page. {winnr} can be the window number or + the |window-ID|. + If {winnr} is -1 return the name of the global working + directory. See also |haslocaldir()|. + With {winnr} and {tabnr} return the local current directory of the window in the specified tab page. - {winnr} can be the window number or the |window-ID|. Return an empty string if the arguments are invalid. getfsize({fname}) *getfsize()* @@ -4557,6 +4616,25 @@ "file" are returned. On MS-Windows a symbolic link to a directory returns "dir" instead of "link". +getjumplist([{winnr} [, {tabnr}]]) *getjumplist()* + Returns the |jumplist| for the specified window. + + Without arguments use the current window. + With {winnr} only use this window in the current tab page. + {winnr} can also be a |window-ID|. + With {winnr} and {tabnr} use the window in the specified tab + page. + + The returned list contains two entries: a list with the jump + locations and the last used jump position number in the list. + Each entry in the jump location list is a dictionary with + the following entries: + bufnr buffer number + col column number + coladd column offset for 'virtualedit' + filename filename if available + lnum line number + *getline()* getline({lnum} [, {end}]) Without {end} the result is a String, which is line {lnum} @@ -4810,16 +4888,36 @@ :let list_is_on = gettabwinvar(1, 2, '&list') :echo "myvar = " . gettabwinvar(3, 1, 'myvar') < +getwinpos([{timeout}]) *getwinpos()* + The result is a list with two numbers, the result of + getwinposx() and getwinposy() combined: + [x-pos, y-pos] + {timeout} can be used to specify how long to wait in msec for + a response from the terminal. When omitted 100 msec is used. + Use a longer time for a remote terminal. + When using a value less than 10 and no response is received + within that time, a previously reported position is returned, + if available. This can be used to poll for the position and + do some work in the mean time: > + while 1 + let res = getwinpos(1) + if res[0] >= 0 + break + endif + " Do some work here + endwhile +< *getwinposx()* getwinposx() The result is a Number, which is the X coordinate in pixels of the left hand side of the GUI Vim window. Also works for an - xterm. + xterm (uses a timeout of 100 msec). The result will be -1 if the information is not available. The value can be used with `:winpos`. *getwinposy()* getwinposy() The result is a Number, which is the Y coordinate in pixels of - the top of the GUI Vim window. Also works for an xterm. + the top of the GUI Vim window. Also works for an xterm (uses + a timeout of 100 msec). The result will be -1 if the information is not available. The value can be used with `:winpos`. @@ -5933,8 +6031,6 @@ < Matches added by |matchaddpos()| are returned by |getmatches()| with an entry "pos1", "pos2", etc., with the value a list like the {pos} item. - These matches cannot be set via |setmatches()|, however they - can still be deleted by |clearmatches()|. matcharg({nr}) *matcharg()* Selects the {nr} match item, as set with a |:match|, @@ -6044,6 +6140,8 @@ Example: > :call mkdir($HOME . "/tmp/foo/bar", "p", 0700) < This function is not available in the |sandbox|. + There is no error if the directory already exists and the "p" + flag is passed (since patch 8.0.1708). Not available on all systems. To check use: > :if exists("*mkdir") < @@ -6120,31 +6218,6 @@ characters. nr2char(0) is a real NUL and terminates the string, thus results in an empty string. -option_restore({list}) *option_restore()* - Restore options previously saved by option_save(). - When buffer-local options have been saved, this function must - be called when the same buffer is the current buffer. - When window-local options have been saved, this function must - be called when the same window is the current window. - When in the wrong buffer and/or window an error is given and - the local options won't be restored. - NOT IMPLEMENTED YET! - -option_save({list}) *option_save()* - Saves the options named in {list}. The returned value can be - passed to option_restore(). Example: > - let s:saved_options = option_save([ - \ 'ignorecase', - \ 'iskeyword', - \ ]) - au BufLeave * - \ call option_restore(s:saved_options) -< The advantage over using `:let` is that global and local - values are handled and the script ID is restored, so that - `:verbose set` will show where the option was originally set, - not where it was restored. - NOT IMPLEMENTED YET! - or({expr}, {expr}) *or()* Bitwise OR on the two arguments. The arguments are converted to a number. A List, Dict or Float argument causes an error. @@ -6523,7 +6596,7 @@ between (not at the end), like with join(expr, "\n"). If {idvar} is present and not empty, it is taken as the name of a variable and a {serverid} for later use with - remote_read() is stored there. + |remote_read()| is stored there. If {timeout} is given the read times out after this many seconds. Otherwise a timeout of 600 seconds is used. See also |clientserver| |RemoteReply|. @@ -8087,12 +8160,88 @@ For MS-Windows forward slashes are used when the 'shellslash' option is set or when 'shellcmdflag' starts with '-'. + *term_dumpdiff()* +term_dumpdiff({filename}, {filename} [, {options}]) + Open a new window displaying the difference between the two + files. The files must have been created with + |term_dumpwrite()|. + Returns the buffer number or zero when the diff fails. + Also see |terminal-diff|. + NOTE: this does not work with double-width characters yet. + + The top part of the buffer contains the contents of the first + file, the bottom part of the buffer contains the contents of + the second file. The middle part shows the differences. + The parts are separated by a line of dashes. + + If the {options} argument is present, it must be a Dict with + these possible members: + "term_name" name to use for the buffer name, instead + of the first file name. + "term_rows" vertical size to use for the terminal, + instead of using 'termwinsize' + "term_cols" horizontal size to use for the terminal, + instead of using 'termwinsize' + "vertical" split the window vertically + "curwin" use the current window, do not split the + window; fails if the current buffer + cannot be |abandon|ed + "norestore" do not add the terminal window to a + session file + + Each character in the middle part indicates a difference. If + there are multiple differences only the first in this list is + used: + X different character + w different width + f different foreground color + b different background color + a different attribute + + missing position in first file + - missing position in second file + + Using the "s" key the top and bottom parts are swapped. This + makes it easy to spot a difference. + + *term_dumpload()* +term_dumpload({filename} [, {options}]) + Open a new window displaying the contents of {filename} + The file must have been created with |term_dumpwrite()|. + Returns the buffer number or zero when it fails. + Also see |terminal-diff|. + + For {options} see |term_dumpdiff()|. + + *term_dumpwrite()* +term_dumpwrite({buf}, {filename} [, {options}]) + Dump the contents of the terminal screen of {buf} in the file + {filename}. This uses a format that can be used with + |term_dumpload()| and |term_dumpdiff()|. + If {filename} already exists an error is given. *E953* + Also see |terminal-diff|. + + {options} is a dictionary with these optional entries: + "rows" maximum number of rows to dump + "columns" maximum number of columns to dump + term_getaltscreen({buf}) *term_getaltscreen()* Returns 1 if the terminal of {buf} is using the alternate screen. {buf} is used as with |term_getsize()|. {only available when compiled with the |+terminal| feature} +term_getansicolors({buf}) *term_getansicolors()* + Get the ANSI color palette in use by terminal {buf}. + Returns a List of length 16 where each element is a String + representing a color in hexadecimal "#rrggbb" format. + Also see |term_setansicolors()| and |g:terminal_ansi_colors|. + If neither was used returns the default colors. + + {buf} is used as with |term_getsize()|. If the buffer does not + exist or is not a terminal window, an empty list is returned. + {only available when compiled with the |+terminal| feature and + with GUI enabled and/or the |+termguicolors| feature} + term_getattr({attr}, {what}) *term_getattr()* Given {attr}, a value returned by term_scrape() in the "attr" item, return whether {what} is on. {what} can be one of: @@ -8137,6 +8286,8 @@ The first line has {row} one. When {row} is "." the cursor line is used. When {row} is invalid an empty string is returned. + + To get attributes of each character use |term_scrape()|. {only available when compiled with the |+terminal| feature} term_getscrolled({buf}) *term_getscrolled()* @@ -8222,8 +8373,68 @@ means the character CTRL-X. {only available when compiled with the |+terminal| feature} -term_setsize({buf}, {expr}) *term_setsize()* - Not implemented yet. +term_setansicolors({buf}, {colors}) *term_setansicolors()* + Set the ANSI color palette used by terminal {buf}. + {colors} must be a List of 16 valid color names or hexadecimal + color codes, like those accepted by |highlight-guifg|. + Also see |term_getansicolors()| and |g:terminal_ansi_colors|. + + The colors normally are: + 0 black + 1 dark red + 2 dark green + 3 brown + 4 dark blue + 5 dark magenta + 6 dark cyan + 7 light grey + 8 dark grey + 9 red + 10 green + 11 yellow + 12 blue + 13 magenta + 14 cyan + 15 white + + These colors are used in the GUI and in the terminal when + 'termguicolors' is set. When not using GUI colors (GUI mode + or 'termguicolors'), the terminal window always uses the 16 + ANSI colors of the underlying terminal. + {only available when compiled with the |+terminal| feature and + with GUI enabled and/or the |+termguicolors| feature} + +term_setkill({buf}, {how}) *term_setkill()* + When exiting Vim or trying to close the terminal window in + another way, {how} defines whether the job in the terminal can + be stopped. + When {how} is empty (the default), the job will not be + stopped, trying to exit will result in |E947|. + Otherwise, {how} specifies what signal to send to the job. + See |job_stop()| for the values. + + After sending the signal Vim will wait for up to a second to + check that the job actually stopped. + +term_setrestore({buf}, {command}) *term_setrestore()* + Set the command to write in a session file to restore the job + in this terminal. The line written in the session file is: > + terminal ++curwin ++cols=%d ++rows=%d {command} +< Make sure to escape the command properly. + + Use an empty {command} to run 'shell'. + Use "NONE" to not restore this window. + {only available when compiled with the |+terminal| feature} + +term_setsize({buf}, {rows}, {cols}) *term_setsize()* *E955* + Set the size of terminal {buf}. The size of the window + containing the terminal will also be adjusted, if possible. + If {rows} or {cols} is zero or negative, that dimension is not + changed. + + {buf} must be the buffer number of a terminal window. Use an + empty string for the current buffer. If the buffer does not + exist or is not a terminal window, an error is given. {only available when compiled with the |+terminal| feature} term_start({cmd}, {options}) *term_start()* @@ -8257,14 +8468,18 @@ "term_name" name to use for the buffer name, instead of the command name. "term_rows" vertical size to use for the terminal, - instead of using 'termsize' + instead of using 'termwinsize' "term_cols" horizontal size to use for the terminal, - instead of using 'termsize' + instead of using 'termwinsize' "vertical" split the window vertically "curwin" use the current window, do not split the window; fails if the current buffer cannot be |abandon|ed "hidden" do not open a window + "norestore" do not add the terminal window to a + session file + "term_kill" what to do when trying to close the + terminal window, see |term_setkill()| "term_finish" What to do when the job is finished: "close": close any windows "open": open window if needed @@ -8280,6 +8495,9 @@ CTRL-D is used on MS-Windows. For Python use CTRL-Z or "exit()". For a shell use "exit". A CR is always added. + "ansi_colors" A list of 16 color names or hex codes + defining the ANSI palette used in GUI + color modes. See |g:terminal_ansi_colors|. {only available when compiled with the |+terminal| feature} @@ -8478,6 +8696,22 @@ echo tr("", "<>", "{}") < returns "{blob}" +trim({text}[, {mask}]) *trim()* + Return {text} as a String where any character in {mask} is + removed from the beginning and end of {text}. + If {mask} is not given, {mask} is all characters up to 0x20, + which includes Tab, space, NL and CR, plus the non-breaking + space character 0xa0. + This code deals with multibyte characters properly. + + Examples: > + echo trim(" some text ") +< returns "some text" > + echo trim(" \r\t\t\r RESERVE \t\n\x0B\xA0") . "_TAIL" +< returns "RESERVE_TAIL" > + echo trim("rmX>rrm", "rm<>") +< returns "Xrm<>X" (characters in the middle are not removed) + trunc({expr}) *trunc()* Return the largest integral value with magnitude less than or equal to {expr} as a |Float| (truncate towards zero). @@ -9056,6 +9290,8 @@ unix Unix version of Vim. *+unix* unnamedplus Compiled with support for "unnamedplus" in 'clipboard' user_commands User-defined commands. +vcon Win32: Virtual console support is working, can use + 'termguicolors'. Also see |+vtp|. vertsplit Compiled with vertically split windows |:vsplit|. vim_starting True while initial source'ing takes place. |startup| *vim_starting* @@ -9066,6 +9302,8 @@ |blockwise-operators|. vms VMS version of Vim. vreplace Compiled with |gR| and |gr| commands. +vtp Compiled for vcon support |+vtp| (check vcon to find + out if it works in the current console). wildignore Compiled with 'wildignore' option. wildmenu Compiled with 'wildmenu' option. win32 Win32 version of Vim (MS-Windows 95 and later, 32 or @@ -9304,8 +9542,7 @@ It is also possible to define a function without any arguments. You must still supply the () then. -It is allowed to define another function inside a function -body. +It is allowed to define another function inside a function body. *local-variables* Inside a function local variables can be used. These will disappear when the diff -Nru vim-8.0.1453/runtime/doc/filetype.txt vim-8.0.1766/runtime/doc/filetype.txt --- vim-8.0.1453/runtime/doc/filetype.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/filetype.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*filetype.txt* For Vim version 8.0. Last change: 2017 Dec 05 +*filetype.txt* For Vim version 8.0. Last change: 2018 Apr 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -319,6 +319,10 @@ Note that the last one is the value of $VIMRUNTIME which has been expanded. +Note that when using a plugin manager or |packages| many directories will be +added to 'runtimepath'. These plugins earch require their own directory, +don't put them directly in ~/.vim/plugin. + What if it looks like your plugin is not being loaded? You can find out what happens when Vim starts up by using the |-V| argument: > @@ -602,51 +606,17 @@ The :Man command allows you to turn Vim into a manpager (that syntax highlights manpages and follows linked manpages on hitting CTRL-]). -Tested on: - - - Linux - - Mac OS - - FreeBSD - - OpenBSD - - Cygwin - - Win 10 under Bash - -Untested: - - - Amiga OS - - BeOS - - OS/2 - -If man sets the $MAN_PN environment variable, like man-db, the most common -implementation on Linux, then the "env MAN_PN=1 " part below should NOT be -set, that is, the "env MAN_PN=1" should be omitted! Otherwise, the Vim -manpager does not correctly recognize manpages whose title contains a capital -letter. See the discussion on - - https://groups.google.com/forum/#!topic/vim_dev/pWZmt_7GkxI - For bash,zsh,ksh or dash, add to the config file (.bashrc,.zshrc, ...) - export MANPAGER="env MAN_PN=1 vim -M +MANPAGER -" + export MANPAGER="vim -M +MANPAGER -" For (t)csh, add to the config file - setenv MANPAGER "env MAN_PN=1 vim -M +MANPAGER -" + setenv MANPAGER "vim -M +MANPAGER -" For fish, add to the config file - set -x MANPAGER "env MAN_PN=1 vim -M +MANPAGER -" - -On OpenBSD: - - export MANPAGER="env MAN_PN=1 vim -M +MANPAGER" - -If you experience still issues on manpages whose titles do not contain capital -letters, then try adding MANPATH=${MANPATH} after MAN_PN=1. If your manpages do -not show up localized, then try adding, LANGUAGE=${LANG} after MAN_PN=1. See - - https://github.com/vim/vim/issues/1002 - + set -x MANPAGER "vim -M +MANPAGER -" PDF *ft-pdf-plugin* @@ -669,7 +639,7 @@ setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8 To disable this behaviour, set the following variable in your vimrc: > - + let g:python_recommended_style = 0 diff -Nru vim-8.0.1453/runtime/doc/gui.txt vim-8.0.1766/runtime/doc/gui.txt --- vim-8.0.1453/runtime/doc/gui.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/gui.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*gui.txt* For Vim version 8.0. Last change: 2017 Nov 09 +*gui.txt* For Vim version 8.0. Last change: 2018 Mar 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -134,7 +134,7 @@ :winp[os] Display current position of the top left corner of the GUI vim window in pixels. Does not work in all versions. - Also see |getwinposx()| and |getwinposy()|. + Also see |getwinpos()|, |getwinposx()| and |getwinposy()|. :winp[os] {X} {Y} *E466* Put the GUI vim window at the given {X} and {Y} coordinates. @@ -992,10 +992,14 @@ :popu[p] {name} Popup the menu {name}. The menu named must have at least one subentry, but need not appear on the menu-bar (see |hidden-menus|). - {only available for Win32 and GTK GUI} + {only available for Win32 and GTK GUI or in + the terminal when compiled with +insert_expand} :popu[p]! {name} Like above, but use the position of the mouse pointer instead of the cursor. + In the terminal this is the last known + position, which is usually at the last click + or release (mouse movement is irrelevalt). Example: > :popup File @@ -1006,6 +1010,10 @@ :popup ]Toolbar This creates a popup menu that doesn't exist on the main menu-bar. +Note that in the GUI the :popup command will return immediately, before a +selection has been made. In the terminal the commands waits for the user to +make a selection. + Note that a menu that starts with ']' will not be displayed. ============================================================================== diff -Nru vim-8.0.1453/runtime/doc/if_pyth.txt vim-8.0.1766/runtime/doc/if_pyth.txt --- vim-8.0.1453/runtime/doc/if_pyth.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/if_pyth.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*if_pyth.txt* For Vim version 8.0. Last change: 2018 Jan 28 +*if_pyth.txt* For Vim version 8.0. Last change: 2018 Jan 30 VIM REFERENCE MANUAL by Paul Moore @@ -823,14 +823,14 @@ python support: > if has('python_compiled') echo 'compiled with Python 2.x support' - if has('python_dynamic - echo 'Python 2.x dynamically loaded + if has('python_dynamic') + echo 'Python 2.x dynamically loaded' endif endif if has('python3_compiled') echo 'compiled with Python 3.x support' - if has('python3_dynamic - echo 'Python 3.x dynamically loaded + if has('python3_dynamic') + echo 'Python 3.x dynamically loaded' endif endif diff -Nru vim-8.0.1453/runtime/doc/if_ruby.txt vim-8.0.1766/runtime/doc/if_ruby.txt --- vim-8.0.1453/runtime/doc/if_ruby.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/if_ruby.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*if_ruby.txt* For Vim version 8.0. Last change: 2016 Sep 01 +*if_ruby.txt* For Vim version 8.0. Last change: 2018 Mar 15 VIM REFERENCE MANUAL by Shugo Maeda @@ -221,6 +221,9 @@ If you want to build Vim with RubyInstaller 1.9 or 2.X using MSVC, you need some tricks. See the src/INSTALLpc.txt for detail. +If Vim is built with RubyInstaller 2.4 or later, you may also need to add +"C:\Ruby\bin\ruby_builtin_dlls" to the PATH environment variable. + Unix ~ diff -Nru vim-8.0.1453/runtime/doc/indent.txt vim-8.0.1766/runtime/doc/indent.txt --- vim-8.0.1453/runtime/doc/indent.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/indent.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*indent.txt* For Vim version 8.0. Last change: 2014 Dec 06 +*indent.txt* For Vim version 8.0. Last change: 2018 Apr 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -414,10 +414,10 @@ *cino-(* (N When in unclosed parentheses, indent N characters from the line with the unclosed parentheses. Add a 'shiftwidth' for every - unclosed parentheses. When N is 0 or the unclosed parentheses - is the first non-white character in its line, line up with the - next non-white character after the unclosed parentheses. - (default 'shiftwidth' * 2). + extra unclosed parentheses. When N is 0 or the unclosed + parentheses is the first non-white character in its line, line + up with the next non-white character after the unclosed + parentheses. (default 'shiftwidth' * 2). cino= cino=(0 > if (c1 && (c2 || if (c1 && (c2 || @@ -428,7 +428,8 @@ { { < *cino-u* - uN Same as (N, but for one level deeper. (default 'shiftwidth'). + uN Same as (N, but for one nesting level deeper. + (default 'shiftwidth'). cino= cino=u2 > if (c123456789 if (c123456789 diff -Nru vim-8.0.1453/runtime/doc/index.txt vim-8.0.1766/runtime/doc/index.txt --- vim-8.0.1453/runtime/doc/index.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/index.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*index.txt* For Vim version 8.0. Last change: 2017 Aug 02 +*index.txt* For Vim version 8.0. Last change: 2018 Apr 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -959,7 +959,7 @@ |v_i{| i{ same as iB |v_i}| i} same as iB |v_o| o move cursor to other corner of area -|v_r| r 2 delete highlighted area and start insert +|v_r| r 2 replace highlighted area with a character |v_s| s 2 delete highlighted area and start insert |v_u| u 2 make highlighted area lowercase |v_v| v make Visual mode characterwise or stop diff -Nru vim-8.0.1453/runtime/doc/insert.txt vim-8.0.1766/runtime/doc/insert.txt --- vim-8.0.1453/runtime/doc/insert.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/insert.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 8.0. Last change: 2018 Jan 26 +*insert.txt* For Vim version 8.0. Last change: 2018 Feb 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1103,6 +1103,8 @@ item with the same word is already present. empty when non-zero this match will be added even when it is an empty string + user_data custom data which is associated with the item and + available in |v:completed_item| All of these except "icase", "dup" and "empty" must be a string. If an item does not meet these requirements then an error message is given and further @@ -1196,6 +1198,8 @@ The 'pumheight' option can be used to set a maximum height. The default is to use all space available. +The 'pumwidth' option can be used to set a minimum width. The default is 15 +characters. There are three states: 1. A complete match has been inserted, e.g., after using CTRL-N or CTRL-P. diff -Nru vim-8.0.1453/runtime/doc/map.txt vim-8.0.1766/runtime/doc/map.txt --- vim-8.0.1453/runtime/doc/map.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/map.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1272,6 +1272,7 @@ However, by specifying one or the other of the following attributes, argument completion can be enabled: + -complete=arglist file names in argument list -complete=augroup autocmd groups -complete=buffer buffer names -complete=behave :behave suboptions diff -Nru vim-8.0.1453/runtime/doc/message.txt vim-8.0.1766/runtime/doc/message.txt --- vim-8.0.1453/runtime/doc/message.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/message.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*message.txt* For Vim version 8.0. Last change: 2017 Oct 14 +*message.txt* For Vim version 8.0. Last change: 2018 Feb 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -76,7 +76,7 @@ LIST OF MESSAGES *E222* *E228* *E232* *E256* *E293* *E298* *E304* *E317* *E318* *E356* *E438* *E439* *E440* *E316* *E320* *E322* - *E323* *E341* *E473* *E570* *E685* > + *E323* *E341* *E473* *E570* *E685* *E950* > Add to read buffer makemap: Illegal mode Cannot create BalloonEval with both message and callback @@ -97,6 +97,7 @@ Internal error Internal error: {function} fatal error in cs_manage_matches + Invalid count for del_bytes(): {N} This is an internal error. If you can reproduce it, please send in a bug report. |bugs| diff -Nru vim-8.0.1453/runtime/doc/options.txt vim-8.0.1766/runtime/doc/options.txt --- vim-8.0.1453/runtime/doc/options.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/options.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.0. Last change: 2017 Dec 21 +*options.txt* For Vim version 8.0. Last change: 2018 Apr 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -50,7 +50,7 @@ :se[t] {option}&vi Reset option to its Vi default value. {not in Vi} :se[t] {option}&vim Reset option to its Vim default value. {not in Vi} -:se[t] all& Set all options to their default value. The values of +:se[t] all& Set all options to their default value. The values of these options are not changed: all terminal options, starting with t_ 'columns' @@ -402,8 +402,8 @@ used to set the option value in, unless this is a help window, in which case the window below help window is used (skipping the option-window). - {not available when compiled without the |+eval| or - |+autocmd| features} + {not available when compiled without the |+eval| + feature} *$HOME* Using "~" is like using "$HOME", but it is only recognized at the start of an @@ -1087,7 +1087,9 @@ < Use 'backupdir' to put the backup in a different directory. *'backupskip'* *'bsk'* -'backupskip' 'bsk' string (default: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*") +'backupskip' 'bsk' string (default: "$TMPDIR/*,$TMP/*,$TEMP/*" + Unix: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*" + Mac: "/private/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*") global {not in Vi} {not available when compiled without the |+wildignore| @@ -1325,7 +1327,7 @@ characters. It permits dynamic French paragraph indentation (negative) or emphasizing the line continuation (positive). - sbr Display the 'showbreak' value before applying the + sbr Display the 'showbreak' value before applying the additional indent. The default value for min is 20 and shift is 0. @@ -1385,8 +1387,7 @@ written nowrite buffer which will not be written acwrite buffer which will always be written with BufWriteCmd - autocommands. {not available when compiled without the - |+autocmd| feature} + autocommands. quickfix quickfix buffer, contains list of errors |:cwindow| or list of locations |:lwindow| help help buffer (you are not supposed to set this @@ -1808,7 +1809,7 @@ 'copyindent' + off don't copy indent structure 'cpoptions' & (all flags) Vi-compatible flags 'cscopepathcomp'+ 0 don't show directories in tags list - 'cscoperelative'+ off + 'cscoperelative'+ off don't use basename of path as prefix 'cscopetag' + off don't use cscope for ":tag" 'cscopetagorder'+ 0 see |cscopetagorder| 'cscopeverbose' + off see |cscopeverbose| @@ -2466,8 +2467,6 @@ 'cursorbind' 'crb' boolean (default off) local to window {not in Vi} - {not available when compiled without the |+cursorbind| - feature} When this option is set, as the cursor in the current window moves other cursorbound windows (windows that also have this option set) move their cursors to the corresponding line and @@ -2918,8 +2917,6 @@ 'eventignore' 'ei' string (default "") global {not in Vi} - {not available when compiled without the |+autocmd| - feature} A list of autocommand event names, which are to be ignored. When set to "all" or when "all" is one of the items, all autocommand events are ignored, autocommands will not be executed. @@ -3168,8 +3165,6 @@ 'filetype' 'ft' string (default: "") local to buffer {not in Vi} - {not available when compiled without the |+autocmd| - feature} When this option is set, the FileType autocommand event is triggered. All autocommands that match with the value of this option will be executed. Thus the value of 'filetype' is used in place of the file @@ -3468,7 +3463,7 @@ when internal formatting is used. Make sure the cursor is kept in the same spot relative to the text then! The |mode()| function will return "i" or "R" in this situation. - + When the expression evaluates to non-zero Vim will fall back to using the internal format mechanism. @@ -3852,7 +3847,14 @@ To avoid problems with flags that are added in the future, use the "+=" and "-=" feature of ":set" |add-option-flags|. - Valid letters are as follows: + Valid characters are as follows: + *'go-!'* + '!' External commands are executed in a terminal window. Without + this flag the MS-Windows GUI will open a console window to + execute the command. The Unix GUI will simulate a dumb + terminal to list the command output. + The terminal window will be positioned at the bottom, and grow + upwards as needed. *guioptions_a* *'go-a'* 'a' Autoselect: If present, then whenever VISUAL mode is started, or the Visual area extended, Vim tries to become the owner of @@ -5114,8 +5116,8 @@ global or local to buffer |global-local| {not in Vi} Program to use for the ":make" command. See |:make_makeprg|. - This option may contain '%' and '#' characters (see |:_%| and |:_#|), - which are expanded to the current and alternate file name. Use |::S| + This option may contain '%' and '#' characters (see |:_%| and |:_#|), + which are expanded to the current and alternate file name. Use |::S| to escape file names in case they contain special characters. Environment variables are expanded |:set_env|. See |option-backslash| about including spaces and backslashes. @@ -5203,8 +5205,11 @@ {not in Vi} Maximum amount of memory (in Kbyte) to use for one buffer. When this limit is reached allocating extra memory for a buffer will cause - other memory to be freed. The maximum usable value is about 2000000. - Use this to work without a limit. Also see 'maxmemtot'. + other memory to be freed. + The maximum usable value is about 2000000. Use this to work without a + limit. + The value is ignored when 'swapfile' is off. + Also see 'maxmemtot'. *'maxmempattern'* *'mmp'* 'maxmempattern' 'mmp' number (default 1000) @@ -5233,6 +5238,8 @@ need more than 2 Gbyte for text editing? Keep in mind that text is stored in the swap file, one can edit files > 2 Gbyte anyway. We do need the memory to store undo info. + Buffers with 'swapfile' off still count to the total amount of memory + used. Also see 'maxmem'. *'menuitems'* *'mis'* @@ -5329,6 +5336,8 @@ an explanation. When 'buftype' is "nowrite" or "nofile" this option may be set, but will be ignored. + Note that the text may actually be the same, e.g. 'modified' is set + when using "rA" on an "A". *'more'* *'nomore'* 'more' boolean (Vim default: on, Vi default: off) @@ -5417,6 +5426,8 @@ In the "popup" model the right mouse button produces a pop-up menu. You need to define this first, see |popup-menu|. + In a terminal the popup menu works if Vim is compiled with the + |+insert_expand| option. Note that you can further refine the meaning of buttons with mappings. See |gui-mouse-mapping|. But mappings are NOT used for modeless @@ -5955,6 +5966,15 @@ Insert mode completion. When zero as much space as available is used. |ins-completion-menu|. + *'pumwidth'* *'pw'* +'pumwidth' 'pw' number (default 15) + global + {not available when compiled without the + |+insert_expand| feature} + {not in Vi} + Determines the minimum width to use for the popup menu for Insert mode + completion. |ins-completion-menu|. + *'pythondll'* 'pythondll' string (default depends on the build) global @@ -6108,7 +6128,7 @@ characters are put before the number. See |hl-LineNr| and |hl-CursorLineNr| for the highlighting used for the number. - + The number in front of the cursor line also depends on the value of 'number', see |number_relativenumber| for all combinations of the two options. @@ -6427,6 +6447,8 @@ to find files which replace a distributed runtime files. You can put a directory after $VIMRUNTIME to find files which add to distributed runtime files. + When Vim is started with |--clean| the home directory entries are not + included. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -6445,8 +6467,6 @@ 'scrollbind' 'scb' boolean (default off) local to window {not in Vi} - {not available when compiled without the |+scrollbind| - feature} See also |scroll-binding|. When this option is set, the current window scrolls as other scrollbind windows (windows that also have this option set) scroll. This option is useful for viewing the @@ -6484,8 +6504,6 @@ *'scrollopt'* *'sbo'* 'scrollopt' 'sbo' string (default "ver,jump") global - {not available when compiled without the |+scrollbind| - feature} {not in Vi} This is a comma-separated list of words that specifies how 'scrollbind' windows should behave. 'sbo' stands for ScrollBind @@ -6575,7 +6593,7 @@ *'sessionoptions'* *'ssop'* 'sessionoptions' 'ssop' string (default: "blank,buffers,curdir,folds, - help,options,tabpages,winsize") + help,options,tabpages,winsize,terminal") global {not in Vi} {not available when compiled without the |+mksession| @@ -6607,6 +6625,7 @@ tabpages all tab pages; without this only the current tab page is restored, so that you can make a session for each tab page separately + terminal include terminal windows where the command can be restored unix with Unix end-of-line format (single ), even when on Windows or DOS winpos position of the whole Vim window @@ -6630,14 +6649,21 @@ It is allowed to give an argument to the command, e.g. "csh -f". See |option-backslash| about including spaces and backslashes. Environment variables are expanded |:set_env|. + If the name of the shell contains a space, you might need to enclose - it in quotes. Example: > + it in quotes or escape the space. Example with quotes: > :set shell=\"c:\program\ files\unix\sh.exe\"\ -f < Note the backslash before each quote (to avoid starting a comment) and each space (to avoid ending the option value). Also note that the "-f" is not inside the quotes, because it is not part of the command - name. And Vim automagically recognizes the backslashes that are path + name. Vim automagically recognizes the backslashes that are path separators. + Example with escaped space (Vim will do this when initializing the + option from $SHELL): > + :set shell=/bin/with\\\ space/sh +< The resulting value of 'shell' is "/bin/with\ space/sh", two + backslashes are consumed by `:set`. + Under MS-Windows, when the executable ends in ".com" it must be included. Thus setting the shell to "command.com" or "4dos.com" works, but "command" and "4dos" do not work for all commands (e.g., @@ -7395,7 +7421,6 @@ W F Preview window flag, text is ",PRV". y F Type of file in the buffer, e.g., "[vim]". See 'filetype'. Y F Type of file in the buffer, e.g., ",VIM". See 'filetype'. - {not available when compiled without |+autocmd| feature} q S "[Quickfix List]", "[Location List]" or empty. k S Value of "b:keymap_name" or 'keymap' when |:lmap| mappings are being used: "" @@ -7419,7 +7444,9 @@ a S Argument list status as in default title. ({current} of {max}) Empty if the argument file count is zero or one. { NF Evaluate expression between '%{' and '}' and substitute result. - Note that there is no '%' before the closing '}'. + Note that there is no '%' before the closing '}'. The + expression cannot contain a '}' character, call a function to + work around that. ( - Start of item group. Can be used for setting the width and alignment of a section. Must be followed by %) somewhere. ) - End of item group. No width fields allowed. @@ -7540,6 +7567,7 @@ Also see |swap-file| and |'swapsync'|. If you want to open a new buffer without creating a swap file for it, use the |:noswapfile| modifier. + See 'directory' for where the swap file is created. This option is used together with 'bufhidden' and 'buftype' to specify special kinds of buffers. See |special-buffers|. @@ -7886,46 +7914,71 @@ :set encoding=utf-8 < You need to do this when your system has no locale support for UTF-8. - *'termguicolors'* *'tgc'* + *'termguicolors'* *'tgc'* *E954* 'termguicolors' 'tgc' boolean (default off) global {not in Vi} {not available when compiled without the |+termguicolors| feature} When on, uses |highlight-guifg| and |highlight-guibg| attributes in - the terminal (thus using 24-bit color). Requires a ISO-8613-3 - compatible terminal. - If setting this option does not work (produces a colorless UI) - reading |xterm-true-color| might help. + the terminal (thus using 24-bit color). + + Requires a ISO-8613-3 compatible terminal. If setting this option + does not work (produces a colorless UI) reading |xterm-true-color| + might help. + + For Win32 console, Windows 10 version 1703 (Creators Update) or later + is required. Use this check to find out: > + if has('vcon') +< This requires Vim to be built with the |+vtp| feature. + Note that the "cterm" attributes are still used, not the "gui" ones. NOTE: This option is reset when 'compatible' is set. - *'termkey'* *'tk'* -'termkey' 'tk' string (default "") + *'termwinscroll'* *'twsl'* +'termwinscroll' 'twsl' number (default 10000) + local to buffer + {not in Vi} + {not available when compiled without the + |+terminal| feature} + Number of scrollback lines to keep. When going over this limit the + first 10% of the scrollback lines are deleted. This is just to reduce + the memory usage. See |Terminal-Normal|. + + *'termwinkey'* *'twk'* +'termwinkey' 'twk' string (default "") local to window {not in Vi} The key that starts a CTRL-W command in a terminal window. Other keys are sent to the job running in the window. The <> notation can be used, e.g.: > - :set termkey= + :set termwinkey= < The string must be one key stroke but can be multiple bytes. When not set CTRL-W is used, so that CTRL-W : gets you to the command - line. If 'termkey' is set to CTRL-L then CTRL-L : gets you to the + line. If 'termwinkey' is set to CTRL-L then CTRL-L : gets you to the command line. - *'termsize'* *'tms'* -'termsize' 'tms' string (default "") + *'termwinsize'* *'tws'* +'termwinsize' 'tws' string (default "") local to window {not in Vi} - Size of the |terminal| window. Format: {rows}x{columns}. + Size of the |terminal| window. Format: {rows}x{columns} or + {rows}*{columns}. - When empty the terminal gets the size from the window. - - When set (e.g., "24x80") the terminal size is not adjusted to the - window size. If the window is smaller only the top-left part is - displayed. - When rows is zero then use the height of the window. - When columns is zero then use the width of the window. - For example: "30x0" uses 30 rows with the current window width. - Using "0x0" is the same as empty. + - When set with a "x" (e.g., "24x80") the terminal size is not + adjusted to the window size. If the window is smaller only the + top-left part is displayed. + - When set with a "*" (e.g., "10*50") the terminal size follows the + window size, but will not be smaller than the specified rows and/or + columns. + - When rows is zero then use the height of the window. + - When columns is zero then use the width of the window. + - Using "0x0" or "0*0" is the same as empty. + + Examples: + "30x0" uses 30 rows and the current window width. + "20*0" uses at least 20 rows and the current window width. + "0*40" uses the current window height and at least 40 columns. Note that the command running in the terminal window may still change the size of the terminal. In that case the Vim window will be adjusted to that size, if possible. @@ -7983,7 +8036,7 @@ non-keyword characters (white space is preferred). Maximum line length is 510 bytes. To obtain a file to be used here, check out this ftp site: - [Sorry this link doesn't work anymore, do you know the right one?] + [Sorry this link doesn't work anymore, do you know the right one?] ftp://ftp.ox.ac.uk/pub/wordlists/ First get the README file. To include a comma in a file name precede it with a backslash. Spaces after a comma are ignored, otherwise spaces are included in the file diff -Nru vim-8.0.1453/runtime/doc/pattern.txt vim-8.0.1766/runtime/doc/pattern.txt --- vim-8.0.1453/runtime/doc/pattern.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/pattern.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 8.0. Last change: 2017 Jun 05 +*pattern.txt* For Vim version 8.0. Last change: 2018 Mar 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -905,7 +905,7 @@ becomes invalid. Vim doesn't automatically update the matches. Similar to moving the cursor for "\%#" |/\%#|. - */\%l* */\%>l* */\%l* */\%23l Matches below a specific line (higher line number). @@ -1166,7 +1166,8 @@ - Matching with a collection can be slow, because each character in the text has to be compared with each character in the collection. Use one of the other atoms above when possible. Example: "\d" is - much faster than "[0-9]" and matches the same characters. + much faster than "[0-9]" and matches the same characters. However, + the new |NFA| regexp engine deals with this better than the old one. */\%[]* *E69* *E70* *E369* \%[] A sequence of optionally matched atoms. This always matches. diff -Nru vim-8.0.1453/runtime/doc/quickfix.txt vim-8.0.1766/runtime/doc/quickfix.txt --- vim-8.0.1453/runtime/doc/quickfix.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/quickfix.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*quickfix.txt* For Vim version 8.0. Last change: 2017 Dec 13 +*quickfix.txt* For Vim version 8.0. Last change: 2018 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -330,9 +330,9 @@ the error location may not be correct. If you quit Vim and start again the marks are lost and the error locations may not be correct anymore. -If vim is built with |+autocmd| support, two autocommands are available for -running commands before and after a quickfix command (':make', ':grep' and so -on) is executed. See |QuickFixCmdPre| and |QuickFixCmdPost| for details. +Two autocommands are available for running commands before and after a +quickfix command (':make', ':grep' and so on) is executed. See +|QuickFixCmdPre| and |QuickFixCmdPost| for details. *QuickFixCmdPost-example* When 'encoding' differs from the locale, the error messages may have a @@ -419,8 +419,7 @@ autocommand event is disabled by adding it to 'eventignore'. This considerably speeds up editing each buffer. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|, |:ldo|, |:cfdo| and |:lfdo|. @@ -433,8 +432,7 @@ :{cmd} etc. < Otherwise it works the same as `:cdo`. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} *:ldo* :ld[o][!] {cmd} Execute {cmd} in each valid entry in the location list @@ -447,8 +445,7 @@ etc. < Only valid entries in the location list are used. Otherwise it works the same as `:cdo`. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} *:lfdo* :lfdo[!] {cmd} Execute {cmd} in each file in the location list for @@ -460,8 +457,7 @@ :{cmd} etc. < Otherwise it works the same as `:ldo`. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} ============================================================================= 2. The error window *quickfix-window* @@ -657,8 +653,8 @@ 4. Using :make *:make_makeprg* *:mak* *:make* -:mak[e][!] [arguments] 1. If vim was built with |+autocmd|, all relevant - |QuickFixCmdPre| autocommands are executed. +:mak[e][!] [arguments] 1. All relevant |QuickFixCmdPre| autocommands are + executed. 2. If the 'autowrite' option is on, write any changed buffers 3. An errorfile name is made from 'makeef'. If @@ -670,9 +666,8 @@ errorfile (for Unix it is also echoed on the screen). 5. The errorfile is read using 'errorformat'. - 6. If vim was built with |+autocmd|, all relevant - |QuickFixCmdPost| autocommands are executed. - See example below. + 6. All relevant |QuickFixCmdPost| autocommands are + executed. See example below. 7. If [!] is not given the first error is jumped to. 8. The errorfile is deleted. 9. You can now move through the errors with commands diff -Nru vim-8.0.1453/runtime/doc/quickref.txt vim-8.0.1766/runtime/doc/quickref.txt --- vim-8.0.1453/runtime/doc/quickref.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/quickref.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*quickref.txt* For Vim version 8.0. Last change: 2017 Nov 21 +*quickref.txt* For Vim version 8.0. Last change: 2018 Apr 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -838,6 +838,7 @@ 'printoptions' 'popt' controls the format of :hardcopy output 'prompt' 'prompt' enable prompt in Ex mode 'pumheight' 'ph' maximum height of the popup menu +'pumwidth' 'pw' minimum width of the popup menu 'pythondll' name of the Python 2 dynamic library 'pythonhome' name of the Python 2 home directory 'pythonthreedll' name of the Python 3 dynamic library @@ -926,8 +927,9 @@ 'termbidi' 'tbidi' terminal takes care of bi-directionality 'termencoding' 'tenc' character encoding used by the terminal 'termguicolors' 'tgc' use GUI colors for the terminal -'termkey' 'tk' key that precedes a Vim command in a terminal -'termsize' 'tms' size of a terminal window +'termwinkey' 'twk' key that precedes a Vim command in a terminal +'termwinscroll' 'twsl' max number of scrollback lines in a terminal window +'termwinsize' 'tws' size of a terminal window 'terse' shorten some messages 'textauto' 'ta' obsolete, use 'fileformats' 'textmode' 'tx' obsolete, use 'fileformat' diff -Nru vim-8.0.1453/runtime/doc/quotes.txt vim-8.0.1766/runtime/doc/quotes.txt --- vim-8.0.1453/runtime/doc/quotes.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/quotes.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*quotes.txt* For Vim version 8.0. Last change: 2010 Nov 03 +*quotes.txt* For Vim version 8.0. Last change: 2018 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -18,7 +18,7 @@ Vi as some kind of outer space alien in human clothes. Once I tried I really got addicted by its power and now I found myself typing Vim keypresses in the oddest places! That's why I would like to see Vim embedded in every -application which deals with text editing. (José Fonseca) +application which deals with text editing. (José Fonseca) I was a 12-year emacs user who switched to Vim about a year ago after finally giving up on the multiple incompatible versions, flaky contributed packages, diff -Nru vim-8.0.1453/runtime/doc/repeat.txt vim-8.0.1766/runtime/doc/repeat.txt --- vim-8.0.1453/runtime/doc/repeat.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/repeat.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 8.0. Last change: 2017 Dec 17 +*repeat.txt* For Vim version 8.0. Last change: 2018 Mar 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -265,6 +265,7 @@ loaded during initialization, see |load-plugins|. Also see |pack-add|. + {only available when compiled with +eval} *:packl* *:packloadall* :packl[oadall][!] Load all packages in the "start" directory under each @@ -288,6 +289,7 @@ An error only causes sourcing the script where it happens to be aborted, further plugins will be loaded. See |packages|. + {only available when compiled with +eval} :scripte[ncoding] [encoding] *:scripte* *:scriptencoding* *E167* Specify the character encoding used in the script. @@ -806,6 +808,19 @@ < Note that this only works for commands that are executed when sourcing the file, not for a function defined in that file. +:breaka[dd] expr {expression} + Sets a breakpoint, that will break whenever the {expression} + evaluates to a different value. Example: > + :breakadd expr g:lnum + +< Will break, whenever the global variable lnum changes. + Note if you watch a |script-variable| this will break + when switching scripts, since the script variable is only + valid in the script where it has been defined and if that + script is called from several other scripts, this will stop + whenever that particular variable will become visible or + unaccessible again. + The [lnum] is the line number of the breakpoint. Vim will stop at or after this line. When omitted line 1 is used. diff -Nru vim-8.0.1453/runtime/doc/spell.txt vim-8.0.1766/runtime/doc/spell.txt --- vim-8.0.1453/runtime/doc/spell.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/spell.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*spell.txt* For Vim version 8.0. Last change: 2017 Oct 26 +*spell.txt* For Vim version 8.0. Last change: 2018 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -907,9 +907,9 @@ *spell-LOW* *spell-UPP* Three lines in the affix file are needed. Simplistic example: - FOL áëñ ~ - LOW áëñ ~ - UPP ÁËÑ ~ + FOL áëñ ~ + LOW áëñ ~ + UPP ÃËÑ ~ All three lines must have exactly the same number of characters. @@ -924,9 +924,9 @@ is upper-case where it's different from the character at the same position in "FOL". -An exception is made for the German sharp s ß. The upper-case version is +An exception is made for the German sharp s ß. The upper-case version is "SS". In the FOL/LOW/UPP lines it should be included, so that it's recognized -as a word character, but use the ß character in all three. +as a word character, but use the ß character in all three. ASCII characters should be omitted, Vim always handles these in the same way. When the encoding is UTF-8 no word characters need to be specified. @@ -1397,7 +1397,7 @@ *spell-SYLLABLE* The SYLLABLE item defines characters or character sequences that are used to count the number of syllables in a word. Example: - SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui ~ + SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui ~ Before the first slash is the set of characters that are counted for one syllable, also when repeated and mixed, until the next character that is not @@ -1478,8 +1478,8 @@ to prefer suggestions with these letters substituted. Example: MAP 2 ~ - MAP eéëêè ~ - MAP uüùúû ~ + MAP eéëêè ~ + MAP uüùúû ~ The first line specifies the number of MAP lines following. Vim ignores the number, but the line must be there. diff -Nru vim-8.0.1453/runtime/doc/starting.txt vim-8.0.1766/runtime/doc/starting.txt --- vim-8.0.1453/runtime/doc/starting.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/starting.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*starting.txt* For Vim version 8.0. Last change: 2018 Jan 27 +*starting.txt* For Vim version 8.0. Last change: 2018 Mar 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -510,12 +510,14 @@ {not in Vi} *--clean* ---clean Equal to "-u DEFAULTS -i NONE": +--clean Equal to "-u DEFAULTS -U NONE -i NONE": - initializations from files and environment variables is skipped - the |defaults.vim| script is loaded, which implies 'nocompatible': use Vim defaults + - no |gvimrc| script is loaded - no viminfo file is read or written + - the home directory is excluded from 'runtimepath' *-x* -x Use encryption to read/write files. Will prompt for a key, which is then stored in the 'key' option. All writes will @@ -1010,14 +1012,13 @@ When Vim starts, the 'compatible' option is on. This will be used when Vim starts its initializations. But as soon as: - a user vimrc file is found, or -- a vimrc file in the current directory, or +- a vimrc file in the current directory is found, or - the "VIMINIT" environment variable is set, or - the "-N" command line argument is given, or - the "--clean" command line argument is given, or - even when no vimrc file exists. - the |defaults.vim| script is loaded, or -- gvimrc file was found, -then it will be set to 'nocompatible'. +- a gvimrc file was found, +then the option will be set to 'nocompatible'. Note that this does NOT happen when a system-wide vimrc file was found. diff -Nru vim-8.0.1453/runtime/doc/syntax.txt vim-8.0.1766/runtime/doc/syntax.txt --- vim-8.0.1453/runtime/doc/syntax.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/syntax.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 8.0. Last change: 2018 Jan 27 +*syntax.txt* For Vim version 8.0. Last change: 2018 Jan 31 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2779,13 +2779,10 @@ SCHEME *scheme.vim* *ft-scheme-syntax* -By default only R5RS keywords are highlighted and properly indented. +By default only R7RS keywords are highlighted and properly indented. -MzScheme-specific stuff will be used if b:is_mzscheme or g:is_mzscheme -variables are defined. - -Also scheme.vim supports keywords of the Chicken Scheme->C compiler. Define -b:is_chicken or g:is_chicken, if you need them. +scheme.vim also supports extensions of the CHICKEN Scheme->C compiler. +Define b:is_chicken or g:is_chicken, if you need them. SDL *sdl.vim* *ft-sdl-syntax* diff -Nru vim-8.0.1453/runtime/doc/tabpage.txt vim-8.0.1766/runtime/doc/tabpage.txt --- vim-8.0.1453/runtime/doc/tabpage.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/tabpage.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*tabpage.txt* For Vim version 8.0. Last change: 2016 Oct 20 +*tabpage.txt* For Vim version 8.0. Last change: 2018 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -286,8 +286,7 @@ current tab page. {cmd} can contain '|' to concatenate several commands. {cmd} must not open or close tab pages or reorder them. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} Also see |:windo|, |:argdo|, |:bufdo|, |:cdo|, |:ldo|, |:cfdo| and |:lfdo| diff -Nru vim-8.0.1453/runtime/doc/tags vim-8.0.1766/runtime/doc/tags --- vim-8.0.1453/runtime/doc/tags 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/tags 2018-04-26 20:30:33.000000000 +0000 @@ -294,6 +294,7 @@ 'gfw' options.txt /*'gfw'* 'ghr' options.txt /*'ghr'* 'go' options.txt /*'go'* +'go-!' options.txt /*'go-!'* 'go-A' options.txt /*'go-A'* 'go-F' options.txt /*'go-F'* 'go-L' options.txt /*'go-L'* @@ -782,10 +783,14 @@ 'prompt' options.txt /*'prompt'* 'pt' options.txt /*'pt'* 'pumheight' options.txt /*'pumheight'* +'pumwidth' options.txt /*'pumwidth'* 'pvh' options.txt /*'pvh'* 'pvw' options.txt /*'pvw'* +'pw' options.txt /*'pw'* 'pythondll' options.txt /*'pythondll'* +'pythonhome' options.txt /*'pythonhome'* 'pythonthreedll' options.txt /*'pythonthreedll'* +'pythonthreehome' options.txt /*'pythonthreehome'* 'pyx' options.txt /*'pyx'* 'pyxversion' options.txt /*'pyxversion'* 'qe' options.txt /*'qe'* @@ -1083,8 +1088,9 @@ 'termbidi' options.txt /*'termbidi'* 'termencoding' options.txt /*'termencoding'* 'termguicolors' options.txt /*'termguicolors'* -'termkey' options.txt /*'termkey'* -'termsize' options.txt /*'termsize'* +'termwinkey' options.txt /*'termwinkey'* +'termwinscroll' options.txt /*'termwinscroll'* +'termwinsize' options.txt /*'termwinsize'* 'terse' options.txt /*'terse'* 'textauto' options.txt /*'textauto'* 'textmode' options.txt /*'textmode'* @@ -1100,10 +1106,8 @@ 'titlelen' options.txt /*'titlelen'* 'titleold' options.txt /*'titleold'* 'titlestring' options.txt /*'titlestring'* -'tk' options.txt /*'tk'* 'tl' options.txt /*'tl'* 'tm' options.txt /*'tm'* -'tms' options.txt /*'tms'* 'to' options.txt /*'to'* 'toolbar' options.txt /*'toolbar'* 'toolbariconsize' options.txt /*'toolbariconsize'* @@ -1124,6 +1128,9 @@ 'ttyscroll' options.txt /*'ttyscroll'* 'ttytype' options.txt /*'ttytype'* 'tw' options.txt /*'tw'* +'twk' options.txt /*'twk'* +'tws' options.txt /*'tws'* +'twsl' options.txt /*'twsl'* 'tx' options.txt /*'tx'* 'uc' options.txt /*'uc'* 'udf' options.txt /*'udf'* @@ -1353,6 +1360,7 @@ +visual various.txt /*+visual* +visualextra various.txt /*+visualextra* +vreplace various.txt /*+vreplace* ++vtp various.txt /*+vtp* +wildignore various.txt /*+wildignore* +wildmenu various.txt /*+wildmenu* +windows various.txt /*+windows* @@ -1926,11 +1934,18 @@ :AdaTagDir ft_ada.txt /*:AdaTagDir* :AdaTagFile ft_ada.txt /*:AdaTagFile* :AdaTypes ft_ada.txt /*:AdaTypes* +:Arguments terminal.txt /*:Arguments* +:Break terminal.txt /*:Break* +:Clear terminal.txt /*:Clear* :CompilerSet usr_41.txt /*:CompilerSet* +:Continue terminal.txt /*:Continue* :DiffOrig diff.txt /*:DiffOrig* :DoMatchParen pi_paren.txt /*:DoMatchParen* +:Evaluate terminal.txt /*:Evaluate* :Explore pi_netrw.txt /*:Explore* +:Finish terminal.txt /*:Finish* :GLVS pi_getscript.txt /*:GLVS* +:Gdb terminal.txt /*:Gdb* :GetLatestVimScripts_dat pi_getscript.txt /*:GetLatestVimScripts_dat* :GnatFind ft_ada.txt /*:GnatFind* :GnatPretty ft_ada.txt /*:GnatPretty* @@ -1955,11 +1970,14 @@ :Ntree pi_netrw.txt /*:Ntree* :Nw pi_netrw.txt /*:Nw* :Nwrite pi_netrw.txt /*:Nwrite* +:Over terminal.txt /*:Over* :P various.txt /*:P* :Pexplore pi_netrw.txt /*:Pexplore* :Print various.txt /*:Print* +:Program terminal.txt /*:Program* :Rexplore pi_netrw.txt /*:Rexplore* :RmVimball pi_vimball.txt /*:RmVimball* +:Run terminal.txt /*:Run* :RustEmitAsm ft_rust.txt /*:RustEmitAsm* :RustEmitIr ft_rust.txt /*:RustEmitIr* :RustExpand ft_rust.txt /*:RustExpand* @@ -1968,14 +1986,19 @@ :RustPlay ft_rust.txt /*:RustPlay* :RustRun ft_rust.txt /*:RustRun* :Sexplore pi_netrw.txt /*:Sexplore* +:Source terminal.txt /*:Source* +:Step terminal.txt /*:Step* +:Stop terminal.txt /*:Stop* :TOhtml syntax.txt /*:TOhtml* :TarDiff pi_tar.txt /*:TarDiff* :Termdebug terminal.txt /*:Termdebug* +:TermdebugCommand terminal.txt /*:TermdebugCommand* :Texplore pi_netrw.txt /*:Texplore* :UseVimball pi_vimball.txt /*:UseVimball* :Vexplore pi_netrw.txt /*:Vexplore* :VimballList pi_vimball.txt /*:VimballList* :Vimuntar pi_tar.txt /*:Vimuntar* +:Winbar terminal.txt /*:Winbar* :X editing.txt /*:X* :XMLent insert.txt /*:XMLent* :XMLns insert.txt /*:XMLns* @@ -3664,6 +3687,7 @@ CmdUndefined autocmd.txt /*CmdUndefined* Cmdline cmdline.txt /*Cmdline* Cmdline-mode cmdline.txt /*Cmdline-mode* +CmdlineChanged autocmd.txt /*CmdlineChanged* CmdlineEnter autocmd.txt /*CmdlineEnter* CmdlineLeave autocmd.txt /*CmdlineLeave* CmdwinEnter autocmd.txt /*CmdwinEnter* @@ -3688,6 +3712,7 @@ Dictionary eval.txt /*Dictionary* Dictionary-function eval.txt /*Dictionary-function* Digraphs digraph.txt /*Digraphs* +DirChanged autocmd.txt /*DirChanged* E motion.txt /*E* E10 message.txt /*E10* E100 diff.txt /*E100* @@ -4577,6 +4602,12 @@ E948 terminal.txt /*E948* E949 editing.txt /*E949* E95 message.txt /*E95* +E950 message.txt /*E950* +E951 pattern.txt /*E951* +E952 autocmd.txt /*E952* +E953 eval.txt /*E953* +E954 options.txt /*E954* +E955 eval.txt /*E955* E96 diff.txt /*E96* E97 diff.txt /*E97* E98 diff.txt /*E98* @@ -4588,6 +4619,7 @@ Eterm syntax.txt /*Eterm* Ex intro.txt /*Ex* Ex-mode intro.txt /*Ex-mode* +ExitPre autocmd.txt /*ExitPre* Exuberant_ctags tagsrch.txt /*Exuberant_ctags* F motion.txt /*F* FALSE eval.txt /*FALSE* @@ -4817,9 +4849,13 @@ Tcl if_tcl.txt /*Tcl* TermChanged autocmd.txt /*TermChanged* TermResponse autocmd.txt /*TermResponse* +Terminal-Job terminal.txt /*Terminal-Job* +Terminal-Normal terminal.txt /*Terminal-Normal* Terminal-mode terminal.txt /*Terminal-mode* +TerminalOpen autocmd.txt /*TerminalOpen* TextChanged autocmd.txt /*TextChanged* TextChangedI autocmd.txt /*TextChangedI* +TextChangedP autocmd.txt /*TextChangedP* TextYankPost autocmd.txt /*TextYankPost* Transact-SQL ft_sql.txt /*Transact-SQL* U undo.txt /*U* @@ -5080,7 +5116,9 @@ asm.vim syntax.txt /*asm.vim* asm68k syntax.txt /*asm68k* asmh8300.vim syntax.txt /*asmh8300.vim* +assert_beeps() eval.txt /*assert_beeps()* assert_equal() eval.txt /*assert_equal()* +assert_equalfile() eval.txt /*assert_equalfile()* assert_exception() eval.txt /*assert_exception()* assert_fails() eval.txt /*assert_fails()* assert_false() eval.txt /*assert_false()* @@ -6481,6 +6519,7 @@ g:tar_readoptions pi_tar.txt /*g:tar_readoptions* g:tar_secure pi_tar.txt /*g:tar_secure* g:tar_writeoptions pi_tar.txt /*g:tar_writeoptions* +g:terminal_ansi_colors terminal.txt /*g:terminal_ansi_colors* g:tex_comment_nospell syntax.txt /*g:tex_comment_nospell* g:tex_conceal syntax.txt /*g:tex_conceal* g:tex_fast syntax.txt /*g:tex_fast* @@ -6555,6 +6594,7 @@ getbufinfo() eval.txt /*getbufinfo()* getbufline() eval.txt /*getbufline()* getbufvar() eval.txt /*getbufvar()* +getchangelist() eval.txt /*getchangelist()* getchar() eval.txt /*getchar()* getcharmod() eval.txt /*getcharmod()* getcharsearch() eval.txt /*getcharsearch()* @@ -6570,6 +6610,7 @@ getfsize() eval.txt /*getfsize()* getftime() eval.txt /*getftime()* getftype() eval.txt /*getftype()* +getjumplist() eval.txt /*getjumplist()* getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install* getline() eval.txt /*getline()* getloclist() eval.txt /*getloclist()* @@ -6589,6 +6630,7 @@ gettabvar() eval.txt /*gettabvar()* gettabwinvar() eval.txt /*gettabwinvar()* getwininfo() eval.txt /*getwininfo()* +getwinpos() eval.txt /*getwinpos()* getwinposx() eval.txt /*getwinposx()* getwinposy() eval.txt /*getwinposy()* getwinvar() eval.txt /*getwinvar()* @@ -7835,8 +7877,8 @@ option-list quickref.txt /*option-list* option-summary options.txt /*option-summary* option-window options.txt /*option-window* -option_restore() eval.txt /*option_restore()* -option_save() eval.txt /*option_save()* +option_restore() todo.txt /*option_restore()* +option_save() todo.txt /*option_save()* options options.txt /*options* options-changed version5.txt /*options-changed* options-in-terminal terminal.txt /*options-in-terminal* @@ -8894,7 +8936,11 @@ term-dependent-settings term.txt /*term-dependent-settings* term-list syntax.txt /*term-list* term.txt term.txt /*term.txt* +term_dumpdiff() eval.txt /*term_dumpdiff()* +term_dumpload() eval.txt /*term_dumpload()* +term_dumpwrite() eval.txt /*term_dumpwrite()* term_getaltscreen() eval.txt /*term_getaltscreen()* +term_getansicolors() eval.txt /*term_getansicolors()* term_getattr() eval.txt /*term_getattr()* term_getcursor() eval.txt /*term_getcursor()* term_getjob() eval.txt /*term_getjob()* @@ -8907,6 +8953,9 @@ term_list() eval.txt /*term_list()* term_scrape() eval.txt /*term_scrape()* term_sendkeys() eval.txt /*term_sendkeys()* +term_setansicolors() eval.txt /*term_setansicolors()* +term_setkill() eval.txt /*term_setkill()* +term_setrestore() eval.txt /*term_setrestore()* term_setsize() eval.txt /*term_setsize()* term_start() eval.txt /*term_start()* term_wait() eval.txt /*term_wait()* @@ -8924,10 +8973,18 @@ termdebug-starting terminal.txt /*termdebug-starting* termdebug-stepping terminal.txt /*termdebug-stepping* termdebug-variables terminal.txt /*termdebug-variables* +termdebug_popup terminal.txt /*termdebug_popup* +termdebug_wide terminal.txt /*termdebug_wide* terminal terminal.txt /*terminal* +terminal-api terminal.txt /*terminal-api* +terminal-client-server terminal.txt /*terminal-client-server* terminal-colors os_unix.txt /*terminal-colors* +terminal-communication terminal.txt /*terminal-communication* terminal-cursor-style terminal.txt /*terminal-cursor-style* terminal-debug terminal.txt /*terminal-debug* +terminal-diff terminal.txt /*terminal-diff* +terminal-diffscreendump terminal.txt /*terminal-diffscreendump* +terminal-dumptest terminal.txt /*terminal-dumptest* terminal-functions usr_41.txt /*terminal-functions* terminal-info term.txt /*terminal-info* terminal-key-codes term.txt /*terminal-key-codes* @@ -8935,9 +8992,12 @@ terminal-options term.txt /*terminal-options* terminal-output-codes term.txt /*terminal-output-codes* terminal-resizing terminal.txt /*terminal-resizing* +terminal-screendump terminal.txt /*terminal-screendump* +terminal-session terminal.txt /*terminal-session* terminal-size-color terminal.txt /*terminal-size-color* terminal-special-keys terminal.txt /*terminal-special-keys* terminal-testing terminal.txt /*terminal-testing* +terminal-to-job terminal.txt /*terminal-to-job* terminal-typing terminal.txt /*terminal-typing* terminal-unix terminal.txt /*terminal-unix* terminal-use terminal.txt /*terminal-use* @@ -9009,6 +9069,7 @@ toolbar-icon gui.txt /*toolbar-icon* toupper() eval.txt /*toupper()* tr() eval.txt /*tr()* +trim() eval.txt /*trim()* trojan-horse starting.txt /*trojan-horse* true-variable eval.txt /*true-variable* trunc() eval.txt /*trunc()* diff -Nru vim-8.0.1453/runtime/doc/terminal.txt vim-8.0.1766/runtime/doc/terminal.txt --- vim-8.0.1453/runtime/doc/terminal.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/terminal.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*terminal.txt* For Vim version 8.0. Last change: 2018 Jan 28 +*terminal.txt* For Vim version 8.0. Last change: 2018 Apr 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -7,36 +7,42 @@ Terminal window support *terminal* -WARNING: THIS IS ONLY PARTLY IMPLEMENTED, ANYTHING CAN STILL CHANGE - The terminal feature is optional, use this to check if your Vim has it: > echo has('terminal') If the result is "1" you have it. -1. Basic use |terminal-use| - Typing |terminal-typing| - Size and color |terminal-size-color| - Syntax |:terminal| - Resizing |terminal-resizing| - Terminal Modes |Terminal-mode| - Cursor style |terminal-cursor-style| - Special keys |terminal-special-keys| - Unix |terminal-unix| - MS-Windows |terminal-ms-windows| -2. Remote testing |terminal-testing| -3. Debugging |terminal-debug| - Starting |termdebug-starting| - Example session |termdebug-example| - Stepping through code |termdebug-stepping| - Inspecting variables |termdebug-variables| - Other commands |termdebug-commands| - Communication |termdebug-communication| - Customizing |termdebug-customizing| +1. Basic use |terminal-use| + Typing |terminal-typing| + Size and color |terminal-size-color| + Syntax |:terminal| + Resizing |terminal-resizing| + Terminal Modes |Terminal-mode| + Cursor style |terminal-cursor-style| + Special keys |terminal-special-keys| + Session |terminal-session| + Unix |terminal-unix| + MS-Windows |terminal-ms-windows| +2. Terminal communication |terminal-communication| + Vim to job: term_sendkeys() |terminal-to-job| + Job to Vim: JSON API |terminal-api| + Using the client-server feature |terminal-client-server| +3. Remote testing |terminal-testing| +4. Diffing screen dumps |terminal-diff| + Writing a screen dump test for Vim |terminal-dumptest| + Creating a screen dump |terminal-screendump| + Comparing screen dumps |terminal-diffscreendump| +5. Debugging |terminal-debug| + Starting |termdebug-starting| + Example session |termdebug-example| + Stepping through code |termdebug-stepping| + Inspecting variables |termdebug-variables| + Other commands |termdebug-commands| + Communication |termdebug-communication| + Customizing |termdebug-customizing| {Vi does not have any of these commands} {only available when compiled with the |+terminal| feature} - The terminal feature requires the |+multi_byte|, |+job| and |+channel| features. ============================================================================== @@ -66,6 +72,7 @@ Special in the terminal window: *CTRL-W_.* *CTRL-W_N* CTRL-W . send a CTRL-W to the job in the terminal + CTRL-W CTRL-\ send a CTRL-\ to the job in the terminal CTRL-W N go to Terminal-Normal mode, see |Terminal-mode| CTRL-\ CTRL-N go to Terminal-Normal mode, see |Terminal-mode| CTRL-W " {reg} paste register {reg} *CTRL-W_quote* @@ -73,16 +80,16 @@ evaluating an expression. CTRL-W CTRL-C ends the job, see below |t_CTRL-W_CTRL-C| -See option 'termkey' for specifying another key instead of CTRL-W that -will work like CTRL-W. However, typing 'termkey' twice sends 'termkey' to -the job. For example: - 'termkey' CTRL-W move focus to the next window - 'termkey' : enter an Ex command - 'termkey' 'termkey' send 'termkey' to the job in the terminal - 'termkey' . send a CTRL-W to the job in the terminal - 'termkey' N go to terminal Normal mode, see below - 'termkey' CTRL-N same as CTRL-W N - 'termkey' CTRL-C same as |t_CTRL-W_CTRL-C| +See option 'termwinkey' for specifying another key instead of CTRL-W that +will work like CTRL-W. However, typing 'termwinkey' twice sends 'termwinkey' +to the job. For example: + 'termwinkey' CTRL-W move focus to the next window + 'termwinkey' : enter an Ex command + 'termwinkey' 'termwinkey' send 'termwinkey' to the job in the terminal + 'termwinkey' . send a CTRL-W to the job in the terminal + 'termwinkey' N go to terminal Normal mode, see below + 'termwinkey' CTRL-N same as CTRL-W N + 'termwinkey' CTRL-C same as |t_CTRL-W_CTRL-C| *t_CTRL-\_CTRL-N* The special key combination CTRL-\ CTRL-N can be used to switch to Normal mode, just like this works in any other mode. @@ -97,9 +104,14 @@ To change the keys you type use terminal mode mappings, see |:tmap|. These are defined like any mapping, but apply only when typing keys that are -sent to the job running in the terminal. For example, to make Escape switch +sent to the job running in the terminal. For example, to make F1 switch to Terminal-Normal mode: > + tnoremap N +You can use Esc, but you need to make sure it won't cause other keys to +break: > tnoremap N + set notimeout ttimeout timeoutlen=100 + < *options-in-terminal* After opening the terminal window and setting 'buftype' to "terminal" the BufWinEnter autocommand event is triggered. This makes it possible to set @@ -113,7 +125,7 @@ Size and color ~ *terminal-size-color* -See option 'termsize' for controlling the size of the terminal window. +See option 'termwinsize' for controlling the size of the terminal window. (TODO: scrolling when the terminal is larger than the window) The job running in the terminal can change the colors. The default foreground @@ -125,6 +137,16 @@ To use a different color the Terminal highlight group can be used, for example: > hi Terminal ctermbg=lightgrey ctermfg=blue guibg=lightgrey guifg=blue +< + *g:terminal_ansi_colors* +In GUI mode or with 'termguicolors', the 16 ANSI colors used by default in new +terminal windows may be configured using the variable +`g:terminal_ansi_colors`, which should be a list of 16 color names or +hexadecimal color codes, similar to those accepted by |highlight-guifg|. When +not using GUI colors, the terminal window always uses the 16 ANSI colors of +the underlying terminal. +The |term_setansicolors()| function can be used to change the colors, and +|term_getansicolors()| to get the currently used colors. Syntax ~ @@ -138,6 +160,13 @@ if [command] is NONE no job is started, the pty of the terminal can be used by a command like gdb. + If [command] is missing the default behavior is to + close the terminal when the shell exits. This can be + changed with the ++noclose argument. + If [command] is present the default behavior is to + keep the terminal open in Terminal-Normal mode. This + can be changed with the ++close argument. + A new buffer will be created, using [command] or 'shell' as the name, prefixed with a "!". If a buffer by this name already exists a number is added in @@ -153,15 +182,25 @@ Supported [options] are: ++close The terminal window will close automatically when the job terminates. + ++noclose The terminal window will NOT close + automatically when the job terminates. ++open When the job terminates and no window shows it, a window will be opened. Note that this can be interruptive. + The last of ++close, ++noclose and ++open + matters and rules out earlier arguments. + ++curwin Open the terminal in the current window, do not split the current window. Fails if the current buffer cannot be |abandon|ed. ++hidden Open the terminal in a hidden buffer, no window will be used. + ++norestore Do not include this terminal window + in a session file. + ++kill={how} When trying to close the terminal + window kill the job with {how}. See + |term_setkill()| for the values. ++rows={height} Use {height} for the terminal window height. If the terminal uses the full Vim height (no window above or below @@ -185,8 +224,12 @@ If you want to use more options use the |term_start()| function. -When the buffer associated with the terminal is unloaded or wiped out the job -is killed, similar to calling `job_stop(job, "kill")` +When the buffer associated with the terminal is forcibly unloaded or wiped out +the job is killed, similar to calling `job_stop(job, "kill")` . +Closing the window normally results in |E947|. When a kill method was set +with "++kill={how}" or |term_setkill()| then closing the window will use that +way to kill or interrupt the job. For example: > + :term ++kill=term tail -f /tmp/log So long as the job is running the window behaves like it contains a modified buffer. Trying to close the window with `CTRL-W :quit` fails. When using @@ -226,39 +269,41 @@ *terminal-resizing* The size of the terminal can be in one of three modes: -1. The 'termsize' option is empty: The terminal size follows the window size. - The minimal size is 2 screen lines with 10 cells. +1. The 'termwinsize' option is empty: The terminal size follows the window + size. The minimal size is 2 screen lines with 10 cells. -2. The 'termsize' option is "rows*cols", where "rows" is the minimal number of - screen rows and "cols" is the minimal number of cells. +2. The 'termwinsize' option is "rows*cols", where "rows" is the minimal number + of screen rows and "cols" is the minimal number of cells. -3. The 'termsize' option is "rowsXcols" (where the x is upper or lower case). - The terminal size is fixed to the specified number of screen lines and - cells. If the window is bigger there will be unused empty space. +3. The 'termwinsize' option is "rowsXcols" (where the x is upper or lower + case). The terminal size is fixed to the specified number of screen lines + and cells. If the window is bigger there will be unused empty space. If the window is smaller than the terminal size, only part of the terminal can be seen (the lower-left part). The |term_getsize()| function can be used to get the current size of the terminal. |term_setsize()| can be used only when in the first or second mode, -not when 'termsize' is "rowsXcols". +not when 'termwinsize' is "rowsXcols". Terminal-Job and Terminal-Normal mode ~ - *Terminal-mode* + *Terminal-mode* *Terminal-Job* When the job is running the contents of the terminal is under control of the job. That includes the cursor position. Typed keys are sent to the job. The terminal contents can change at any time. This is called Terminal-Job mode. -Use CTRL-W N (or 'termkey' N) to switch to Terminal-Normal mode. Now the +Use CTRL-W N (or 'termwinkey' N) to switch to Terminal-Normal mode. Now the contents of the terminal window is under control of Vim, the job output is suspended. CTRL-\ CTRL-N does the same. Terminal-Job mode is where |:tmap| mappings are applied. Keys sent by |term_sendkeys()| are not subject to tmap, but keys from |feedkeys()| are. - *E946* +It is not possible to enter Insert mode from Terminal-Job mode. + + *Terminal-Normal* *E946* In Terminal-Normal mode you can move the cursor around with the usual Vim commands, Visually mark text, yank text, etc. But you cannot change the contents of the buffer. The commands that would start insert mode, such as @@ -269,7 +314,10 @@ the job ends while in Terminal-Normal mode this changes to "(Terminal-finished)". -It is not possible to enter Insert mode from Terminal-Job mode. +When the job outputs lines in the terminal, such that the contents scrolls off +the top, those lines are remembered and can be seen in Terminal-Normal mode. +The number of lines is limited by the 'termwinscroll' option. When going over +this limit, the first 10% of the scrolled lins are deleted and are lost. Cursor style ~ @@ -285,6 +333,22 @@ blinking will also be inverted. +Session ~ + *terminal-session* +A terminal window will be restored when using a session file, if possible and +wanted. + +If "terminal" was removed from 'sessionoptions' then no terminal windows will +be restored. + +If the job in the terminal was finished the window will not be restored. + +If the terminal can be restored, the command that was used to open it will be +used again. To change this use the |term_setrestore()| function. This can +also be used to not restore a specific terminal by setting the command to +"NONE". + + Special keys ~ *terminal-special-keys* Since the terminal emulator simulates an xterm, only escape sequences that @@ -304,22 +368,15 @@ can even run Vim in the terminal! That's used for debugging, see below. Environment variables are used to pass information to the running job: - TERM name of the terminal, 'term' + TERM the name of the terminal, from the 'term' option or + $TERM in the GUI; falls back to "xterm" if it does not + start with "xterm" ROWS number of rows in the terminal initially LINES same as ROWS COLUMNS number of columns in the terminal initially COLORS number of colors, 't_Co' (256*256*256 in the GUI) VIM_SERVERNAME v:servername -The |client-server| feature can be used to communicate with the Vim instance -where the job was started. This only works when v:servername is not empty. -If needed you can set it with: > - call remote_startserver('vim-server') - -In the job you can then do something like: > - vim --servername $VIM_SERVERNAME --remote +123 some_file.c -This will open the file "some_file.c" and put the cursor on line 123. - MS-Windows ~ *terminal-ms-windows* @@ -345,7 +402,111 @@ VIM_SERVERNAME v:servername ============================================================================== -2. Remote testing *terminal-testing* +2. Terminal communication *terminal-communication* + +There are several ways to communicate with the job running in a terminal: +- Use |term_sendkeys()| to send text and escape sequences from Vim to the job. +- Use the JSON API to send encoded commands from the job to Vim. +- Use the |client-server| mechanism. This works on machines with an X server + and on MS-Windows. + + +Vim to job: term_sendkeys() ~ + *terminal-to-job* +This allows for remote controlling the job running in the terminal. It is a +one-way mechanism. The job can update the display to signal back to Vim. +For example, if a shell is running in a terminal, you can do: > + call term_sendkeys(buf, "ls *.java\") + +This requires for the job to be in the right state where it will do the right +thing when receiving the keys. For the above example, the shell must be +waiting for a command to be typed. + +For a job that was written for the purpose, you can use the JSON API escape +sequence in the other direction. E.g.: > + call term_sendkeys(buf, "\]51;["response"]\x07") + + +Job to Vim: JSON API ~ + *terminal-api* +The job can send JSON to Vim, using a special escape sequence. The JSON +encodes a command that Vim understands. Example of such a message: > + ]51;["drop", "README.md"]<07> + +The body is always a list, making it easy to find the end: ]<07>. +The ]51;msg<07> sequence is reserved by xterm for "Emacs shell", which is +similar to what we are doing here. + +Currently supported commands: + + call {funcname} {argument} + + Call a user defined function with {argument}. + The function is called with two arguments: the buffer number + of the terminal and {argument}, the decoded JSON argument. + The function name must start with "Tapi_" to avoid + accidentally calling a function not meant to be used for the + terminal API + The user function should sanity check the argument. + The function can use |term_sendkeys()| to send back a reply. + Example in JSON: > + ["call", "Tapi_Impression", ["play", 14]] +< Calls a function defined like this: > + function Tapi_Impression(bufnum, arglist) + if len(a:arglist) == 2 + echomsg "impression " . a:arglist[0] + echomsg "count " . a:arglist[1] + endif + endfunc +< Output from `:echo` may be erased by a redraw, use `:echomsg` + to be able to see it with `:messages`. + + drop {filename} [options] + + Let Vim open a file, like the `:drop` command. If {filename} + is already open in a window, switch to that window. Otherwise + open a new window to edit {filename}. + + [options] is only used when opening a new window. If present, + it must be a Dict. Similarly to |++opt|, These entries are recognized: + "ff" file format: "dos", "mac" or "unix" + "fileformat" idem + "enc" overrides 'fileencoding' + "encoding" idem + "bin" sets 'binary' + "binary" idem + "nobin" resets 'binary' + "nobinary" idem + "bad" specifies behavior for bad characters, see + |++bad| + + Example in JSON: > + ["drop", "path/file.txt", {"ff": "dos"}] + +A trick to have Vim send this escape sequence: > + exe "set t_ts=\]51; t_fs=\x07" + let &titlestring = '["call","Tapi_TryThis",["hello",123]]' + redraw + set t_ts& t_fs& + +Rationale: Why not allow for any command or expression? Because that might +create a security problem. + + +Using the client-server feature ~ + *terminal-client-server* +This only works when v:servername is not empty. If needed you can set it, +before opening the terminal, with: > + call remote_startserver('vim-server') + +$VIM_SERVERNAME is set in the terminal to pass on the server name. + +In the job you can then do something like: > + vim --servername $VIM_SERVERNAME --remote +123 some_file.c +This will open the file "some_file.c" and put the cursor on line 123. + +============================================================================== +3. Remote testing *terminal-testing* Most Vim tests execute a script inside Vim. For some tests this does not work, running the test interferes with the code being tested. To avoid this @@ -360,7 +521,97 @@ ============================================================================== -3. Debugging *terminal-debug* +4. Diffing screen dumps *terminal-diff* + +In some cases it can be bothersome to test that Vim displays the right +characters on the screen. E.g. with syntax highlighting. To make this +simpler it is possible to take a screen dump of a terminal and compare it to +an expected screen dump. + +Vim uses the window size, text, color and other attributes as displayed. The +Vim screen size, font and other properties do not matter. Therefore this +mechanism is portable across systems. A conventional screenshot would reflect +all differences, including font size and family. + + +Writing a screen dump test for Vim ~ + *terminal-dumptest* +For an example see the Test_syntax_c() function in +src/testdir/test_syntax.vim. The main parts are: +- Write a file you want to test with. This is useful for testing syntax + highlighting. You can also start Vim with en empty buffer. +- Run Vim in a terminal with a specific size. The default is 20 lines of 75 + characters. This makes sure the dump is always this size. The function + RunVimInTerminal() takes care of this. Pass it the arguments for the Vim + command. +- Send any commands to Vim using term_sendkeys(). For example: > + call term_sendkeys(buf, ":echo &lines &columns\") +- Check that the screen is now in the expected state, using + VerifyScreenDump(). This expects the reference screen dump to be in the + src/testdir/dumps/ directory. Pass the name without ".dump". It is + recommended to use the name of the test function and a sequence number, so + that we know what test is using the file. +- Repeat sending commands and checking the state. +- Finally stop Vim by calling StopVimInTerminal(). + +The first time you do this you won't have a screen dump yet. Create an empty +file for now, e.g.: > + touch src/testdir/dumps/Test_function_name_01.dump + +The test will then fail, giving you the command to compare the reference dump +and the failed dump, e.g.: > + call term_dumpdiff("Test_func.dump.failed", "dumps/Test_func.dump") + +Use this command in Vim, with the current directory set to src/testdir. +Once you are satisfied with the test, move the failed dump in place of the +reference: > + :!mv Test_func.dump.failed dumps/Test_func.dump + + +Creating a screen dump ~ + *terminal-screendump* + +To create the screen dump, run Vim (or any other program) in a terminal and +make it show the desired state. Then use the term_dumpwrite() function to +create a screen dump file. For example: > + :call term_dumpwrite(77, "mysyntax.dump") + +Here "77" is the buffer number of the terminal. Use `:ls!` to see it. + +You can view the screen dump with term_dumpload(): > + :call term_dumpload("mysyntax.dump") + +To verify that Vim still shows exactly the same screen, run Vim again with +exactly the same way to show the desired state. Then create a screen dump +again, using a different file name: > + :call term_dumpwrite(88, "test.dump") + +To assert that the files are exactly the same use assert_equalfile(): > + call assert_equalfile("mysyntax.dump", "test.dump") + +If there are differences then v:errors will contain the error message. + + +Comparing screen dumps ~ + *terminal-diffscreendump* + +assert_equalfile() does not make it easy to see what is different. +To spot the problem use term_dumpdiff(): > + call term_dumpdiff("mysyntax.dump", "test.dump") + +This will open a window consisting of three parts: +1. The contents of the first dump +2. The difference between the first and second dump +3. The contents of the second dump + +You can usually see what differs in the second part. Use the 'ruler' to +relate it to the position in the first or second dump. + +Alternatively, press "s" to swap the first and second dump. Do this several +times so that you can spot the difference in the context of the text. + +============================================================================== +5. Debugging *terminal-debug* The Terminal debugging plugin can be used to debug a program with gdb and view the source code in a Vim window. Since this is completely contained inside @@ -372,7 +623,8 @@ Load the plugin with this command: > packadd termdebug < *:Termdebug* -To start debugging use `:Termdebug` followed by the command name, for example: > +To start debugging use `:Termdebug` or `:TermdebugCommand`` followed by the +command name, for example: > :Termdebug vim This opens two windows: @@ -387,10 +639,11 @@ The current window is used to show the source code. When gdb pauses the source file location will be displayed, if possible. A sign is used to -highlight the current position (using highlight group debugPC). +highlight the current position, using highlight group debugPC. If the buffer in the current window is modified, another window will be opened -to display the current gdb position. +to display the current gdb position. You can use `:Winbar` to add a window +toolbar there. Focus the terminal of the executed program to interact with it. This works the same as any command running in a terminal window. @@ -398,6 +651,26 @@ When the debugger ends, typically by typing "quit" in the gdb window, the two opened windows are closed. +Only one debugger can be active at a time. + *:TermdebugCommand* +If you want to give specific commands to the command being debugged, you can +use the `:TermdebugCommand` command followed by the command name and +additional parameters. > + :TermdebugCommand vim --clean -c ':set nu' + +Both the `:Termdebug` and `:TermdebugCommand` support an optional "!" bang +argument to start the command right away, without pausing at the gdb window +(and cursor will be in the debugged window). For example: > + :TermdebugCommand! vim --clean + +To attach gdb to an already running executable or use a core file, pass extra +arguments. E.g.: > + :Termdebug vim core + :Termdebug vim 98343 + +If no argument is given, you'll end up in a gdb window, in which you need to +specify which command to run using e.g. the gdb `file` command. + Example session ~ *termdebug-example* @@ -412,6 +685,7 @@ source - where you started, has a window toolbar with buttons gdb - you can type gdb commands here program - the executed program will use this window + You can use CTRL-W CTRL-W or the mouse to move focus between windows. Put focus on the gdb window and type: > break ex_help @@ -432,6 +706,8 @@ This way you can inspect the value of local variables. You can also focus the gdb window and use a "print" command, e.g.: > print *eap +If mouse pointer movements are working, Vim will also show a balloon when the +mouse rests on text that can be evaluated by gdb. Now go back to the source window and put the cursor on the first line after the for loop, then type: > @@ -467,44 +743,57 @@ - frame N go to the Nth stack frame - continue continue execution -In the window showing the source code these commands can used to control gdb: - :Run [args] run the program with [args] or the previous arguments - :Arguments {args} set arguments for the next :Run - - :Break set a breakpoint at the current line; a sign will be displayed - :Delete delete a breakpoint at the current line - - :Step execute the gdb "step" command - :Over execute the gdb "next" command (:Next is a Vim command) - :Finish execute the gdb "finish" command - :Continue execute the gdb "continue" command - :Stop interrupt the program + *:Run* *:Arguments* +In the window showing the source code these commands can be used to control +gdb: + `:Run` [args] run the program with [args] or the previous arguments + `:Arguments` {args} set arguments for the next `:Run` + + *:Break* set a breakpoint at the current line; a sign will be displayed + *:Clear* delete the breakpoint at the current line + + *:Step* execute the gdb "step" command + *:Over* execute the gdb "next" command (`:Next` is a Vim command) + *:Finish* execute the gdb "finish" command + *:Continue* execute the gdb "continue" command + *:Stop* interrupt the program If 'mouse' is set the plugin adds a window toolbar with these entries: - Step :Step - Next :Over - Finish :Finish - Cont :Continue - Stop :Stop - Eval :Evaluate + Step `:Step` + Next `:Over` + Finish `:Finish` + Cont `:Continue` + Stop `:Stop` + Eval `:Evaluate` This way you can use the mouse to perform the most common commands. You need to have the 'mouse' option set to enable mouse clicks. + *:Winbar* +You can add the window toolbar in other windows you open with: > + :Winbar + +If gdb stops at a source line and there is no window currently showing the +source code, a new window will be created for the source code. This also +happens if the buffer in the source code window has been modified and can't be +abandoned. Inspecting variables ~ - *termdebug-variables* - :Evaluate evaluate the expression under the cursor - K same - :Evaluate {expr} evaluate {expr} - :'<,'>Evaluate evaluate the Visually selected text + *termdebug-variables* *:Evaluate* + `:Evaluate` evaluate the expression under the cursor + `K` same + `:Evaluate` {expr} evaluate {expr} + `:'<,'>Evaluate` evaluate the Visually selected text This is similar to using "print" in the gdb window. +You can usually shorten `:Evaluate` to `:Ev`. Other commands ~ *termdebug-commands* - :Gdb jump to the gdb window - :Program jump to the window with the running program + *:Gdb* jump to the gdb window + *:Program* jump to the window with the running program + *:Source* jump to the window with the source code, create it if there + isn't one Communication ~ @@ -515,17 +804,22 @@ Customizing ~ - *termdebug-customizing* + +GDB command *termdebug-customizing* + To change the name of the gdb command, set the "termdebugger" variable before invoking `:Termdebug`: > let termdebugger = "mygdb" -< *gdb-version* +< *gdb-version* Only debuggers fully compatible with gdb will work. Vim uses the GDB/MI -interface. This probably requires gdb version 7.12. if you get this error: +interface. The "new-ui" command requires gdb version 7.12 or later. if you +get this error: Undefined command: "new-ui". Try "help".~ Then your gdb is too old. - *hl-debugPC* *hl-debugBreakpoint* + +Colors *hl-debugPC* *hl-debugBreakpoint* + The color of the signs can be adjusted with these highlight groups: - debugPC the current position - debugBreakpoint a breakpoint @@ -538,6 +832,20 @@ hi debugPC term=reverse ctermbg=darkblue guibg=darkblue hi debugBreakpoint term=reverse ctermbg=red guibg=red + +Popup menu *termdebug_popup* + +By default the Termdebug plugin sets 'mousemodel' to "popup_setpos" and adds +these entries to the popup menu: + Set breakpoint `:Break` + Clear breakpoint `:Clear` + Evaluate `:Evaluate` +If you don't want this then disable it with: > + let g:termdebug_popup = 0 + + +Vim window width *termdebug_wide* + To change the width of the Vim window when debugging starts, and use a vertical split: > let g:termdebug_wide = 163 diff -Nru vim-8.0.1453/runtime/doc/todo.txt vim-8.0.1766/runtime/doc/todo.txt --- vim-8.0.1453/runtime/doc/todo.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/todo.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.0. Last change: 2018 Jan 28 +*todo.txt* For Vim version 8.0. Last change: 2018 Apr 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -35,258 +35,136 @@ *known-bugs* -------------------- Known bugs and current work ----------------------- -No maintainer for Vietnamese translations. -No maintainer for Simplified Chinese translations. - Terminal emulator window: -- Lots of stuff to implement, see src/terminal.c -- Improve debugger interface: - Include all debug features of Agide. - - Implement the right-click popup menu for the terminal. Can use the - completion popup menu code and mouse dragging. - Use it for "set breakpoint", "remove breakpoint", etc. - - get ideas from http://clewn.sf.net - - Look into the idevim plugin/script. -- Improve testing: - Make a screenshot of a terminal, store in a file. - Display a stored screenshot, display diff with another one. - Make a test that puts Vim in a specific state, make a screenshot and compare - with the expected screenshot. Set t_Co to 256. - -+channel: -- Add a separate timeout for opening a socket. Currently it's fixed at 50 - msec, which is too small for a remote connection. (tverniquet, #2130) -- Try out background make plugin: - https://github.com/AndrewVos/vim-make-background -- Problem with stderr on Windows? (Vincent Rischmann, 2016 Aug 31, #1026) -- Writing raw mode to a buffer should still handle NL characters as line - breaks. (Dmitry Zotikov, 2017 Aug 16) -- When out_cb executes :sleep, the close_cb may be invoked. (Daniel Hahler, - 2016 Dec 11, #1320) -- Implement |job-term| ? -- Channel test fails with Motif. Sometimes kills the X11 server. -- When a message in the queue but there is no callback, drop it after a while? - Add timestamp to queued messages and callbacks with ID, remove after a - minute. Option to set the droptime. -- Add an option to drop text of very long lines? Default to 1 Mbyte. -- Add remark about undo sync, is there a way to force it? -- When starting a job, have an option to open the server socket, so we know - the port, and pass it to the command with --socket-fd {nr}. (Olaf Dabrunz, - Feb 9) How to do this on MS-Windows? -- For connection to server, a "keep open" flag would be useful. Retry - connecting in the main loop with zero timeout. -- job_start(): run job in a newly opened terminal (not a terminal window). - With xterm could use -S{pty}. - Although user could use "xterm -e 'cmd arg'". - -Regexp problems: -- When search pattern has the base character both with and without combining - character, search fails. E.g. "รรีบ" in "à¸à¸²à¸£à¸£à¸µà¸šà¸£à¸±à¸à¹ƒà¸„ร". (agguser, #2312) -- [:space:] only matches ASCII spaces. Add [:white:] for all space-like - characters, esp. including 0xa0. Use character class zero. -- Since 7.4.704 the old regex engine fails to match [[:print:]] in 0xf6. - (Manuel Ortega, 2016 Apr 24) - Test fails on Mac. Avoid using isalpha(), isalnum(), etc? Depends on - LC_CTYPE -- The old engine does not find a match for "/\%#=1\(\)\{80}", the new engine - matches everywhere. -- Using win_linetabsize() can still be slow. Cache the result, store col and - vcol. Reset them when moving to another line. -- Very slow with a long line and Ruby highlighting. (John Whitley, 2014 Dec 4) -- Bug with pattern: '\vblock (\d+)\.\n.*\d+%(\1)@ and \?. (Brett Stahlman, 2013 Dec 21) Remark from Marcin - Szamotulski; Remark from Brett 2014 Jan 6 and 7. -- NFA regexp doesn't handle \%\)\@<=.*\%(<\/\(\w\+\)>\)\@=" matching text inside HTML tags. - This problem is probably the same: "\%(^\1.*$\n\)\@<=\(\d\+\).*$". - (guotuofeng, 2015 Jun 22) -- Strange matching with "\(Hello\n\)\@<=A". (Anas Syed, 2015 Feb 12) -- Problem with \v(A)@<=b+\1c. (Issue 334) -- Diff highlighting can be very slow. (Issue 309) -- Using %> for a virtual column has a check based on 'tabsize'. Better would - be to cache the result of win_linetabsize(col), storing both col and vcol, - and use them to decide whether win_linetabsize() needs to be called. Reset - col and vcol when moving to another line. -- this doesn't work: "syntax match ErrorMsg /.\%9l\%>20c\&\%<28c/". Leaving - out the \& works. Seems any column check after \& fails. -- Difference between two engines: ".*\zs\/\@>\/" on text "///" - (Chris Paul, 2016 Nov 13) New engine not greedy enough? - Another one: echom matchstr(" sdfsfsf\n sfdsdfsdf",'[^\n]*') - (2017 May 15, #1252) - -Include a few color schemes, based on popularity: -http://www.vim.org/scripts/script_search_results.php?keywords=&script_type=color+scheme&order_by=rating&direction=descending&search=search -http://vimawesome.com/?q=tag:color-scheme -Use names that indicate their appearance (Christian Brabandt, 2017 Aug 3) -- monokai - Xia Crusoe (2017 Aug 4) -- seoul256 - Christian Brabandt (2017 Aug 3) -- gruvbox - Christian Brabandt (2017 Aug 3) (simplified version from - Lifepillar, 2018 Jan 22, #2573) -- janah - Marco Hinz (2017 Aug 4) -- apprentice - Romain Lafourcade (2017 Aug 6) remarks about help file #1964 -Suggested by Hiroki Kokubun: -- [Iceberg](https://github.com/cocopon/iceberg.vim) (my one) -- [hybrid](https://github.com/w0ng/vim-hybrid) -Include solarized color scheme?, it does not support termguicolors. -- Sanitized version of pablo (Lifepillar, 2017 Nov 21) - -Reproducible: - invalid memory access in regexp with zero-width. - reproduced by Dominique, 2017 Dec 23 - heap-use-after-free in win_equal_rec (#2467) - au* 0 vs¡ - ar0 - arga - al - al -Patch to fix using freed memory. (Christian Brabandt, 2018 Jan 6, #2467) - -Patch for nsis runtime files. (Ken Takata, 2018 Jan 25) - -Patch for scheme runtime files (new version) (Evan Hanson, 2018 Jan 26) - -Patch to turn tests into new style. (Yegappan, 2017 Dec 29, #2509) - -Patch to fix crash in rubyf. (W, #2512) fixes #2511 - -Updates for Debian runtime files. (James McCoy, 2018 Jan 7) - -Crash when calling term_start() with empty command on windows. (Wang Shidong, -2018 Dec 27, #2501) - -Patch to improve DirectX rendering. (Ken Takata, 2018 Jan 18, #2560 fixes -#2401) - -Endless loop invovlving gui_mch_stop_blink(). (zdohnal, 2018 Jan 11) +- Still some stuff to implement and bugs to fix, see src/terminal.c -Patch to add 'pythonhome' and 'pythonthreehome' options. (Kazuki Sakamoto, -2016 Nov 21, #1266) +Problem with sudo. #2758 -"silent! try" doesn't restore emsg_silent when an exception is thrown. -(Ben Reilly, 2018 Jan 5, #2531) Possible solution by Christian Brabandt, 2018 -Jan 6. - -Patch to fix ex mode buffering output. (Brian M. Carlson, 2018 Jan 8, #2537) +Errors found with random data: + heap-buffer-overflow in alist_add (#2472) -Patch for config.vim syntax file. (James McCoy, 2018 Jan 28, maintainer didn't -respond). +Patch to avoid bad highlighting caused by #if. (ichizok, #2731) -Patch to add support for clojure script filetype detection. (David Burgin, -2018 Jan 20, #257) +Patch to refactor qf_set_properties(). (Yegappan, Apr 17, #2812) -Patch to implement the DirChanged autocmd event. (Andy Massimino, 2018 Jan 9, -replaces #888) +Patch for static analysis warnings. (Christian Brabandt, 2018 Apr 1, #2770) +Ther are more here: https://lgtm.com/projects/g/vim/vim/alerts/?mode=list -Patch to fix not adding a slash after :find completion. (Genki Sky, 2018 Jan -10) +Patch to refactor ex_helpgrep. (Yegappan, #2766, 2018 Mar 30) +Also in email, take the one with a test. -Patch for man.vim, fix for Mac. (SungHyun Nam, 2018 Jan 8, #2488) -Update Jan 10. +Allow for C99 features, decide which ones are OK: +- "inline" +- "long long" +- flexible array members (change code to avoid FORTIFY_SOURCE problems) -Patch to fix illegal memory access in del_bytes(). (Christian Brabandt, 2018 -Jan 2, #2466) +Looks like an error for inserting register makes ":file other" not work. +(Tom M, 2018 Mar 28) Reset did_emsg after inserting a register. +Or at the top of the loop? (Apr 4) -Recursive use of alist_add() (Christian Brabandt, 2018 Jan 6, #2472) +Patch to fix mouse pointer after :tselect. (Hirohito Higashi, #2709) +How to reproduce the problem? Remarks by Hirohito, Apr 8. -patch 1218 breaks etags. (zdohnal, 2018 Jan 5) +Patch to avoid job killed when I/O is disconnected. (ichizok, #2734) -Errors found with random data: - heap-buffer-overflow in alist_add (#2472) - heap-buffer-overflow in del_bytes (#2466) +When opening foo/x.txt and bar/x.txt get swap file warning. Should check the +file name. (Juergen Weigert) Compiler warnings (geeknik, 2017 Oct 26): - signed integer overflow in do_sub() (#2249) - signed integer overflow in get_address() (#2248) - signed integer overflow in getdecchrs() (#2254) -- signed integer overflow in nfa_regatom() (#2251) - patch by Christian Brabandt, 2018 Jan 8 - undefined left shift in get_string_tv() (#2250) -Patch to fix CursorIM highlighting on Windows. (Ken Takata, 2018 Jan 18) +Tests failing for "make testgui" with GTK: +- Test_setbufvar_options() +- Test_exit_callback_interval() -Cursor in wrong screen line with WinBar. (#2362) -Fix by Christian Brabandt (2018 Jan 2) +Mouse pointer sticks to stop shape. Only on Windows GUI? #2709 + +Patch to make log_tr() use variable arguments. (Ichizok, 2018 Mar 20, #2730) balloon_show() does not work properly in the terminal. (Ben Jackson, 2017 Dec 20, #2481) Also see #2352, want better control over balloon, perhaps set the position. -Patch to make installer faster. (Ken Takata, 2018 Jan 3, #2522) +Try out background make plugin: + https://github.com/AndrewVos/vim-make-background +or asyncmake: + https://github.com/yegappan/asyncmake -Patch to support hunspell. (Matej Cepl, Jan 2018, #2500) +Add a ModeChanged autocommand that has an argument indicating the old and new +mode. Also used for switching Terminal mode. Cursor in status line after search. (#2530) +Add an option with file patterns, to be used when unloading a buffer: If there +is a match, remove entries for the buffer from marks, jumplist, etc. To be +used for git temp files. + +Patch to fix that an empty buffer remains when using :argedit. (Christian, +#2713) Updated patch. + +Patch to fix interaction between 'virtualedit' and i_CTRL-G_j. (Christian +Brabandt, #2743) + Cursor in wrong position when line wraps. (#2540) +Add an option similar to 'lazyredraw' to skip redrawing while executing a +script or function. + Alternative manpager.vim. (Enno, 2018 Jan 5, #2529) -Patch for minimum width of completion popup menu. (Christian Brabandt, 2018 -Jan 3, #2314) +Patch to add more flags to :ls. (Marcin Szamotulski, #2751) + +Does setting 'cursorline' cause syntax highlighting to slow down? Perhaps is +mess up the cache? (Mike Lee Williams, 2018 Jan 27, #2539) +Also: 'foldtext' is evaluated too often. (Daniel Hahler, #2773) When using :packadd files under "later" are not used, which is inconsistent with packages under "start". (xtal8, #1994) -Patch to make D&D work between 32 bit app and 64 bit Vim. (Ken Takata, #2504) - -Patch to fix invalid return value with backwards searchpair. (Daniel Hahler, -2018 Jan 15, #2552) - -Column number is wrong whsn using 'linebreak' and 'wrap'. (Keith Smiley, 2018 +Column number is wrong when using 'linebreak' and 'wrap'. (Keith Smiley, 2018 Jan 15, #2555) -Patch to remove redundant "if". (Dominique Pelle, 2018 Jan 14) - -Serbian translations. (Peseic, 2018 Jan 17) +":bufdo e" disabled syntax HL in windows other than the current. (BPJ) Check argument of systemlist(). (Pavlov) -Patch to parse ":line" in tags file and use it for search. (Daniel Hahler, -#2546) +Patch to add reg_executing() and reg_recording(). (Hirohito Higashi, #2745) -Patch to fix illegal memory access. (Christian Brabandt, 2018 Jan 6, #2523) +No maintainer for Vietnamese translations. +No maintainer for Simplified Chinese translations. When 'inchsearch' and 'hlsearch' are set /\v highlights everything. Also see #2337 +Python indenting: alternative way to indent arguments: +http://orchistro.tistory.com/236 +Should be supported with a flag. + Starting job with cwd option, when the directory does not exist, gives a confusing error message. (Wang Shidong, 2018 Jan 2, #2519) -7 Add a watchpoint in the debug mode: An expression that breaks execution - when evaluating to non-zero. Add the "watchadd expr" command, stop when - the value of the expression changes. ":watchdel" deletes an item, - ":watchlist" lists the items. (Charles Campbell) -Patch by Christian Brabandt, 2016 Jun 10, #859 - -7 Make "ga" show the digraph for a character, if it exists. -Patch from Christian Brabandt, 2011 Aug 19. - Patch to add "module" to quickfix entries. (Marcin Szamotulski, Coot, 2017 Jun 8, #1757) Now part of #2322. Or #2327? #1757 was re-opened, include that first. +Add the debug command line history to viminfo. + +Avoid that "sign unplace id" does a redraw right away, esp. when there is a +sequence of these commands. (Andy Stewart, 2018 Mar 16) + ch_sendraw() with long string does not try to read inbetween, which may cause a deadlock if the reading side is waiting for the write to finish. (Nate Bosch, 2018 Jan 13, #2548) -Problem with mouse scroll in tmux. (fcying, #2419) Might be caused by patch -8.0.1309. +Add Makefiles to the runtime/spell directory tree, since nobody uses Aap. +Will have to explain the manual steps (downloading the .aff and .dic files, +applying the diff, etc. -Des setting 'cursorline' cause syntax highlighting to slow down? Perhaps is -mess up the cache? (Mike Lee Williams, 2018 Jan 27, #2539) +User dictionary ~/.vim/spell/lang.utf-8.add not used for spell checking until a +word is re-added to it. (Matej Cepl, 2018 Feb 6) Fold at end of the buffer behaves inconsistently. (James McCoy, 2017 Oct 9) @@ -296,18 +174,48 @@ Using 'wildignore' also applies to literally entered file name. Also with :drop (remote commands). +Patch to use the xdiff library instead of external diff. (Christian Brabandt, +2018 Mar 20, #2732) + +Implement option_save() and option_restore(): +option_restore({list}) *option_restore()* + Restore options previously saved by option_save(). + When buffer-local options have been saved, this function must + be called when the same buffer is the current buffer. + When window-local options have been saved, this function must + be called when the same window is the current window. + When in the wrong buffer and/or window an error is given and + the local options won't be restored. + +option_save({list}) *option_save()* + Saves the options named in {list}. The returned value can be + passed to option_restore(). Example: > + let s:saved_options = option_save([ + \ 'ignorecase', + \ 'iskeyword', + \ ]) + au BufLeave * + \ call option_restore(s:saved_options) +< The advantage over using `:let` is that global and local + values are handled and the script ID is restored, so that + `:verbose set` will show where the option was originally set, + not where it was restored. + "gvim --remote" from a directory with non-word characters changes the current directory (Paulo Marcel Coelho Arabic, 2017 Oct 30, #2266) Also see #1689. -Patch for 24 bit color support in MS-Windows console, using vcon. (Nobuhiro -Takasaki, Ken Takata, 2017 Oct 1, #2060). - ml_get error when using a Python. (Yggdroot, 2017 Jun 1, #1737) Lemonboy can reproduce (2017 Jun 5) +crash when removing an element while inside map(). (Nikolai Pavlov, 2018 Feb +17, #2652) + When 'virtualedit' is "all" and 'cursorcolumn' is set, the wrong column may be -highlighted. (van-debugger, 2018 Jan 23, #2576) +highlighted. (van-de-bugger, 2018 Jan 23, #2576) + +Patch to parse ":line" in tags file and use it for search. (Daniel Hahler, +#2546) Fixes #1057. Missing a test. Patch to add winlayout() function. (Yegappan Lakshmanan, 2018 Jan 4) @@ -317,6 +225,8 @@ Get a "No Name" buffer when 'hidden' is set and opening a new window from the quickfix list. (bfrg, 2018 Jan 22, #2574) +CTRL-X on zero gets stuck on 0xfffffffffffffffe. (Hengyang Zhao, #2746) + A function on a dictionary is not profiled. (ZyX, 2010 Dec 25) Patch to fix E806. (Dominique, 2017 Nov 22, #2368) @@ -328,12 +238,22 @@ Invalid range error when using BufWinLeave for closing terminal. (Gabriel Barta, 2017 Nov 15, #2339) +Using an external diff is inefficient. Not all systems have a good diff +program available (esp. MS-Windows). Would be nice to have in internal diff +implementation. Can then also use this for displaying changes within a line. +Olaf Dabrunz is working on this. (10 Jan 2016) +9 Instead invoking an external diff program, use builtin code. One can be + found here: http://www.ioplex.com/~miallen/libmba/dl/src/diff.c + It's complicated and badly documented. +Alternative: use the xdiff library. Patch from Christian Brabandt, 2018 Mar +2018, #2732) + ml_get errors with buggy script. (Dominique, 2017 Apr 30) Error in emsg with buggy script. (Dominique, 2017 Apr 30) -Patch to avoid clearing the intro message on Win32 console. -(Ken Takata, 2017 Nov 14) +Using CTRL-G j in insert mode in combination with 'virtualedit' doesn't work +as expected. (Rich, 2018 March 23, #2743) Patch to fix encoding in print document name (Yasuhiro Matsumoto, 2017 Dec 20, #2478) @@ -344,9 +264,19 @@ Join truncates xml comment. (Dmitrii Tcyganok, 2017 Dec 24, #2494) Requires 'formatoptions' to include "j". (Gary Johnson, 2017 Dec 24) +Patch to support hunspell. (Matej Cepl, Jan 2018, #2500) Based on older patch +in #846) +Doesn't work on Windows yet. Not ready to included, hard coded paths. + +Win32 GUI: when running a fast timer, the cursor no longer blinks. +Was reported: cursor blinks in terminal on widows with a timer. (xtal8, #2142) + When a timer is running and typing CTRL-R on the command line, it is not redrawn properly. (xtal8, 2017 Oct 23, #2241) +In an optional package the "after" directory is not scanned? +(Renato Fabbri, 2018 Feb 22) + Universal solution to detect if t_RS is working, using cursor position. Koichi Iwamoto, #2126 @@ -362,9 +292,6 @@ Patch for improving detecting Ruby on Mac in configure. (Ilya Mikhaltsou, 2017 Nov 21) -Add a ModeChanged autocommand that has an argument indicating the old and new -mode. Also used for switching Terminal mode. - When using command line window, CmdlineLeave is triggered without CmdlineEnter. (xtal8, 2017 Oct 30, #2263) Add some way to get the nested state. Although CmdwinEnter is obviously @@ -372,6 +299,9 @@ matchit hasn't been maintained for a long time. #955. +Patch to add variable name after "scope add". (Eddie Lebow, 2018 Feb 7, #2620) +Maybe not needed? + Problem with 'delcombine'. (agguser, 2017 Nov 10, #2313) MS-Windows: buffer completion doesn't work when using backslash (or slash) @@ -385,6 +315,10 @@ Window not closed when deleting buffer. (Harm te Hennepe, 2017 Aug 27, #2029) +Duplication of completion suggestions for ":!hom". Issue #539. +Patch by Christian, 2016 Jan 29 +Another patch in #2733. +> Add options_default() / options_restore() to set several options to Vim defaults for a plugin. Comments from Zyx, 2017 May 10. Perhaps use a vimcontext / endvimcontext command block. @@ -400,13 +334,13 @@ The ":move" command does not honor closed folds. (Ryan Lue, #2351) +Patch to fix increment/decrement not working properly when 'virtualedit' is +set. (Hirohito Higashi, 2016 Aug 1, #923) + Memory leaks in test_channel? (or is it because of fork()) Using uninitialized value in test_crypt. Memory leaks in test_escaped_glob -Patch to clear background when "guibg=NONE" is used and 'termguicolors' is -set. (Nick Jensen, 2017 Nov 13, #2332, based on #981 by Kazunobu Kuriyama) - Patch to make gM move to middle of line. (Yasuhiro Matsumoto, Sep 8, #2070) Cannot copy modeless selection when cursor is inside it. (lkintact, #2300) @@ -416,9 +350,6 @@ Now on github: #1856. Updated Oct 2017 Got permission to include this under the Vim license. -Patch to include hunspell support. (Matej Cepl, 2017 Dec 26, #845) -Doesn't work on Windows yet. - Refactored HTML indent file. (Michael Lee, #1821) Test_writefile_fails_conversion failure on Solaris because if different iconv @@ -457,6 +388,22 @@ clip_x11_convert_selection_cb() is invoked, thus in X library code. Kazunobu Kuriyama is working on a proper fix. (2017 Jul 25) +Include a few color schemes, based on popularity: +http://www.vim.org/scripts/script_search_results.php?keywords=&script_type=color+scheme&order_by=rating&direction=descending&search=search +http://vimawesome.com/?q=tag:color-scheme +Use names that indicate their appearance (Christian Brabandt, 2017 Aug 3) +- monokai - Xia Crusoe (2017 Aug 4) +- seoul256 - Christian Brabandt (2017 Aug 3) +- gruvbox - Christian Brabandt (2017 Aug 3) (simplified version from + Lifepillar, 2018 Jan 22, #2573) +- janah - Marco Hinz (2017 Aug 4) +- apprentice - Romain Lafourcade (2017 Aug 6) remarks about help file #1964 +Suggested by Hiroki Kokubun: +- [Iceberg](https://github.com/cocopon/iceberg.vim) (my one) +- [hybrid](https://github.com/w0ng/vim-hybrid) +Include solarized color scheme?, it does not support termguicolors. +- Sanitized version of pablo (Lifepillar, 2017 Nov 21) + Problem with three-piece comment. (Michael Lee, 2017 May 11, #1696) Creating a partial with an autoload function is confused about the "self" @@ -650,9 +597,6 @@ Update Oct 14: https://gist.github.com/mattn/d47e7d3bfe5ade4be86062b565a4bfca Update Aug 2017: #1954 -Characters deleted on completion. (Adrià Farrés, 2017 Apr 20, #1645) -Remarks from Christian Brabandt (Apr 21) - The TermResponse event is not triggered when a plugin has set 'eventignore' to "all". Netrw does this. (Gary Johnson, 2017 Jan 24) Postpone the event until 'eventignore' is reset. @@ -700,14 +644,6 @@ When 'completeopt' has "noselect" does not insert a newline. (Lifepillar, 2017 Apr 23, #1653) -Using an external diff is inefficient. Not all systems have a good diff -program available (esp. MS-Windows). Would be nice to have in internal diff -implementation. Can then also use this for displaying changes within a line. -Olaf Dabrunz is working on this. (10 Jan 2016) -9 Instead invoking an external diff program, use builtin code. One can be - found here: http://www.ioplex.com/~miallen/libmba/dl/src/diff.c - It's complicated and badly documented. - Window resizing with 'winfixheight': With a vertical split the height changes anyway. (Tommy allen, 2017 Feb 21, #1502) @@ -723,8 +659,6 @@ Patch to add Zstandard compressed file support. (Nick Terrell, 2016 Oct 24) -Patch to add trim() function. (Bukn, 2016 Nov 25, #1280) - Patch to add MODIFIED_BY to MSVC build file. (Chen Lei, 2016 Nov 24, #1275) Patch to change argument of :marks. (LemonBoy, 2017 Jan 29, #1426) @@ -747,6 +681,78 @@ sort() is not stable when using numeric/float sort (Nikolay Pavlov, 2016 Sep 4#1038) ++channel: +- Add a separate timeout for opening a socket. Currently it's fixed at 50 + msec, which is too small for a remote connection. (tverniquet, #2130) +- Problem with stderr on Windows? (Vincent Rischmann, 2016 Aug 31, #1026) +- Writing raw mode to a buffer should still handle NL characters as line + breaks. (Dmitry Zotikov, 2017 Aug 16) +- When out_cb executes :sleep, the close_cb may be invoked. (Daniel Hahler, + 2016 Dec 11, #1320) +- Implement |job-term| ? +- Channel test fails with Motif. Sometimes kills the X11 server. +- When a message in the queue but there is no callback, drop it after a while? + Add timestamp to queued messages and callbacks with ID, remove after a + minute. Option to set the droptime. +- Add an option to drop text of very long lines? Default to 1 Mbyte. +- Add remark about undo sync, is there a way to force it? +- When starting a job, have an option to open the server socket, so we know + the port, and pass it to the command with --socket-fd {nr}. (Olaf Dabrunz, + Feb 9) How to do this on MS-Windows? +- For connection to server, a "keep open" flag would be useful. Retry + connecting in the main loop with zero timeout. +- job_start(): run job in a newly opened terminal (not a terminal window). + With xterm could use -S{pty}. + Although user could use "xterm -e 'cmd arg'". + +Regexp problems: +- When search pattern has the base character both with and without combining + character, search fails. E.g. "รรีบ" in "à¸à¸²à¸£à¸£à¸µà¸šà¸£à¸±à¸à¹ƒà¸„ร". (agguser, #2312) +- [:space:] only matches ASCII spaces. Add [:white:] for all space-like + characters, esp. including 0xa0. Use character class zero. +- Since 7.4.704 the old regex engine fails to match [[:print:]] in 0xf6. + (Manuel Ortega, 2016 Apr 24) + Test fails on Mac. Avoid using isalpha(), isalnum(), etc? Depends on + LC_CTYPE +- The old engine does not find a match for "/\%#=1\(\)\{80}", the new engine + matches everywhere. +- Using win_linetabsize() can still be slow. Cache the result, store col and + vcol. Reset them when moving to another line. +- Very slow with a long line and Ruby highlighting. (John Whitley, 2014 Dec 4) +- Bug with pattern: '\vblock (\d+)\.\n.*\d+%(\1)@ and \?. (Brett Stahlman, 2013 Dec 21) Remark from Marcin + Szamotulski; Remark from Brett 2014 Jan 6 and 7. +- NFA regexp doesn't handle \%\)\@<=.*\%(<\/\(\w\+\)>\)\@=" matching text inside HTML tags. + This problem is probably the same: "\%(^\1.*$\n\)\@<=\(\d\+\).*$". + (guotuofeng, 2015 Jun 22) +- Strange matching with "\(Hello\n\)\@<=A". (Anas Syed, 2015 Feb 12) +- Problem with \v(A)@<=b+\1c. (Issue 334) +- Diff highlighting can be very slow. (Issue 309) +- Using %> for a virtual column has a check based on 'tabsize'. Better would + be to cache the result of win_linetabsize(col), storing both col and vcol, + and use them to decide whether win_linetabsize() needs to be called. Reset + col and vcol when moving to another line. +- this doesn't work: "syntax match ErrorMsg /.\%9l\%>20c\&\%<28c/". Leaving + out the \& works. Seems any column check after \& fails. +- Difference between two engines: ".*\zs\/\@>\/" on text "///" + (Chris Paul, 2016 Nov 13) New engine not greedy enough? + Another one: echom matchstr(" sdfsfsf\n sfdsdfsdf",'[^\n]*') + (2017 May 15, #1252) + Patch to add "cmdline" completion to getcompletion(). (Shougo, Oct 1, #1140) Feature request: Complete members of a dictionary. (Luc Hermitte, 2017 Jan 4, @@ -769,6 +775,8 @@ Patch to support CamelCase for spell checking: See a lower-to-upper case change as a word boundary. (btucker-MPCData, 2016 Nov 6, #1235) +patch for 'spellcamelcase' option: spellcheck each CamelCased word. +(Ben Tucker, 2016 Dec 2) Idea from Sven: record sequence of keys. Useful to show others what they are doing (look over the shoulder), and also to see what happened. @@ -785,9 +793,6 @@ Patch to order results from taglist(). (Duncan McDougall, 2016 Oct 25) -patch for 'spellcamelcase' option: spellcheck each CamelCased word. -(Ben Tucker, 2016 Dec 2) - When using ":diffput" through a mapping, undo in the target buffer isn't synced. (Ryan Carney, 2016 Sep 14) @@ -855,9 +860,6 @@ It's possible to add ",," to 'wildignore', an empty entry. Causes problems. Reject the value? #710. -Patch to fix increment/decrement not working properly when 'virtualedit' is -set. (Hirohito Higashi, 2016 Aug 1, #923) - When doing "vi buf.md" a BufNew autocommand for *.md is not triggered. Because of using the initial buffer? (Dun Peal, 2016 May 12) @@ -887,9 +889,6 @@ interfaces: https://github.com/k-takata/vim/tree/chrisbra-appveyor-build result: https://ci.appveyor.com/project/k-takata/vim/history -Duplication of completion suggestions for ":!hom". Issue 539. -Patch by Christian, 2016 Jan 29 -> Problem that a previous silent ":throw" causes a following try/catch not to work. (ZyX, 2013 Sep 28) With examples: (Malcolm Rowe, 2015 Dec 24) @@ -1072,10 +1071,6 @@ When using --remote-tab on MS-Windows 'encoding' hasn't been initialized yet, the file name ends up encoded wrong. (Raul Coronado, 2015 Dec 21) -Patch for problem with restoring screen on Windows. (Nobuhiro Takasaki, 2015 -Sep 10) Update 2018 Jan 4 #2575 -Alternate change by Ken Takata. - Example in editing.txt uses $HOME with the expectation that it ends in a slash. For me it does, but perhaps not for everybody. Add a function that inserts a slash when needed? pathconcat(dir, path) (Thilo Six, 2015 Aug 12) @@ -1122,9 +1117,6 @@ Patch to add a "literal" argument to bufnr(). (Olaf Dabrunz, 2015 Aug 4) -Cannot execute the shell when it's in a directory with a space. -Issue #459. - When a session file is created and there are "nofile" buffers, these are not filled. Need to trigger BufReadCmd autocommands. Also handle deleting the initial empty buffer better. (ZyX, 2015 March 8) @@ -1185,7 +1177,7 @@ (Ingo Karkat, 2015 Jan 16) Patch for variable tabstops. On github (Christian Brabandt, 2014 May 15) -Update 2016 Jun 10, # 857 +Update 2018 March 12, #2711 Redo only remembers the last change. Could use "{count}g." to redo an older change. How does the user know which change? At least have a way to list @@ -1224,6 +1216,9 @@ New OpenOffice spell files support this with ICONV. But they are not compatible with Vim spell files. The old files can no longer be downloaded. +Spell checking: Add a feature to only consider two spaces after a dot to start +a new sentence. Don't give the capitalization error when there is one space. + xterm should be able to pass focus changes to Vim, so that Vim can check for buffers that changed. Perhaps in misc.c, function selectwindow(). Xterm 224 supports it! @@ -4401,6 +4396,8 @@ Shared libraries: +8 libcall() can keep the library around instead of always calling dlclose(). + (Jason Felice, 2018 Mar 20) 6 Add support for loading shared libraries, and calling functions in it. :libload internal-name libname :libunload internal-name @@ -4623,8 +4620,6 @@ Error - When an error happens NormalEnter - Entering Normal mode ReplaceEnter - Entering Replace mode - CmdEnter - Entering Cmdline mode (with type of cmdline to allow - different mapping) VisualEnter - Entering Visual mode *Leave - Leaving a mode (in pair with the above *Enter) VimLeaveCheck - Before Vim decides to exit, so that it can be cancelled diff -Nru vim-8.0.1453/runtime/doc/usr_05.txt vim-8.0.1766/runtime/doc/usr_05.txt --- vim-8.0.1453/runtime/doc/usr_05.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/usr_05.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*usr_05.txt* For Vim version 8.0. Last change: 2016 Mar 28 +*usr_05.txt* For Vim version 8.0. Last change: 2018 Feb 20 VIM USER MANUAL - by Bram Moolenaar @@ -48,6 +48,14 @@ $HOME/_vimrc ~ $VIM/_vimrc ~ +If you are creating the vimrc file for the first time, it is recommended to +put this line at the top: > + + source $VIMRUNTIME/defaults.vim + +This initializes Vim for new users (as opposed to traditional Vi users). See +|defaults.vim| for the details. + The vimrc file can contain all the commands that you type after a colon. The most simple ones are for setting options. For example, if you want Vim to always start with the 'incsearch' option on, add this line your vimrc file: > diff -Nru vim-8.0.1453/runtime/doc/usr_11.txt vim-8.0.1766/runtime/doc/usr_11.txt --- vim-8.0.1453/runtime/doc/usr_11.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/usr_11.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*usr_11.txt* For Vim version 8.0. Last change: 2010 Jul 20 +*usr_11.txt* For Vim version 8.0. Last change: 2018 Apr 13 VIM USER MANUAL - by Bram Moolenaar @@ -234,7 +234,7 @@ WHAT TO DO? *swap-exists-choices* -If dialogs are supported you will be asked to select one of five choices: +If dialogs are supported you will be asked to select one of six choices: Swap file ".main.c.swp" already exists! ~ [O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort, (D)elete it: ~ diff -Nru vim-8.0.1453/runtime/doc/usr_24.txt vim-8.0.1766/runtime/doc/usr_24.txt --- vim-8.0.1453/runtime/doc/usr_24.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/usr_24.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*usr_24.txt* For Vim version 8.0. Last change: 2006 Jul 23 +*usr_24.txt* For Vim version 8.0. Last change: 2018 Mar 18 VIM USER MANUAL - by Bram Moolenaar @@ -538,8 +538,8 @@ *24.9* Digraphs Some characters are not on the keyboard. For example, the copyright character -(©). To type these characters in Vim, you use digraphs, where two characters -represent one. To enter a ©, for example, you press three keys: > +(©). To type these characters in Vim, you use digraphs, where two characters +represent one. To enter a ©, for example, you press three keys: > CTRL-K Co @@ -549,12 +549,12 @@ Vim will display the digraph table. Here are three lines of it: - AC ~_ 159 NS | 160 !I ¡ 161 Ct ¢ 162 Pd £ 163 Cu ¤ 164 Ye ¥ 165 ~ - BB ¦ 166 SE § 167 ': ¨ 168 Co © 169 -a ª 170 << « 171 NO ¬ 172 ~ - -- ­ 173 Rg ® 174 'm ¯ 175 DG ° 176 +- ± 177 2S ² 178 3S ³ 179 ~ + AC ~_ 159 NS | 160 !I ¡ 161 Ct ¢ 162 Pd £ 163 Cu ¤ 164 Ye Â¥ 165 ~ + BB ¦ 166 SE § 167 ': ¨ 168 Co © 169 -a ª 170 << « 171 NO ¬ 172 ~ + -- ­ 173 Rg ® 174 'm ¯ 175 DG ° 176 +- ± 177 2S ² 178 3S ³ 179 ~ This shows, for example, that the digraph you get by typing CTRL-K Pd is the -character (£). This is character number 163 (decimal). +character (£). This is character number 163 (decimal). Pd is short for Pound. Most digraphs are selected to give you a hint about the character they will produce. If you look through the list you will understand the logic. @@ -569,9 +569,9 @@ You can define your own digraphs. Example: > - :digraph a" ä + :digraph a" ä -This defines that CTRL-K a" inserts an ä character. You can also specify the +This defines that CTRL-K a" inserts an ä character. You can also specify the character with a decimal number. This defines the same digraph: > :digraph a" 228 diff -Nru vim-8.0.1453/runtime/doc/usr_41.txt vim-8.0.1766/runtime/doc/usr_41.txt --- vim-8.0.1453/runtime/doc/usr_41.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/usr_41.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 8.0. Last change: 2017 Dec 02 +*usr_41.txt* For Vim version 8.0. Last change: 2018 Apr 11 VIM USER MANUAL - by Bram Moolenaar @@ -807,6 +807,8 @@ getbufinfo() get a list with buffer information gettabinfo() get a list with tab page information getwininfo() get a list with window information + getchangelist() get a list of change list entries + getjumplist() get a list of jump list entries Command line: *command-line-functions* getcmdline() get the current command line @@ -883,8 +885,9 @@ GUI: *gui-functions* getfontname() get name of current font being used - getwinposx() X position of the GUI Vim window - getwinposy() Y position of the GUI Vim window + getwinpos() position of the Vim window + getwinposx() X position of the Vim window + getwinposy() Y position of the Vim window balloon_show() set the balloon content balloon_split() split a message for a balloon @@ -922,7 +925,8 @@ assert_false() assert that an expression is false assert_true() assert that an expression is true assert_exception() assert that a command throws an exception - assert_fails() assert that a function call fails + assert_beeps() assert that a command beeps + assert_fails() assert that a command fails assert_report() report a test failure test_alloc_fail() make memory allocation fail test_autochdir() enable 'autochdir' during startup @@ -984,6 +988,8 @@ term_getstatus() get the status of a terminal term_gettitle() get the title of a terminal term_gettty() get the tty name of a terminal + term_setansicolors() set 16 ANSI colors, used for GUI + term_getansicolors() get 16 ANSI colors, used for GUI Timers: *timer-functions* timer_start() create a timer diff -Nru vim-8.0.1453/runtime/doc/various.txt vim-8.0.1766/runtime/doc/various.txt --- vim-8.0.1453/runtime/doc/various.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/various.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*various.txt* For Vim version 8.0. Last change: 2017 Nov 18 +*various.txt* For Vim version 8.0. Last change: 2018 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -40,23 +40,35 @@ :as[cii] or *ga* *:as* *:ascii* ga Print the ascii value of the character under the - cursor in decimal, hexadecimal and octal. For - example, when the cursor is on a 'R': + cursor in decimal, hexadecimal and octal. + Mnemonic: Get Ascii value. + + For example, when the cursor is on a 'R': 82, Hex 52, Octal 122 ~ When the character is a non-standard ASCII character, but printable according to the 'isprint' option, the - non-printable version is also given. When the - character is larger than 127, the form is also - printed. For example: + non-printable version is also given. + + When the character is larger than 127, the form + is also printed. For example: <~A> 129, Hex 81, Octal 201 ~

<|~> 254, Hex fe, Octal 376 ~ (where

is a special character) + The character in a file is stored internally as , but it will be shown as: <^@> 0, Hex 00, Octal 000 ~ + If the character has composing characters these are also shown. The value of 'maxcombine' doesn't matter. - Mnemonic: Get Ascii value. {not in Vi} + + If the character can be inserted as a digraph, also + output the two characters that can be used to create + the character: + <ö> 246, Hex 00f6, Oct 366, Digr o: ~ + This shows you can type CTRL-K o : to insert ö. + + {not in Vi} *g8* g8 Print the hex values of the bytes used in the @@ -294,7 +306,7 @@ Here is an overview of the features. The first column shows the smallest version in which they are included: - T tiny + T tiny (always) S small N normal B big @@ -308,7 +320,7 @@ *+acl* |ACL| support included *+ARP* Amiga only: ARP support included B *+arabic* |Arabic| language support -N *+autocmd* |:autocmd|, automatic commands +T *+autocmd* |:autocmd|, automatic commands H *+autoservername* Automatically enable |clientserver| m *+balloon_eval* |balloon-eval| support in the GUI. Included when compiling with supported GUI (Motif, GTK, GUI) and @@ -332,7 +344,7 @@ B *+conceal* "conceal" support, see |conceal| |:syn-conceal| etc. N *+cryptv* encryption support |encryption| B *+cscope* |cscope| support -m *+cursorbind* |'cursorbind'| support +T *+cursorbind* |'cursorbind'| support m *+cursorshape* |termcap-cursor-shape| support m *+debug* Compiled for debugging. N *+dialog_gui* Support for |:confirm| with GUI dialog. @@ -340,7 +352,7 @@ N *+dialog_con_gui* Support for |:confirm| with GUI and console dialog. N *+diff* |vimdiff| and 'diff' N *+digraphs* |digraphs| *E196* -m *+directx* Win32 GUI only: DirectX and |'renderoptions'| + *+directx* Win32 GUI only: DirectX and |'renderoptions'| *+dnd* Support for DnD into the "~ register |quote_~|. B *+emacs_tags* |emacs-tags| files N *+eval* expression evaluation |eval.txt| @@ -372,7 +384,7 @@ N *+libcall* |libcall()| N *+linebreak* |'linebreak'|, |'breakat'| and |'showbreak'| N *+lispindent* |'lisp'| -N *+listcmds* Vim commands for the list of buffers |buffer-hidden| +T *+listcmds* Vim commands for the list of buffers |buffer-hidden| and argument list |:argdelete| N *+localmap* Support for mappings local to a buffer |:map-local| m *+lua* |Lua| interface @@ -417,7 +429,7 @@ B *+rightleft* Right to left typing |'rightleft'| m *+ruby* Ruby interface |ruby| m *+ruby/dyn* Ruby interface |ruby-dynamic| |/dyn| -N *+scrollbind* |'scrollbind'| +T *+scrollbind* |'scrollbind'| B *+signs* |:sign| N *+smartindent* |'smartindent'| N *+startuptime* |--startuptime| argument @@ -449,6 +461,7 @@ S *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200. N *+visualextra* extra Visual mode commands |blockwise-operators| N *+vreplace* |gR| and |gr| + *+vtp* on MS-Windows console: support for 'termguicolors' N *+wildignore* |'wildignore'| N *+wildmenu* |'wildmenu'| *+windows* more than one window; Always enabled since 8.0.1118. diff -Nru vim-8.0.1453/runtime/doc/version6.txt vim-8.0.1766/runtime/doc/version6.txt --- vim-8.0.1453/runtime/doc/version6.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/version6.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*version6.txt* For Vim version 8.0. Last change: 2014 Aug 29 +*version6.txt* For Vim version 8.0. Last change: 2018 Mar 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -6103,7 +6103,7 @@ Slovak (Lubos Celko) Greek (Christos Kontas) German (Joachim Hofmann) - Norwegian (Øyvind Holm) + Norwegian (Øyvind Holm) New filetype plugins: Occam (Mario Schweigler) @@ -6121,13 +6121,13 @@ Modelsim vcom (Paul Baleme) New menu translations: - Brazilian (José de Paula) + Brazilian (José de Paula) British (Mike Williams) Korean in UTF-8. (Nam SungHyun) - Norwegian (Øyvind Holm) + Norwegian (Øyvind Holm) Serbian (Aleksandar Jelenak) -New message translation for Norwegian. (Øyvind Holm) +New message translation for Norwegian. (Øyvind Holm) New color scheme: desert (Hans Fugal) @@ -10066,7 +10066,7 @@ Patch 6.2.019 (lang) Problem: Loading the Portuguese menu causes an error message. -Solution: Join two lines. (Jose Pedro Oliveira, José de Paula) +Solution: Join two lines. (Jose Pedro Oliveira, José de Paula) Files: runtime/lang/menu_pt_br.vim Patch 6.2.020 @@ -12418,7 +12418,7 @@ Patch 6.2.376 Problem: Win32: Ruby interface cannot be dynamically linked with Ruby 1.6. -Solution: Add #ifdefs around use of rb_w32_snprintf(). (Benoît Cerrina) +Solution: Add #ifdefs around use of rb_w32_snprintf(). (Benoît Cerrina) Files: src/if_ruby.c Patch 6.2.377 (after 6.2.372) @@ -14320,7 +14320,7 @@ Patch 6.3.061 Problem: When editing a utf-8 file in an utf-8 xterm and there is a multi-byte character in the last column, displaying is messed up. - (Joël Rio) + (Joël Rio) Solution: Check for a multi-byte character, not a multi-column character. Files: src/screen.c diff -Nru vim-8.0.1453/runtime/doc/windows.txt vim-8.0.1766/runtime/doc/windows.txt --- vim-8.0.1453/runtime/doc/windows.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/windows.txt 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -*windows.txt* For Vim version 8.0. Last change: 2017 Sep 25 +*windows.txt* For Vim version 8.0. Last change: 2018 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -711,7 +711,6 @@ When using the |:tab| modifier each argument is opened in a tab page. The last window is used if it's empty. Also see |++opt| and |+cmd|. - {only available when compiled with a GUI} ============================================================================== 8. Do a command in all buffers or windows *list-repeat* @@ -732,8 +731,7 @@ the current window. {cmd} can contain '|' to concatenate several commands. {cmd} must not open or close windows or reorder them. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} Also see |:tabdo|, |:argdo|, |:bufdo|, |:cdo|, |:ldo|, |:cfdo| and |:lfdo| @@ -761,8 +759,7 @@ autocommand event is disabled by adding it to 'eventignore'. This considerably speeds up editing each buffer. - {not in Vi} {not available when compiled without the - |+listcmds| feature} + {not in Vi} Also see |:tabdo|, |:argdo|, |:windo|, |:cdo|, |:ldo|, |:cfdo| and |:lfdo| @@ -975,7 +972,6 @@ A hidden buffer is not displayed in a window, but is still loaded into memory. This makes it possible to jump from file to file, without the need to read or write the file every time you get another buffer in a window. -{not available when compiled without the |+listcmds| feature} *:buffer-!* If the option 'hidden' ('hid') is set, abandoned buffers are kept for all @@ -1050,6 +1046,9 @@ x buffers with a read error % current buffer # alternate buffer + R terminal buffers with a running job + F terminal buffers with a finished job + ? terminal buffers without a job: `:terminal NONE` Combining flags means they are "and"ed together, e.g.: h+ hidden buffers which are modified a+ active buffers which are modified diff -Nru vim-8.0.1453/runtime/doc/xxd.1 vim-8.0.1766/runtime/doc/xxd.1 --- vim-8.0.1453/runtime/doc/xxd.1 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/xxd.1 2018-04-26 20:30:33.000000000 +0000 @@ -57,7 +57,7 @@ .PP .TP .IR \-a " | " \-autoskip -toggle autoskip: A single '*' replaces nul-lines. Default off. +Toggle autoskip: A single '*' replaces nul-lines. Default off. .TP .IR \-b " | " \-bits Switch to bits (binary digits) dump, rather than hexdump. @@ -67,10 +67,13 @@ \-r, \-p, \-i do not work with this mode. .TP .IR "\-c cols " | " \-cols cols" -format +Format .RI < cols > octets per line. Default 16 (\-i: 12, \-ps: 30, \-b: 6). Max 256. .TP +.IR \-C " | " \-capitalize +Capitalize variable names in C include file style, when using \-i. +.TP .IR \-E " | " \-EBCDIC Change the character encoding in the righthand column from ASCII to EBCDIC. This does not change the hexadecimal representation. The option is @@ -87,7 +90,7 @@ \-r, \-p, \-i do not work with this mode. .TP .IR "\-g bytes " | " \-groupsize bytes" -separate the output of every +Separate the output of every .RI < bytes > bytes (two hex characters or eight bit-digits each) by a whitespace. Specify @@ -98,28 +101,28 @@ Grouping does not apply to postscript or include style. .TP .IR \-h " | " \-help -print a summary of available commands and exit. No hex dumping is performed. +Print a summary of available commands and exit. No hex dumping is performed. .TP .IR \-i " | " \-include -output in C include file style. A complete static array definition is written +Output in C include file style. A complete static array definition is written (named after the input file), unless xxd reads from stdin. .TP .IR "\-l len " | " \-len len" -stop after writing +Stop after writing .RI < len > octets. .TP .I \-o offset -add +Add .RI < offset > to the displayed file position. .TP .IR \-p " | " \-ps " | " \-postscript " | " \-plain -output in postscript continuous hexdump style. Also known as plain hexdump +Output in postscript continuous hexdump style. Also known as plain hexdump style. .TP .IR \-r " | " \-revert -reverse operation: convert (or patch) hexdump into binary. +Reverse operation: convert (or patch) hexdump into binary. If not writing to stdout, xxd writes into its output file without truncating it. Use the combination .I \-r \-p @@ -135,7 +138,7 @@ added to file positions found in hexdump. .TP .I \-s [+][\-]seek -start at +Start at .RI < seek > bytes abs. (or rel.) infile offset. \fI+ \fRindicates that the seek is relative to the current stdin file position @@ -145,10 +148,10 @@ Without \-s option, xxd starts at the current file position. .TP .I \-u -use upper case hex letters. Default is lower case. +Use upper case hex letters. Default is lower case. .TP .IR \-v " | " \-version -show version string. +Show version string. .SH CAVEATS .PP .I xxd \-r diff -Nru vim-8.0.1453/runtime/doc/xxd.man vim-8.0.1766/runtime/doc/xxd.man --- vim-8.0.1453/runtime/doc/xxd.man 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/doc/xxd.man 2018-04-26 20:30:33.000000000 +0000 @@ -30,7 +30,7 @@ notation. Thus -c8, -c 8, -c 010 and -cols 8 are all equivalent. -a | -autoskip - toggle autoskip: A single '*' replaces nul-lines. Default off. + Toggle autoskip: A single '*' replaces nul-lines. Default off. -b | -bits Switch to bits (binary digits) dump, rather than hexdump. This @@ -41,9 +41,13 @@ mode. -c cols | -cols cols - format octets per line. Default 16 (-i: 12, -ps: 30, -b: + Format octets per line. Default 16 (-i: 12, -ps: 30, -b: 6). Max 256. + -C | -capitalize + Capitalize variable names in C include file style, when using + -i. + -E | -EBCDIC Change the character encoding in the righthand column from ASCII to EBCDIC. This does not change the hexadecimal representation. @@ -52,41 +56,41 @@ -e Switch to little-endian hexdump. This option treats byte groups as words in little-endian byte order. The default grouping of 4 bytes may be changed using -g. This option only applies to hex†- dump, leaving the ASCII (or EBCDIC) representation unchanged. + dump, leaving the ASCII (or EBCDIC) representation unchanged. The command line switches -r, -p, -i do not work with this mode. -g bytes | -groupsize bytes - separate the output of every bytes (two hex characters + Separate the output of every bytes (two hex characters or eight bit-digits each) by a whitespace. Specify -g 0 to sup†press grouping. defaults to 2 in normal mode, 4 in lit†- tle-endian mode and 1 in bits mode. Grouping does not apply to + tle-endian mode and 1 in bits mode. Grouping does not apply to postscript or include style. -h | -help - print a summary of available commands and exit. No hex dumping + Print a summary of available commands and exit. No hex dumping is performed. -i | -include - output in C include file style. A complete static array defini†- tion is written (named after the input file), unless xxd reads + Output in C include file style. A complete static array defini†+ tion is written (named after the input file), unless xxd reads from stdin. -l len | -len len - stop after writing octets. + Stop after writing octets. -o offset - add to the displayed file position. + Add to the displayed file position. -p | -ps | -postscript | -plain - output in postscript continuous hexdump style. Also known as + Output in postscript continuous hexdump style. Also known as plain hexdump style. -r | -revert - reverse operation: convert (or patch) hexdump into binary. If - not writing to stdout, xxd writes into its output file without + Reverse operation: convert (or patch) hexdump into binary. If + not writing to stdout, xxd writes into its output file without truncating it. Use the combination -r -p to read plain hexadeci†mal dumps without line number information and without a particu†- lar column layout. Additional Whitespace and line-breaks are + lar column layout. Additional Whitespace and line-breaks are allowed anywhere. -seek offset @@ -94,34 +98,34 @@ found in hexdump. -s [+][-]seek - start at bytes abs. (or rel.) infile offset. + indicates - that the seek is relative to the current stdin file position + Start at bytes abs. (or rel.) infile offset. + indicates + that the seek is relative to the current stdin file position (meaningless when not reading from stdin). - indicates that the - seek should be that many characters from the end of the input + seek should be that many characters from the end of the input (or if combined with +: before the current stdin file position). Without -s option, xxd starts at the current file position. - -u use upper case hex letters. Default is lower case. + -u Use upper case hex letters. Default is lower case. -v | -version - show version string. + Show version string. CAVEATS xxd -r has some builtin magic while evaluating line number information. - If the output file is seekable, then the linenumbers at the start of - each hexdump line may be out of order, lines may be missing, or over†- lapping. In these cases xxd will lseek(2) to the next position. If the - output file is not seekable, only gaps are allowed, which will be + If the output file is seekable, then the linenumbers at the start of + each hexdump line may be out of order, lines may be missing, or over†+ lapping. In these cases xxd will lseek(2) to the next position. If the + output file is not seekable, only gaps are allowed, which will be filled by null-bytes. xxd -r never generates parse errors. Garbage is silently skipped. - When editing hexdumps, please note that xxd -r skips everything on the + When editing hexdumps, please note that xxd -r skips everything on the input line after reading enough columns of hexadecimal data (see option - -c). This also means, that changes to the printable ascii (or ebcdic) - columns are always ignored. Reverting a plain (or postscript) style - hexdump with xxd -r -p does not depend on the correct number of col†- umns. Here anything that looks like a pair of hex-digits is inter†+ -c). This also means, that changes to the printable ascii (or ebcdic) + columns are always ignored. Reverting a plain (or postscript) style + hexdump with xxd -r -p does not depend on the correct number of col†+ umns. Here anything that looks like a pair of hex-digits is inter†preted. Note the difference between @@ -129,28 +133,28 @@ and % xxd -i < file - xxd -s +seek may be different from xxd -s seek, as lseek(2) is used to + xxd -s +seek may be different from xxd -s seek, as lseek(2) is used to "rewind" input. A '+' makes a difference if the input source is stdin, - and if stdin's file position is not at the start of the file by the - time xxd is started and given its input. The following examples may + and if stdin's file position is not at the start of the file by the + time xxd is started and given its input. The following examples may help to clarify (or further confuse!)... - Rewind stdin before reading; needed because the `cat' has already read + Rewind stdin before reading; needed because the `cat' has already read to the end of stdin. % sh -c "cat > plain_copy; xxd -s 0 > hex_copy" < file - Hexdump from file position 0x480 (=1024+128) onwards. The `+' sign + Hexdump from file position 0x480 (=1024+128) onwards. The `+' sign means "relative to the current position", thus the `128' adds to the 1k where dd left off. - % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +128 > hex_snippet" + % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +128 > hex_snippet" < file Hexdump from file position 0x100 ( = 1024-768) on. % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +-768 > hex_snippet" < file - However, this is a rare situation and the use of `+' is rarely needed. - The author prefers to monitor the effect of xxd with strace(1) or + However, this is a rare situation and the use of `+' is rarely needed. + The author prefers to monitor the effect of xxd with strace(1) or truss(1), whenever -s is used. EXAMPLES @@ -194,7 +198,7 @@ % xxd -s 0x36 -l 13 -c 13 xxd.1 0000036: 3235 7468 204d 6179 2031 3939 36 25th May 1996 - Create a 65537 byte file with all bytes 0x00, except for the last one + Create a 65537 byte file with all bytes 0x00, except for the last one which is 'A' (hex 0x41). % echo "010000: 41" | xxd -r > file @@ -204,7 +208,7 @@ * 000fffc: 0000 0000 40 ....A - Create a 1 byte file containing a single 'A' character. The number + Create a 1 byte file containing a single 'A' character. The number after '-r -s' adds to the linenumbers found in the file; in effect, the leading bytes are suppressed. % echo "010000: 41" | xxd -r -s -0x10000 > file @@ -245,7 +249,7 @@ uuencode(1), uudecode(1), patch(1) WARNINGS - The tools weirdness matches its creators brain. Use entirely at your + The tools weirdness matches its creators brain. Use entirely at your own risk. Copy files. Trace it. Become a wizard. VERSION diff -Nru vim-8.0.1453/runtime/ftplugin/chicken.vim vim-8.0.1766/runtime/ftplugin/chicken.vim --- vim-8.0.1453/runtime/ftplugin/chicken.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/runtime/ftplugin/chicken.vim 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,54 @@ +" CHICKEN-specific Vim customizations +" Last Change: 2018-03-05 +" Author: Evan Hanson +" Maintainer: Evan Hanson +" URL: https://foldling.org/vim/ftplugin/chicken.vim +" Notes: These are supplemental settings, to be loaded after the core +" Scheme ftplugin file (ftplugin/scheme.vim). Enable it by setting +" b:is_chicken=1 and filetype=scheme. + +if !exists('b:did_scheme_ftplugin') + finish +endif + +setl keywordprg=chicken-doc + +setl lispwords+=and-let* +setl lispwords+=compiler-typecase +setl lispwords+=condition-case +setl lispwords+=define-compiler-syntax +setl lispwords+=define-constant +setl lispwords+=define-external +setl lispwords+=define-for-syntax +setl lispwords+=define-foreign-type +setl lispwords+=define-inline +setl lispwords+=define-location +setl lispwords+=define-record +setl lispwords+=define-record-printer +setl lispwords+=define-specialization +setl lispwords+=fluid-let +setl lispwords+=foreign-lambda* +setl lispwords+=foreign-primitive +setl lispwords+=foreign-safe-lambda* +setl lispwords+=functor +setl lispwords+=handle-exceptions +setl lispwords+=let-compiler-syntax +setl lispwords+=let-location +setl lispwords+=let-optionals +setl lispwords+=let-optionals* +setl lispwords+=letrec-values +setl lispwords+=match +setl lispwords+=match-let +setl lispwords+=match-let* +setl lispwords+=match-letrec +setl lispwords+=module +setl lispwords+=receive +setl lispwords+=set!-values +setl lispwords+=test-group + +let b:undo_ftplugin = b:undo_ftplugin . ' keywordprg<' + +if exists('g:loaded_matchit') && !exists('b:match_words') + let b:match_words = '#>:<#' + let b:undo_ftplugin = b:undo_ftplugin . ' | unlet! b:match_words' +endif diff -Nru vim-8.0.1453/runtime/ftplugin/debchangelog.vim vim-8.0.1766/runtime/ftplugin/debchangelog.vim --- vim-8.0.1453/runtime/ftplugin/debchangelog.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/ftplugin/debchangelog.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,11 +1,11 @@ " Vim filetype plugin file (GUI menu, folding and completion) " Language: Debian Changelog -" Maintainer: Debian Vim Maintainers +" Maintainer: Debian Vim Maintainers " Former Maintainers: Michael Piefel " Stefano Zacchiroli -" Last Change: 2014-01-31 +" Last Change: 2018-01-06 " License: Vim License -" URL: http://hg.debian.org/hg/pkg-vim/vim/file/unstable/runtime/ftplugin/debchangelog.vim +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/ftplugin/debchangelog.vim " Bug completion requires apt-listbugs installed for Debian packages or " python-launchpadlib installed for Ubuntu packages diff -Nru vim-8.0.1453/runtime/ftplugin/debcontrol.vim vim-8.0.1766/runtime/ftplugin/debcontrol.vim --- vim-8.0.1453/runtime/ftplugin/debcontrol.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/ftplugin/debcontrol.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,9 +1,9 @@ " Vim filetype plugin file (GUI menu and folding) " Language: Debian control files -" Maintainer: Debian Vim Maintainers +" Maintainer: Debian Vim Maintainers " Former Maintainer: Pierre Habouzit -" Last Change: 2008-03-08 -" URL: http://hg.debian.org/hg/pkg-vim/vim/raw-file/tip/runtime/ftplugin/debcontrol.vim +" Last Change: 2018-01-06 +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/ftplugin/debcontrol.vim " Do these settings once per buffer if exists("b:did_ftplugin") diff -Nru vim-8.0.1453/runtime/ftplugin/python.vim vim-8.0.1766/runtime/ftplugin/python.vim --- vim-8.0.1453/runtime/ftplugin/python.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/ftplugin/python.vim 2018-04-26 20:30:33.000000000 +0000 @@ -3,7 +3,7 @@ " Maintainer: Tom Picton " Previous Maintainer: James Sully " Previous Maintainer: Johannes Zellner -" Last Change: Wed, 20 December 2017 +" Last Change: Sun, 15 April 2018 " https://github.com/tpict/vim-ftplugin-python if exists("b:did_ftplugin") | finish | endif @@ -14,7 +14,25 @@ setlocal cinkeys-=0# setlocal indentkeys-=0# setlocal include=^\\s*\\(from\\\|import\\) -setlocal includeexpr=substitute(v:fname,'\\.','/','g') + +" For imports with leading .., append / and replace additional .s with ../ +let b:grandparent_match = '^\(.\.\)\(\.*\)' +let b:grandparent_sub = '\=submatch(1)."/".repeat("../",strlen(submatch(2)))' + +" For imports with a single leading ., replace it with ./ +let b:parent_match = '^\.\(\.\)\@!' +let b:parent_sub = './' + +" Replace any . sandwiched between word characters with / +let b:child_match = '\(\w\)\.\(\w\)' +let b:child_sub = '\1/\2' + +setlocal includeexpr=substitute(substitute(substitute( + \v:fname, + \b:grandparent_match,b:grandparent_sub,''), + \b:parent_match,b:parent_sub,''), + \b:child_match,b:child_sub,'g') + setlocal suffixesadd=.py setlocal comments=b:#,fb:- setlocal commentstring=#\ %s @@ -35,35 +53,35 @@ let b:next_end='\v\S\n*(%$\|^(\s*\n*)*(class\|def\|async def)\|^\S)' let b:prev_end='\v\S\n*(^(\s*\n*)*(class\|def\|async def)\|^\S)' -execute "nnoremap ]] :call Python_jump('n', '". b:next_toplevel."', 'W')" -execute "nnoremap [[ :call Python_jump('n', '". b:prev_toplevel."', 'Wb')" -execute "nnoremap ][ :call Python_jump('n', '". b:next_endtoplevel."', 'W', 0)" -execute "nnoremap [] :call Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0)" -execute "nnoremap ]m :call Python_jump('n', '". b:next."', 'W')" -execute "nnoremap [m :call Python_jump('n', '". b:prev."', 'Wb')" -execute "nnoremap ]M :call Python_jump('n', '". b:next_end."', 'W', 0)" -execute "nnoremap [M :call Python_jump('n', '". b:prev_end."', 'Wb', 0)" - -execute "onoremap ]] :call Python_jump('o', '". b:next_toplevel."', 'W')" -execute "onoremap [[ :call Python_jump('o', '". b:prev_toplevel."', 'Wb')" -execute "onoremap ][ :call Python_jump('o', '". b:next_endtoplevel."', 'W', 0)" -execute "onoremap [] :call Python_jump('o', '". b:prev_endtoplevel."', 'Wb', 0)" -execute "onoremap ]m :call Python_jump('o', '". b:next."', 'W')" -execute "onoremap [m :call Python_jump('o', '". b:prev."', 'Wb')" -execute "onoremap ]M :call Python_jump('o', '". b:next_end."', 'W', 0)" -execute "onoremap [M :call Python_jump('o', '". b:prev_end."', 'Wb', 0)" - -execute "xnoremap ]] :call Python_jump('x', '". b:next_toplevel."', 'W')" -execute "xnoremap [[ :call Python_jump('x', '". b:prev_toplevel."', 'Wb')" -execute "xnoremap ][ :call Python_jump('x', '". b:next_endtoplevel."', 'W', 0)" -execute "xnoremap [] :call Python_jump('x', '". b:prev_endtoplevel."', 'Wb', 0)" -execute "xnoremap ]m :call Python_jump('x', '". b:next."', 'W')" -execute "xnoremap [m :call Python_jump('x', '". b:prev."', 'Wb')" -execute "xnoremap ]M :call Python_jump('x', '". b:next_end."', 'W', 0)" -execute "xnoremap [M :call Python_jump('x', '". b:prev_end."', 'Wb', 0)" +execute "nnoremap ]] :call Python_jump('n', '". b:next_toplevel."', 'W', v:count1)" +execute "nnoremap [[ :call Python_jump('n', '". b:prev_toplevel."', 'Wb', v:count1)" +execute "nnoremap ][ :call Python_jump('n', '". b:next_endtoplevel."', 'W', 0, v:count1)" +execute "nnoremap [] :call Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)" +execute "nnoremap ]m :call Python_jump('n', '". b:next."', 'W', v:count1)" +execute "nnoremap [m :call Python_jump('n', '". b:prev."', 'Wb', v:count1)" +execute "nnoremap ]M :call Python_jump('n', '". b:next_end."', 'W', 0, v:count1)" +execute "nnoremap [M :call Python_jump('n', '". b:prev_end."', 'Wb', 0, v:count1)" + +execute "onoremap ]] :call Python_jump('o', '". b:next_toplevel."', 'W', v:count1)" +execute "onoremap [[ :call Python_jump('o', '". b:prev_toplevel."', 'Wb', v:count1)" +execute "onoremap ][ :call Python_jump('o', '". b:next_endtoplevel."', 'W', 0, v:count1)" +execute "onoremap [] :call Python_jump('o', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)" +execute "onoremap ]m :call Python_jump('o', '". b:next."', 'W', v:count1)" +execute "onoremap [m :call Python_jump('o', '". b:prev."', 'Wb', v:count1)" +execute "onoremap ]M :call Python_jump('o', '". b:next_end."', 'W', 0, v:count1)" +execute "onoremap [M :call Python_jump('o', '". b:prev_end."', 'Wb', 0, v:count1)" + +execute "xnoremap ]] :call Python_jump('x', '". b:next_toplevel."', 'W', v:count1)" +execute "xnoremap [[ :call Python_jump('x', '". b:prev_toplevel."', 'Wb', v:count1)" +execute "xnoremap ][ :call Python_jump('x', '". b:next_endtoplevel."', 'W', 0, v:count1)" +execute "xnoremap [] :call Python_jump('x', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)" +execute "xnoremap ]m :call Python_jump('x', '". b:next."', 'W', v:count1)" +execute "xnoremap [m :call Python_jump('x', '". b:prev."', 'Wb', v:count1)" +execute "xnoremap ]M :call Python_jump('x', '". b:next_end."', 'W', 0, v:count1)" +execute "xnoremap [M :call Python_jump('x', '". b:prev_end."', 'Wb', 0, v:count1)" if !exists('*Python_jump') - fun! Python_jump(mode, motion, flags, ...) range + fun! Python_jump(mode, motion, flags, count, ...) range let l:startofline = (a:0 >= 1) ? a:1 : 1 if a:mode == 'x' @@ -74,7 +92,7 @@ normal! 0 endif - let cnt = v:count1 + let cnt = a:count mark ' while cnt > 0 call search(a:motion, a:flags) diff -Nru vim-8.0.1453/runtime/ftplugin/scheme.vim vim-8.0.1766/runtime/ftplugin/scheme.vim --- vim-8.0.1453/runtime/ftplugin/scheme.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/ftplugin/scheme.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,45 +1,57 @@ -" Vim filetype plugin -" Language: Scheme -" Maintainer: Sergey Khorev -" URL: http://sites.google.com/site/khorser/opensource/vim -" Original author: Dorai Sitaram -" Original URL: http://www.ccs.neu.edu/~dorai/vimplugins/vimplugins.html -" Last Change: Oct 23, 2013 +" Vim filetype plugin file +" Language: Scheme (R7RS) +" Last Change: 2018-03-05 +" Author: Evan Hanson +" Maintainer: Evan Hanson +" Previous Maintainer: Sergey Khorev +" URL: https://foldling.org/vim/ftplugin/scheme.vim -" Only do this when not done yet for this buffer -if exists("b:did_ftplugin") +if exists('b:did_ftplugin') finish endif -" Don't load another plugin for this buffer -let b:did_ftplugin = 1 +let s:cpo = &cpo +set cpo&vim -" Copy-paste from ftplugin/lisp.vim -setl comments=:; -setl define=^\\s*(def\\k* -setl formatoptions-=t -setl iskeyword+=+,-,*,/,%,<,=,>,:,$,?,!,@-@,94 setl lisp +setl comments=:;;;;,:;;;,:;;,:;,sr:#\|,mb:\|,ex:\|# setl commentstring=;%s +setl define=^\\s*(def\\k* +setl iskeyword=33,35-39,42-43,45-58,60-90,94,95,97-122,126 -setl comments^=:;;;,:;;,sr:#\|,mb:\|,ex:\|# +let b:undo_ftplugin = 'setl lisp< comments< commentstring< define< iskeyword<' -" Scheme-specific settings -if exists("b:is_mzscheme") || exists("is_mzscheme") - " improve indenting - setl iskeyword+=#,%,^ - setl lispwords+=module,parameterize,let-values,let*-values,letrec-values - setl lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case - setl lispwords+=define-signature,unit,unit/sig,compund-unit/sig,define-values/invoke-unit/sig -endif +setl lispwords=case +setl lispwords+=define +setl lispwords+=define-record-type +setl lispwords+=define-syntax +setl lispwords+=define-values +setl lispwords+=do +setl lispwords+=guard +setl lispwords+=lambda +setl lispwords+=let +setl lispwords+=let* +setl lispwords+=let*-values +setl lispwords+=let-syntax +setl lispwords+=let-values +setl lispwords+=letrec +setl lispwords+=letrec* +setl lispwords+=letrec-syntax +setl lispwords+=parameterize +setl lispwords+=set! +setl lispwords+=syntax-rules +setl lispwords+=unless +setl lispwords+=when -if exists("b:is_chicken") || exists("is_chicken") - " improve indenting - setl iskeyword+=#,%,^ - setl lispwords+=let-optionals,let-optionals*,declare - setl lispwords+=let-values,let*-values,letrec-values - setl lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case - setl lispwords+=cond-expand,and-let*,foreign-lambda,foreign-lambda* +let b:undo_ftplugin = b:undo_ftplugin . ' lispwords<' + +let b:did_scheme_ftplugin = 1 + +if exists('b:is_chicken') || exists('g:is_chicken') + exe 'ru! ftplugin/chicken.vim' endif -let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lispwords< lisp< commentstring<" +unlet b:did_scheme_ftplugin +let b:did_ftplugin = 1 +let &cpo = s:cpo +unlet s:cpo diff -Nru vim-8.0.1453/runtime/indent/html.vim vim-8.0.1766/runtime/indent/html.vim --- vim-8.0.1453/runtime/indent/html.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/indent/html.vim 2018-04-26 20:30:33.000000000 +0000 @@ -2,7 +2,7 @@ " Header: "{{{ " Maintainer: Bram Moolenaar " Original Author: Andy Wokula -" Last Change: 2017 Jun 13 +" Last Change: 2018 Mar 28 " Version: 1.0 " Description: HTML indent script with cached state for faster indenting on a " range of lines. @@ -56,6 +56,9 @@ set cpo-=C "}}} +" Pattern to match the name of a tag, including custom elements. +let s:tagname = '\w\+\(-\w\+\)*' + " Check and process settings from b:html_indent and g:html_indent... variables. " Prefer using buffer-local settings over global settings, so that there can " be defaults for all HTML files and exceptions for specific types of HTML @@ -213,7 +216,8 @@ " Add known tag pairs. " Self-closing tags and tags that are sometimes {{{ " self-closing (e.g.,

) are not here (when encountering

we can find -" the matching

, but not the other way around). +" the matching

, but not the other way around). Known self-closing tags: +" 'p', 'img', 'source'. " Old HTML tags: call s:AddITags(s:indent_tags, [ \ 'a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big', @@ -230,9 +234,9 @@ call s:AddITags(s:indent_tags, [ \ 'area', 'article', 'aside', 'audio', 'bdi', 'canvas', \ 'command', 'data', 'datalist', 'details', 'embed', 'figcaption', - \ 'figure', 'footer', 'header', 'keygen', 'mark', 'meter', 'nav', 'output', - \ 'progress', 'rp', 'rt', 'ruby', 'section', 'source', 'summary', 'svg', - \ 'time', 'track', 'video', 'wbr']) + \ 'figure', 'footer', 'header', 'keygen', 'main', 'mark', 'meter', + \ 'nav', 'output', 'picture', 'progress', 'rp', 'rt', 'ruby', 'section', + \ 'summary', 'svg', 'time', 'track', 'video', 'wbr']) " Tags added for web components: call s:AddITags(s:indent_tags, [ @@ -280,7 +284,7 @@ let s:nextrel = 0 " relative indent steps for next line [unit &sw]: let s:block = 0 " assume starting outside of a block let s:countonly = 1 " don't change state - call substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|\|', '\=s:CheckTag(submatch(0))', 'g') + call substitute(a:text, '<\zs/\=' . s:tagname . '\>\|\|', '\=s:CheckTag(submatch(0))', 'g') let s:countonly = 0 endfunc "}}} @@ -292,7 +296,7 @@ let s:nextrel = 0 " relative indent steps for next line [unit &sw]: let s:block = b:hi_newstate.block - let tmp = substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|\|', '\=s:CheckTag(submatch(0))', 'g') + let tmp = substitute(a:text, '<\zs/\=' . s:tagname . '\>\|\|', '\=s:CheckTag(submatch(0))', 'g') if s:block == 3 let b:hi_newstate.scripttype = s:GetScriptType(matchstr(tmp, '\C.*\zs[^>]*')) endif @@ -530,7 +534,7 @@ let swendtag = match(text, '^\s*= 0 " If previous line ended in a closing tag, line up with the opening tag. - if !swendtag && text =~ '\s*$' + if !swendtag && text =~ '\s*$' call cursor(state.lnum, 99999) normal! F< let start_lnum = HtmlIndent_FindStartTag() @@ -860,7 +864,7 @@ " The cursor must be on or before a closing tag. " If found, positions the cursor at the match and returns the line number. " Otherwise returns 0. - let tagname = matchstr(getline('.')[col('.') - 1:], '', '', '', 'bW') if start_lnum > 0 return start_lnum @@ -876,7 +880,7 @@ " a self-closing tag, to the matching ">". " Limited to look up to b:html_indent_line_limit lines away. let text = getline('.') - let tagname = matchstr(text, '\w\+\|!--', col('.')) + let tagname = matchstr(text, s:tagname . '\|!--', col('.')) if tagname == '!--' call search('--\zs>') elseif s:get_tag('/' . tagname) != 0 @@ -921,9 +925,22 @@ else let idx = match(text, '\s\zs[_a-zA-Z0-9-]\+="') endif + if idx == -1 + " try = 0 + call cursor(lnum, idx) + return virtcol('.') + shiftwidth() + endif + endif if idx > 0 - " Found the attribute. TODO: assumes spaces, no Tabs. - return idx + " Found the attribute to align with. + call cursor(lnum, idx) + return virtcol('.') endif endwhile return -1 diff -Nru vim-8.0.1453/runtime/indent/scheme.vim vim-8.0.1766/runtime/indent/scheme.vim --- vim-8.0.1453/runtime/indent/scheme.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/indent/scheme.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,11 +1,14 @@ " Vim indent file -" Language: Scheme -" Maintainer: Sergey Khorev -" Last Change: 2005 Jun 24 +" Language: Scheme +" Last Change: 2018 Jan 31 +" Maintainer: Evan Hanson +" Previous Maintainer: Sergey Khorev +" URL: https://foldling.org/vim/indent/scheme.vim " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif +" Use the Lisp indenting runtime! indent/lisp.vim diff -Nru vim-8.0.1453/runtime/indent/tex.vim vim-8.0.1766/runtime/indent/tex.vim --- vim-8.0.1453/runtime/indent/tex.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/indent/tex.vim 2018-04-26 20:30:33.000000000 +0000 @@ -2,7 +2,7 @@ " Language: LaTeX " Maintainer: Yichao Zhou " Created: Sat, 16 Feb 2002 16:50:19 +0100 -" Version: 0.9.4 +" Version: 1.0.0 " Please email me if you found something I can do. Comments, bug report and " feature request are welcome. @@ -62,6 +62,8 @@ " (*) Fix a bug between g:tex_noindent_env and g:tex_indent_items " Now g:tex_noindent_env='document\|verbatim\|itemize' (Emacs " style) is supported. Thanks Miles Wheeler for reporting. +" 2018/02/07 by Yichao Zhou +" (*) Make indentation more smart in the normal mode " " }}} @@ -91,19 +93,14 @@ " If this variable is set, item-environments are indented like Emacs does " it, i.e., continuation lines are indented with a shiftwidth. " -" NOTE: I've already set the variable below; delete the corresponding line -" if you don't like this behaviour. -" -" Per default, it is unset. -" -" set unset -" ---------------------------------------------------------------- -" \begin{itemize} \begin{itemize} -" \item blablabla \item blablabla -" bla bla bla bla bla bla -" \item blablabla \item blablabla -" bla bla bla bla bla bla -" \end{itemize} \end{itemize} +" set unset +" ------------------------------------------------------ +" \begin{itemize} \begin{itemize} +" \item blablabla \item blablabla +" bla bla bla bla bla bla +" \item blablabla \item blablabla +" bla bla bla bla bla bla +" \end{itemize} \end{itemize} " " " * g:tex_items @@ -290,8 +287,9 @@ endif endif - if stay - " If there is no obvious indentation hint, we trust our user. + if stay && mode() == 'i' + " If there is no obvious indentation hint, and indentation is triggered + " in insert mode, we trust our user. if empty(cline) return ind else diff -Nru vim-8.0.1453/runtime/keymap/oldturkic-orkhon_utf-8.vim vim-8.0.1766/runtime/keymap/oldturkic-orkhon_utf-8.vim --- vim-8.0.1453/runtime/keymap/oldturkic-orkhon_utf-8.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/runtime/keymap/oldturkic-orkhon_utf-8.vim 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,143 @@ +" Maintainer: Oliver Corff +" Last Changed: 2018 Feb 12 + +scriptencoding utf-8 + +" oto = Old Turkic, Orkhon +let b:keymap_name = "oto" +highlight lCursor guibg=red guifg=NONE + +" map F8 to toggle keymap (Ctrl-^ not present on keyboard) +noremap :let &iminsert = ! &iminsert +lnoremap +noremap! + +loadkeymap +A ð°€ 10C00 OLD TURKIC LETTER ORKHON A +00 ð°€ 10C00 OLD TURKIC LETTER ORKHON A +I ð°ƒ 10C03 OLD TURKIC LETTER ORKHON I +03 ð°ƒ 10C03 OLD TURKIC LETTER ORKHON I +O ð°† 10C06 OLD TURKIC LETTER ORKHON O +U ð°† 10C06 OLD TURKIC LETTER ORKHON O +06 ð°† 10C06 OLD TURKIC LETTER ORKHON O +OE ð°‡ 10C07 OLD TURKIC LETTER ORKHON OE +UE ð°‡ 10C07 OLD TURKIC LETTER ORKHON OE +07 ð°‡ 10C07 OLD TURKIC LETTER ORKHON OE +ab ð°‰ 10C09 OLD TURKIC LETTER ORKHON AB +b1 ð°‰ 10C09 OLD TURKIC LETTER ORKHON AB +09 ð°‰ 10C09 OLD TURKIC LETTER ORKHON AB +aeb ð°‹ 10C0B OLD TURKIC LETTER ORKHON AEB +eb ð°‹ 10C0B OLD TURKIC LETTER ORKHON AEB +b2 ð°‹ 10C0B OLD TURKIC LETTER ORKHON AEB +0b ð°‹ 10C0B OLD TURKIC LETTER ORKHON AEB +ag ð° 10C0D OLD TURKIC LETTER ORKHON AG +g1 ð° 10C0D OLD TURKIC LETTER ORKHON AG +0d ð° 10C0D OLD TURKIC LETTER ORKHON AG +aeg ð° 10C0F OLD TURKIC LETTER ORKHON AEG +eg ð° 10C0F OLD TURKIC LETTER ORKHON AEG +g2 ð° 10C0F OLD TURKIC LETTER ORKHON AEG +0f ð° 10C0F OLD TURKIC LETTER ORKHON AEG +ad ð°‘ 10C11 OLD TURKIC LETTER ORKHON AD +d1 ð°‘ 10C11 OLD TURKIC LETTER ORKHON AD +11 ð°‘ 10C11 OLD TURKIC LETTER ORKHON AD +aed ð°“ 10C13 OLD TURKIC LETTER ORKHON AED +ed ð°“ 10C13 OLD TURKIC LETTER ORKHON AED +d2 ð°“ 10C13 OLD TURKIC LETTER ORKHON AED +13 ð°“ 10C13 OLD TURKIC LETTER ORKHON AED +ez ð°” 10C14 OLD TURKIC LETTER ORKHON EZ +z ð°” 10C14 OLD TURKIC LETTER ORKHON EZ +14 ð°” 10C14 OLD TURKIC LETTER ORKHON EZ +ay ð°– 10C16 OLD TURKIC LETTER ORKHON AY +y1 ð°– 10C16 OLD TURKIC LETTER ORKHON AY +16 ð°– 10C16 OLD TURKIC LETTER ORKHON AY +aey ð°˜ 10C18 OLD TURKIC LETTER ORKHON AEY +ey ð°˜ 10C18 OLD TURKIC LETTER ORKHON AEY +y2 ð°˜ 10C18 OLD TURKIC LETTER ORKHON AEY +18 ð°˜ 10C18 OLD TURKIC LETTER ORKHON AEY +aek ð°š 10C1A OLD TURKIC LETTER ORKHON AEK +k ð°š 10C1A OLD TURKIC LETTER ORKHON AEK +1a ð°š 10C1A OLD TURKIC LETTER ORKHON AEK +oek 𰜠10C1C OLD TURKIC LETTER ORKHON OEK +q 𰜠10C1C OLD TURKIC LETTER ORKHON OEK +1c 𰜠10C1C OLD TURKIC LETTER ORKHON OEK +al ð°ž 10C1E OLD TURKIC LETTER ORKHON AL +l1 ð°ž 10C1E OLD TURKIC LETTER ORKHON AL +1e ð°ž 10C1E OLD TURKIC LETTER ORKHON AL +ael ð°  10C20 OLD TURKIC LETTER ORKHON AEL +el ð°  10C20 OLD TURKIC LETTER ORKHON AEL +l2 ð°  10C20 OLD TURKIC LETTER ORKHON AEL +20 ð°  10C20 OLD TURKIC LETTER ORKHON AEL +elt ð°¡ 10C21 OLD TURKIC LETTER ORKHON ELT +lt ð°¡ 10C21 OLD TURKIC LETTER ORKHON ELT +21 ð°¡ 10C21 OLD TURKIC LETTER ORKHON ELT +em ð°¢ 10C22 OLD TURKIC LETTER ORKHON EM +m ð°¢ 10C22 OLD TURKIC LETTER ORKHON EM +22 ð°¢ 10C22 OLD TURKIC LETTER ORKHON EM +an ð°£ 10C23 OLD TURKIC LETTER ORKHON AN +n1 ð°£ 10C23 OLD TURKIC LETTER ORKHON AN +23 ð°£ 10C23 OLD TURKIC LETTER ORKHON AN +en ð°¤ 10C24 OLD TURKIC LETTER ORKHON AEN +n2 ð°¤ 10C24 OLD TURKIC LETTER ORKHON AEN +24 ð°¤ 10C24 OLD TURKIC LETTER ORKHON AEN +ent ð°¦ 10C26 OLD TURKIC LETTER ORKHON ENT +nt ð°¦ 10C26 OLD TURKIC LETTER ORKHON ENT +26 ð°¦ 10C26 OLD TURKIC LETTER ORKHON ENT +enc ð°¨ 10C28 OLD TURKIC LETTER ORKHON ENC +nc ð°¨ 10C28 OLD TURKIC LETTER ORKHON ENC +28 ð°¨ 10C28 OLD TURKIC LETTER ORKHON ENC +eny ð°ª 10C2A OLD TURKIC LETTER ORKHON ENY +ny ð°ª 10C2A OLD TURKIC LETTER ORKHON ENY +2a ð°ª 10C2A OLD TURKIC LETTER ORKHON ENY +eng ð°­ 10C2D OLD TURKIC LETTER ORKHON ENG +ng ð°­ 10C2D OLD TURKIC LETTER ORKHON ENG +2d ð°­ 10C2D OLD TURKIC LETTER ORKHON ENG +ep ð°¯ 10C2F OLD TURKIC LETTER ORKHON EP +p ð°¯ 10C2F OLD TURKIC LETTER ORKHON EP +2f ð°¯ 10C2F OLD TURKIC LETTER ORKHON EP +op ð°° 10C30 OLD TURKIC LETTER ORKHON OP +up ð°° 10C30 OLD TURKIC LETTER ORKHON OP +30 ð°° 10C30 OLD TURKIC LETTER ORKHON OP +ic ð°± 10C31 OLD TURKIC LETTER ORKHON IC +31 ð°± 10C31 OLD TURKIC LETTER ORKHON IC +ec ð°² 10C32 OLD TURKIC LETTER ORKHON EC +32 ð°² 10C32 OLD TURKIC LETTER ORKHON EC +aq ð°´ 10C34 OLD TURKIC LETTER ORKHON AQ +34 ð°´ 10C34 OLD TURKIC LETTER ORKHON AQ +iq ð°¶ 10C36 OLD TURKIC LETTER ORKHON IQ +yq ð°¶ 10C36 OLD TURKIC LETTER ORKHON IQ +36 ð°¶ 10C36 OLD TURKIC LETTER ORKHON IQ +oq ð°¸ 10C38 OLD TURKIC LETTER ORKHON OQ +uq ð°¸ 10C38 OLD TURKIC LETTER ORKHON OQ +38 ð°¸ 10C38 OLD TURKIC LETTER ORKHON OQ +ar ð°º 10C3A OLD TURKIC LETTER ORKHON AR +r1 ð°º 10C3A OLD TURKIC LETTER ORKHON AR +3a ð°º 10C3A OLD TURKIC LETTER ORKHON AR +aer ð°¼ 10C3C OLD TURKIC LETTER ORKHON AER +er ð°¼ 10C3C OLD TURKIC LETTER ORKHON AER +r2 ð°¼ 10C3C OLD TURKIC LETTER ORKHON AER +3c ð°¼ 10C3C OLD TURKIC LETTER ORKHON AER +as ð°½ 10C3D OLD TURKIC LETTER ORKHON AS +s1 ð°½ 10C3D OLD TURKIC LETTER ORKHON AS +3d ð°½ 10C3D OLD TURKIC LETTER ORKHON AS +aes ð°¾ 10C3E OLD TURKIC LETTER ORKHON AES +es ð°¾ 10C3E OLD TURKIC LETTER ORKHON AES +s2 ð°¾ 10C3E OLD TURKIC LETTER ORKHON AES +3e ð°¾ 10C3E OLD TURKIC LETTER ORKHON AES +ash ð°¿ 10C3F OLD TURKIC LETTER ORKHON ASH +sh1 ð°¿ 10C3F OLD TURKIC LETTER ORKHON ASH +3f ð°¿ 10C3F OLD TURKIC LETTER ORKHON ASH +esh ð± 10C41 OLD TURKIC LETTER ORKHON ESH +sh2 ð± 10C41 OLD TURKIC LETTER ORKHON ESH +41 ð± 10C41 OLD TURKIC LETTER ORKHON ESH +at 𱃠10C43 OLD TURKIC LETTER ORKHON AT +t1 𱃠10C43 OLD TURKIC LETTER ORKHON AT +43 𱃠10C43 OLD TURKIC LETTER ORKHON AT +aet ð±… 10C45 OLD TURKIC LETTER ORKHON AET +et ð±… 10C45 OLD TURKIC LETTER ORKHON AET +t2 ð±… 10C45 OLD TURKIC LETTER ORKHON AET +45 ð±… 10C45 OLD TURKIC LETTER ORKHON AET +ot 𱇠10C47 OLD TURKIC LETTER ORKHON OT +ut 𱇠10C47 OLD TURKIC LETTER ORKHON OT +47 𱇠10C47 OLD TURKIC LETTER ORKHON OT +bash 𱈠10C48 OLD TURKIC LETTER ORKHON BASH +48 𱈠10C48 OLD TURKIC LETTER ORKHON BASH diff -Nru vim-8.0.1453/runtime/keymap/oldturkic-yenisei_utf-8.vim vim-8.0.1766/runtime/keymap/oldturkic-yenisei_utf-8.vim --- vim-8.0.1453/runtime/keymap/oldturkic-yenisei_utf-8.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/runtime/keymap/oldturkic-yenisei_utf-8.vim 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,115 @@ +" Maintainer: Oliver Corff +" Last Changed: 2018 Feb 12 + +" All characters are given literally, conversion to another encoding (e.g., +" UTF-8) should work. +scriptencoding utf-8 + +let b:keymap_name = "oto" +highlight lCursor guibg=red guifg=NONE + +" map F8 to toggle keymap (Ctrl-^ not present on keyboard) +noremap :let &iminsert = ! &iminsert +lnoremap +noremap! + +loadkeymap +A ð° 10C01 OLD TURKIC LETTER YENISEI A +01 ð° 10C01 OLD TURKIC LETTER YENISEI A +AE ð°‚ 10C02 OLD TURKIC LETTER YENISEI AE +02 ð°‚ 10C02 OLD TURKIC LETTER YENISEI AE +I ð°„ 10C04 OLD TURKIC LETTER YENISEI I +04 ð°„ 10C04 OLD TURKIC LETTER YENISEI I +E ð°… 10C05 OLD TURKIC LETTER YENISEI E +05 ð°… 10C05 OLD TURKIC LETTER YENISEI E +OE ð°ˆ 10C08 OLD TURKIC LETTER YENISEI OE +UE ð°ˆ 10C08 OLD TURKIC LETTER YENISEI OE +08 ð°ˆ 10C08 OLD TURKIC LETTER YENISEI OE +ab ð°Š 10C0A OLD TURKIC LETTER YENISEI AB +b1 ð°Š 10C0A OLD TURKIC LETTER YENISEI AB +0a ð°Š 10C0A OLD TURKIC LETTER YENISEI AB +aeb 𰌠10C0C OLD TURKIC LETTER YENISEI AEB +eb 𰌠10C0C OLD TURKIC LETTER YENISEI AEB +b2 𰌠10C0C OLD TURKIC LETTER YENISEI AEB +0c 𰌠10C0C OLD TURKIC LETTER YENISEI AEB +ag ð°Ž 10C0E OLD TURKIC LETTER YENISEI AG +g1 ð°Ž 10C0E OLD TURKIC LETTER YENISEI AG +0e ð°Ž 10C0E OLD TURKIC LETTER YENISEI AG +aeg ð° 10C10 OLD TURKIC LETTER YENISEI AEG +eg ð° 10C10 OLD TURKIC LETTER YENISEI AEG +g2 ð° 10C10 OLD TURKIC LETTER YENISEI AEG +10 ð° 10C10 OLD TURKIC LETTER YENISEI AEG +ad ð°’ 10C12 OLD TURKIC LETTER YENISEI AD +d1 ð°’ 10C12 OLD TURKIC LETTER YENISEI AD +12 ð°’ 10C12 OLD TURKIC LETTER YENISEI AD +ez ð°• 10C15 OLD TURKIC LETTER YENISEI EZ +z ð°• 10C15 OLD TURKIC LETTER YENISEI EZ +15 ð°• 10C15 OLD TURKIC LETTER YENISEI EZ +ay ð°— 10C17 OLD TURKIC LETTER YENISEI AY +y1 ð°— 10C17 OLD TURKIC LETTER YENISEI AY +17 ð°— 10C17 OLD TURKIC LETTER YENISEI AY +aey ð°™ 10C19 OLD TURKIC LETTER YENISEI AEY +ey ð°™ 10C19 OLD TURKIC LETTER YENISEI AEY +y2 ð°™ 10C19 OLD TURKIC LETTER YENISEI AEY +19 ð°™ 10C19 OLD TURKIC LETTER YENISEI AEY +aek ð°› 10C1B OLD TURKIC LETTER YENISEI AEK +ak ð°› 10C1B OLD TURKIC LETTER YENISEI AEK +k ð°› 10C1B OLD TURKIC LETTER YENISEI AEK +1b ð°› 10C1B OLD TURKIC LETTER YENISEI AEK +oek ð° 10C1D OLD TURKIC LETTER YENISEI OEK +ök ð° 10C1D OLD TURKIC LETTER YENISEI OEK +uek ð° 10C1D OLD TURKIC LETTER YENISEI OEK +ük ð° 10C1D OLD TURKIC LETTER YENISEI OEK +1d ð° 10C1D OLD TURKIC LETTER YENISEI OEK +al ð°Ÿ 10C1F OLD TURKIC LETTER YENISEI AL +l ð°Ÿ 10C1F OLD TURKIC LETTER YENISEI AL +l1 ð°Ÿ 10C1F OLD TURKIC LETTER YENISEI AL +1f ð°Ÿ 10C1F OLD TURKIC LETTER YENISEI AL +aen ð°¥ 10C25 OLD TURKIC LETTER YENISEI AEN +en ð°¥ 10C25 OLD TURKIC LETTER YENISEI AEN +n2 ð°¥ 10C25 OLD TURKIC LETTER YENISEI AEN +25 ð°¥ 10C25 OLD TURKIC LETTER YENISEI AEN +ent ð°§ 10C27 OLD TURKIC LETTER YENISEI ENT +nt ð°§ 10C27 OLD TURKIC LETTER YENISEI ENT +27 ð°§ 10C27 OLD TURKIC LETTER YENISEI ENT +enc ð°© 10C29 OLD TURKIC LETTER YENISEI ENC +nc ð°© 10C29 OLD TURKIC LETTER YENISEI ENC +29 ð°© 10C29 OLD TURKIC LETTER YENISEI ENC +eny ð°« 10C2B OLD TURKIC LETTER YENISEI ENY +ny ð°« 10C2B OLD TURKIC LETTER YENISEI ENY +2b ð°« 10C2B OLD TURKIC LETTER YENISEI ENY +ang ð°¬ 10C2C OLD TURKIC LETTER YENISEI ANG +ng ð°¬ 10C2C OLD TURKIC LETTER YENISEI ANG +2c ð°¬ 10C2C OLD TURKIC LETTER YENISEI ANG +aeng ð°® 10C2E OLD TURKIC LETTER YENISEI AENG +eng ð°® 10C2E OLD TURKIC LETTER YENISEI AENG +2e ð°® 10C2E OLD TURKIC LETTER YENISEI AENG +ec ð°³ 10C33 OLD TURKIC LETTER YENISEI EC +c ð°³ 10C33 OLD TURKIC LETTER YENISEI EC +33 ð°³ 10C33 OLD TURKIC LETTER YENISEI EC +aq ð°µ 10C35 OLD TURKIC LETTER YENISEI AQ +q ð°µ 10C35 OLD TURKIC LETTER YENISEI AQ +35 ð°µ 10C35 OLD TURKIC LETTER YENISEI AQ +iq ð°· 10C37 OLD TURKIC LETTER YENISEI IQ +yq ð°· 10C37 OLD TURKIC LETTER YENISEI IQ +37 ð°· 10C37 OLD TURKIC LETTER YENISEI IQ +oq ð°¹ 10C39 OLD TURKIC LETTER YENISEI OQ +uq ð°¹ 10C39 OLD TURKIC LETTER YENISEI OQ +39 ð°¹ 10C39 OLD TURKIC LETTER YENISEI OQ +ar ð°» 10C3B OLD TURKIC LETTER YENISEI AR +r ð°» 10C3B OLD TURKIC LETTER YENISEI AR +r1 ð°» 10C3B OLD TURKIC LETTER YENISEI AR +3b ð°» 10C3B OLD TURKIC LETTER YENISEI AR +ash ð±€ 10C40 OLD TURKIC LETTER YENISEI ASH +sh1 ð±€ 10C40 OLD TURKIC LETTER YENISEI ASH +40 ð±€ 10C40 OLD TURKIC LETTER YENISEI ASH +esh 𱂠10C42 OLD TURKIC LETTER YENISEI ESH +sh2 𱂠10C42 OLD TURKIC LETTER YENISEI ESH +42 𱂠10C42 OLD TURKIC LETTER YENISEI ESH +at 𱄠10C44 OLD TURKIC LETTER YENISEI AT +t1 𱄠10C44 OLD TURKIC LETTER YENISEI AT +44 𱄠10C44 OLD TURKIC LETTER YENISEI AT +aet 𱆠10C46 OLD TURKIC LETTER YENISEI AET +et 𱆠10C46 OLD TURKIC LETTER YENISEI AET +t2 𱆠10C46 OLD TURKIC LETTER YENISEI AET +46 𱆠10C46 OLD TURKIC LETTER YENISEI AET diff -Nru vim-8.0.1453/runtime/lang/menu_sr_rs.ascii.vim vim-8.0.1766/runtime/lang/menu_sr_rs.ascii.vim --- vim-8.0.1453/runtime/lang/menu_sr_rs.ascii.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/lang/menu_sr_rs.ascii.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,6 +1,7 @@ " Menu Translations: Serbian " Maintainer: Aleksandar Jelenak -" Last Change: Fri, 30 May 2003 12:15:30 -0400 +" Last Change: Fri, 30 May 2003 10:17:39 Eastern Daylight Time +" Adapted for VIM 8 by: Ivan Pesic on 2017-12-28 12:05+0400 " Quit when menu translations have already been done. if exists("did_menu_trans") @@ -19,6 +20,7 @@ menutrans &Credits &Zasluge menutrans Co&pying P&reuzimanje menutrans O&rphans &Sirocici +menutrans &Sponsor/Register Sponzor/&Registrujte\ se menutrans &Version &Verzija menutrans &About &O\ programu @@ -26,6 +28,7 @@ menutrans &File &Datoteka menutrans &Open\.\.\.:e &Otvori\.\.\.:e menutrans Sp&lit-Open\.\.\.:sp &Podeli-otvori\.\.\.:sp +menutrans Open\ Tab\.\.\.:tabnew Otvori\ karticu\.\.\.:tabnew menutrans &New:enew &Nova:enew menutrans &Close:close &Zatvori:close menutrans &Save:w &Sacuvaj:w @@ -52,24 +55,27 @@ menutrans &Find\.\.\. &Nadji\.\.\. menutrans Find\ and\ Rep&lace\.\.\. Nadji\ i\ &zameni\.\.\. menutrans Settings\ &Window P&rozor\ podesavanja +menutrans Startup\ &Settings Po&desavanja\ pri\ pokretanju menutrans &Global\ Settings Op&sta\ podesavanja menutrans F&ile\ Settings Podesavanja\ za\ da&toteke menutrans &Shiftwidth &Pomeraj menutrans Soft\ &Tabstop &Meka\ tabulacija menutrans Te&xt\ Width\.\.\. &Sirina\ teksta\.\.\. menutrans &File\ Format\.\.\. &Vrsta\ datoteke\.\.\. -menutrans C&olor\ Scheme Bo&je -menutrans &Keymap Pres&likavanje\ tastature +menutrans Show\ C&olor\ Schemes\ in\ Menu Prikazi\ seme\ bo&ja\ u\ meniju +menutrans C&olor\ Scheme \Seme\ bo&ja +menutrans Show\ &Keymaps\ in\ Menu Prikazi\ pres&likavanja\ tastature\ u\ meniju +menutrans &Keymap Pres&likavanja\ tastature menutrans Select\ Fo&nt\.\.\. Izbor\ &fonta\.\.\. " Edit/Global Settings menutrans Toggle\ Pattern\ &Highlight:set\ hls! Naglasi\ &obrazce\ (da/ne):set\ hls! -menutrans Toggle\ &Ignore-case:set\ ic! Zanemari\ \velicinu\ &slova\ (da/ne):set\ ic! -menutrans Toggle\ &Showmatch:set\ sm! Proveri\ pratecu\ &zagradu\ (da/ne):set\ sm! +menutrans Toggle\ &Ignoring\ Case:set\ ic! Zanemari\ velicinu\ &slova\ (da/ne):set\ ic! +menutrans Toggle\ &Showing\ Matched\ Pairs:set\ sm! Proveri\ pratecu\ &zagradu\ (da/ne):set\ sm! menutrans &Context\ lines Vidljivi\ &redovi menutrans &Virtual\ Edit Virtuelno\ &uredjivanje menutrans Toggle\ Insert\ &Mode:set\ im! Rezim\ u&nosa\ (da/ne):set\ im! -menutrans Toggle\ Vi\ C&ompatible:set\ cp! '&Vi'\ saglasno\ (da/ne):set\ cp! +menutrans Toggle\ Vi\ C&ompatibility:set\ cp! '&Vi'\ saglasno\ (da/ne):set\ cp! menutrans Search\ &Path\.\.\. Putanja\ &pretrage\.\.\. menutrans Ta&g\ Files\.\.\. &Datoteke\ oznaka\.\.\. menutrans Toggle\ &Toolbar Linija\ sa\ &alatkama\ (da/ne) @@ -85,28 +91,30 @@ menutrans Always Uvek " Edit/File Settings -menutrans Toggle\ Line\ &Numbering:set\ nu! Redni\ &brojevi\ (da/ne):set\ nu! -menutrans Toggle\ &List\ Mode:set\ list! Rezim\ &liste\ (da/ne):set\ list! -menutrans Toggle\ Line\ &Wrap:set\ wrap! Obavijanje\ &redova\ (da/ne):set\ wrap! -menutrans Toggle\ W&rap\ at\ word:set\ lbr! Prelomi\ &na\ rec\ (da/ne):set\ lbr! -menutrans Toggle\ &expand-tab:set\ et! Razmaci\ umesto\ &tabulacije\ (da/ne):set\ et! -menutrans Toggle\ &auto-indent:set\ ai! Auto-&uvlacenje\ (da/ne):set\ ai! -menutrans Toggle\ &C-indenting:set\ cin! &Ce-uvlacenje\ (da/ne):set\ cin! +menutrans Toggle\ Line\ &Numbering:set\ nu! Prikazi\ &numeraciju\ linija\ (da/ne):set\ nu! +menutrans Toggle\ Relati&ve\ Line\ Numbering:set\ rnu! Prikazi\ Relati&vnu\ numeraciju\ linija\ (da/ne):set\ rnu! +menutrans Toggle\ &List\ Mode:set\ list! Rezim\ &liste\ (da/ne):set\ list! +menutrans Toggle\ Line\ &Wrapping:set\ wrap! Obavijanje\ &redova\ (da/ne):set\ wrap! +menutrans Toggle\ W&rapping\ at\ Word:set\ lbr! Prelomi\ &na\ rec\ (da/ne):set\ lbr! +menutrans Toggle\ Tab\ &Expanding:set\ et! Razmaci\ umesto\ &tabulacije\ (da/ne):set\ et! +menutrans Toggle\ &Auto\ Indenting:set\ ai! Auto-&uvlacenje\ (da/ne):set\ ai! +menutrans Toggle\ &C-Style\ Indenting:set\ cin! &C-uvlacenje\ (da/ne):set\ cin! " Edit/Keymap -menutrans None Nijedan +menutrans None Bez\ preslikavanja " Tools menu menutrans &Tools &Alatke menutrans &Jump\ to\ this\ tagg^] Skoci\ na\ &ovu\ oznakug^] menutrans Jump\ &back^T Skoci\ &natrag^T menutrans Build\ &Tags\ File Izgradi\ &datoteku\ oznaka +menutrans &Spelling Pra&vopis menutrans &Folding &Podvijanje menutrans Create\ &Foldzf S&tvori\ podvijutakzf menutrans &Delete\ Foldzd O&brisi\ podvijutakzd menutrans Delete\ &All\ FoldszD Obrisi\ sve\ po&dvijutkezD menutrans Fold\ column\ &width Sirina\ &reda\ podvijutka -menutrans &Diff &Uporedjivanje +"menutrans &Diff &Uporedjivanje menutrans &Make:make 'mak&e':make menutrans &List\ Errors:cl Spisak\ &gresaka:cl menutrans L&ist\ Messages:cl! Sp&isak\ poruka:cl! @@ -115,32 +123,49 @@ menutrans &Older\ List:cold Stari\ spisa&k:cold menutrans N&ewer\ List:cnew No&vi\ spisak:cnew menutrans Error\ &Window Prozor\ sa\ g&reskama -menutrans &Set\ Compiler I&zaberi\ prevodioca +menutrans Se&t\ Compiler I&zaberi\ prevodioca menutrans &Convert\ to\ HEX:%!xxd Pretvori\ u\ &HEKS:%!xxd menutrans Conve&rt\ back:%!xxd\ -r Vr&ati\ u\ prvobitan\ oblik:%!xxd\ -r +menutrans Show\ Compiler\ Se&ttings\ in\ Menu Prikazi\ pode&savanja\ prevodioca\ u\ meniju + +" Tools/Spelling +menutrans &Spell\ Check\ On &Ukljuci\ proveru\ pravopisa +menutrans Spell\ Check\ &Off &Iskljuci\ proveru\ pravopisa +menutrans To\ &Next\ Error]s Idi\ na\ &sledecu\ gresku]s +menutrans To\ &Previous\ Error[s Idi\ na\ &prethodnu\ gresku[s +menutrans Suggest\ &Correctionsz= Predlozi\ isp&ravkez= +menutrans &Repeat\ Correction:spellrepall P&onovi\ ispravku:spellrepall +menutrans Set\ Language\ to\ "en" Postavi\ jezik\ na\ "en" +menutrans Set\ Language\ to\ "en_au" Postavi\ jezik\ na\ "en_au" +menutrans Set\ Language\ to\ "en_ca" Postavi\ jezik\ na\ "en_ca" +menutrans Set\ Language\ to\ "en_gb" Postavi\ jezik\ na\ "en_gb" +menutrans Set\ Language\ to\ "en_nz" Postavi\ jezik\ na\ "en_nz" +menutrans Set\ Language\ to\ "en_us" Postavi\ jezik\ na\ "en_us" +menutrans &Find\ More\ Languages Pronadji\ jos\ jezika " Tools/Folding menutrans &Enable/Disable\ foldszi &Omoguci/prekini\ podvijanjezi -menutrans &View\ Cursor\ Linezv &Pokazi\ red\ sa\ kursoromzv +menutrans &View\ Cursor\ Linezv &Pokazi\ red\ sa\ kursoromzv menutrans Vie&w\ Cursor\ Line\ onlyzMzx Pokazi\ &samo\ red\ sa\ kursoromzMzx menutrans C&lose\ more\ foldszm &Zatvori\ vise\ podvijutakazm menutrans &Close\ all\ foldszM Zatvori\ s&ve\ podvijutkezM menutrans O&pen\ more\ foldszr Otvori\ vis&e\ podvijutakazr menutrans &Open\ all\ foldszR O&tvori\ sve\ podvijutkezR menutrans Fold\ Met&hod &Nacin\ podvijanja +menutrans Fold\ Col&umn\ Width Sirina\ kolone\ ispred\ podvijutaka " Tools/Folding/Fold Method -menutrans M&anual &Rucno -menutrans I&ndent &Uvucenost -menutrans E&xpression &Izraz -menutrans S&yntax &Sintaksa +menutrans M&anual &Rucno +menutrans I&ndent &Uvucenost +menutrans E&xpression &Izraz +menutrans S&yntax &Sintaksa "menutrans &Diff -menutrans Ma&rker &Oznaka +menutrans Ma&rker &Oznaka " Tools/Diff -menutrans &Update &Azuriraj -menutrans &Get\ Block &Prihvati\ izmenu -menutrans &Put\ Block Pre&baci\ izmenu +menutrans &Update &Azuriraj +menutrans &Get\ Block &Prihvati\ blok\ izmena +menutrans &Put\ Block Pre&baci\ blok\ izmena " Tools/Error Window menutrans &Update:cwin &Azuriraj:cwin @@ -188,8 +213,10 @@ menutrans &Copy &Kopiraj menutrans &Paste &Ubaci menutrans &Delete I&zbrisi -menutrans Select\ Blockwise Biraj\ &pravougaono +menutrans Select\ Blockwise Biraj\ b&lokovski menutrans Select\ &Word Izaberi\ &rec +menutrans Select\ &Sentence Izaberi\ r&ecenicu +menutrans Select\ Pa&ragraph Izaberi\ ¶graf menutrans Select\ &Line Izaberi\ r&ed menutrans Select\ &Block Izaberi\ &blok menutrans Select\ &All Izaberi\ &sve @@ -235,9 +262,9 @@ " Syntax menu menutrans &Syntax &Sintaksa -menutrans &Show\ filetypes\ in\ menu Izbor\ 'filetype'\ iz\ &menija -menutrans Set\ '&syntax'\ only Pode&si\ 'syntax'\ samo -menutrans Set\ '&filetype'\ too Podesi\ 'filetype'\ &takodje +menutrans &Show\ File\ Types\ in\ Menu Prikazi\ tipove\ datoteka\ u\ &meniju +menutrans Set\ '&syntax'\ only Pode&si\ samo\ 'syntax' +menutrans Set\ '&filetype'\ too Podesi\ &takodje\ i\ 'filetype' menutrans &Off &Iskljuceno menutrans &Manual &Rucno menutrans A&utomatic &Automatski @@ -255,9 +282,13 @@ let g:menutrans_textwidth_dialog = "Unesite novu sirinu teksta (0 sprecava prelom)" -let g:menutrans_fileformat_dialog = "Izaberite vrstu datoteke" +let g:menutrans_fileformat_dialog = "Izaberite format zapisa datoteke" + +let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Otkazi" let menutrans_no_file = "[Nema datoteke]" let &cpo = s:keepcpo unlet s:keepcpo + +" vim: tw=0 keymap=serbian diff -Nru vim-8.0.1453/runtime/lang/menu_sr_rs.iso_8859-2.vim vim-8.0.1766/runtime/lang/menu_sr_rs.iso_8859-2.vim --- vim-8.0.1453/runtime/lang/menu_sr_rs.iso_8859-2.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/lang/menu_sr_rs.iso_8859-2.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,6 +1,7 @@ " Menu Translations: Serbian " Maintainer: Aleksandar Jelenak -" Last Change: Fri, 30 May 2003 12:04:48 -0400 +" Last Change: Fri, 30 May 2003 10:17:39 Eastern Daylight Time +" Adapted for VIM 8 by: Ivan Pe¹iæ on 2017-12-28 12:05+0400 " Quit when menu translations have already been done. if exists("did_menu_trans") @@ -21,6 +22,7 @@ menutrans &Credits &Zasluge menutrans Co&pying P&reuzimanje menutrans O&rphans &Siroèiæi +menutrans &Sponsor/Register Sponzor/&Registrujte\ se menutrans &Version &Verzija menutrans &About &O\ programu @@ -28,6 +30,7 @@ menutrans &File &Datoteka menutrans &Open\.\.\.:e &Otvori\.\.\.:e menutrans Sp&lit-Open\.\.\.:sp &Podeli-otvori\.\.\.:sp +menutrans Open\ Tab\.\.\.:tabnew Otvori\ karticu\.\.\.:tabnew menutrans &New:enew &Nova:enew menutrans &Close:close &Zatvori:close menutrans &Save:w &Saèuvaj:w @@ -54,24 +57,27 @@ menutrans &Find\.\.\. &Naði\.\.\. menutrans Find\ and\ Rep&lace\.\.\. Naði\ i\ &zameni\.\.\. menutrans Settings\ &Window P&rozor\ pode¹avanja +menutrans Startup\ &Settings Po&de¹avanja\ pri\ pokretanju menutrans &Global\ Settings Op&¹ta\ pode¹avanja menutrans F&ile\ Settings Pode¹avanja\ za\ da&toteke menutrans &Shiftwidth &Pomeraj menutrans Soft\ &Tabstop &Meka\ tabulacija menutrans Te&xt\ Width\.\.\. &©irina\ teksta\.\.\. menutrans &File\ Format\.\.\. &Vrsta\ datoteke\.\.\. -menutrans C&olor\ Scheme Bo&je -menutrans &Keymap Pres&likavanje\ tastature +menutrans Show\ C&olor\ Schemes\ in\ Menu Prika¾i\ ¹eme\ bo&ja\ u\ meniju +menutrans C&olor\ Scheme \©eme\ bo&ja +menutrans Show\ &Keymaps\ in\ Menu Prika¾i\ pres&likavanja\ tastature\ u\ meniju +menutrans &Keymap Pres&likavanja\ tastature menutrans Select\ Fo&nt\.\.\. Izbor\ &fonta\.\.\. " Edit/Global Settings menutrans Toggle\ Pattern\ &Highlight:set\ hls! Naglasi\ &obrazce\ (da/ne):set\ hls! -menutrans Toggle\ &Ignore-case:set\ ic! Zanemari\ \velièinu\ &slova\ (da/ne):set\ ic! -menutrans Toggle\ &Showmatch:set\ sm! Proveri\ prateæu\ &zagradu\ (da/ne):set\ sm! +menutrans Toggle\ &Ignoring\ Case:set\ ic! Zanemari\ velièinu\ &slova\ (da/ne):set\ ic! +menutrans Toggle\ &Showing\ Matched\ Pairs:set\ sm! Proveri\ prateæu\ &zagradu\ (da/ne):set\ sm! menutrans &Context\ lines Vidljivi\ &redovi menutrans &Virtual\ Edit Virtuelno\ &ureðivanje -menutrans Toggle\ Insert\ &Mode:set\ im! Re¾im\ u&nosa\ (da/ne):set\ im! -menutrans Toggle\ Vi\ C&ompatible:set\ cp! '&Vi'\ saglasno\ (da/ne):set\ cp! +menutrans Toggle\ Insert\ &Mode:set\ im! Re¾im\ u&nosa\ (da/ne):set\ im! +menutrans Toggle\ Vi\ C&ompatibility:set\ cp! '&Vi'\ saglasno\ (da/ne):set\ cp! menutrans Search\ &Path\.\.\. Putanja\ &pretrage\.\.\. menutrans Ta&g\ Files\.\.\. &Datoteke\ oznaka\.\.\. menutrans Toggle\ &Toolbar Linija\ sa\ &alatkama\ (da/ne) @@ -87,28 +93,30 @@ menutrans Always Uvek " Edit/File Settings -menutrans Toggle\ Line\ &Numbering:set\ nu! Redni\ &brojevi\ (da/ne):set\ nu! +menutrans Toggle\ Line\ &Numbering:set\ nu! Prika¾i\ &numeraciju\ linija\ (da/ne):set\ nu! +menutrans Toggle\ Relati&ve\ Line\ Numbering:set\ rnu! Prika¾i\ Relati&vnu\ numeraciju\ linija\ (da/ne):set\ rnu! menutrans Toggle\ &List\ Mode:set\ list! Re¾im\ &liste\ (da/ne):set\ list! -menutrans Toggle\ Line\ &Wrap:set\ wrap! Obavijanje\ &redova\ (da/ne):set\ wrap! -menutrans Toggle\ W&rap\ at\ word:set\ lbr! Prelomi\ &na\ reè\ (da/ne):set\ lbr! -menutrans Toggle\ &expand-tab:set\ et! Razmaci\ umesto\ &tabulacije\ (da/ne):set\ et! -menutrans Toggle\ &auto-indent:set\ ai! Auto-&uvlaèenje\ (da/ne):set\ ai! -menutrans Toggle\ &C-indenting:set\ cin! &Ce-uvlaèenje\ (da/ne):set\ cin! +menutrans Toggle\ Line\ &Wrapping:set\ wrap! Obavijanje\ &redova\ (da/ne):set\ wrap! +menutrans Toggle\ W&rapping\ at\ Word:set\ lbr! Prelomi\ &na\ reè\ (da/ne):set\ lbr! +menutrans Toggle\ Tab\ &Expanding:set\ et! Razmaci\ umesto\ &tabulacije\ (da/ne):set\ et! +menutrans Toggle\ &Auto\ Indenting:set\ ai! Auto-&uvlaèenje\ (da/ne):set\ ai! +menutrans Toggle\ &C-Style\ Indenting:set\ cin! &C-uvlaèenje\ (da/ne):set\ cin! " Edit/Keymap -menutrans None Nijedan +menutrans None Bez\ preslikavanja " Tools menu menutrans &Tools &Alatke menutrans &Jump\ to\ this\ tagg^] Skoèi\ na\ &ovu\ oznakug^] menutrans Jump\ &back^T Skoèi\ &natrag^T menutrans Build\ &Tags\ File Izgradi\ &datoteku\ oznaka +menutrans &Spelling Pra&vopis menutrans &Folding &Podvijanje menutrans Create\ &Foldzf S&tvori\ podvijutakzf menutrans &Delete\ Foldzd O&bri¹i\ podvijutakzd menutrans Delete\ &All\ FoldszD Obri¹i\ sve\ po&dvijutkezD menutrans Fold\ column\ &width ©irina\ &reda\ podvijutka -menutrans &Diff &Uporeðivanje +"menutrans &Diff &Uporeðivanje menutrans &Make:make 'mak&e':make menutrans &List\ Errors:cl Spisak\ &gre¹aka:cl menutrans L&ist\ Messages:cl! Sp&isak\ poruka:cl! @@ -117,9 +125,25 @@ menutrans &Older\ List:cold Stari\ spisa&k:cold menutrans N&ewer\ List:cnew No&vi\ spisak:cnew menutrans Error\ &Window Prozor\ sa\ g&re¹kama -menutrans &Set\ Compiler I&zaberi\ prevodioca +menutrans Se&t\ Compiler I&zaberi\ prevodioca menutrans &Convert\ to\ HEX:%!xxd Pretvori\ u\ &HEKS:%!xxd menutrans Conve&rt\ back:%!xxd\ -r Vr&ati\ u\ prvobitan\ oblik:%!xxd\ -r +menutrans Show\ Compiler\ Se&ttings\ in\ Menu Prika¾i\ pode&¹avanja\ prevodioca\ u\ meniju + +" Tools/Spelling +menutrans &Spell\ Check\ On &Ukljuèi\ proveru\ pravopisa +menutrans Spell\ Check\ &Off &Iskljuèi\ proveru\ pravopisa +menutrans To\ &Next\ Error]s Idi\ na\ &sledeæu\ gre¹ku]s +menutrans To\ &Previous\ Error[s Idi\ na\ &prethodnu\ gre¹ku[s +menutrans Suggest\ &Correctionsz= Predlo¾i\ isp&ravkez= +menutrans &Repeat\ Correction:spellrepall P&onovi\ ispravku:spellrepall +menutrans Set\ Language\ to\ "en" Postavi\ jezik\ na\ "en" +menutrans Set\ Language\ to\ "en_au" Postavi\ jezik\ na\ "en_au" +menutrans Set\ Language\ to\ "en_ca" Postavi\ jezik\ na\ "en_ca" +menutrans Set\ Language\ to\ "en_gb" Postavi\ jezik\ na\ "en_gb" +menutrans Set\ Language\ to\ "en_nz" Postavi\ jezik\ na\ "en_nz" +menutrans Set\ Language\ to\ "en_us" Postavi\ jezik\ na\ "en_us" +menutrans &Find\ More\ Languages Pronaði\ jo¹\ jezika " Tools/Folding menutrans &Enable/Disable\ foldszi &Omoguæi/prekini\ podvijanjezi @@ -130,6 +154,7 @@ menutrans O&pen\ more\ foldszr Otvori\ vi¹&e\ podvijutakazr menutrans &Open\ all\ foldszR O&tvori\ sve\ podvijutkezR menutrans Fold\ Met&hod &Naèin\ podvijanja +menutrans Fold\ Col&umn\ Width ©irina\ kolone\ ispred\ podvijutaka " Tools/Folding/Fold Method menutrans M&anual &Ruèno @@ -141,8 +166,8 @@ " Tools/Diff menutrans &Update &A¾uriraj -menutrans &Get\ Block &Prihvati\ izmenu -menutrans &Put\ Block Pre&baci\ izmenu +menutrans &Get\ Block &Prihvati\ blok\ izmena +menutrans &Put\ Block Pre&baci\ blok\ izmena " Tools/Error Window menutrans &Update:cwin &A¾uriraj:cwin @@ -190,8 +215,10 @@ menutrans &Copy &Kopiraj menutrans &Paste &Ubaci menutrans &Delete I&zbri¹i -menutrans Select\ Blockwise Biraj\ &pravougaono +menutrans Select\ Blockwise Biraj\ b&lokovski menutrans Select\ &Word Izaberi\ &reè +menutrans Select\ &Sentence Izaberi\ r&eèenicu +menutrans Select\ Pa&ragraph Izaberi\ ¶graf menutrans Select\ &Line Izaberi\ r&ed menutrans Select\ &Block Izaberi\ &blok menutrans Select\ &All Izaberi\ &sve @@ -202,20 +229,20 @@ delfun Do_toolbar_tmenu endif fun Do_toolbar_tmenu() - tmenu ToolBar.Open Uèitaj - tmenu ToolBar.Save Saèuvaj + tmenu ToolBar.Open Uèitaj + tmenu ToolBar.Save Saèuvaj tmenu ToolBar.SaveAll Saèuvaj sve tmenu ToolBar.Print ©tampaj - tmenu ToolBar.Undo Vrati - tmenu ToolBar.Redo Povrati - tmenu ToolBar.Cut Iseci - tmenu ToolBar.Copy Kopiraj + tmenu ToolBar.Undo Vrati + tmenu ToolBar.Redo Povrati + tmenu ToolBar.Cut Iseci + tmenu ToolBar.Copy Kopiraj tmenu ToolBar.Paste Ubaci - tmenu ToolBar.Find Naði + tmenu ToolBar.Find Naði tmenu ToolBar.FindNext Naði sledeæi tmenu ToolBar.FindPrev Naði prethodni tmenu ToolBar.Replace Zameni - tmenu ToolBar.New Novi + tmenu ToolBar.New Novi tmenu ToolBar.WinSplit Podeli prozor tmenu ToolBar.WinMax Maksimalna visina tmenu ToolBar.WinMin Minimalna visina @@ -226,25 +253,25 @@ tmenu ToolBar.LoadSesn Uèitaj seansu tmenu ToolBar.SaveSesn Saèuvaj seansu tmenu ToolBar.RunScript Izvr¹i spis - tmenu ToolBar.Make 'make' + tmenu ToolBar.Make 'make' tmenu ToolBar.Shell Operativno okru¾enje tmenu ToolBar.RunCtags Napravi oznake tmenu ToolBar.TagJump Idi na oznaku - tmenu ToolBar.Help Pomoæ + tmenu ToolBar.Help Pomoæ tmenu ToolBar.FindHelp Naði obja¹njenje endfun endif " Syntax menu menutrans &Syntax &Sintaksa -menutrans &Show\ filetypes\ in\ menu Izbor\ 'filetype'\ iz\ &menija -menutrans Set\ '&syntax'\ only Pode&si\ 'syntax'\ samo -menutrans Set\ '&filetype'\ too Podesi\ 'filetype'\ &takoðe -menutrans &Off &Iskljuèeno +menutrans &Show\ File\ Types\ in\ Menu Prika¾i\ tipove\ datoteka\ u\ &meniju +menutrans Set\ '&syntax'\ only Pode&si\ samo\ 'syntax' +menutrans Set\ '&filetype'\ too Podesi\ &takoðe\ i\ 'filetype' +menutrans &Off &Iskljuèeno menutrans &Manual &Ruèno -menutrans A&utomatic &Automatski +menutrans A&utomatic &Automatski menutrans on/off\ for\ &This\ file Da/ne\ za\ ovu\ &datoteku -menutrans Co&lor\ test Provera\ &boja +menutrans Co&lor\ test Provera\ &boja menutrans &Highlight\ test Provera\ isti&canja menutrans &Convert\ to\ HTML Pretvori\ &u\ HTML @@ -257,9 +284,13 @@ let g:menutrans_textwidth_dialog = "Unesite novu ¹irinu teksta (0 spreèava prelom)" -let g:menutrans_fileformat_dialog = "Izaberite vrstu datoteke" +let g:menutrans_fileformat_dialog = "Izaberite format zapisa datoteke" + +let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Otka¾i" let menutrans_no_file = "[Nema datoteke]" let &cpo = s:keepcpo unlet s:keepcpo + +" vim: tw=0 keymap=serbian diff -Nru vim-8.0.1453/runtime/lang/menu_sr_rs.iso_8859-5.vim vim-8.0.1766/runtime/lang/menu_sr_rs.iso_8859-5.vim --- vim-8.0.1453/runtime/lang/menu_sr_rs.iso_8859-5.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/lang/menu_sr_rs.iso_8859-5.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,6 +1,7 @@ " Menu Translations: Serbian " Maintainer: Aleksandar Jelenak -" Last Change: Fri, 30 May 2003 12:02:07 -0400 +" Last Change: Fri, 30 May 2003 10:17:39 Eastern Daylight Time +" Adapted for VIM 8 by: ¸ÒÐÝ ¿ÕèØû on 2017-12-28 12:05+0400 " Quit when menu translations have already been done. if exists("did_menu_trans") @@ -21,6 +22,7 @@ menutrans &Credits &·ÐáÛãÓÕ menutrans Co&pying ¿&àÕã×ØÜÐúÕ menutrans O&rphans &ÁØàÞçØûØ +menutrans &Sponsor/Register ÁßÞÝ×Þà/&ÀÕÓØáâàãøâÕ\ áÕ menutrans &Version &²Õà×ØøÐ menutrans &About &¾\ ßàÞÓàÐÜã @@ -28,6 +30,7 @@ menutrans &File &´ÐâÞâÕÚÐ menutrans &Open\.\.\.:e &¾âÒÞàØ\.\.\.:e menutrans Sp&lit-Open\.\.\.:sp &¿ÞÔÕÛØ-ÞâÒÞàØ\.\.\.:sp +menutrans Open\ Tab\.\.\.:tabnew ¾âÒÞàØ\ ÚÐàâØæã\.\.\.:tabnew menutrans &New:enew &½ÞÒÐ:enew menutrans &Close:close &·ÐâÒÞàØ:close menutrans &Save:w &ÁÐçãÒÐø:w @@ -54,24 +57,27 @@ menutrans &Find\.\.\. &½ÐòØ\.\.\. menutrans Find\ and\ Rep&lace\.\.\. ½ÐòØ\ Ø\ &×ÐÜÕÝØ\.\.\. menutrans Settings\ &Window ¿&àÞ×Þà\ ßÞÔÕèÐÒÐúÐ +menutrans Startup\ &Settings ¿Þ&ÔÕèÐÒÐúÐ\ ßàØ\ ßÞÚàÕâÐúã menutrans &Global\ Settings ¾ß&èâÐ\ ßÞÔÕèÐÒÐúÐ menutrans F&ile\ Settings ¿ÞÔÕèÐÒÐúÐ\ ×Ð\ ÔÐ&âÞâÕÚÕ menutrans &Shiftwidth &¿ÞÜÕàÐø menutrans Soft\ &Tabstop &¼ÕÚÐ\ âÐÑãÛÐæØøÐ menutrans Te&xt\ Width\.\.\. &ÈØàØÝÐ\ âÕÚáâÐ\.\.\. menutrans &File\ Format\.\.\. &²àáâÐ\ ÔÐâÞâÕÚÕ\.\.\. -menutrans C&olor\ Scheme ±Þ&øÕ -menutrans &Keymap ¿àÕá&ÛØÚÐÒÐúÕ\ âÐáâÐâãàÕ +menutrans Show\ C&olor\ Schemes\ in\ Menu ¿àØÚÐÖØ\ èÕÜÕ\ ÑÞ&øÐ\ ã\ ÜÕÝØøã +menutrans C&olor\ Scheme \ÈÕÜÕ\ ÑÞ&øÐ +menutrans Show\ &Keymaps\ in\ Menu ¿àØÚÐÖØ\ ßàÕá&ÛØÚÐÒÐúÐ\ âÐáâÐâãàÕ\ ã\ ÜÕÝØøã +menutrans &Keymap ¿àÕá&ÛØÚÐÒÐúÐ\ âÐáâÐâãàÕ menutrans Select\ Fo&nt\.\.\. ¸×ÑÞà\ &äÞÝâÐ\.\.\. " Edit/Global Settings menutrans Toggle\ Pattern\ &Highlight:set\ hls! ½ÐÓÛÐáØ\ &ÞÑàÐ×æÕ\ (ÔÐ/ÝÕ):set\ hls! -menutrans Toggle\ &Ignore-case:set\ ic! ·ÐÝÕÜÐàØ\ \ÒÕÛØçØÝã\ &áÛÞÒÐ\ (ÔÐ/ÝÕ):set\ ic! -menutrans Toggle\ &Showmatch:set\ sm! ¿àÞÒÕàØ\ ßàÐâÕûã\ &×ÐÓàÐÔã\ (ÔÐ/ÝÕ):set\ sm! +menutrans Toggle\ &Ignoring\ Case:set\ ic! ·ÐÝÕÜÐàØ\ ÒÕÛØçØÝã\ &áÛÞÒÐ\ (ÔÐ/ÝÕ):set\ ic! +menutrans Toggle\ &Showing\ Matched\ Pairs:set\ sm! ¿àÞÒÕàØ\ ßàÐâÕûã\ &×ÐÓàÐÔã\ (ÔÐ/ÝÕ):set\ sm! menutrans &Context\ lines ²ØÔùØÒØ\ &àÕÔÞÒØ menutrans &Virtual\ Edit ²ØàâãÕÛÝÞ\ &ãàÕòØÒÐúÕ -menutrans Toggle\ Insert\ &Mode:set\ im! ÀÕÖØÜ\ ã&ÝÞáÐ\ (ÔÐ/ÝÕ):set\ im! -menutrans Toggle\ Vi\ C&ompatible:set\ cp! '&Vi'\ áÐÓÛÐáÝÞ\ (ÔÐ/ÝÕ):set\ cp! +menutrans Toggle\ Insert\ &Mode:set\ im! ÀÕÖØÜ\ ã&ÝÞáÐ\ (ÔÐ/ÝÕ):set\ im! +menutrans Toggle\ Vi\ C&ompatibility:set\ cp! '&Vi'\ áÐÓÛÐáÝÞ\ (ÔÐ/ÝÕ):set\ cp! menutrans Search\ &Path\.\.\. ¿ãâÐúÐ\ &ßàÕâàÐÓÕ\.\.\. menutrans Ta&g\ Files\.\.\. &´ÐâÞâÕÚÕ\ Þ×ÝÐÚÐ\.\.\. menutrans Toggle\ &Toolbar »ØÝØøÐ\ áÐ\ &ÐÛÐâÚÐÜÐ\ (ÔÐ/ÝÕ) @@ -87,28 +93,30 @@ menutrans Always ÃÒÕÚ " Edit/File Settings -menutrans Toggle\ Line\ &Numbering:set\ nu! ÀÕÔÝØ\ &ÑàÞøÕÒØ\ (ÔÐ/ÝÕ):set\ nu! +menutrans Toggle\ Line\ &Numbering:set\ nu! ¿àØÚÐÖØ\ &ÝãÜÕàÐæØøã\ ÛØÝØøÐ\ (ÔÐ/ÝÕ):set\ nu! +menutrans Toggle\ Relati&ve\ Line\ Numbering:set\ rnu! ¿àØÚÐÖØ\ ÀÕÛÐâØ&ÒÝã\ ÝãÜÕàÐæØøã\ ÛØÝØøÐ\ (ÔÐ/ÝÕ):set\ rnu! menutrans Toggle\ &List\ Mode:set\ list! ÀÕÖØÜ\ &ÛØáâÕ\ (ÔÐ/ÝÕ):set\ list! -menutrans Toggle\ Line\ &Wrap:set\ wrap! ¾ÑÐÒØøÐúÕ\ &àÕÔÞÒÐ\ (ÔÐ/ÝÕ):set\ wrap! -menutrans Toggle\ W&rap\ at\ word:set\ lbr! ¿àÕÛÞÜØ\ &ÝÐ\ àÕç\ (ÔÐ/ÝÕ):set\ lbr! -menutrans Toggle\ &expand-tab:set\ et! ÀÐ×ÜÐæØ\ ãÜÕáâÞ\ &âÐÑãÛÐæØøÕ\ (ÔÐ/ÝÕ):set\ et! -menutrans Toggle\ &auto-indent:set\ ai! °ãâÞ-&ãÒÛÐçÕúÕ\ (ÔÐ/ÝÕ):set\ ai! -menutrans Toggle\ &C-indenting:set\ cin! &ÆÕ-ãÒÛÐçÕúÕ\ (ÔÐ/ÝÕ):set\ cin! +menutrans Toggle\ Line\ &Wrapping:set\ wrap! ¾ÑÐÒØøÐúÕ\ &àÕÔÞÒÐ\ (ÔÐ/ÝÕ):set\ wrap! +menutrans Toggle\ W&rapping\ at\ Word:set\ lbr! ¿àÕÛÞÜØ\ &ÝÐ\ àÕç\ (ÔÐ/ÝÕ):set\ lbr! +menutrans Toggle\ Tab\ &Expanding:set\ et! ÀÐ×ÜÐæØ\ ãÜÕáâÞ\ &âÐÑãÛÐæØøÕ\ (ÔÐ/ÝÕ):set\ et! +menutrans Toggle\ &Auto\ Indenting:set\ ai! °ãâÞ-&ãÒÛÐçÕúÕ\ (ÔÐ/ÝÕ):set\ ai! +menutrans Toggle\ &C-Style\ Indenting:set\ cin! &C-ãÒÛÐçÕúÕ\ (ÔÐ/ÝÕ):set\ cin! " Edit/Keymap -menutrans None ½ØøÕÔÐÝ +menutrans None ±Õ×\ ßàÕáÛØÚÐÒÐúÐ " Tools menu menutrans &Tools &°ÛÐâÚÕ menutrans &Jump\ to\ this\ tagg^] ÁÚÞçØ\ ÝÐ\ &ÞÒã\ Þ×ÝÐÚãg^] menutrans Jump\ &back^T ÁÚÞçØ\ &ÝÐâàÐÓ^T menutrans Build\ &Tags\ File ¸×ÓàÐÔØ\ &ÔÐâÞâÕÚã\ Þ×ÝÐÚÐ +menutrans &Spelling ¿àÐ&ÒÞßØá menutrans &Folding &¿ÞÔÒØøÐúÕ menutrans Create\ &Foldzf Á&âÒÞàØ\ ßÞÔÒØøãâÐÚzf menutrans &Delete\ Foldzd ¾&ÑàØèØ\ ßÞÔÒØøãâÐÚzd menutrans Delete\ &All\ FoldszD ¾ÑàØèØ\ áÒÕ\ ßÞ&ÔÒØøãâÚÕzD menutrans Fold\ column\ &width ÈØàØÝÐ\ &àÕÔÐ\ ßÞÔÒØøãâÚÐ -menutrans &Diff &ÃßÞàÕòØÒÐúÕ +"menutrans &Diff &ÃßÞàÕòØÒÐúÕ menutrans &Make:make 'mak&Õ':make menutrans &List\ Errors:cl ÁßØáÐÚ\ &ÓàÕèÐÚÐ:cl menutrans L&ist\ Messages:cl! Áß&ØáÐÚ\ ßÞàãÚÐ:cl! @@ -117,9 +125,25 @@ menutrans &Older\ List:cold ÁâÐàØ\ áßØáÐ&Ú:cold menutrans N&ewer\ List:cnew ½Þ&ÒØ\ áßØáÐÚ:cnew menutrans Error\ &Window ¿àÞ×Þà\ áÐ\ Ó&àÕèÚÐÜÐ -menutrans &Set\ Compiler ¸&×ÐÑÕàØ\ ßàÕÒÞÔØÞæÐ +menutrans Se&t\ Compiler ¸&×ÐÑÕàØ\ ßàÕÒÞÔØÞæÐ menutrans &Convert\ to\ HEX:%!xxd ¿àÕâÒÞàØ\ ã\ &ŵºÁ:%!xxd menutrans Conve&rt\ back:%!xxd\ -r ²à&ÐâØ\ ã\ ßàÒÞÑØâÐÝ\ ÞÑÛØÚ:%!xxd\ -r +menutrans Show\ Compiler\ Se&ttings\ in\ Menu ¿àØÚÐÖØ\ ßÞÔÕ&èÐÒÐúÐ\ ßàÕÒÞÔØÞæÐ\ ã\ ÜÕÝØøã + +" Tools/Spelling +menutrans &Spell\ Check\ On &ÃÚùãçØ\ ßàÞÒÕàã\ ßàÐÒÞßØáÐ +menutrans Spell\ Check\ &Off &¸áÚùãçØ\ ßàÞÒÕàã\ ßàÐÒÞßØáÐ +menutrans To\ &Next\ Error]s ¸ÔØ\ ÝÐ\ &áÛÕÔÕûã\ ÓàÕèÚã]s +menutrans To\ &Previous\ Error[s ¸ÔØ\ ÝÐ\ &ßàÕâåÞÔÝã\ ÓàÕèÚã[s +menutrans Suggest\ &Correctionsz= ¿àÕÔÛÞÖØ\ Øáß&àÐÒÚÕz= +menutrans &Repeat\ Correction:spellrepall ¿&ÞÝÞÒØ\ ØáßàÐÒÚã:spellrepall +menutrans Set\ Language\ to\ "en" ¿ÞáâÐÒØ\ øÕ×ØÚ\ ÝÐ\ "en" +menutrans Set\ Language\ to\ "en_au" ¿ÞáâÐÒØ\ øÕ×ØÚ\ ÝÐ\ "en_au" +menutrans Set\ Language\ to\ "en_ca" ¿ÞáâÐÒØ\ øÕ×ØÚ\ ÝÐ\ "en_ca" +menutrans Set\ Language\ to\ "en_gb" ¿ÞáâÐÒØ\ øÕ×ØÚ\ ÝÐ\ "en_gb" +menutrans Set\ Language\ to\ "en_nz" ¿ÞáâÐÒØ\ øÕ×ØÚ\ ÝÐ\ "en_nz" +menutrans Set\ Language\ to\ "en_us" ¿ÞáâÐÒØ\ øÕ×ØÚ\ ÝÐ\ "en_us" +menutrans &Find\ More\ Languages ¿àÞÝÐòØ\ øÞè\ øÕ×ØÚÐ " Tools/Folding menutrans &Enable/Disable\ foldszi &¾ÜÞÓãûØ/ßàÕÚØÝØ\ ßÞÔÒØøÐúÕzi @@ -130,6 +154,7 @@ menutrans O&pen\ more\ foldszr ¾âÒÞàØ\ ÒØè&Õ\ ßÞÔÒØøãâÐÚÐzr menutrans &Open\ all\ foldszR ¾&âÒÞàØ\ áÒÕ\ ßÞÔÒØøãâÚÕzR menutrans Fold\ Met&hod &½ÐçØÝ\ ßÞÔÒØøÐúÐ +menutrans Fold\ Col&umn\ Width ÈØàØÝÐ\ ÚÞÛÞÝÕ\ ØáßàÕÔ\ ßÞÔÒØøãâÐÚÐ " Tools/Folding/Fold Method menutrans M&anual &ÀãçÝÞ @@ -141,8 +166,8 @@ " Tools/Diff menutrans &Update &°ÖãàØàÐø -menutrans &Get\ Block &¿àØåÒÐâØ\ Ø×ÜÕÝã -menutrans &Put\ Block ¿àÕ&ÑÐæØ\ Ø×ÜÕÝã +menutrans &Get\ Block &¿àØåÒÐâØ\ ÑÛÞÚ\ Ø×ÜÕÝa +menutrans &Put\ Block ¿àÕ&ÑÐæØ\ ÑÛÞÚ\ Ø×ÜÕÝÐ " Tools/Error Window menutrans &Update:cwin &°ÖãàØàÐø:cwin @@ -190,8 +215,10 @@ menutrans &Copy &ºÞßØàÐø menutrans &Paste &ÃÑÐæØ menutrans &Delete ¸&×ÑàØèØ -menutrans Select\ Blockwise ±ØàÐø\ &ßàÐÒÞãÓÐÞÝÞ +menutrans Select\ Blockwise ±ØàÐø\ Ñ&ÛÞÚÞÒáÚØ menutrans Select\ &Word ¸×ÐÑÕàØ\ &àÕç +menutrans Select\ &Sentence ¸×ÐÑÕàØ\ à&ÕçÕÝØæã +menutrans Select\ Pa&ragraph ¸×ÐÑÕàØ\ &ßÐàÐÓàÐä menutrans Select\ &Line ¸×ÐÑÕàØ\ à&ÕÔ menutrans Select\ &Block ¸×ÐÑÕàØ\ &ÑÛÞÚ menutrans Select\ &All ¸×ÐÑÕàØ\ &áÒÕ @@ -202,20 +229,20 @@ delfun Do_toolbar_tmenu endif fun Do_toolbar_tmenu() - tmenu ToolBar.Open ÃçØâÐø - tmenu ToolBar.Save ÁÐçãÒÐø + tmenu ToolBar.Open ÃçØâÐø + tmenu ToolBar.Save ÁÐçãÒÐø tmenu ToolBar.SaveAll ÁÐçãÒÐø áÒÕ tmenu ToolBar.Print ÈâÐÜßÐø - tmenu ToolBar.Undo ²àÐâØ - tmenu ToolBar.Redo ¿ÞÒàÐâØ - tmenu ToolBar.Cut ¸áÕæØ - tmenu ToolBar.Copy ºÞßØàÐø + tmenu ToolBar.Undo ²àÐâØ + tmenu ToolBar.Redo ¿ÞÒàÐâØ + tmenu ToolBar.Cut ¸áÕæØ + tmenu ToolBar.Copy ºÞßØàÐø tmenu ToolBar.Paste ÃÑÐæØ - tmenu ToolBar.Find ½ÐòØ + tmenu ToolBar.Find ½ÐòØ tmenu ToolBar.FindNext ½ÐòØ áÛÕÔÕûØ tmenu ToolBar.FindPrev ½ÐòØ ßàÕâåÞÔÝØ tmenu ToolBar.Replace ·ÐÜÕÝØ - tmenu ToolBar.New ½ÞÒØ + tmenu ToolBar.New ½ÞÒØ tmenu ToolBar.WinSplit ¿ÞÔÕÛØ ßàÞ×Þà tmenu ToolBar.WinMax ¼ÐÚáØÜÐÛÝÐ ÒØáØÝÐ tmenu ToolBar.WinMin ¼ØÝØÜÐÛÝÐ ÒØáØÝÐ @@ -226,25 +253,25 @@ tmenu ToolBar.LoadSesn ÃçØâÐø áÕÐÝáã tmenu ToolBar.SaveSesn ÁÐçãÒÐø áÕÐÝáã tmenu ToolBar.RunScript ¸×ÒàèØ áßØá - tmenu ToolBar.Make 'make' + tmenu ToolBar.Make 'make' tmenu ToolBar.Shell ¾ßÕàÐâØÒÝÞ ÞÚàãÖÕúÕ tmenu ToolBar.RunCtags ½ÐßàÐÒØ Þ×ÝÐÚÕ tmenu ToolBar.TagJump ¸ÔØ ÝÐ Þ×ÝÐÚã - tmenu ToolBar.Help ¿ÞÜÞû + tmenu ToolBar.Help ¿ÞÜÞû tmenu ToolBar.FindHelp ½ÐòØ ÞÑøÐèúÕúÕ endfun endif " Syntax menu menutrans &Syntax &ÁØÝâÐÚáÐ -menutrans &Show\ filetypes\ in\ menu ¸×ÑÞà\ 'filetype'\ Ø×\ &ÜÕÝØøÐ -menutrans Set\ '&syntax'\ only ¿ÞÔÕ&áØ\ 'syntax'\ áÐÜÞ -menutrans Set\ '&filetype'\ too ¿ÞÔÕáØ\ 'filetype'\ &âÐÚÞòÕ -menutrans &Off &¸áÚùãçÕÝÞ +menutrans &Show\ File\ Types\ in\ Menu ¿àØÚÐÖØ\ âØßÞÒÕ\ ÔÐâÞâÕÚÐ\ ã\ &ÜÕÝØøã +menutrans Set\ '&syntax'\ only ¿ÞÔÕ&áØ\ áÐÜÞ\ 'syntax' +menutrans Set\ '&filetype'\ too ¿ÞÔÕáØ\ &âÐÚÞòÕ\ Ø\ 'filetype' +menutrans &Off &¸áÚùãçÕÝÞ menutrans &Manual &ÀãçÝÞ -menutrans A&utomatic &°ãâÞÜÐâáÚØ +menutrans A&utomatic &°ãâÞÜÐâáÚØ menutrans on/off\ for\ &This\ file ´Ð/ÝÕ\ ×Ð\ ÞÒã\ &ÔÐâÞâÕÚã -menutrans Co&lor\ test ¿àÞÒÕàÐ\ &ÑÞøÐ +menutrans Co&lor\ test ¿àÞÒÕàÐ\ &ÑÞøÐ menutrans &Highlight\ test ¿àÞÒÕàÐ\ ØáâØ&æÐúÐ menutrans &Convert\ to\ HTML ¿àÕâÒÞàØ\ &ã\ HTML @@ -257,9 +284,13 @@ let g:menutrans_textwidth_dialog = "ÃÝÕáØâÕ ÝÞÒã èØàØÝã âÕÚáâÐ (0 áßàÕçÐÒÐ ßàÕÛÞÜ)" -let g:menutrans_fileformat_dialog = "¸×ÐÑÕàØâÕ Òàáâã ÔÐâÞâÕÚÕ" +let g:menutrans_fileformat_dialog = "¸×ÐÑÕàØâÕ äÞàÜÐâ ×ÐßØáÐ ÔÐâÞâÕÚÕ" + +let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&¾âÚÐÖØ" let menutrans_no_file = "[½ÕÜÐ ÔÐâÞâÕÚÕ]" let &cpo = s:keepcpo unlet s:keepcpo + +" vim: tw=0 keymap=serbian diff -Nru vim-8.0.1453/runtime/lang/menu_sr_rs.utf-8.vim vim-8.0.1766/runtime/lang/menu_sr_rs.utf-8.vim --- vim-8.0.1453/runtime/lang/menu_sr_rs.utf-8.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/lang/menu_sr_rs.utf-8.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,6 +1,7 @@ " Menu Translations: Serbian " Maintainer: Aleksandar Jelenak " Last Change: Fri, 30 May 2003 10:17:39 Eastern Daylight Time +" Adapted for VIM 8 by: Иван Пешић on 2017-12-28 12:05+0400 " Quit when menu translations have already been done. if exists("did_menu_trans") @@ -21,6 +22,7 @@ menutrans &Credits &ЗаÑлуге menutrans Co&pying П&реузимање menutrans O&rphans &Сирочићи +menutrans &Sponsor/Register Спонзор/&РегиÑтрујте\ Ñе menutrans &Version &Верзија menutrans &About &О\ програму @@ -28,6 +30,7 @@ menutrans &File &Датотека menutrans &Open\.\.\.:e &Отвори\.\.\.:e menutrans Sp&lit-Open\.\.\.:sp &Подели-отвори\.\.\.:sp +menutrans Open\ Tab\.\.\.:tabnew Отвори\ картицу\.\.\.:tabnew menutrans &New:enew &Ðова:enew menutrans &Close:close &Затвори:close menutrans &Save:w &Сачувај:w @@ -54,24 +57,27 @@ menutrans &Find\.\.\. &Ðађи\.\.\. menutrans Find\ and\ Rep&lace\.\.\. Ðађи\ и\ &замени\.\.\. menutrans Settings\ &Window П&розор\ подешавања +menutrans Startup\ &Settings По&дешавања\ при\ покретању menutrans &Global\ Settings Оп&шта\ подешавања menutrans F&ile\ Settings Подешавања\ за\ да&тотеке menutrans &Shiftwidth &Померај menutrans Soft\ &Tabstop &Мека\ табулација menutrans Te&xt\ Width\.\.\. &Ширина\ текÑта\.\.\. menutrans &File\ Format\.\.\. &Ð’Ñ€Ñта\ датотеке\.\.\. -menutrans C&olor\ Scheme Бо&је -menutrans &Keymap ПреÑ&ликавање\ таÑтатуре +menutrans Show\ C&olor\ Schemes\ in\ Menu Прикажи\ шеме\ бо&ја\ у\ менију +menutrans C&olor\ Scheme \Шеме\ бо&ја +menutrans Show\ &Keymaps\ in\ Menu Прикажи\ преÑ&ликавања\ таÑтатуре\ у\ менију +menutrans &Keymap ПреÑ&ликавања\ таÑтатуре menutrans Select\ Fo&nt\.\.\. Избор\ &фонта\.\.\. " Edit/Global Settings menutrans Toggle\ Pattern\ &Highlight:set\ hls! ÐаглаÑи\ &образце\ (да/не):set\ hls! -menutrans Toggle\ &Ignore-case:set\ ic! Занемари\ \величину\ &Ñлова\ (да/не):set\ ic! -menutrans Toggle\ &Showmatch:set\ sm! Провери\ пратећу\ &заграду\ (да/не):set\ sm! +menutrans Toggle\ &Ignoring\ Case:set\ ic! Занемари\ величину\ &Ñлова\ (да/не):set\ ic! +menutrans Toggle\ &Showing\ Matched\ Pairs:set\ sm! Провери\ пратећу\ &заграду\ (да/не):set\ sm! menutrans &Context\ lines Видљиви\ &редови menutrans &Virtual\ Edit Виртуелно\ &уређивање menutrans Toggle\ Insert\ &Mode:set\ im! Режим\ у&ноÑа\ (да/не):set\ im! -menutrans Toggle\ Vi\ C&ompatible:set\ cp! '&Vi'\ ÑаглаÑно\ (да/не):set\ cp! +menutrans Toggle\ Vi\ C&ompatibility:set\ cp! '&Vi'\ ÑаглаÑно\ (да/не):set\ cp! menutrans Search\ &Path\.\.\. Путања\ &претраге\.\.\. menutrans Ta&g\ Files\.\.\. &Датотеке\ ознака\.\.\. menutrans Toggle\ &Toolbar Линија\ Ñа\ &алаткама\ (да/не) @@ -87,28 +93,30 @@ menutrans Always Увек " Edit/File Settings -menutrans Toggle\ Line\ &Numbering:set\ nu! Редни\ &бројеви\ (да/не):set\ nu! +menutrans Toggle\ Line\ &Numbering:set\ nu! Прикажи\ &нумерацију\ линија\ (да/не):set\ nu! +menutrans Toggle\ Relati&ve\ Line\ Numbering:set\ rnu! Прикажи\ Релати&вну\ нумерацију\ линија\ (да/не):set\ rnu! menutrans Toggle\ &List\ Mode:set\ list! Режим\ &лиÑте\ (да/не):set\ list! -menutrans Toggle\ Line\ &Wrap:set\ wrap! Обавијање\ &редова\ (да/не):set\ wrap! -menutrans Toggle\ W&rap\ at\ word:set\ lbr! Преломи\ &на\ реч\ (да/не):set\ lbr! -menutrans Toggle\ &expand-tab:set\ et! Размаци\ умеÑто\ &табулације\ (да/не):set\ et! -menutrans Toggle\ &auto-indent:set\ ai! Ðуто-&увлачење\ (да/не):set\ ai! -menutrans Toggle\ &C-indenting:set\ cin! &Це-увлачење\ (да/не):set\ cin! +menutrans Toggle\ Line\ &Wrapping:set\ wrap! Обавијање\ &редова\ (да/не):set\ wrap! +menutrans Toggle\ W&rapping\ at\ Word:set\ lbr! Преломи\ &на\ реч\ (да/не):set\ lbr! +menutrans Toggle\ Tab\ &Expanding:set\ et! Размаци\ умеÑто\ &табулације\ (да/не):set\ et! +menutrans Toggle\ &Auto\ Indenting:set\ ai! Ðуто-&увлачење\ (да/не):set\ ai! +menutrans Toggle\ &C-Style\ Indenting:set\ cin! &C-увлачење\ (да/не):set\ cin! " Edit/Keymap -menutrans None Ðиједан +menutrans None Без\ преÑликавања " Tools menu menutrans &Tools &Ðлатке menutrans &Jump\ to\ this\ tagg^] Скочи\ на\ &ову\ ознакуg^] menutrans Jump\ &back^T Скочи\ &натраг^T menutrans Build\ &Tags\ File Изгради\ &датотеку\ ознака +menutrans &Spelling Пра&Ð²Ð¾Ð¿Ð¸Ñ menutrans &Folding &Подвијање menutrans Create\ &Foldzf С&твори\ подвијутакzf menutrans &Delete\ Foldzd О&бриши\ подвијутакzd menutrans Delete\ &All\ FoldszD Обриши\ Ñве\ по&двијуткеzD menutrans Fold\ column\ &width Ширина\ &реда\ подвијутка -menutrans &Diff &Упоређивање +"menutrans &Diff &Упоређивање menutrans &Make:make 'mak&е':make menutrans &List\ Errors:cl СпиÑак\ &грешака:cl menutrans L&ist\ Messages:cl! Сп&иÑак\ порука:cl! @@ -117,9 +125,25 @@ menutrans &Older\ List:cold Стари\ ÑпиÑа&к:cold menutrans N&ewer\ List:cnew Ðо&ви\ ÑпиÑак:cnew menutrans Error\ &Window Прозор\ Ñа\ г&решкама -menutrans &Set\ Compiler И&забери\ преводиоца +menutrans Se&t\ Compiler И&забери\ преводиоца menutrans &Convert\ to\ HEX:%!xxd Претвори\ у\ &ХЕКС:%!xxd menutrans Conve&rt\ back:%!xxd\ -r Ð’Ñ€&ати\ у\ првобитан\ облик:%!xxd\ -r +menutrans Show\ Compiler\ Se&ttings\ in\ Menu Прикажи\ поде&шавања\ преводиоца\ у\ менију + +" Tools/Spelling +menutrans &Spell\ Check\ On &Укључи\ проверу\ правопиÑа +menutrans Spell\ Check\ &Off &ИÑкључи\ проверу\ правопиÑа +menutrans To\ &Next\ Error]s Иди\ на\ &Ñледећу\ грешку]s +menutrans To\ &Previous\ Error[s Иди\ на\ &претходну\ грешку[s +menutrans Suggest\ &Correctionsz= Предложи\ иÑп&равкеz= +menutrans &Repeat\ Correction:spellrepall П&онови\ иÑправку:spellrepall +menutrans Set\ Language\ to\ "en" ПоÑтави\ језик\ на\ "en" +menutrans Set\ Language\ to\ "en_au" ПоÑтави\ језик\ на\ "en_au" +menutrans Set\ Language\ to\ "en_ca" ПоÑтави\ језик\ на\ "en_ca" +menutrans Set\ Language\ to\ "en_gb" ПоÑтави\ језик\ на\ "en_gb" +menutrans Set\ Language\ to\ "en_nz" ПоÑтави\ језик\ на\ "en_nz" +menutrans Set\ Language\ to\ "en_us" ПоÑтави\ језик\ на\ "en_us" +menutrans &Find\ More\ Languages Пронађи\ још\ језика " Tools/Folding menutrans &Enable/Disable\ foldszi &Омогући/прекини\ подвијањеzi @@ -130,6 +154,7 @@ menutrans O&pen\ more\ foldszr Отвори\ виш&е\ подвијутакаzr menutrans &Open\ all\ foldszR О&твори\ Ñве\ подвијуткеzR menutrans Fold\ Met&hod &Ðачин\ подвијања +menutrans Fold\ Col&umn\ Width Ширина\ колоне\ иÑпред\ подвијутака " Tools/Folding/Fold Method menutrans M&anual &Ручно @@ -141,8 +166,8 @@ " Tools/Diff menutrans &Update &Ðжурирај -menutrans &Get\ Block &Прихвати\ измену -menutrans &Put\ Block Пре&баци\ измену +menutrans &Get\ Block &Прихвати\ блок\ изменa +menutrans &Put\ Block Пре&баци\ блок\ измена " Tools/Error Window menutrans &Update:cwin &Ðжурирај:cwin @@ -190,8 +215,10 @@ menutrans &Copy &Копирај menutrans &Paste &Убаци menutrans &Delete И&збриши -menutrans Select\ Blockwise Бирај\ &правоугаоно +menutrans Select\ Blockwise Бирај\ б&локовÑки menutrans Select\ &Word Изабери\ &реч +menutrans Select\ &Sentence Изабери\ Ñ€&еченицу +menutrans Select\ Pa&ragraph Изабери\ &параграф menutrans Select\ &Line Изабери\ Ñ€&ед menutrans Select\ &Block Изабери\ &блок menutrans Select\ &All Изабери\ &Ñве @@ -237,9 +264,9 @@ " Syntax menu menutrans &Syntax &СинтакÑа -menutrans &Show\ filetypes\ in\ menu Избор\ 'filetype'\ из\ &менија -menutrans Set\ '&syntax'\ only Поде&Ñи\ 'syntax'\ Ñамо -menutrans Set\ '&filetype'\ too ПодеÑи\ 'filetype'\ &такође +menutrans &Show\ File\ Types\ in\ Menu Прикажи\ типове\ датотека\ у\ &менију +menutrans Set\ '&syntax'\ only Поде&Ñи\ Ñамо\ 'syntax' +menutrans Set\ '&filetype'\ too ПодеÑи\ &такође\ и\ 'filetype' menutrans &Off &ИÑкључено menutrans &Manual &Ручно menutrans A&utomatic &ÐутоматÑки @@ -257,7 +284,9 @@ let g:menutrans_textwidth_dialog = "УнеÑите нову ширину текÑта (0 Ñпречава прелом)" -let g:menutrans_fileformat_dialog = "Изаберите врÑту датотеке" +let g:menutrans_fileformat_dialog = "Изаберите формат запиÑа датотеке" + +let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Откажи" let menutrans_no_file = "[Ðема датотеке]" diff -Nru vim-8.0.1453/runtime/optwin.vim vim-8.0.1766/runtime/optwin.vim --- vim-8.0.1453/runtime/optwin.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/optwin.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,7 +1,7 @@ " These commands create the option window. " " Maintainer: Bram Moolenaar -" Last Change: 2017 Nov 21 +" Last Change: 2018 Feb 27 " If there already is an option window, jump to that one. let buf = bufnr('option-window') @@ -122,11 +122,13 @@ endfun " Reset 'title' and 'icon' to make it work faster. +" Reset 'undolevels' to avoid undo'ing until the buffer is empty. let s:old_title = &title let s:old_icon = &icon let s:old_sc = &sc let s:old_ru = &ru -set notitle noicon nosc noru +let s:old_ul = &ul +set notitle noicon nosc noru ul=-1 " If the current window is a help window, try finding a non-help window. " Relies on syntax highlighting to be switched on. @@ -504,12 +506,15 @@ call BinOptionL("crb") endif if has("terminal") - call append("$", "termsize\tsize of a terminal window") + call append("$", "termwinsize\tsize of a terminal window") call append("$", "\t(local to window)") - call OptionL("tms") - call append("$", "termkey\tkey that precedes Vim commands in a terminal window") + call OptionL("tws") + call append("$", "termwinkey\tkey that precedes Vim commands in a terminal window") call append("$", "\t(local to window)") - call OptionL("tk") + call OptionL("twk") + call append("$", "termwinscroll\tmax number of lines to keep for scrollback in a terminal window") + call append("$", "\t(local to window)") + call OptionL("twsl") if exists("&winptydll") call append("$", "winptydll\tname of the winpty dynamic library") call OptionG("winptydll", &winptydll) @@ -756,7 +761,7 @@ call Header("editing text") call append("$", "undolevels\tmaximum number of changes that can be undone") call append("$", "\t(global or local to buffer)") -call append("$", " \tset ul=" . &ul) +call append("$", " \tset ul=" . s:old_ul) call append("$", "undofile\tautomatically save and restore undo history") call BinOptionG("udf", &udf) call append("$", "undodir\tlist of directories for undo files") @@ -802,6 +807,8 @@ call OptionG("cot", &cot) call append("$", "pumheight\tmaximum height of the popup menu") call OptionG("ph", &ph) + call append("$", "pumwidth\tminimum width of the popup menu") + call OptionG("pw", &pw) call append("$", "completefunc\tuser defined function for Insert mode completion") call append("$", "\t(local to buffer)") call OptionL("cfu") @@ -1436,6 +1443,7 @@ let &ru = s:old_ru let &sc = s:old_sc let &cpo = s:cpo_save -unlet s:old_title s:old_icon s:old_ru s:old_sc s:cpo_save s:idx s:lnum +let &ul = s:old_ul +unlet s:old_title s:old_icon s:old_ru s:old_sc s:cpo_save s:idx s:lnum s:old_ul " vim: ts=8 sw=2 sts=2 diff -Nru vim-8.0.1453/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim vim-8.0.1766/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim --- vim-8.0.1453/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim 2018-04-26 20:30:33.000000000 +0000 @@ -25,7 +25,8 @@ " The command that starts debugging, e.g. ":Termdebug vim". " To end type "quit" in the gdb window. -command -nargs=* -complete=file Termdebug call s:StartDebug() +command -nargs=* -complete=file -bang Termdebug call s:StartDebug(0, ) +command -nargs=+ -complete=file -bang TermdebugCommand call s:StartDebugCommand(0, ) " Name of the gdb command, defaults to "gdb". if !exists('termdebugger') @@ -43,7 +44,22 @@ endif hi default debugBreakpoint term=reverse ctermbg=red guibg=red -func s:StartDebug(cmd) +func s:StartDebug(bang, ...) + " First argument is the command to debug, second core file or process ID. + call s:StartDebug_internal({'gdb_args': a:000, 'bang': a:bang}) +endfunc + +func s:StartDebugCommand(bang, ...) + " First argument is the command to debug, rest are run arguments. + call s:StartDebug_internal({'gdb_args': [a:1], 'proc_args': a:000[1:], 'bang': a:bang}) +endfunc + +func s:StartDebug_internal(dict) + if exists('s:gdbwin') + echoerr 'Terminal debugger already running' + return + endif + let s:startwin = win_getid(winnr()) let s:startsigncolumn = &signcolumn @@ -90,7 +106,10 @@ " Open a terminal window to run the debugger. " Add -quiet to avoid the intro message causing a hit-enter prompt. - let cmd = [g:termdebugger, '-quiet', '-tty', pty, a:cmd] + let gdb_args = get(a:dict, 'gdb_args', []) + let proc_args = get(a:dict, 'proc_args', []) + + let cmd = [g:termdebugger, '-quiet', '-tty', pty] + gdb_args echomsg 'executing "' . join(cmd) . '"' let s:gdbbuf = term_start(cmd, { \ 'exit_cb': function('s:EndDebug'), @@ -104,15 +123,54 @@ endif let s:gdbwin = win_getid(winnr()) + " Set arguments to be run + if len(proc_args) + call term_sendkeys(s:gdbbuf, 'set args ' . join(proc_args) . "\r") + endif + " Connect gdb to the communication pty, using the GDB/MI interface - " If you get an error "undefined command" your GDB is too old. call term_sendkeys(s:gdbbuf, 'new-ui mi ' . commpty . "\r") + " Wait for the response to show up, users may not notice the error and wonder + " why the debugger doesn't work. + let try_count = 0 + while 1 + let response = '' + for lnum in range(1,200) + if term_getline(s:gdbbuf, lnum) =~ 'new-ui mi ' + let response = term_getline(s:gdbbuf, lnum + 1) + if response =~ 'Undefined command' + echoerr 'Sorry, your gdb is too old, gdb 7.12 is required' + exe 'bwipe! ' . s:ptybuf + exe 'bwipe! ' . s:commbuf + return + endif + if response =~ 'New UI allocated' + " Success! + break + endif + endif + endfor + if response =~ 'New UI allocated' + break + endif + let try_count += 1 + if try_count > 100 + echoerr 'Cannot check if your gdb works, continuing anyway' + break + endif + sleep 10m + endwhile + " Interpret commands while the target is running. This should usualy only be " exec-interrupt, since many commands don't work properly while the target is " running. call s:SendCommand('-gdb-set mi-async on') + " Disable pagination, it causes everything to stop at the gdb + " "Type to continue" prompt. + call s:SendCommand('-gdb-set pagination off') + " Sign used to highlight the line where the program has stopped. " There can be only one. sign define debugPC linehl=debugPC @@ -143,11 +201,20 @@ au BufRead * call s:BufRead() au BufUnload * call s:BufUnloaded() augroup END + + " Run the command if the bang attribute was given + " and got to the window + if get(a:dict, 'bang', 0) + call s:SendCommand('-exec-run') + call win_gotoid(s:ptywin) + endif + endfunc func s:EndDebug(job, status) exe 'bwipe! ' . s:ptybuf exe 'bwipe! ' . s:commbuf + unlet s:gdbwin let curwinid = win_getid(winnr()) @@ -201,7 +268,7 @@ " Install commands in the current window to control the debugger. func s:InstallCommands() command Break call s:SetBreakpoint() - command Delete call s:DeleteBreakpoint() + command Clear call s:ClearBreakpoint() command Step call s:SendCommand('-exec-step') command Over call s:SendCommand('-exec-next') command Finish call s:SendCommand('-exec-finish') @@ -212,24 +279,45 @@ command -range -nargs=* Evaluate call s:Evaluate(, ) command Gdb call win_gotoid(s:gdbwin) command Program call win_gotoid(s:ptywin) + command Source call s:GotoStartwinOrCreateIt() + command Winbar call s:InstallWinbar() " TODO: can the K mapping be restored? nnoremap K :Evaluate if has('menu') && &mouse != '' - nnoremenu WinBar.Step :Step - nnoremenu WinBar.Next :Over + call s:InstallWinbar() + + if !exists('g:termdebug_popup') || g:termdebug_popup != 0 + let s:saved_mousemodel = &mousemodel + let &mousemodel = 'popup_setpos' + an 1.200 PopUp.-SEP3- + an 1.210 PopUp.Set\ breakpoint :Break + an 1.220 PopUp.Clear\ breakpoint :Clear + an 1.230 PopUp.Evaluate :Evaluate + endif + endif +endfunc + +let s:winbar_winids = [] + +" Install the window toolbar in the current window. +func s:InstallWinbar() + if has('menu') && &mouse != '' + nnoremenu WinBar.Step :Step + nnoremenu WinBar.Next :Over nnoremenu WinBar.Finish :Finish - nnoremenu WinBar.Cont :Continue - nnoremenu WinBar.Stop :Stop - nnoremenu WinBar.Eval :Evaluate + nnoremenu WinBar.Cont :Continue + nnoremenu WinBar.Stop :Stop + nnoremenu WinBar.Eval :Evaluate + call add(s:winbar_winids, win_getid(winnr())) endif endfunc " Delete installed debugger commands in the current window. func s:DeleteCommands() delcommand Break - delcommand Delete + delcommand Clear delcommand Step delcommand Over delcommand Finish @@ -240,16 +328,35 @@ delcommand Evaluate delcommand Gdb delcommand Program + delcommand Source + delcommand Winbar nunmap K if has('menu') - aunmenu WinBar.Step - aunmenu WinBar.Next - aunmenu WinBar.Finish - aunmenu WinBar.Cont - aunmenu WinBar.Stop - aunmenu WinBar.Eval + " Remove the WinBar entries from all windows where it was added. + let curwinid = win_getid(winnr()) + for winid in s:winbar_winids + if win_gotoid(winid) + aunmenu WinBar.Step + aunmenu WinBar.Next + aunmenu WinBar.Finish + aunmenu WinBar.Cont + aunmenu WinBar.Stop + aunmenu WinBar.Eval + endif + endfor + call win_gotoid(curwinid) + let s:winbar_winids = [] + + if exists('s:saved_mousemodel') + let &mousemodel = s:saved_mousemodel + unlet s:saved_mousemodel + aunmenu PopUp.-SEP3- + aunmenu PopUp.Set\ breakpoint + aunmenu PopUp.Clear\ breakpoint + aunmenu PopUp.Evaluate + endif endif exe 'sign unplace ' . s:pc_id @@ -278,8 +385,8 @@ endif endfunc -" :Delete - Delete a breakpoint at the cursor position. -func s:DeleteBreakpoint() +" :Clear - Delete a breakpoint at the cursor position. +func s:ClearBreakpoint() let fname = fnameescape(expand('%:p')) let lnum = line('.') for [key, val] in items(s:breakpoints) @@ -325,9 +432,11 @@ else let expr = expand('') endif + let s:ignoreEvalError = 0 call s:SendEval(expr) endfunc +let s:ignoreEvalError = 0 let s:evalFromBalloonExpr = 0 " Handle the result of data-evaluate-expression @@ -347,6 +456,7 @@ if s:evalexpr[0] != '*' && value =~ '^0x' && value != '0x0' && value !~ '"$' " Looks like a pointer, also display what it points to. + let s:ignoreEvalError = 1 call s:SendEval('*' . s:evalexpr) else let s:evalFromBalloonExpr = 0 @@ -359,24 +469,32 @@ if v:beval_winid != s:startwin return endif - call s:SendEval(v:beval_text) let s:evalFromBalloonExpr = 1 let s:evalFromBalloonExprResult = '' + let s:ignoreEvalError = 1 + call s:SendEval(v:beval_text) return '' endfunc " Handle an error. func s:HandleError(msg) - if a:msg =~ 'No symbol .* in current context' - \ || a:msg =~ 'Cannot access memory at address ' - \ || a:msg =~ 'Attempt to use a type name as an expression' - \ || a:msg =~ 'A syntax error in expression,' + if s:ignoreEvalError " Result of s:SendEval() failed, ignore. + let s:ignoreEvalError = 0 + let s:evalFromBalloonExpr = 0 return endif echoerr substitute(a:msg, '.*msg="\(.*\)"', '\1', '') endfunc +func s:GotoStartwinOrCreateIt() + if !win_gotoid(s:startwin) + new + let s:startwin = win_getid(winnr()) + call s:InstallWinbar() + endif +endfunc + " Handle stopping and running message from gdb. " Will update the sign that shows the current position. func s:HandleCursor(msg) @@ -388,31 +506,32 @@ let s:stopped = 0 endif - if win_gotoid(s:startwin) - let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '') - if a:msg =~ '^\(\*stopped\|=thread-selected\)' && filereadable(fname) - let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '') - if lnum =~ '^[0-9]*$' - if expand('%:p') != fnamemodify(fname, ':p') - if &modified - " TODO: find existing window - exe 'split ' . fnameescape(fname) - let s:startwin = win_getid(winnr()) - else - exe 'edit ' . fnameescape(fname) - endif + call s:GotoStartwinOrCreateIt() + + let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '') + if a:msg =~ '^\(\*stopped\|=thread-selected\)' && filereadable(fname) + let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '') + if lnum =~ '^[0-9]*$' + if expand('%:p') != fnamemodify(fname, ':p') + if &modified + " TODO: find existing window + exe 'split ' . fnameescape(fname) + let s:startwin = win_getid(winnr()) + call s:InstallWinbar() + else + exe 'edit ' . fnameescape(fname) endif - exe lnum - exe 'sign unplace ' . s:pc_id - exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fname - setlocal signcolumn=yes endif - else + exe lnum exe 'sign unplace ' . s:pc_id + exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fname + setlocal signcolumn=yes endif - - call win_gotoid(wid) + else + exe 'sign unplace ' . s:pc_id endif + + call win_gotoid(wid) endfunc " Handle setting a breakpoint diff -Nru vim-8.0.1453/runtime/plugin/manpager.vim vim-8.0.1766/runtime/plugin/manpager.vim --- vim-8.0.1453/runtime/plugin/manpager.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/plugin/manpager.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,29 +1,30 @@ " Vim plugin for using Vim as manpager. " Maintainer: Enno Nagel -" Last Change: 2017 November 07 +" Last Change: 2018 Feb 04 -" $MAN_PN is supposed to be set by MANPAGER, see ":help manpager.vim". -if empty($MAN_PN) - finish -endif - -command! -nargs=0 MANPAGER call s:MANPAGER() | delcommand MANPAGER - -function! s:MANPAGER() - let page_pattern = '\v\w[-_.:0-9A-Za-z]*' - let sec_pattern = '\v\w+%(\+\w+)*' - let pagesec_pattern = '\v(' . page_pattern . ')\((' . sec_pattern . ')\)' - - if $MAN_PN is '1' - let manpage = tolower(matchstr( getline(nextnonblank(1)), '^' . pagesec_pattern )) - else - let manpage = expand($MAN_PN) - endif +command! -nargs=0 MANPAGER call s:ManPager() | delcommand MANPAGER - let page_sec = matchlist(manpage, '^' . pagesec_pattern . '$') +function! s:ManPager() + set nocompatible + if exists('+viminfofile') + set viminfofile=NONE + endif + set noswapfile - bwipe! + setlocal ft=man + runtime ftplugin/man.vim + setlocal buftype=nofile bufhidden=hide iskeyword+=: modifiable + + " Emulate 'col -b' + silent keepj keepp %s/\v(.)\b\ze\1?//ge + + " Remove empty lines above the header + call cursor(1, 1) + let n = search(".*(.*)", "c") + if n > 1 + exe "1," . n-1 . "d" + endif + setlocal nomodified readonly - setlocal filetype=man - exe 'Man' page_sec[2] page_sec[1] + syntax on endfunction diff -Nru vim-8.0.1453/runtime/scripts.vim vim-8.0.1766/runtime/scripts.vim --- vim-8.0.1453/runtime/scripts.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/scripts.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,7 +1,7 @@ " Vim support file to detect file types in scripts " " Maintainer: Bram Moolenaar -" Last change: 2017 Nov 11 +" Last change: 2018 Feb 03 " This file is called by an autocommand for every file that has just been " loaded into a buffer. It checks if the type of file can be recognized by @@ -133,7 +133,7 @@ set ft=ruby " JavaScript - elseif s:name =~# 'node\(js\)\=\>' || s:name =~# 'rhino\>' + elseif s:name =~# 'node\(js\)\=\>\|js\>' || s:name =~# 'rhino\>' set ft=javascript " BC calculator @@ -176,6 +176,10 @@ elseif s:name =~# 'scala\>' set ft=scala + " Clojure + elseif s:name =~# 'clojure' + set ft=clojure + endif unlet s:name diff -Nru vim-8.0.1453/runtime/spell/sr/main.aap vim-8.0.1766/runtime/spell/sr/main.aap --- vim-8.0.1453/runtime/spell/sr/main.aap 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/runtime/spell/sr/main.aap 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,142 @@ +# Aap recipe for Serbian Vim spell files. + +# Use a freshly compiled Vim if it exists. +@if os.path.exists('../../../src/vim'): + VIM = ../../../src/vim +@else: + :progsearch VIM vim + +SPELLDIR = .. +FILES = sr_RS.aff sr_RS.dic + 'sr_RS@latin.aff' 'sr_RS@latin.dic' + +all: $SPELLDIR/sr.utf-8.spl $SPELLDIR/'sr@latin.utf-8.spl' ../README_sr.txt + +# Original files will be in the subfolder hunspell-sr after unpacking: +# sr.dic original cyrillic dictionary +# sr.aff original cyrillic affix file +# sr-Latn.dic original latin dictionary file +# sr-Latn.aff original latin affix file +# Just before using the dictionary files, the right ones are copied to +# sr_RS.aff +# sr_RS.dic +# and +# sr_RS@latin.aff +# sr_RS@latin.dic + +$SPELLDIR/sr.utf-8.spl : $FILES + :sys env LANG=sr_RS.UTF-8 + $VIM -u NONE -e -c "set enc=utf-8" -c "mkspell! $SPELLDIR/sr sr_RS" -c q + +$SPELLDIR/"sr@latin.utf-8.spl" : $FILES + :sys env LANG=sr_RS@latin.UTF-8 + $VIM -u NONE -e -c "set enc=utf-8" -c "mkspell! $SPELLDIR/sr@latin sr_RS@latin" -c q + +../README_sr.txt : hunspell-sr/README_sr.txt README_sr_RS.txt + :cat README_sr_RS.txt >!$target + :print >>$target + :print ============================================================== >>$target + :print Следи оригинална README датотека: >>$target + :print >>$target + :cat hunspell-sr/README_sr.txt >>$target + +# +# Used to fetch the files. +# +ZIPFILE = http://devbase.net/dict-sr/hunspell-sr-20130715.zip + +:attr {fetch = $ZIPFILE} sr_RS.zip + +# The files don't depend on the .zip file so that we can delete it. +# Only download the zip file if the targets don't exist. +sr_RS.aff sr_RS.dic: {buildcheck=} + :assertpkg unzip patch + :fetch sr_RS.zip + :sys $UNZIP sr_RS.zip + :delete sr_RS.zip + @if not os.path.exists('sr_RS.orig.aff'): + :copy hunspell-sr/sr.aff sr_RS.orig.aff + @if not os.path.exists('sr_RS.orig.dic'): + :copy hunspell-sr/sr.dic sr_RS.orig.dic + @if os.path.exists('sr_RS.diff'): + :sys patch sr_RS.diff + :sys {force} diff -a -C 1 sr_RS.orig.dic sr_RS.dic >>sr_RS.diff + :sys {force} diff -a -C 1 'sr_RS@latin.orig.aff' 'sr_RS@latin.aff' >'sr_RS@latin.diff' + :sys {force} diff -a -C 1 'sr_RS@latin.orig.dic' 'sr_RS@latin.dic' >>'sr_RS@latin.diff' + +# Delete all the unpacked and generated files, including the "orig" files. +clean: + :delete {force} sr_RS.zip sr_RS.dic + sr_RS.orig.aff sr_RS.orig.dic + sr_RS.aff + 'sr_RS@latin.dic' 'sr_RS@latin.aff' + 'sr_RS@latin.orig.aff' 'sr_RS@latin.orig.dic' + :sys rm -f -r hunspell-sr/ + +# Check for updated OpenOffice spell files. When there are changes the +# ".new.aff" and ".new.dic" files are left behind for manual inspection. +# +#check: +# :assertpkg unzip diff +# :fetch fr_FR.zip +# :mkdir tmp +# :cd tmp +# @try: +# @import stat +# :sys $UNZIP ../fr_FR.zip +# :sys {force} diff ../fr_FR.orig.aff fr_FR.aff >d +# @if os.stat('d')[stat.ST_SIZE] > 0: +# :copy fr_FR.aff ../fr_FR.new.aff +# :sys {force} diff ../fr_FR.orig.dic fr_FR.dic >d +# @if os.stat('d')[stat.ST_SIZE] > 0: +# :copy fr_FR.dic ../fr_FR.new.dic +# @finally: +# :cd .. +# :delete {r}{f}{q} tmp +# :delete fr_FR.zip + + +vim: set sts=4 sw=4 : diff -Nru vim-8.0.1453/runtime/spell/sr/sr_RS.diff vim-8.0.1766/runtime/spell/sr/sr_RS.diff --- vim-8.0.1453/runtime/spell/sr/sr_RS.diff 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/runtime/spell/sr/sr_RS.diff 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,68 @@ +*** sr_RS.orig.aff Fri Feb 23 20:04:41 2018 +--- sr_RS.aff Fri Feb 23 18:18:48 2018 +*************** +*** 1,10 **** +! SET UTF-8 + +! LANG sr +! TRY аиоенртÑвумклпјдгзбшчцхћњљжфђџÐИОЕÐРТСВУМКЛПЈДГЗБШЧЦХЋЊЉЖФЂР+! KEY љњертжуиопшђж|аÑдфгхјклчћ|зџцвбнм|жшђ|ћшч|жчђ|ђћж|зж|љањÑедрфтгжхуј|јиколпч|азÑџдцфвгбх|хнјмк +! +! MAP 4 +! MAP цћ +! MAP цч + MAP зж +--- 1,5 ---- +! SET utf-8 + +! MAP 3 +! MAP цћч + MAP зж +*************** +*** 12,14 **** + +! REP 8 + REP дј Ñ’ +--- 7,11 ---- + +! MIDWORD -’ +! +! REP 4 + REP дј Ñ’ +*************** +*** 17,28 **** + REP дж ÑŸ +- REP ц Ñ # Ðко хоћу да откуцам Ñлово „С“ могу Ñе залетети за ознаком на таÑтатури и упиÑати „Ц“ (C) +- REP п Ñ€ # Ðко хоћу да откуцам Ñлово „В“ могу Ñе залетети за ознаком и упиÑати „Б“ (B) +- REP ÑŸ Ñ… # Ðко хоћу да откуцам Ñлово „Р“ могу Ñе залетети за ознаком и упиÑати „П“ (P) +- REP Ñ… н # Ðко хоћу да откуцам Ñлово „Х“ могу Ñе залетети за ознаком и упиÑати „Ð“ (X) +- # Ðко хоћу да откуцам Ñлово „В“ могу Ñе залетети за ознаком и упиÑати „Б“ (B) (покривено KEY паром „в - б“) +- +- ICONV 3 +- ICONV Òµ тц +- ICONV Ò¥ нг +- ICONV Ó• ае + +--- 14,15 ---- +*** sr_RS.orig.dic Fri Feb 23 20:04:42 2018 +--- sr_RS.dic Fri Feb 23 20:04:46 2018 +*************** +*** 1,2 **** +! 263909 + а +--- 1,2 ---- +! 263906 + а +*************** +*** 882,884 **** + ажурираних +- ажуриранје + ажурирано +--- 882,883 ---- +*************** +*** 22177,22180 **** + вишку +- вишнја +- вишнјевац + Вишну +--- 22176,22177 ---- diff -Nru vim-8.0.1453/runtime/spell/sr/sr_RS@latin.diff vim-8.0.1766/runtime/spell/sr/sr_RS@latin.diff --- vim-8.0.1453/runtime/spell/sr/sr_RS@latin.diff 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/runtime/spell/sr/sr_RS@latin.diff 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,66 @@ +*** sr_RS@latin.orig.aff Fri Feb 23 20:08:28 2018 +--- sr_RS@latin.aff Fri Feb 23 18:18:48 2018 +*************** +*** 1,10 **** +! SET UTF-8 + +! LANG sr-Latn +! TRY aioenrtsvumklpjdgzbÅ¡ÄchćnjljžfÄ‘džAIOENRTSVUMKLPJDGZBÅ ÄŒCHĆNJLJŽFÄDŽ +! KEY qwertyuiopšđž|asdfghjklÄć|zxcvbnm|žšđ|ćšÄ|žÄÄ‘|đćž|zy|qawsedrftgyhuj|jikolpÄ|azsxdcfvgbh|hnjmk +! +! MAP 4 +! MAP cć +! MAP cÄ + MAP zž +--- 1,5 ---- +! SET utf-8 + +! MAP 3 +! MAP cÄ‡Ä + MAP zž +*************** +*** 12,20 **** + +! REP 1 +! REP dj Ä‘ + +! ICONV ï¬ fi +! ICONV fl fl +! ICONV st st +! ICONV ij ij +! ICONV Å“ oe +--- 7,14 ---- + +! MIDWORD -’ + +! REP 4 +! REP dj Ä‘ +! REP fl fl +! REP ff ff +! REP ï¬ fi +*** sr_RS@latin.orig.dic Fri Feb 23 20:08:28 2018 +--- sr_RS@latin.dic Fri Feb 23 20:08:53 2018 +*************** +*** 1,2 **** +! 263909 + a +--- 1,2 ---- +! 263906 + a +*************** +*** 882,884 **** + ažuriranih +- ažuriranje + ažurirano +--- 882,883 ---- +*************** +*** 22177,22184 **** + viÅ¡ku +- viÅ¡nja +- viÅ¡njevac + ViÅ¡nu + viÅ¡nja + viÅ¡njama + viÅ¡njare + viÅ¡nje +--- 22176,22181 ---- diff -Nru vim-8.0.1453/runtime/syntax/chicken.vim vim-8.0.1766/runtime/syntax/chicken.vim --- vim-8.0.1453/runtime/syntax/chicken.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/chicken.vim 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,77 @@ +" Vim syntax file +" Language: Scheme (CHICKEN) +" Last Change: 2018-02-05 +" Author: Evan Hanson +" Maintainer: Evan Hanson +" URL: https://foldling.org/vim/syntax/chicken.vim +" Notes: This is supplemental syntax, to be loaded after the core Scheme +" syntax file (syntax/scheme.vim). Enable it by setting b:is_chicken=1 +" and filetype=scheme. + +" Only to be used on top of the Scheme syntax. +if !exists('b:did_scheme_syntax') + finish +endif + +" Lighten parentheses. +hi! def link schemeParentheses Comment + +" foo#bar +syn match schemeExtraSyntax /[^ #'`\t\n()\[\]"|;]\+#[^ '`\t\n()\[\]"|;]\+/ + +" ##foo#bar +syn match schemeExtraSyntax /##[^ '`\t\n()\[\]"|;]\+/ + +" Heredocs. +syn region schemeString start=/#<[<#]\s*\z(.*\)/ end=/^\z1$/ + +" Keywords. +syn match schemeKeyword /#[!:][a-zA-Z0-9!$%&*+-./:<=>?@^_~#]\+/ +syn match schemeKeyword /[a-zA-Z0-9!$%&*+-./:<=>?@^_~#]\+:\>/ + +" C/C++ syntax. +let s:c = globpath(&rtp, 'syntax/cpp.vim', 0, 1) +if len(s:c) + exe 'syn include @c ' s:c[0] + syn region c matchgroup=schemeComment start=/#>/ end=/<#/ contains=@c +endif + +syn keyword schemeSyntax define-record + +syn keyword schemeLibrarySyntax declare +syn keyword schemeLibrarySyntax module +syn keyword schemeLibrarySyntax reexport +syn keyword schemeLibrarySyntax require-library + +syn keyword schemeTypeSyntax --> +syn keyword schemeTypeSyntax -> +syn keyword schemeTypeSyntax : +syn keyword schemeTypeSyntax assume +syn keyword schemeTypeSyntax compiler-typecase +syn keyword schemeTypeSyntax define-specialization +syn keyword schemeTypeSyntax define-type +syn keyword schemeTypeSyntax the + +syn keyword schemeExtraSyntax and-let* +syn keyword schemeExtraSyntax match +syn keyword schemeExtraSyntax match-lambda +syn keyword schemeExtraSyntax match-lambda* + +syn keyword schemeSpecialSyntax define-compiler-syntax +syn keyword schemeSpecialSyntax define-constant +syn keyword schemeSpecialSyntax define-external +syn keyword schemeSpecialSyntax define-inline +syn keyword schemeSpecialSyntax foreign-code +syn keyword schemeSpecialSyntax foreign-declare +syn keyword schemeSpecialSyntax foreign-lambda +syn keyword schemeSpecialSyntax foreign-lambda* +syn keyword schemeSpecialSyntax foreign-primitive +syn keyword schemeSpecialSyntax foreign-safe-lambda +syn keyword schemeSpecialSyntax foreign-safe-lambda* +syn keyword schemeSpecialSyntax foreign-value + +syn keyword schemeSyntaxSyntax begin-for-syntax +syn keyword schemeSyntaxSyntax define-for-syntax +syn keyword schemeSyntaxSyntax er-macro-transformer +syn keyword schemeSyntaxSyntax ir-macro-transformer +syn keyword schemeSyntaxSyntax require-library-for-syntax diff -Nru vim-8.0.1453/runtime/syntax/config.vim vim-8.0.1766/runtime/syntax/config.vim --- vim-8.0.1453/runtime/syntax/config.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/config.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,9 +1,10 @@ " Vim syntax file " Language: configure.in script: M4 with sh -" Maintainer: Christian Hammesr -" Last Change: 2015 Jan 14 +" Former Maintainer: Christian Hammesr +" Last Change: 2018 Feb 03 " (patch from Yngve Inntjore Levinsen to detect AC_MSG) " (patch from Khym Chanur to add @Spell) +" (patch from James McCoy to fix paren matching) " Well, I actually even do not know much about m4. This explains why there " is probably very much missing here, yet ! @@ -30,8 +31,8 @@ syn region configstring start=+\z(["'`]\)+ skip=+\\\z1+ end=+\z1+ contains=@Spell " Anything inside AC_MSG_TYPE([...]) and AC_MSG_TYPE(...) is a string. -syn region configstring matchgroup=configfunction start="AC_MSG_[A-Z]*\ze(\[" matchgroup=configdelimiter end="\])" contains=configdelimiter,@Spell -syn region configstring matchgroup=configfunction start="AC_MSG_[A-Z]*\ze([^[]" matchgroup=configdelimiter end=")" contains=configdelimiter,@Spell +syn region configmsg matchgroup=configfunction start="AC_MSG_[A-Z]*\ze(\[" matchgroup=configdelimiter end="\])" contains=configdelimiter,@Spell +syn region configmsg matchgroup=configfunction start="AC_MSG_[A-Z]*\ze([^[]" matchgroup=configdelimiter end=")" contains=configdelimiter,@Spell " Define the default highlighting. " Only when an item doesn't have highlighting yet @@ -45,6 +46,7 @@ hi def link configkeyword Keyword hi def link configspecial Special hi def link configstring String +hi def link configmsg String let b:current_syntax = "config" diff -Nru vim-8.0.1453/runtime/syntax/css.vim vim-8.0.1766/runtime/syntax/css.vim --- vim-8.0.1453/runtime/syntax/css.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/css.vim 2018-04-26 20:30:33.000000000 +0000 @@ -4,10 +4,10 @@ " Claudio Fleiner (Maintainer) " Yeti (Add full CSS2, HTML4 support) " Nikolai Weibull (Add CSS2 support) -" Maintainer: Jules Wang " URL: https://github.com/JulesWang/css.vim -" Last Change: 2017 Jan 14 -" cssClassName updated by Ryuichi Hayashida Jan 2016 +" Maintainer: Jules Wang +" Last Change: 2018 Feb. 27 +" cssClassName updated by Ryuichi Hayashida Jan 2016 " quit when a syntax file was already loaded if !exists("main_syntax") @@ -69,74 +69,12 @@ " digits syn match cssValueInteger contained "[-+]\=\d\+" contains=cssUnitDecorators syn match cssValueNumber contained "[-+]\=\d\+\(\.\d*\)\=" contains=cssUnitDecorators -syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=\(%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\|dpi\|dppx\|dpcm\)\>" contains=cssUnitDecorators +syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=\(mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\|dpi\|dppx\|dpcm\)\>" contains=cssUnitDecorators +syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=%" contains=cssUnitDecorators syn match cssValueAngle contained "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\)\>" contains=cssUnitDecorators syn match cssValueTime contained "+\=\d\+\(\.\d*\)\=\(ms\|s\)\>" contains=cssUnitDecorators syn match cssValueFrequency contained "+\=\d\+\(\.\d*\)\=\(Hz\|kHz\)\>" contains=cssUnitDecorators - -syn match cssIncludeKeyword /@\(-[a-z]\+-\)\=\(media\|keyframes\|import\|charset\|namespace\|page\)/ contained -" @media -syn region cssInclude start=/@media\>/ end=/\ze{/ skipwhite skipnl contains=cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType,cssIncludeKeyword,cssMediaComma,cssComment nextgroup=cssMediaBlock -syn keyword cssMediaType contained screen print aural braille embossed handheld projection tty tv speech all contained skipwhite skipnl -syn keyword cssMediaKeyword only not and contained -syn region cssMediaBlock transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssTagName,cssClassName,cssIdentifier,cssPseudoClass,cssSelectorOp,cssSelectorOp2,cssAttributeSelector fold -syn match cssMediaComma "," skipwhite skipnl contained - -" Reference: http://www.w3.org/TR/css3-mediaqueries/ -syn keyword cssMediaProp contained width height orientation scan grid -syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(\(device\)-\)\=aspect-ratio/ -syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-pixel-ratio/ -syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-\(height\|width\)/ -syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(height\|width\|resolution\|monochrome\|color\(-index\)\=\)/ -syn keyword cssMediaAttr contained portrait landscape progressive interlace - -" @page -" http://www.w3.org/TR/css3-page/ -syn match cssPage "@page\>[^{]*{\@=" contains=cssPagePseudo,cssIncludeKeyword nextgroup=cssPageWrap transparent skipwhite skipnl -syn match cssPagePseudo /:\(left\|right\|first\|blank\)/ contained skipwhite skipnl -syn region cssPageWrap contained transparent matchgroup=cssBraces start="{" end="}" contains=cssPageMargin,cssPageProp,cssAttrRegion,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks -syn match cssPageMargin /@\(\(top\|left\|right\|bottom\)-\(left\|center\|right\|middle\|bottom\)\)\(-corner\)\=/ contained nextgroup=cssDefinition skipwhite skipnl -syn keyword cssPageProp contained content size -" http://www.w3.org/TR/CSS2/page.html#break-inside -syn keyword cssPageProp contained orphans widows - -" @keyframe -" http://www.w3.org/TR/css3-animations/#keyframes -syn match cssKeyFrame "@\(-[a-z]\+-\)\=keyframes\>[^{]*{\@=" nextgroup=cssKeyFrameWrap contains=cssVendor,cssIncludeKeyword skipwhite skipnl transparent -syn region cssKeyFrameWrap contained transparent matchgroup=cssBraces start="{" end="}" contains=cssKeyFrameSelector -syn match cssKeyFrameSelector /\(\d*%\|from\|to\)\=/ contained skipwhite skipnl nextgroup=cssDefinition - -" @import -syn region cssInclude start=/@import\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword,cssURL,cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType -syn region cssInclude start=/@charset\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword -syn region cssInclude start=/@namespace\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword - -" @font-face -" http://www.w3.org/TR/css3-fonts/#at-font-face-rule -syn match cssFontDescriptor "@font-face\>" nextgroup=cssFontDescriptorBlock skipwhite skipnl -syn region cssFontDescriptorBlock contained transparent matchgroup=cssBraces start="{" end="}" contains=cssComment,cssError,cssUnicodeEscape,cssCommonAttr,cssFontDescriptorProp,cssValue.*,cssFontDescriptorFunction,cssFontDescriptorAttr,cssNoise - -syn match cssFontDescriptorProp contained "\" -syn keyword cssFontDescriptorProp contained src -syn match cssFontDescriptorProp contained "\" -syn match cssFontDescriptorProp contained "\" -syn match cssFontDescriptorProp contained "\" - -" src functions -syn region cssFontDescriptorFunction contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline keepend -" font-sytle and font-weight attributes -syn keyword cssFontDescriptorAttr contained normal italic oblique bold -" font-stretch attributes -syn match cssFontDescriptorAttr contained "\<\(\(ultra\|extra\|semi\)-\)\=\(condensed\|expanded\)\>" -" unicode-range attributes -syn match cssFontDescriptorAttr contained "U+[0-9A-Fa-f?]\+" -syn match cssFontDescriptorAttr contained "U+\x\+-\x\+" -" font-feature-settings attributes -syn keyword cssFontDescriptorAttr contained on off - - - " The 16 basic color names syn keyword cssColor contained aqua black blue fuchsia gray green lime maroon navy olive purple red silver teal yellow @@ -162,8 +100,8 @@ syn keyword cssColor contained oldlace olivedrab orange orangered orchid syn match cssColor contained /\/ syn keyword cssColor contained papayawhip peachpuff peru pink plum powderblue -syn keyword cssColor contained rosybrown royalblue saddlebrown salmon sandybrown -syn keyword cssColor contained seagreen seashell sienna skyblue slateblue +syn keyword cssColor contained rosybrown royalblue rebeccapurple saddlebrown salmon +syn keyword cssColor contained sandybrown seagreen seashell sienna skyblue slateblue syn keyword cssColor contained slategray slategrey snow springgreen steelblue tan syn keyword cssColor contained thistle tomato turquoise violet wheat syn keyword cssColor contained whitesmoke yellowgreen @@ -180,10 +118,11 @@ syn match cssColor contained "\" syn match cssColor contained "\" syn match cssColor contained "\" -syn match cssColor contained "#[0-9A-Fa-f]\{3\}\>" contains=cssUnitDecorators -syn match cssColor contained "#[0-9A-Fa-f]\{6\}\>" contains=cssUnitDecorators +syn match cssColor contained "#\x\{3,4\}\>" contains=cssUnitDecorators +syn match cssColor contained "#\x\{6\}\>" contains=cssUnitDecorators +syn match cssColor contained "#\x\{8\}\>" contains=cssUnitDecorators -syn region cssURL contained matchgroup=cssFunctionName start="\" syn match cssBackgroundAttr contained "\" -syn keyword cssBackgroundAttr contained space round " background-size attributes syn keyword cssBackgroundAttr contained cover contain @@ -236,7 +174,7 @@ syn match cssBorderProp contained "\" " border-image attributes -syn keyword cssBorderAttr contained stretch round space fill +syn keyword cssBorderAttr contained stretch round fill " border-style attributes syn keyword cssBorderAttr contained dotted dashed solid double groove ridge inset outset @@ -264,14 +202,18 @@ syn keyword cssDimensionProp contained height syn keyword cssDimensionProp contained width -" shadow and sizing are in other property groups -syn match cssFlexibleBoxProp contained "\" -syn keyword cssFlexibleBoxAttr contained start end baseline -syn keyword cssFlexibleBoxAttr contained reverse -syn keyword cssFlexibleBoxAttr contained single multiple -syn keyword cssFlexibleBoxAttr contained horizontal -syn match cssFlexibleBoxAttr contained "\" "escape vertical-align -syn match cssFlexibleBoxAttr contained "\<\(inline\|block\)-axis\>" +" CSS Flexible Box Layout Module Level 1 +" http://www.w3.org/TR/css3-flexbox/ +" CSS Box Alignment Module Level 3 +" http://www.w3.org/TR/css-align-3/ +syn match cssFlexibleBoxProp contained "\" +syn match cssFlexibleBoxProp contained "\<\(align\|justify\)\(-\(items\|self\|content\)\)\=\>" +syn keyword cssFlexibleBoxProp contained order + +syn match cssFlexibleBoxAttr contained "\<\(row\|column\|wrap\)\(-reverse\)\=\>" +syn keyword cssFlexibleBoxAttr contained nowrap stretch baseline center +syn match cssFlexibleBoxAttr contained "\" +syn match cssFlexibleBoxAttr contained "\" " CSS Fonts Module Level 3 " http://www.w3.org/TR/css-fonts-3/ @@ -279,11 +221,11 @@ " font attributes syn keyword cssFontAttr contained icon menu caption -syn match cssFontAttr contained "\" syn match cssFontAttr contained "\" syn match cssFontAttr contained "\" syn keyword cssFontAttr contained larger smaller syn match cssFontAttr contained "\<\(x\{1,2\}-\)\=\(large\|small\)\>" +syn match cssFontAttr contained "\" " font-family attributes syn match cssFontAttr contained "\<\(sans-\)\=serif\>" syn keyword cssFontAttr contained Antiqua Arial Black Book Charcoal Comic Courier Dingbats Gadget Geneva Georgia Grande Helvetica Impact Linotype Lucida MS Monaco Neue New Palatino Roboto Roman Symbol Tahoma Times Trebuchet Verdana Webdings Wingdings York Zapf @@ -312,12 +254,16 @@ syn match cssMultiColumnProp contained "\" syn keyword cssMultiColumnProp contained columns syn keyword cssMultiColumnAttr contained balance medium -syn keyword cssMultiColumnAttr contained always avoid left right page column -syn match cssMultiColumnAttr contained "\" +syn keyword cssMultiColumnAttr contained always left right page column +syn match cssMultiColumnAttr contained "\" " http://www.w3.org/TR/css3-break/#page-break syn match cssMultiColumnProp contained "\" +" http://www.w3.org/TR/SVG11/interact.html +syn match cssInteractProp contained "\" +syn match cssInteractAttr contained "\<\(visible\)\=\(Painted\|Fill\|Stroke\)\=\>" + " TODO find following items in w3c docs. syn keyword cssGeneratedContentProp contained quotes crop syn match cssGeneratedContentProp contained "\" @@ -325,7 +271,12 @@ syn match cssGeneratedContentProp contained "\" syn match cssGeneratedContentAttr contained "\<\(no-\)\=\(open\|close\)-quote\>" -syn match cssGridProp contained "\" +" https://www.w3.org/TR/css-grid-1/ +syn match cssGridProp contained "\" +syn match cssGridProp contained "\" +syn match cssGridProp contained "\" +syn match cssGridProp contained "\" +syn match cssGridProp contained "\" syn match cssHyerlinkProp contained "\" @@ -339,14 +290,14 @@ syn keyword cssPositioningProp contained bottom clear clip display float left syn keyword cssPositioningProp contained position right top visibility syn match cssPositioningProp contained "\" -syn keyword cssPositioningAttr contained block compact +syn keyword cssPositioningAttr contained block compact grid syn match cssPositioningAttr contained "\" syn keyword cssPositioningAttr contained left right both syn match cssPositioningAttr contained "\" -syn match cssPositioningAttr contained "\" -syn keyword cssPositioningAttr contained static relative absolute fixed +syn match cssPositioningAttr contained "\" +syn keyword cssPositioningAttr contained static relative absolute fixed subgrid -syn keyword cssPrintAttr contained landscape portrait crop cross always avoid +syn keyword cssPrintAttr contained landscape portrait crop cross always syn match cssTableProp contained "\<\(caption-side\|table-layout\|border-collapse\|border-spacing\|empty-cells\)\>" syn keyword cssTableAttr contained fixed collapse separate show hide once always @@ -419,17 +370,20 @@ syn match cssUIProp contained "\" syn keyword cssUIAttr contained clip ellipsis -" Already highlighted Props: font content +syn match cssUIProp contained "\" +syn keyword cssUIAttr contained pixellated +syn match cssUIAttr contained "\" + "------------------------------------------------ " Webkit/iOS specific attributes -syn match cssUIAttr contained '\(preserve-3d\)' +syn match cssUIAttr contained '\' " IE specific attributes -syn match cssIEUIAttr contained '\(bicubic\)' +syn match cssIEUIAttr contained '\' " Webkit/iOS specific properties -syn match cssUIProp contained '\(tap-highlight-color\|user-select\|touch-callout\)' +syn match cssUIProp contained '\' " IE specific properties -syn match cssIEUIProp contained '\(interpolation-mode\|zoom\|filter\)' +syn match cssIEUIProp contained '\' " Webkit/Firebox specific properties/attributes syn keyword cssUIProp contained appearance @@ -454,11 +408,25 @@ " mobile text syn match cssMobileTextProp contained "\" - +syn keyword cssMediaProp contained width height orientation scan grid +syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(\(device\)-\)\=aspect-ratio/ +syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-pixel-ratio/ +syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-\(height\|width\)/ +syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(height\|width\|resolution\|monochrome\|color\(-index\)\=\)/ +syn keyword cssMediaAttr contained portrait landscape progressive interlace +syn match cssKeyFrameProp /\d*%\|from\|to/ contained nextgroup=cssDefinition +syn match cssPageMarginProp /@\(\(top\|left\|right\|bottom\)-\(left\|center\|right\|middle\|bottom\)\)\(-corner\)\=/ contained nextgroup=cssDefinition +syn keyword cssPageProp contained content size +syn keyword cssPageProp contained orphans widows +syn keyword cssFontDescriptorProp contained src +syn match cssFontDescriptorProp contained "\" +" unicode-range attributes +syn match cssFontDescriptorAttr contained "U+[0-9A-Fa-f?]\+" +syn match cssFontDescriptorAttr contained "U+\x\+-\x\+" syn match cssBraces contained "[{}]" syn match cssError contained "{@<>" -syn region cssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=cssAttrRegion,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks,cssNoise fold +syn region cssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=cssTagName,cssAttributeSelector,cssClassName,cssIdentifier,cssAtRule,cssAttrRegion,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks,cssNoise fold syn match cssBraceError "}" syn match cssAttrComma "," @@ -477,7 +445,7 @@ syn match cssPseudoClassId contained "\<\(input-\)\=placeholder\>" " Misc highlight groups -syntax match cssUnitDecorators /\(#\|-\|%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|ch\|rem\|vh\|vw\|vmin\|vmax\|dpi\|dppx\|dpcm\|Hz\|kHz\|s\|ms\|deg\|grad\|rad\)/ contained +syntax match cssUnitDecorators /\(#\|-\|+\|%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|ch\|rem\|vh\|vw\|vmin\|vmax\|dpi\|dppx\|dpcm\|Hz\|kHz\|s\|ms\|deg\|grad\|rad\)/ contained syntax match cssNoise contained /\(:\|;\|\/\)/ " Comment @@ -490,7 +458,7 @@ syn region cssStringQ start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=cssUnicodeEscape,cssSpecialCharQ " Vendor Prefix -syn match cssVendor contained "\(-\(webkit\|moz\|o\|ms\)-\)" +syn match cssVendor contained "-\(webkit\|moz\|o\|ms\)-" " Various CSS Hack characters " In earlier versions of IE (6 and 7), one can prefix property names @@ -508,6 +476,34 @@ " 'transition' has Props after ':'. syn region cssAttrRegion start=/transition\s*:/ end=/\ze\(;\|)\|}\)/ contained contains=css.*Prop,css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise +syn match cssAtKeyword /@\(font-face\|media\|keyframes\|import\|charset\|namespace\|page\|supports\)/ contained + +syn keyword cssAtRuleLogical only not and contained + +" @media +" Reference: http://www.w3.org/TR/css3-mediaqueries/ +syn region cssAtRule start=/@media\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssMediaProp,cssValueLength,cssAtRuleLogical,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType,cssComment nextgroup=cssDefinition +syn keyword cssMediaType contained screen print aural braille embossed handheld projection tty tv speech all contained + +" @page +" http://www.w3.org/TR/css3-page/ +syn region cssAtRule start=/@page\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssPagePseudo,cssComment nextgroup=cssDefinition +syn match cssPagePseudo /:\(left\|right\|first\|blank\)/ contained skipwhite skipnl +" @keyframe +" http://www.w3.org/TR/css3-animations/#keyframes +syn region cssAtRule start=/@\(-[a-z]\+-\)\=keyframes\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssVendor,cssComment nextgroup=cssDefinition + +syn region cssAtRule start=/@import\>/ end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword,cssURL,cssMediaProp,cssValueLength,cssAtRuleLogical,cssValueInteger,cssMediaAttr,cssMediaType +syn region cssAtRule start=/@charset\>/ end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword +syn region cssAtRule start=/@namespace\>/ end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword + +" @font-face +" http://www.w3.org/TR/css3-fonts/#at-font-face-rule +syn match cssAtRule "@font-face\>" nextgroup=cssFontDescriptorBlock +" @supports +" https://www.w3.org/TR/css3-conditional/#at-supports +syn region cssAtRule start=/@supports\>/ end=/\ze{/ skipwhite skipnl contains=cssAtRuleLogical,cssAttrRegion,css.*Prop,cssValue.*,cssVendor,cssAtKeyword,cssComment nextgroup=cssDefinition + if main_syntax == "css" syn sync minlines=10 @@ -537,6 +533,7 @@ hi def link cssGeneratedContentProp cssProp hi def link cssGridProp cssProp hi def link cssHyerlinkProp cssProp +hi def link cssInteractProp cssProp hi def link cssLineboxProp cssProp hi def link cssListProp cssProp hi def link cssMarqueeProp cssProp @@ -567,6 +564,7 @@ hi def link cssGeneratedContentAttr cssAttr hi def link cssGridAttr cssAttr hi def link cssHyerlinkAttr cssAttr +hi def link cssInteractAttr cssAttr hi def link cssLineboxAttr cssAttr hi def link cssListAttr cssAttr hi def link cssMarginAttr cssAttr @@ -603,8 +601,8 @@ hi def link cssFunctionComma Function hi def link cssColor Constant hi def link cssIdentifier Function -hi def link cssInclude Include -hi def link cssIncludeKeyword atKeyword +hi def link cssAtRule Include +hi def link cssAtKeyword PreProc hi def link cssImportant Special hi def link cssBraces Function hi def link cssBraceError Error @@ -613,20 +611,16 @@ hi def link cssStringQQ String hi def link cssStringQ String hi def link cssAttributeSelector String -hi def link cssMedia atKeyword hi def link cssMediaType Special hi def link cssMediaComma Normal -hi def link cssMediaKeyword Statement +hi def link cssAtRuleLogical Statement hi def link cssMediaProp cssProp hi def link cssMediaAttr cssAttr -hi def link cssPage atKeyword hi def link cssPagePseudo PreProc -hi def link cssPageMargin atKeyword +hi def link cssPageMarginProp cssAtKeyword hi def link cssPageProp cssProp -hi def link cssKeyFrame atKeyword -hi def link cssKeyFrameSelector Constant +hi def link cssKeyFrameProp Constant hi def link cssFontDescriptor Special -hi def link cssFontDescriptorFunction Constant hi def link cssFontDescriptorProp cssProp hi def link cssFontDescriptorAttr cssAttr hi def link cssUnicodeRange Constant @@ -636,7 +630,6 @@ hi def link cssAttr Constant hi def link cssUnitDecorators Number hi def link cssNoise Noise -hi def link atKeyword PreProc let b:current_syntax = "css" diff -Nru vim-8.0.1453/runtime/syntax/cuda.vim vim-8.0.1766/runtime/syntax/cuda.vim --- vim-8.0.1453/runtime/syntax/cuda.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/cuda.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,15 +1,15 @@ " Vim syntax file " Language: CUDA (NVIDIA Compute Unified Device Architecture) " Maintainer: Timothy B. Terriberry -" Last Change: 2007 Oct 13 +" Last Change: 2018 Feb 06 " quit when a syntax file was already loaded if exists("b:current_syntax") finish endif -" Read the C syntax to start with -runtime! syntax/c.vim +" Read the C++ syntax to start with +runtime! syntax/cpp.vim " CUDA extentions syn keyword cudaStorageClass __device__ __global__ __host__ diff -Nru vim-8.0.1453/runtime/syntax/debchangelog.vim vim-8.0.1766/runtime/syntax/debchangelog.vim --- vim-8.0.1453/runtime/syntax/debchangelog.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/debchangelog.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,10 +1,10 @@ " Vim syntax file " Language: Debian changelog files -" Maintainer: Debian Vim Maintainers +" Maintainer: Debian Vim Maintainers " Former Maintainers: Gerfried Fuchs " Wichert Akkerman -" Last Change: 2017 Apr 23 -" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debchangelog.vim +" Last Change: 2018 Jan 06 +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debchangelog.vim " Standard syntax initialization if exists("b:current_syntax") @@ -21,7 +21,7 @@ syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ " exe 'syn match debchangelogFirstKV contained "; \('.s:urgency.'\|'.s:binNMU.'\)"' exe 'syn match debchangelogOtherKV contained ", \('.s:urgency.'\|'.s:binNMU.'\)"' -syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|%(wheezy|jessie)%(-backports%(-sloppy)=|-security)=|stretch%(-backports|-security)=|%(devel|precise|trusty|vivid|wily|xenial|yakkety|zesty|artful)%(-%(security|proposed|updates|backports|commercial|partner))=)+" +syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|%(wheezy|jessie)%(-backports%(-sloppy)=|-security)=|stretch%(-backports|-security)=|%(devel|precise|trusty|vivid|wily|xenial|yakkety|zesty|artful|bionic)%(-%(security|proposed|updates|backports|commercial|partner))=)+" syn match debchangelogVersion contained "(.\{-})" syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*" syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s*#\d\+\)*" diff -Nru vim-8.0.1453/runtime/syntax/debcontrol.vim vim-8.0.1766/runtime/syntax/debcontrol.vim --- vim-8.0.1453/runtime/syntax/debcontrol.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/debcontrol.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,10 +1,10 @@ " Vim syntax file " Language: Debian control files -" Maintainer: Debian Vim Maintainers +" Maintainer: Debian Vim Maintainers " Former Maintainers: Gerfried Fuchs " Wichert Akkerman -" Last Change: 2017 Nov 04 -" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debcontrol.vim +" Last Change: 2018 Jan 06 +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debcontrol.vim " Standard syntax initialization if exists("b:current_syntax") @@ -52,7 +52,7 @@ \, 'devel', 'doc', 'editors', 'education', 'electronics', 'embedded' \, 'fonts', 'games', 'gnome', 'gnustep', 'gnu-r', 'golang', 'graphics' \, 'hamradio', 'haskell', 'httpd', 'interpreters', 'introspection' - \, 'java', 'javascript', 'kde', 'kernel', 'libs', 'libdevel', 'lisp' + \, 'java\%(script\)\=', 'kde', 'kernel', 'libs', 'libdevel', 'lisp' \, 'localization', 'mail', 'math', 'metapackages', 'misc', 'net' \, 'news', 'ocaml', 'oldlibs', 'otherosfs', 'perl', 'php', 'python' \, 'ruby', 'rust', 'science', 'shells', 'sound', 'text', 'tex' @@ -87,44 +87,29 @@ syn case ignore -" List of all legal keys, in order, from deb-src-control(5) -" Source fields -syn match debcontrolKey contained "^\%(Source\|Maintainer\|Uploaders\|Standards-Version\|Description\|Homepage\|Bugs\|Rules-Requires-Root\): *" -syn match debcontrolKey contained "^\%(XS-\)\=Vcs-\%(Arch\|Bzr\|Cvs\|Darcs\|Git\|Hg\|Mtn\|Svn\|Browser\): *" -syn match debcontrolKey contained "^\%(Origin\|Section\|Priority\): *" -syn match debcontrolKey contained "^Build-\%(Depends\|Conflicts\)\%(-Arch\|-Indep\)\=: *" - -" Binary fields -syn match debcontrolKey contained "^\%(Package\%(-Type\)\=\|Architecture\|Build-Profiles\): *" -syn match debcontrolKey contained "^\%(\%(Build-\)\=Essential\|Multi-Arch\|Tag\): *" -syn match debcontrolKey contained "^\%(\%(Pre-\)\=Depends\|Recommends\|Suggests\|Breaks\|Enhances\|Replaces\|Conflicts\|Provides\|Built-Using\): *" -syn match debcontrolKey contained "^\%(Subarchitecture\|Kernel-Version\|Installer-Menu-Item\): *" - -" User-defined fields -syn match debcontrolKey contained "^X[SBC]\{0,3\}\%(-Private\)\=-[-a-zA-Z0-9]\+: *" - -syn match debcontrolDeprecatedKey contained "^\%(\%(XS-\)\=DM-Upload-Allowed\): *" +" Handle all fields from deb-src-control(5) " Fields for which we do strict syntax checking -syn region debcontrolStrictField start="^Architecture" end="$" contains=debcontrolKey,debcontrolArchitecture,debcontrolSpace oneline -syn region debcontrolStrictField start="^Multi-Arch" end="$" contains=debcontrolKey,debcontrolMultiArch oneline -syn region debcontrolStrictField start="^\%(Package\|Source\)" end="$" contains=debcontrolKey,debcontrolName oneline -syn region debcontrolStrictField start="^Priority" end="$" contains=debcontrolKey,debcontrolPriority oneline -syn region debcontrolStrictField start="^Section" end="$" contains=debcontrolKey,debcontrolSection oneline -syn region debcontrolStrictField start="^\%(XC-\)\=Package-Type" end="$" contains=debcontrolKey,debcontrolPackageType oneline -syn region debcontrolStrictField start="^Homepage" end="$" contains=debcontrolKey,debcontrolHTTPUrl oneline keepend -syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-\%(Browser\|Arch\|Bzr\|Darcs\|Hg\)" end="$" contains=debcontrolKey,debcontrolHTTPUrl oneline keepend -syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Svn" end="$" contains=debcontrolKey,debcontrolVcsSvn,debcontrolHTTPUrl oneline keepend -syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Cvs" end="$" contains=debcontrolKey,debcontrolVcsCvs oneline keepend -syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Git" end="$" contains=debcontrolKey,debcontrolVcsGit oneline keepend -syn region debcontrolStrictField start="^\%(XS-\)\=DM-Upload-Allowed" end="$" contains=debcontrolDeprecatedKey,debcontrolDmUpload oneline -syn region debcontrolStrictField start="^Rules-Requires-Root" end="$" contains=debcontrolKey,debcontrolR3 oneline -syn region debcontrolStrictField start="^\%(Build-\)\=Essential" end="$" contains=debcontrolKey,debcontrolYesNo oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^Architecture: *" end="$" contains=debcontrolArchitecture,debcontrolSpace oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^Multi-Arch: *" end="$" contains=debcontrolMultiArch oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(Package\|Source\): *" end="$" contains=debcontrolName oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^Priority: *" end="$" contains=debcontrolPriority oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^Section: *" end="$" contains=debcontrolSection oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XC-\)\=Package-Type: *" end="$" contains=debcontrolPackageType oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^Homepage: *" end="$" contains=debcontrolHTTPUrl oneline keepend +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-\)\=Vcs-\%(Browser\|Arch\|Bzr\|Darcs\|Hg\): *" end="$" contains=debcontrolHTTPUrl oneline keepend +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-\)\=Vcs-Svn: *" end="$" contains=debcontrolVcsSvn,debcontrolHTTPUrl oneline keepend +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-\)\=Vcs-Cvs: *" end="$" contains=debcontrolVcsCvs oneline keepend +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(XS-\)\=Vcs-Git: *" end="$" contains=debcontrolVcsGit oneline keepend +syn region debcontrolStrictField matchgroup=debcontrolKey start="^Rules-Requires-Root: *" end="$" contains=debcontrolR3 oneline +syn region debcontrolStrictField matchgroup=debcontrolKey start="^\%(Build-\)\=Essential: *" end="$" contains=debcontrolYesNo oneline + +syn region debcontrolStrictField matchgroup=debcontrolDeprecatedKey start="^\%(XS-\)\=DM-Upload-Allowed: *" end="$" contains=debcontrolDmUpload oneline " Catch-all for the other legal fields -syn region debcontrolField start="^\%(\%(XSBC-Original-\)\=Maintainer\|Standards-Version\|Bugs\|Origin\|X[SB]-Python-Version\|\%(XS-\)\=Vcs-Mtn\|\%(XS-\)\=Testsuite\|Build-Profiles\|Tag\|Subarchitecture\|Kernel-Version\|Installer-Menu-Item\):" end="$" contains=debcontrolKey,debcontrolVariable,debcontrolEmail oneline -syn region debcontrolMultiField start="^\%(Build-\%(Conflicts\|Depends\)\%(-Arch\|-Indep\)\=\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Breaks\|Enhances\|Replaces\|Conflicts\|Provides\|Built-Using\|Uploaders\|X[SBC]\{0,3\}\%(Private-\)\=-[-a-zA-Z0-9]\+\):" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment -syn region debcontrolMultiFieldSpell start="^\%(Description\):" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment,@Spell +syn region debcontrolField matchgroup=debcontrolKey start="^\%(\%(XSBC-Original-\)\=Maintainer\|Standards-Version\|Bugs\|Origin\|X[SB]-Python-Version\|\%(XS-\)\=Vcs-Mtn\|\%(XS-\)\=Testsuite\%(-Triggers\)\=\|Build-Profiles\|Tag\|Subarchitecture\|Kernel-Version\|Installer-Menu-Item\): " end="$" contains=debcontrolVariable,debcontrolEmail oneline +syn region debcontrolMultiField matchgroup=debcontrolKey start="^\%(Build-\%(Conflicts\|Depends\)\%(-Arch\|-Indep\)\=\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Breaks\|Enhances\|Replaces\|Conflicts\|Provides\|Built-Using\|Uploaders\|X[SBC]\{0,3\}\%(Private-\)\=-[-a-zA-Z0-9]\+\): *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=debcontrolEmail,debcontrolVariable,debcontrolComment +syn region debcontrolMultiFieldSpell matchgroup=debcontrolKey start="^Description: *" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=debcontrolEmail,debcontrolVariable,debcontrolComment,@Spell " Associate our matches and regions with pretty colours hi def link debcontrolKey Keyword diff -Nru vim-8.0.1453/runtime/syntax/debsources.vim vim-8.0.1766/runtime/syntax/debsources.vim --- vim-8.0.1453/runtime/syntax/debsources.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/debsources.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,9 +1,9 @@ " Vim syntax file " Language: Debian sources.list -" Maintainer: Debian Vim Maintainers +" Maintainer: Debian Vim Maintainers " Former Maintainer: Matthijs Mohlmann -" Last Change: 2017 Oct 28 -" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debsources.vim +" Last Change: 2018 Jan 06 +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim " Standard syntax initialization if exists("b:current_syntax") diff -Nru vim-8.0.1453/runtime/syntax/dircolors.vim vim-8.0.1766/runtime/syntax/dircolors.vim --- vim-8.0.1453/runtime/syntax/dircolors.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/dircolors.vim 2018-04-26 20:30:33.000000000 +0000 @@ -2,7 +2,7 @@ " Language: dircolors(1) input file " Maintainer: Jan Larres " Previous Maintainer: Nikolai Weibull -" Latest Revision: 2013-08-17 +" Latest Revision: 2018-02-19 if exists("b:current_syntax") finish @@ -135,6 +135,12 @@ elseif item >= 40 && item <= 47 " ANSI SGR background color let hi_str .= s:get_hi_str(item - 40, 'bg') + elseif item >= 90 && item <= 97 + " ANSI SGR+8 foreground color (xterm 16-color support) + let hi_str .= s:get_hi_str(item - 82, 'fg') + elseif item >= 100 && item <= 107 + " ANSI SGR+8 background color (xterm 16-color support) + let hi_str .= s:get_hi_str(item - 92, 'bg') elseif item == 38 " Foreground for terminals with 88/256 color support let color = s:get_256color(colors) diff -Nru vim-8.0.1453/runtime/syntax/forth.vim vim-8.0.1766/runtime/syntax/forth.vim --- vim-8.0.1453/runtime/syntax/forth.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/forth.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,84 +1,10 @@ " Vim syntax file " Language: FORTH -" Maintainer: Christian V. J. Brüssow -" Last Change: So 27 Mai 2012 15:56:28 CEST +" Current Maintainer: Johan Kotlinski +" Previous Maintainer: Christian V. J. Brüssow +" Last Change: 2018-03-29 " Filenames: *.fs,*.ft -" URL: http://www.cvjb.de/comp/vim/forth.vim - -" $Id: forth.vim,v 1.14 2012/05/27 15:57:22 bruessow Exp $ - -" The list of keywords is incomplete, compared with the official ANS -" wordlist. If you use this language, please improve it, and send me -" the patches. -" -" Before sending me patches, please download the newest version of this file -" from http://www.cvjb.de/comp/vim/forth.vim or http://www.vim.org/ (search -" for forth.vim). - -" Many Thanks to... -" -" 2012-05-13: -" Dominique Pellé for sending the -" patch to allow spellchecking of strings, comments, ... -" -" 2012-01-07: -" Thilo Six send a patch for cpoptions. -" See the discussion at http://thread.gmane.org/gmane.editors.vim.devel/32151 -" -" 2009-06-28: -" Josh Grams send a patch to allow the parenthesis comments at the -" beginning of a line. That patch also fixed a typo in one of the -" comments. -" -" 2008-02-09: -" Shawn K. Quinn send a big patch with -" new words commonly used in Forth programs or defined by GNU Forth. -" -" 2007-07-11: -" Benjamin Krill send me a patch -" to highlight space errors. -" You can toggle this feature on through setting the -" flag forth_space_errors in you vimrc. If you have switched it on, -" you can turn off highlighting of trailing spaces in comments by -" setting forth_no_trail_space_error in your vimrc. If you do not want -" the highlighting of a tabulator following a space in comments, you -" can turn this off by setting forth_no_tab_space_error. -" -" 2006-05-25: -" Bill McCarthy and Ilya Sher -" Who found a bug in the ccomment line in 2004!!! -" I'm really very sorry, that it has taken two years to fix that -" in the official version of this file. Shame on me. -" I think my face will be red the next ten years... -" -" 2006-05-21: -" Thomas E. Vaughan send me a patch -" for the parenthesis comment word, so words with a trailing -" parenthesis will not start the highlighting for such comments. -" -" 2003-05-10: -" Andrew Gaul send me a patch for -" forthOperators. -" -" 2003-04-03: -" Ron Aaron made updates for an -" improved Win32Forth support. -" -" 2002-04-22: -" Charles Shattuck helped me to settle up with the -" binary and hex number highlighting. -" -" 2002-04-20: -" Charles Shattuck send me some code for correctly -" highlighting char and [char] followed by an opening paren. He also added -" some words for operators, conditionals, and definitions; and added the -" highlighting for s" and c". -" -" 2000-03-28: -" John Providenza made improvements for the -" highlighting of strings, and added the code for highlighting hex numbers. -" - +" URL: https://github.com/jkotlinski/forth.vim " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -129,7 +55,10 @@ syn keyword forthOperators 0< 0<= 0<> 0= 0> 0>= < <= <> = > >= U< U<= syn keyword forthOperators U> U>= D0< D0<= D0<> D0= D0> D0>= D< D<= D<> syn keyword forthOperators D= D> D>= DU< DU<= DU> DU>= WITHIN ?NEGATE -syn keyword forthOperators ?DNEGATE +syn keyword forthOperators ?DNEGATE TRUE FALSE + +" various words that take an input and do something with it +syn keyword forthFunction . U. .R U.R " stack manipulations syn keyword forthStack DROP NIP DUP OVER TUCK SWAP ROT -ROT ?DUP PICK ROLL @@ -141,7 +70,7 @@ syn keyword forthFStack FDROP FNIP FDUP FOVER FTUCK FSWAP FROT " stack pointer manipulations -syn keyword forthSP SP@ SP! FP@ FP! RP@ RP! LP@ LP! +syn keyword forthSP SP@ SP! FP@ FP! RP@ RP! LP@ LP! DEPTH " address operations syn keyword forthMemory @ ! +! C@ C! 2@ 2! F@ F! SF@ SF! DF@ DF! @@ -150,7 +79,7 @@ syn keyword forthAdrArith SFALIGN SFALIGNED DFLOATS DFLOAT+ DFALIGN DFALIGNED syn keyword forthAdrArith MAXALIGN MAXALIGNED CFALIGN CFALIGNED syn keyword forthAdrArith ADDRESS-UNIT-BITS ALLOT ALLOCATE HERE -syn keyword forthMemBlks MOVE ERASE CMOVE CMOVE> FILL BLANK +syn keyword forthMemBlks MOVE ERASE CMOVE CMOVE> FILL BLANK UNUSED " conditionals syn keyword forthCond IF ELSE ENDIF THEN CASE OF ENDOF ENDCASE ?DUP-IF @@ -159,7 +88,7 @@ " iterations syn keyword forthLoop BEGIN WHILE REPEAT UNTIL AGAIN syn keyword forthLoop ?DO LOOP I J K +DO U+DO -DO U-DO DO +LOOP -LOOP -syn keyword forthLoop UNLOOP LEAVE ?LEAVE EXIT DONE FOR NEXT +syn keyword forthLoop UNLOOP LEAVE ?LEAVE EXIT DONE FOR NEXT RECURSE " new words syn match forthClassDef '\<:class\s*[^ \t]\+\>' @@ -174,8 +103,8 @@ syn keyword forthDefine LITERAL CREATE-INTERPRET/COMPILE INTERPRETATION> syn keyword forthDefine INT NAME?INT NAME>COMP -syn keyword forthDefine NAME>STRING STATE C; CVARIABLE -syn keyword forthDefine , 2, F, C, +syn keyword forthDefine NAME>STRING STATE C; CVARIABLE BUFFER: MARKER +syn keyword forthDefine , 2, F, C, COMPILE, syn match forthDefine "\[IFDEF]" syn match forthDefine "\[IFUNDEF]" syn match forthDefine "\[THEN]" @@ -196,6 +125,7 @@ syn match forthDefine '\<\[\>' syn match forthDefine "\[']" syn match forthDefine '\[COMPILE]' +syn match forthDefine '\[CHAR]' " debugging syn keyword forthDebug PRINTDEBUGDATA PRINTDEBUGLINE @@ -206,7 +136,7 @@ " basic character operations syn keyword forthCharOps (.) CHAR EXPECT FIND WORD TYPE -TRAILING EMIT KEY -syn keyword forthCharOps KEY? TIB CR +syn keyword forthCharOps KEY? TIB CR BL COUNT SPACE SPACES " recognize 'char (' or '[char] (' correctly, so it doesn't " highlight everything after the paren as a comment till a closing ')' syn match forthCharOps '\ #>> #S (NUMBER) (NUMBER?) CONVERT D>F syn keyword forthConversion D>S DIGIT DPL F>D HLD HOLD NUMBER S>D SIGN >NUMBER -syn keyword forthConversion F>S S>F +syn keyword forthConversion F>S S>F HOLDS " interpreter, wordbook, compiler syn keyword forthForth (LOCAL) BYE COLD ABORT >BODY >NEXT >LINK CFA >VIEW HERE syn keyword forthForth PAD WORDS VIEW VIEW> N>LINK NAME> LINK> L>NAME FORGET syn keyword forthForth BODY> ASSERT( ASSERT0( ASSERT1( ASSERT2( ASSERT3( ) +syn keyword forthForth >IN ACCEPT ENVIRONMENT? EVALUATE QUIT SOURCE ACTION-OF +syn keyword forthForth DEFER! DEFER@ PARSE PARSE-NAME REFILL RESTORE-INPUT +syn keyword forthForth SAVE-INPUT SOURCE-ID syn region forthForth start=+ABORT"\s+ skip=+\\"+ end=+"+ " vocabularies @@ -236,16 +169,17 @@ syn keyword forthFileWords FLUSH-FILE FILE-STATUS FILE-POSITION syn keyword forthFileWords REPOSITION-FILE FILE-SIZE RESIZE-FILE syn keyword forthFileWords SLURP-FILE SLURP-FID STDIN STDOUT STDERR +syn keyword forthFileWords INCLUDE-FILE INCLUDED REQUIRED syn keyword forthBlocks OPEN-BLOCKS USE LOAD --> BLOCK-OFFSET syn keyword forthBlocks GET-BLOCK-FID BLOCK-POSITION LIST SCR BLOCK syn keyword forthBlocks BUFER EMPTY-BUFFERS EMPTY-BUFFER UPDATE UPDATED? syn keyword forthBlocks SAVE-BUFFERS SAVE-BUFFER FLUSH THRU +LOAD +THRU -syn keyword forthBlocks BLOCK-INCLUDED +syn keyword forthBlocks BLOCK-INCLUDED BLK " numbers syn keyword forthMath DECIMAL HEX BASE -syn match forthInteger '\<-\=[0-9.]*[0-9.]\+\>' -syn match forthInteger '\<&-\=[0-9.]*[0-9.]\+\>' +syn match forthInteger '\<-\=[0-9]\+.\=\>' +syn match forthInteger '\<&-\=[0-9]\+.\=\>' " recognize hex and binary numbers, the '$' and '%' notation is for gforth syn match forthInteger '\<\$\x*\x\+\>' " *1* --- dont't mess syn match forthInteger '\<\x*\d\x*\>' " *2* --- this order! @@ -253,28 +187,29 @@ syn match forthFloat '\<-\=\d*[.]\=\d\+[DdEe]\d\+\>' syn match forthFloat '\<-\=\d*[.]\=\d\+[DdEe][-+]\d\+\>' -" XXX If you find this overkill you can remove it. This has to come after the +" XXX If you find this overkill you can remove it. this has to come after the " highlighting for numbers otherwise it has no effect. syn region forthComment start='0 \[if\]' end='\[endif\]' end='\[then\]' contains=forthTodo " Strings -syn region forthString start=+\.*\"+ end=+"+ end=+$+ contains=@Spell +syn region forthString start=+\.*\"+ end=+"+ end=+$+ " XXX -syn region forthString start=+s\"+ end=+"+ end=+$+ contains=@Spell -syn region forthString start=+c\"+ end=+"+ end=+$+ contains=@Spell +syn region forthString start=+s\"+ end=+"+ end=+$+ +syn region forthString start=+s\\\"+ end=+"+ end=+$+ +syn region forthString start=+c\"+ end=+"+ end=+$+ " Comments -syn match forthComment '\\\s.*$' contains=@Spell,forthTodo,forthSpaceError -syn region forthComment start='\\S\s' end='.*' contains=@Spell,forthTodo,forthSpaceError -syn match forthComment '\.(\s[^)]*)' contains=@Spell,forthTodo,forthSpaceError -syn region forthComment start='\(^\|\s\)\zs(\s' skip='\\)' end=')' contains=@Spell,forthTodo,forthSpaceError -syn region forthComment start='/\*' end='\*/' contains=@Spell,forthTodo,forthSpaceError +syn match forthComment '\\\s.*$' contains=forthTodo,forthSpaceError +syn region forthComment start='\\S\s' end='.*' contains=forthTodo,forthSpaceError +syn match forthComment '\.(\s[^)]*)' contains=forthTodo,forthSpaceError +syn region forthComment start='\(^\|\s\)\zs(\s' skip='\\)' end=')' contains=forthTodo,forthSpaceError +syn region forthComment start='/\*' end='\*/' contains=forthTodo,forthSpaceError " Include files syn match forthInclude '^INCLUDE\s\+\k\+' -syn match forthInclude '^require\s\+\k\+' -syn match forthInclude '^fload\s\+' -syn match forthInclude '^needs\s\+' +syn match forthInclude '^REQUIRE\s\+\k\+' +syn match forthInclude '^FLOAD\s\+' +syn match forthInclude '^NEEDS\s\+' " Locals definitions syn region forthLocals start='{\s' start='{$' end='\s}' end='^}' @@ -282,9 +217,6 @@ syn region forthDeprecated start='locals|' end='|' " Define the default highlighting. -" Only when an item doesn't have highlighting yet - -" The default methods for highlighting. Can be overridden later. hi def link forthTodo Todo hi def link forthOperators Operator hi def link forthMath Number @@ -318,11 +250,11 @@ hi def link forthLocals Type " nothing else uses type and locals must stand out hi def link forthDeprecated Error " if you must, change to Type hi def link forthFileMode Function +hi def link forthFunction Function hi def link forthFileWords Statement hi def link forthBlocks Statement hi def link forthSpaceError Error - let b:current_syntax = "forth" let &cpo = s:cpo_save diff -Nru vim-8.0.1453/runtime/syntax/haskell.vim vim-8.0.1766/runtime/syntax/haskell.vim --- vim-8.0.1453/runtime/syntax/haskell.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/haskell.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,7 +1,7 @@ " Vim syntax file " Language: Haskell " Maintainer: Haskell Cafe mailinglist -" Last Change: 2017 Dec 16 +" Last Change: 2018 Mar 29 by Marcin Szamotulski " Original Author: John Williams " " Thanks to Ryan Crumley for suggestions and John Meacham for @@ -38,8 +38,8 @@ endif " (Qualified) identifiers (no default highlighting) -syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[A-Z][a-zA-Z0-9_']*\>" -syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_']*\>" +syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[A-Z][a-zA-Z0-9_']*\>" contains=@NoSpell +syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_']*\>" contains=@NoSpell " Infix operators--most punctuation characters and any (qualified) identifier " enclosed in `backquotes`. An operator starting with : is a constructor, @@ -56,7 +56,7 @@ syn match hsSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)" syn match hsSpecialChar contained "\\\(NUL\|SOH\|STX\|ETX\|EOT\|ENQ\|ACK\|BEL\|BS\|HT\|LF\|VT\|FF\|CR\|SO\|SI\|DLE\|DC1\|DC2\|DC3\|DC4\|NAK\|SYN\|ETB\|CAN\|EM\|SUB\|ESC\|FS\|GS\|RS\|US\|SP\|DEL\)" syn match hsSpecialCharError contained "\\&\|'''\+" -syn region hsString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=hsSpecialChar +syn region hsString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=hsSpecialChar,@NoSpell syn match hsCharacter "[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=hsSpecialChar,hsSpecialCharError syn match hsCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=hsSpecialChar,hsSpecialCharError syn match hsNumber "\v<[0-9]%(_*[0-9])*>|<0[xX]_*[0-9a-fA-F]%(_*[0-9a-fA-F])*>|<0[oO]_*%(_*[0-7])*>|<0[bB]_*[01]%(_*[01])*>" @@ -66,8 +66,8 @@ " because otherwise they would match as keywords at the start of a " "literate" comment (see lhs.vim). syn match hsModule "\" -syn match hsImport "\.*"he=s+6 contains=hsImportMod,hsLineComment,hsBlockComment -syn match hsImportMod contained "\<\(as\|qualified\|hiding\)\>" +syn match hsImport "\.*"he=s+6 contains=hsImportMod,hsLineComment,hsBlockComment,@NoSpell +syn match hsImportMod contained "\<\(as\|qualified\|hiding\)\>" contains=@NoSpell syn match hsInfix "\<\(infix\|infixl\|infixr\)\>" syn match hsStructure "\<\(class\|data\|deriving\|instance\|default\|where\)\>" syn match hsTypedef "\<\(type\|newtype\)\>" @@ -97,8 +97,8 @@ " Comments -syn match hsLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" -syn region hsBlockComment start="{-" end="-}" contains=hsBlockComment +syn match hsLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" contains=@Spell +syn region hsBlockComment start="{-" end="-}" contains=hsBlockComment,@Spell syn region hsPragma start="{-#" end="#-}" " C Preprocessor directives. Shamelessly ripped from c.vim and trimmed diff -Nru vim-8.0.1453/runtime/syntax/javascript.vim vim-8.0.1766/runtime/syntax/javascript.vim --- vim-8.0.1453/runtime/syntax/javascript.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/javascript.vim 2018-04-26 20:30:33.000000000 +0000 @@ -9,6 +9,7 @@ " (ss) additional factoring of keywords, globals, and members " Last Change: 2012 Oct 05 " 2013 Jun 12: adjusted javaScriptRegexpString (Kevin Locke) +" 2018 Apr 14: adjusted javaScriptRegexpString (LongJohnCoder) " tuning parameters: " unlet javaScript_fold @@ -37,7 +38,7 @@ syn match javaScriptSpecialCharacter "'\\.'" syn match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>" -syn region javaScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gim]\{0,2\}\s*$+ end=+/[gim]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline +syn region javaScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gimuys]\{0,2\}\s*$+ end=+/[gimuys]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline syn keyword javaScriptConditional if else switch syn keyword javaScriptRepeat while for do in diff -Nru vim-8.0.1453/runtime/syntax/lisp.vim vim-8.0.1766/runtime/syntax/lisp.vim --- vim-8.0.1453/runtime/syntax/lisp.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/lisp.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,9 +1,9 @@ " Vim syntax file " Language: Lisp " Maintainer: Charles E. Campbell -" Last Change: May 02, 2016 -" Version: 26 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_LISP +" Last Change: Feb 15, 2018 +" Version: 27 +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_LISP " " Thanks to F Xavier Noria for a list of 978 Common Lisp symbols taken from HyperSpec " Clisp additions courtesy of http://clisp.cvs.sourceforge.net/*checkout*/clisp/clisp/emacs/lisp.vim @@ -40,8 +40,8 @@ " --------------------------------------------------------------------- " Lists: {{{1 -syn match lispSymbol contained ![^()'`,"; \t]\+! -syn match lispBarSymbol contained !|..\{-}|! +syn match lispSymbol contained ![^()'`,"; \t]\+! +syn match lispBarSymbol contained !|..\{-}|! if exists("g:lisp_rainbow") && g:lisp_rainbow != 0 syn region lispParen0 matchgroup=hlLevel0 start="`\=(" end=")" skip="|.\{-}|" contains=@lispListCluster,lispParen1 syn region lispParen1 contained matchgroup=hlLevel1 start="`\=(" end=")" skip="|.\{-}|" contains=@lispListCluster,lispParen2 @@ -71,320 +71,320 @@ " --------------------------------------------------------------------- " Standard Lisp Functions and Macros: {{{1 -syn keyword lispFunc * find-method pprint-indent -syn keyword lispFunc ** find-package pprint-linear -syn keyword lispFunc *** find-restart pprint-logical-block -syn keyword lispFunc + find-symbol pprint-newline -syn keyword lispFunc ++ finish-output pprint-pop -syn keyword lispFunc +++ first pprint-tab -syn keyword lispFunc - fixnum pprint-tabular -syn keyword lispFunc / flet prin1 -syn keyword lispFunc // float prin1-to-string -syn keyword lispFunc /// float-digits princ -syn keyword lispFunc /= float-precision princ-to-string -syn keyword lispFunc 1+ float-radix print -syn keyword lispFunc 1- float-sign print-not-readable -syn keyword lispFunc < floating-point-inexact print-not-readable-object -syn keyword lispFunc <= floating-point-invalid-operation print-object -syn keyword lispFunc = floating-point-overflow print-unreadable-object -syn keyword lispFunc > floating-point-underflow probe-file -syn keyword lispFunc >= floatp proclaim -syn keyword lispFunc abort floor prog -syn keyword lispFunc abs fmakunbound prog* -syn keyword lispFunc access force-output prog1 -syn keyword lispFunc acons format prog2 -syn keyword lispFunc acos formatter progn -syn keyword lispFunc acosh fourth program-error -syn keyword lispFunc add-method fresh-line progv -syn keyword lispFunc adjoin fround provide -syn keyword lispFunc adjust-array ftruncate psetf -syn keyword lispFunc adjustable-array-p ftype psetq -syn keyword lispFunc allocate-instance funcall push -syn keyword lispFunc alpha-char-p function pushnew -syn keyword lispFunc alphanumericp function-keywords putprop -syn keyword lispFunc and function-lambda-expression quote -syn keyword lispFunc append functionp random -syn keyword lispFunc apply gbitp random-state -syn keyword lispFunc applyhook gcd random-state-p -syn keyword lispFunc apropos generic-function rassoc -syn keyword lispFunc apropos-list gensym rassoc-if -syn keyword lispFunc aref gentemp rassoc-if-not -syn keyword lispFunc arithmetic-error get ratio -syn keyword lispFunc arithmetic-error-operands get-decoded-time rational -syn keyword lispFunc arithmetic-error-operation get-dispatch-macro-character rationalize -syn keyword lispFunc array get-internal-real-time rationalp -syn keyword lispFunc array-dimension get-internal-run-time read -syn keyword lispFunc array-dimension-limit get-macro-character read-byte -syn keyword lispFunc array-dimensions get-output-stream-string read-char -syn keyword lispFunc array-displacement get-properties read-char-no-hang -syn keyword lispFunc array-element-type get-setf-expansion read-delimited-list -syn keyword lispFunc array-has-fill-pointer-p get-setf-method read-eval-print -syn keyword lispFunc array-in-bounds-p get-universal-time read-from-string -syn keyword lispFunc array-rank getf read-line -syn keyword lispFunc array-rank-limit gethash read-preserving-whitespace -syn keyword lispFunc array-row-major-index go read-sequence -syn keyword lispFunc array-total-size graphic-char-p reader-error -syn keyword lispFunc array-total-size-limit handler-bind readtable -syn keyword lispFunc arrayp handler-case readtable-case -syn keyword lispFunc ash hash-table readtablep -syn keyword lispFunc asin hash-table-count real -syn keyword lispFunc asinh hash-table-p realp -syn keyword lispFunc assert hash-table-rehash-size realpart -syn keyword lispFunc assoc hash-table-rehash-threshold reduce -syn keyword lispFunc assoc-if hash-table-size reinitialize-instance -syn keyword lispFunc assoc-if-not hash-table-test rem -syn keyword lispFunc atan host-namestring remf -syn keyword lispFunc atanh identity remhash -syn keyword lispFunc atom if remove -syn keyword lispFunc base-char if-exists remove-duplicates -syn keyword lispFunc base-string ignorable remove-if -syn keyword lispFunc bignum ignore remove-if-not -syn keyword lispFunc bit ignore-errors remove-method -syn keyword lispFunc bit-and imagpart remprop -syn keyword lispFunc bit-andc1 import rename-file -syn keyword lispFunc bit-andc2 in-package rename-package -syn keyword lispFunc bit-eqv in-package replace -syn keyword lispFunc bit-ior incf require -syn keyword lispFunc bit-nand initialize-instance rest -syn keyword lispFunc bit-nor inline restart -syn keyword lispFunc bit-not input-stream-p restart-bind -syn keyword lispFunc bit-orc1 inspect restart-case -syn keyword lispFunc bit-orc2 int-char restart-name -syn keyword lispFunc bit-vector integer return -syn keyword lispFunc bit-vector-p integer-decode-float return-from -syn keyword lispFunc bit-xor integer-length revappend -syn keyword lispFunc block integerp reverse -syn keyword lispFunc boole interactive-stream-p room -syn keyword lispFunc boole-1 intern rotatef -syn keyword lispFunc boole-2 internal-time-units-per-second round -syn keyword lispFunc boole-and intersection row-major-aref -syn keyword lispFunc boole-andc1 invalid-method-error rplaca -syn keyword lispFunc boole-andc2 invoke-debugger rplacd -syn keyword lispFunc boole-c1 invoke-restart safety -syn keyword lispFunc boole-c2 invoke-restart-interactively satisfies -syn keyword lispFunc boole-clr isqrt sbit -syn keyword lispFunc boole-eqv keyword scale-float -syn keyword lispFunc boole-ior keywordp schar -syn keyword lispFunc boole-nand labels search -syn keyword lispFunc boole-nor lambda second -syn keyword lispFunc boole-orc1 lambda-list-keywords sequence -syn keyword lispFunc boole-orc2 lambda-parameters-limit serious-condition -syn keyword lispFunc boole-set last set -syn keyword lispFunc boole-xor lcm set-char-bit -syn keyword lispFunc boolean ldb set-difference -syn keyword lispFunc both-case-p ldb-test set-dispatch-macro-character -syn keyword lispFunc boundp ldiff set-exclusive-or -syn keyword lispFunc break least-negative-double-float set-macro-character -syn keyword lispFunc broadcast-stream least-negative-long-float set-pprint-dispatch -syn keyword lispFunc broadcast-stream-streams least-negative-normalized-double-float set-syntax-from-char -syn keyword lispFunc built-in-class least-negative-normalized-long-float setf -syn keyword lispFunc butlast least-negative-normalized-short-float setq -syn keyword lispFunc byte least-negative-normalized-single-float seventh -syn keyword lispFunc byte-position least-negative-short-float shadow -syn keyword lispFunc byte-size least-negative-single-float shadowing-import -syn keyword lispFunc call-arguments-limit least-positive-double-float shared-initialize -syn keyword lispFunc call-method least-positive-long-float shiftf -syn keyword lispFunc call-next-method least-positive-normalized-double-float short-float -syn keyword lispFunc capitalize least-positive-normalized-long-float short-float-epsilon -syn keyword lispFunc car least-positive-normalized-short-float short-float-negative-epsilon -syn keyword lispFunc case least-positive-normalized-single-float short-site-name -syn keyword lispFunc catch least-positive-short-float signal -syn keyword lispFunc ccase least-positive-single-float signed-byte -syn keyword lispFunc cdr length signum -syn keyword lispFunc ceiling let simple-condition -syn keyword lispFunc cell-error let* simple-array -syn keyword lispFunc cell-error-name lisp simple-base-string -syn keyword lispFunc cerror lisp-implementation-type simple-bit-vector -syn keyword lispFunc change-class lisp-implementation-version simple-bit-vector-p -syn keyword lispFunc char list simple-condition-format-arguments -syn keyword lispFunc char-bit list* simple-condition-format-control -syn keyword lispFunc char-bits list-all-packages simple-error -syn keyword lispFunc char-bits-limit list-length simple-string -syn keyword lispFunc char-code listen simple-string-p -syn keyword lispFunc char-code-limit listp simple-type-error -syn keyword lispFunc char-control-bit load simple-vector -syn keyword lispFunc char-downcase load-logical-pathname-translations simple-vector-p -syn keyword lispFunc char-equal load-time-value simple-warning -syn keyword lispFunc char-font locally sin -syn keyword lispFunc char-font-limit log single-flaot-epsilon -syn keyword lispFunc char-greaterp logand single-float -syn keyword lispFunc char-hyper-bit logandc1 single-float-epsilon -syn keyword lispFunc char-int logandc2 single-float-negative-epsilon -syn keyword lispFunc char-lessp logbitp sinh -syn keyword lispFunc char-meta-bit logcount sixth -syn keyword lispFunc char-name logeqv sleep -syn keyword lispFunc char-not-equal logical-pathname slot-boundp -syn keyword lispFunc char-not-greaterp logical-pathname-translations slot-exists-p -syn keyword lispFunc char-not-lessp logior slot-makunbound -syn keyword lispFunc char-super-bit lognand slot-missing -syn keyword lispFunc char-upcase lognor slot-unbound -syn keyword lispFunc char/= lognot slot-value -syn keyword lispFunc char< logorc1 software-type -syn keyword lispFunc char<= logorc2 software-version -syn keyword lispFunc char= logtest some -syn keyword lispFunc char> logxor sort -syn keyword lispFunc char>= long-float space -syn keyword lispFunc character long-float-epsilon special -syn keyword lispFunc characterp long-float-negative-epsilon special-form-p -syn keyword lispFunc check-type long-site-name special-operator-p -syn keyword lispFunc cis loop speed -syn keyword lispFunc class loop-finish sqrt -syn keyword lispFunc class-name lower-case-p stable-sort -syn keyword lispFunc class-of machine-instance standard -syn keyword lispFunc clear-input machine-type standard-char -syn keyword lispFunc clear-output machine-version standard-char-p -syn keyword lispFunc close macro-function standard-class -syn keyword lispFunc clrhash macroexpand standard-generic-function -syn keyword lispFunc code-char macroexpand-1 standard-method -syn keyword lispFunc coerce macroexpand-l standard-object -syn keyword lispFunc commonp macrolet step -syn keyword lispFunc compilation-speed make-array storage-condition -syn keyword lispFunc compile make-array store-value -syn keyword lispFunc compile-file make-broadcast-stream stream -syn keyword lispFunc compile-file-pathname make-char stream-element-type -syn keyword lispFunc compiled-function make-concatenated-stream stream-error -syn keyword lispFunc compiled-function-p make-condition stream-error-stream -syn keyword lispFunc compiler-let make-dispatch-macro-character stream-external-format -syn keyword lispFunc compiler-macro make-echo-stream streamp -syn keyword lispFunc compiler-macro-function make-hash-table streamup -syn keyword lispFunc complement make-instance string -syn keyword lispFunc complex make-instances-obsolete string-capitalize -syn keyword lispFunc complexp make-list string-char -syn keyword lispFunc compute-applicable-methods make-load-form string-char-p -syn keyword lispFunc compute-restarts make-load-form-saving-slots string-downcase -syn keyword lispFunc concatenate make-method string-equal -syn keyword lispFunc concatenated-stream make-package string-greaterp -syn keyword lispFunc concatenated-stream-streams make-pathname string-left-trim -syn keyword lispFunc cond make-random-state string-lessp -syn keyword lispFunc condition make-sequence string-not-equal -syn keyword lispFunc conjugate make-string string-not-greaterp -syn keyword lispFunc cons make-string-input-stream string-not-lessp -syn keyword lispFunc consp make-string-output-stream string-right-strim -syn keyword lispFunc constantly make-symbol string-right-trim -syn keyword lispFunc constantp make-synonym-stream string-stream -syn keyword lispFunc continue make-two-way-stream string-trim -syn keyword lispFunc control-error makunbound string-upcase -syn keyword lispFunc copy-alist map string/= -syn keyword lispFunc copy-list map-into string< -syn keyword lispFunc copy-pprint-dispatch mapc string<= -syn keyword lispFunc copy-readtable mapcan string= -syn keyword lispFunc copy-seq mapcar string> -syn keyword lispFunc copy-structure mapcon string>= -syn keyword lispFunc copy-symbol maphash stringp -syn keyword lispFunc copy-tree mapl structure -syn keyword lispFunc cos maplist structure-class -syn keyword lispFunc cosh mask-field structure-object -syn keyword lispFunc count max style-warning -syn keyword lispFunc count-if member sublim -syn keyword lispFunc count-if-not member-if sublis -syn keyword lispFunc ctypecase member-if-not subseq -syn keyword lispFunc debug merge subsetp -syn keyword lispFunc decf merge-pathname subst -syn keyword lispFunc declaim merge-pathnames subst-if -syn keyword lispFunc declaration method subst-if-not -syn keyword lispFunc declare method-combination substitute -syn keyword lispFunc decode-float method-combination-error substitute-if -syn keyword lispFunc decode-universal-time method-qualifiers substitute-if-not -syn keyword lispFunc defclass min subtypep -syn keyword lispFunc defconstant minusp svref -syn keyword lispFunc defgeneric mismatch sxhash -syn keyword lispFunc define-compiler-macro mod symbol -syn keyword lispFunc define-condition most-negative-double-float symbol-function -syn keyword lispFunc define-method-combination most-negative-fixnum symbol-macrolet -syn keyword lispFunc define-modify-macro most-negative-long-float symbol-name -syn keyword lispFunc define-setf-expander most-negative-short-float symbol-package -syn keyword lispFunc define-setf-method most-negative-single-float symbol-plist -syn keyword lispFunc define-symbol-macro most-positive-double-float symbol-value -syn keyword lispFunc defmacro most-positive-fixnum symbolp -syn keyword lispFunc defmethod most-positive-long-float synonym-stream -syn keyword lispFunc defpackage most-positive-short-float synonym-stream-symbol -syn keyword lispFunc defparameter most-positive-single-float sys -syn keyword lispFunc defsetf muffle-warning system -syn keyword lispFunc defstruct multiple-value-bind t -syn keyword lispFunc deftype multiple-value-call tagbody -syn keyword lispFunc defun multiple-value-list tailp -syn keyword lispFunc defvar multiple-value-prog1 tan -syn keyword lispFunc delete multiple-value-seteq tanh -syn keyword lispFunc delete-duplicates multiple-value-setq tenth -syn keyword lispFunc delete-file multiple-values-limit terpri -syn keyword lispFunc delete-if name-char the -syn keyword lispFunc delete-if-not namestring third -syn keyword lispFunc delete-package nbutlast throw -syn keyword lispFunc denominator nconc time -syn keyword lispFunc deposit-field next-method-p trace -syn keyword lispFunc describe nil translate-logical-pathname -syn keyword lispFunc describe-object nintersection translate-pathname -syn keyword lispFunc destructuring-bind ninth tree-equal -syn keyword lispFunc digit-char no-applicable-method truename -syn keyword lispFunc digit-char-p no-next-method truncase -syn keyword lispFunc directory not truncate -syn keyword lispFunc directory-namestring notany two-way-stream -syn keyword lispFunc disassemble notevery two-way-stream-input-stream -syn keyword lispFunc division-by-zero notinline two-way-stream-output-stream -syn keyword lispFunc do nreconc type -syn keyword lispFunc do* nreverse type-error -syn keyword lispFunc do-all-symbols nset-difference type-error-datum -syn keyword lispFunc do-exeternal-symbols nset-exclusive-or type-error-expected-type -syn keyword lispFunc do-external-symbols nstring type-of -syn keyword lispFunc do-symbols nstring-capitalize typecase -syn keyword lispFunc documentation nstring-downcase typep -syn keyword lispFunc dolist nstring-upcase unbound-slot -syn keyword lispFunc dotimes nsublis unbound-slot-instance -syn keyword lispFunc double-float nsubst unbound-variable -syn keyword lispFunc double-float-epsilon nsubst-if undefined-function -syn keyword lispFunc double-float-negative-epsilon nsubst-if-not unexport -syn keyword lispFunc dpb nsubstitute unintern -syn keyword lispFunc dribble nsubstitute-if union -syn keyword lispFunc dynamic-extent nsubstitute-if-not unless -syn keyword lispFunc ecase nth unread -syn keyword lispFunc echo-stream nth-value unread-char -syn keyword lispFunc echo-stream-input-stream nthcdr unsigned-byte -syn keyword lispFunc echo-stream-output-stream null untrace -syn keyword lispFunc ed number unuse-package -syn keyword lispFunc eighth numberp unwind-protect -syn keyword lispFunc elt numerator update-instance-for-different-class -syn keyword lispFunc encode-universal-time nunion update-instance-for-redefined-class -syn keyword lispFunc end-of-file oddp upgraded-array-element-type -syn keyword lispFunc endp open upgraded-complex-part-type -syn keyword lispFunc enough-namestring open-stream-p upper-case-p -syn keyword lispFunc ensure-directories-exist optimize use-package -syn keyword lispFunc ensure-generic-function or use-value -syn keyword lispFunc eq otherwise user -syn keyword lispFunc eql output-stream-p user-homedir-pathname -syn keyword lispFunc equal package values -syn keyword lispFunc equalp package-error values-list -syn keyword lispFunc error package-error-package vector -syn keyword lispFunc etypecase package-name vector-pop -syn keyword lispFunc eval package-nicknames vector-push -syn keyword lispFunc eval-when package-shadowing-symbols vector-push-extend -syn keyword lispFunc evalhook package-use-list vectorp -syn keyword lispFunc evenp package-used-by-list warn -syn keyword lispFunc every packagep warning -syn keyword lispFunc exp pairlis when -syn keyword lispFunc export parse-error wild-pathname-p -syn keyword lispFunc expt parse-integer with-accessors -syn keyword lispFunc extended-char parse-namestring with-compilation-unit -syn keyword lispFunc fboundp pathname with-condition-restarts -syn keyword lispFunc fceiling pathname-device with-hash-table-iterator -syn keyword lispFunc fdefinition pathname-directory with-input-from-string -syn keyword lispFunc ffloor pathname-host with-open-file -syn keyword lispFunc fifth pathname-match-p with-open-stream -syn keyword lispFunc file-author pathname-name with-output-to-string -syn keyword lispFunc file-error pathname-type with-package-iterator -syn keyword lispFunc file-error-pathname pathname-version with-simple-restart -syn keyword lispFunc file-length pathnamep with-slots -syn keyword lispFunc file-namestring peek-char with-standard-io-syntax -syn keyword lispFunc file-position phase write -syn keyword lispFunc file-stream pi write-byte -syn keyword lispFunc file-string-length plusp write-char -syn keyword lispFunc file-write-date pop write-line -syn keyword lispFunc fill position write-sequence -syn keyword lispFunc fill-pointer position-if write-string -syn keyword lispFunc find position-if-not write-to-string -syn keyword lispFunc find-all-symbols pprint y-or-n-p -syn keyword lispFunc find-class pprint-dispatch yes-or-no-p -syn keyword lispFunc find-if pprint-exit-if-list-exhausted zerop -syn keyword lispFunc find-if-not pprint-fill +syn keyword lispFunc < find-method pprint-indent +syn keyword lispFunc <= find-package pprint-linear +syn keyword lispFunc = find-restart pprint-logical-block +syn keyword lispFunc > find-symbol pprint-newline +syn keyword lispFunc >= finish-output pprint-pop +syn keyword lispFunc - first pprint-tab +syn keyword lispFunc / fixnum pprint-tabular +syn keyword lispFunc /= flet prin1 +syn keyword lispFunc // float prin1-to-string +syn keyword lispFunc /// float-digits princ +syn keyword lispFunc * floating-point-inexact princ-to-string +syn keyword lispFunc ** floating-point-invalid-operation print +syn keyword lispFunc *** floating-point-overflow print-not-readable +syn keyword lispFunc + floating-point-underflow print-not-readable-object +syn keyword lispFunc ++ floatp print-object +syn keyword lispFunc +++ float-precision print-unreadable-object +syn keyword lispFunc 1- float-radix probe-file +syn keyword lispFunc 1+ float-sign proclaim +syn keyword lispFunc abort floor prog +syn keyword lispFunc abs fmakunbound prog* +syn keyword lispFunc access force-output prog1 +syn keyword lispFunc acons format prog2 +syn keyword lispFunc acos formatter progn +syn keyword lispFunc acosh fourth program-error +syn keyword lispFunc add-method fresh-line progv +syn keyword lispFunc adjoin fround provide +syn keyword lispFunc adjustable-array-p ftruncate psetf +syn keyword lispFunc adjust-array ftype psetq +syn keyword lispFunc allocate-instance funcall push +syn keyword lispFunc alpha-char-p function pushnew +syn keyword lispFunc alphanumericp function-keywords putprop +syn keyword lispFunc and function-lambda-expression quote +syn keyword lispFunc append functionp random +syn keyword lispFunc apply gbitp random-state +syn keyword lispFunc applyhook gcd random-state-p +syn keyword lispFunc apropos generic-function rassoc +syn keyword lispFunc apropos-list gensym rassoc-if +syn keyword lispFunc aref gentemp rassoc-if-not +syn keyword lispFunc arithmetic-error get ratio +syn keyword lispFunc arithmetic-error-operands get-decoded-time rational +syn keyword lispFunc arithmetic-error-operation get-dispatch-macro-character rationalize +syn keyword lispFunc array getf rationalp +syn keyword lispFunc array-dimension gethash read +syn keyword lispFunc array-dimension-limit get-internal-real-time read-byte +syn keyword lispFunc array-dimensions get-internal-run-time read-char +syn keyword lispFunc array-displacement get-macro-character read-char-no-hang +syn keyword lispFunc array-element-type get-output-stream-string read-delimited-list +syn keyword lispFunc array-has-fill-pointer-p get-properties reader-error +syn keyword lispFunc array-in-bounds-p get-setf-expansion read-eval-print +syn keyword lispFunc arrayp get-setf-method read-from-string +syn keyword lispFunc array-rank get-universal-time read-line +syn keyword lispFunc array-rank-limit go read-preserving-whitespace +syn keyword lispFunc array-row-major-index graphic-char-p read-sequence +syn keyword lispFunc array-total-size handler-bind readtable +syn keyword lispFunc array-total-size-limit handler-case readtable-case +syn keyword lispFunc ash hash-table readtablep +syn keyword lispFunc asin hash-table-count real +syn keyword lispFunc asinh hash-table-p realp +syn keyword lispFunc assert hash-table-rehash-size realpart +syn keyword lispFunc assoc hash-table-rehash-threshold reduce +syn keyword lispFunc assoc-if hash-table-size reinitialize-instance +syn keyword lispFunc assoc-if-not hash-table-test rem +syn keyword lispFunc atan host-namestring remf +syn keyword lispFunc atanh identity remhash +syn keyword lispFunc atom if remove +syn keyword lispFunc base-char if-exists remove-duplicates +syn keyword lispFunc base-string ignorable remove-if +syn keyword lispFunc bignum ignore remove-if-not +syn keyword lispFunc bit ignore-errors remove-method +syn keyword lispFunc bit-and imagpart remprop +syn keyword lispFunc bit-andc1 import rename-file +syn keyword lispFunc bit-andc2 incf rename-package +syn keyword lispFunc bit-eqv initialize-instance replace +syn keyword lispFunc bit-ior inline require +syn keyword lispFunc bit-nand in-package rest +syn keyword lispFunc bit-nor in-package restart +syn keyword lispFunc bit-not input-stream-p restart-bind +syn keyword lispFunc bit-orc1 inspect restart-case +syn keyword lispFunc bit-orc2 int-char restart-name +syn keyword lispFunc bit-vector integer return +syn keyword lispFunc bit-vector-p integer-decode-float return-from +syn keyword lispFunc bit-xor integer-length revappend +syn keyword lispFunc block integerp reverse +syn keyword lispFunc boole interactive-stream-p room +syn keyword lispFunc boole-1 intern rotatef +syn keyword lispFunc boole-2 internal-time-units-per-second round +syn keyword lispFunc boolean intersection row-major-aref +syn keyword lispFunc boole-and invalid-method-error rplaca +syn keyword lispFunc boole-andc1 invoke-debugger rplacd +syn keyword lispFunc boole-andc2 invoke-restart safety +syn keyword lispFunc boole-c1 invoke-restart-interactively satisfies +syn keyword lispFunc boole-c2 isqrt sbit +syn keyword lispFunc boole-clr keyword scale-float +syn keyword lispFunc boole-eqv keywordp schar +syn keyword lispFunc boole-ior labels search +syn keyword lispFunc boole-nand lambda second +syn keyword lispFunc boole-nor lambda-list-keywords sequence +syn keyword lispFunc boole-orc1 lambda-parameters-limit serious-condition +syn keyword lispFunc boole-orc2 last set +syn keyword lispFunc boole-set lcm set-char-bit +syn keyword lispFunc boole-xor ldb set-difference +syn keyword lispFunc both-case-p ldb-test set-dispatch-macro-character +syn keyword lispFunc boundp ldiff set-exclusive-or +syn keyword lispFunc break least-negative-double-float setf +syn keyword lispFunc broadcast-stream least-negative-long-float set-macro-character +syn keyword lispFunc broadcast-stream-streams least-negative-normalized-double-float set-pprint-dispatch +syn keyword lispFunc built-in-class least-negative-normalized-long-float setq +syn keyword lispFunc butlast least-negative-normalized-short-float set-syntax-from-char +syn keyword lispFunc byte least-negative-normalized-single-float seventh +syn keyword lispFunc byte-position least-negative-short-float shadow +syn keyword lispFunc byte-size least-negative-single-float shadowing-import +syn keyword lispFunc call-arguments-limit least-positive-double-float shared-initialize +syn keyword lispFunc call-method least-positive-long-float shiftf +syn keyword lispFunc call-next-method least-positive-normalized-double-float short-float +syn keyword lispFunc capitalize least-positive-normalized-long-float short-float-epsilon +syn keyword lispFunc car least-positive-normalized-short-float short-float-negative-epsilon +syn keyword lispFunc case least-positive-normalized-single-float short-site-name +syn keyword lispFunc catch least-positive-short-float signal +syn keyword lispFunc ccase least-positive-single-float signed-byte +syn keyword lispFunc cdr length signum +syn keyword lispFunc ceiling let simple-array +syn keyword lispFunc cell-error let* simple-base-string +syn keyword lispFunc cell-error-name lisp simple-bit-vector +syn keyword lispFunc cerror lisp-implementation-type simple-bit-vector-p +syn keyword lispFunc change-class lisp-implementation-version simple-condition +syn keyword lispFunc char list simple-condition-format-arguments +syn keyword lispFunc char< list* simple-condition-format-control +syn keyword lispFunc char<= list-all-packages simple-error +syn keyword lispFunc char= listen simple-string +syn keyword lispFunc char> list-length simple-string-p +syn keyword lispFunc char>= listp simple-type-error +syn keyword lispFunc char/= load simple-vector +syn keyword lispFunc character load-logical-pathname-translations simple-vector-p +syn keyword lispFunc characterp load-time-value simple-warning +syn keyword lispFunc char-bit locally sin +syn keyword lispFunc char-bits log single-flaot-epsilon +syn keyword lispFunc char-bits-limit logand single-float +syn keyword lispFunc char-code logandc1 single-float-epsilon +syn keyword lispFunc char-code-limit logandc2 single-float-negative-epsilon +syn keyword lispFunc char-control-bit logbitp sinh +syn keyword lispFunc char-downcase logcount sixth +syn keyword lispFunc char-equal logeqv sleep +syn keyword lispFunc char-font logical-pathname slot-boundp +syn keyword lispFunc char-font-limit logical-pathname-translations slot-exists-p +syn keyword lispFunc char-greaterp logior slot-makunbound +syn keyword lispFunc char-hyper-bit lognand slot-missing +syn keyword lispFunc char-int lognor slot-unbound +syn keyword lispFunc char-lessp lognot slot-value +syn keyword lispFunc char-meta-bit logorc1 software-type +syn keyword lispFunc char-name logorc2 software-version +syn keyword lispFunc char-not-equal logtest some +syn keyword lispFunc char-not-greaterp logxor sort +syn keyword lispFunc char-not-lessp long-float space +syn keyword lispFunc char-super-bit long-float-epsilon special +syn keyword lispFunc char-upcase long-float-negative-epsilon special-form-p +syn keyword lispFunc check-type long-site-name special-operator-p +syn keyword lispFunc cis loop speed +syn keyword lispFunc class loop-finish sqrt +syn keyword lispFunc class-name lower-case-p stable-sort +syn keyword lispFunc class-of machine-instance standard +syn keyword lispFunc clear-input machine-type standard-char +syn keyword lispFunc clear-output machine-version standard-char-p +syn keyword lispFunc close macroexpand standard-class +syn keyword lispFunc clrhash macroexpand-1 standard-generic-function +syn keyword lispFunc code-char macroexpand-l standard-method +syn keyword lispFunc coerce macro-function standard-object +syn keyword lispFunc commonp macrolet step +syn keyword lispFunc compilation-speed make-array storage-condition +syn keyword lispFunc compile make-array store-value +syn keyword lispFunc compiled-function make-broadcast-stream stream +syn keyword lispFunc compiled-function-p make-char stream-element-type +syn keyword lispFunc compile-file make-concatenated-stream stream-error +syn keyword lispFunc compile-file-pathname make-condition stream-error-stream +syn keyword lispFunc compiler-let make-dispatch-macro-character stream-external-format +syn keyword lispFunc compiler-macro make-echo-stream streamp +syn keyword lispFunc compiler-macro-function make-hash-table streamup +syn keyword lispFunc complement make-instance string +syn keyword lispFunc complex make-instances-obsolete string< +syn keyword lispFunc complexp make-list string<= +syn keyword lispFunc compute-applicable-methods make-load-form string= +syn keyword lispFunc compute-restarts make-load-form-saving-slots string> +syn keyword lispFunc concatenate make-method string>= +syn keyword lispFunc concatenated-stream make-package string/= +syn keyword lispFunc concatenated-stream-streams make-pathname string-capitalize +syn keyword lispFunc cond make-random-state string-char +syn keyword lispFunc condition make-sequence string-char-p +syn keyword lispFunc conjugate make-string string-downcase +syn keyword lispFunc cons make-string-input-stream string-equal +syn keyword lispFunc consp make-string-output-stream string-greaterp +syn keyword lispFunc constantly make-symbol string-left-trim +syn keyword lispFunc constantp make-synonym-stream string-lessp +syn keyword lispFunc continue make-two-way-stream string-not-equal +syn keyword lispFunc control-error makunbound string-not-greaterp +syn keyword lispFunc copy-alist map string-not-lessp +syn keyword lispFunc copy-list mapc stringp +syn keyword lispFunc copy-pprint-dispatch mapcan string-right-strim +syn keyword lispFunc copy-readtable mapcar string-right-trim +syn keyword lispFunc copy-seq mapcon string-stream +syn keyword lispFunc copy-structure maphash string-trim +syn keyword lispFunc copy-symbol map-into string-upcase +syn keyword lispFunc copy-tree mapl structure +syn keyword lispFunc cos maplist structure-class +syn keyword lispFunc cosh mask-field structure-object +syn keyword lispFunc count max style-warning +syn keyword lispFunc count-if member sublim +syn keyword lispFunc count-if-not member-if sublis +syn keyword lispFunc ctypecase member-if-not subseq +syn keyword lispFunc debug merge subsetp +syn keyword lispFunc decf merge-pathname subst +syn keyword lispFunc declaim merge-pathnames subst-if +syn keyword lispFunc declaration method subst-if-not +syn keyword lispFunc declare method-combination substitute +syn keyword lispFunc decode-float method-combination-error substitute-if +syn keyword lispFunc decode-universal-time method-qualifiers substitute-if-not +syn keyword lispFunc defclass min subtypep +syn keyword lispFunc defconstant minusp svref +syn keyword lispFunc defgeneric mismatch sxhash +syn keyword lispFunc define-compiler-macro mod symbol +syn keyword lispFunc define-condition most-negative-double-float symbol-function +syn keyword lispFunc define-method-combination most-negative-fixnum symbol-macrolet +syn keyword lispFunc define-modify-macro most-negative-long-float symbol-name +syn keyword lispFunc define-setf-expander most-negative-short-float symbolp +syn keyword lispFunc define-setf-method most-negative-single-float symbol-package +syn keyword lispFunc define-symbol-macro most-positive-double-float symbol-plist +syn keyword lispFunc defmacro most-positive-fixnum symbol-value +syn keyword lispFunc defmethod most-positive-long-float synonym-stream +syn keyword lispFunc defpackage most-positive-short-float synonym-stream-symbol +syn keyword lispFunc defparameter most-positive-single-float sys +syn keyword lispFunc defsetf muffle-warning system +syn keyword lispFunc defstruct multiple-value-bind t +syn keyword lispFunc deftype multiple-value-call tagbody +syn keyword lispFunc defun multiple-value-list tailp +syn keyword lispFunc defvar multiple-value-prog1 tan +syn keyword lispFunc delete multiple-value-seteq tanh +syn keyword lispFunc delete-duplicates multiple-value-setq tenth +syn keyword lispFunc delete-file multiple-values-limit terpri +syn keyword lispFunc delete-if name-char the +syn keyword lispFunc delete-if-not namestring third +syn keyword lispFunc delete-package nbutlast throw +syn keyword lispFunc denominator nconc time +syn keyword lispFunc deposit-field next-method-p trace +syn keyword lispFunc describe nil translate-logical-pathname +syn keyword lispFunc describe-object nintersection translate-pathname +syn keyword lispFunc destructuring-bind ninth tree-equal +syn keyword lispFunc digit-char no-applicable-method truename +syn keyword lispFunc digit-char-p no-next-method truncase +syn keyword lispFunc directory not truncate +syn keyword lispFunc directory-namestring notany two-way-stream +syn keyword lispFunc disassemble notevery two-way-stream-input-stream +syn keyword lispFunc division-by-zero notinline two-way-stream-output-stream +syn keyword lispFunc do nreconc type +syn keyword lispFunc do* nreverse typecase +syn keyword lispFunc do-all-symbols nset-difference type-error +syn keyword lispFunc documentation nset-exclusive-or type-error-datum +syn keyword lispFunc do-exeternal-symbols nstring type-error-expected-type +syn keyword lispFunc do-external-symbols nstring-capitalize type-of +syn keyword lispFunc dolist nstring-downcase typep +syn keyword lispFunc do-symbols nstring-upcase unbound-slot +syn keyword lispFunc dotimes nsublis unbound-slot-instance +syn keyword lispFunc double-float nsubst unbound-variable +syn keyword lispFunc double-float-epsilon nsubst-if undefined-function +syn keyword lispFunc double-float-negative-epsilon nsubst-if-not unexport +syn keyword lispFunc dpb nsubstitute unintern +syn keyword lispFunc dribble nsubstitute-if union +syn keyword lispFunc dynamic-extent nsubstitute-if-not unless +syn keyword lispFunc ecase nth unread +syn keyword lispFunc echo-stream nthcdr unread-char +syn keyword lispFunc echo-stream-input-stream nth-value unsigned-byte +syn keyword lispFunc echo-stream-output-stream null untrace +syn keyword lispFunc ed number unuse-package +syn keyword lispFunc eighth numberp unwind-protect +syn keyword lispFunc elt numerator update-instance-for-different-class +syn keyword lispFunc encode-universal-time nunion update-instance-for-redefined-class +syn keyword lispFunc end-of-file oddp upgraded-array-element-type +syn keyword lispFunc endp open upgraded-complex-part-type +syn keyword lispFunc enough-namestring open-stream-p upper-case-p +syn keyword lispFunc ensure-directories-exist optimize use-package +syn keyword lispFunc ensure-generic-function or user +syn keyword lispFunc eq otherwise user-homedir-pathname +syn keyword lispFunc eql output-stream-p use-value +syn keyword lispFunc equal package values +syn keyword lispFunc equalp package-error values-list +syn keyword lispFunc error package-error-package variable +syn keyword lispFunc etypecase package-name vector +syn keyword lispFunc eval package-nicknames vectorp +syn keyword lispFunc evalhook packagep vector-pop +syn keyword lispFunc eval-when package-shadowing-symbols vector-push +syn keyword lispFunc evenp package-used-by-list vector-push-extend +syn keyword lispFunc every package-use-list warn +syn keyword lispFunc exp pairlis warning +syn keyword lispFunc export parse-error when +syn keyword lispFunc expt parse-integer wild-pathname-p +syn keyword lispFunc extended-char parse-namestring with-accessors +syn keyword lispFunc fboundp pathname with-compilation-unit +syn keyword lispFunc fceiling pathname-device with-condition-restarts +syn keyword lispFunc fdefinition pathname-directory with-hash-table-iterator +syn keyword lispFunc ffloor pathname-host with-input-from-string +syn keyword lispFunc fifth pathname-match-p with-open-file +syn keyword lispFunc file-author pathname-name with-open-stream +syn keyword lispFunc file-error pathnamep with-output-to-string +syn keyword lispFunc file-error-pathname pathname-type with-package-iterator +syn keyword lispFunc file-length pathname-version with-simple-restart +syn keyword lispFunc file-namestring peek-char with-slots +syn keyword lispFunc file-position phase with-standard-io-syntax +syn keyword lispFunc file-stream pi write +syn keyword lispFunc file-string-length plusp write-byte +syn keyword lispFunc file-write-date pop write-char +syn keyword lispFunc fill position write-line +syn keyword lispFunc fill-pointer position-if write-sequence +syn keyword lispFunc find position-if-not write-string +syn keyword lispFunc find-all-symbols pprint write-to-string +syn keyword lispFunc find-class pprint-dispatch yes-or-no-p +syn keyword lispFunc find-if pprint-exit-if-list-exhausted y-or-n-p +syn keyword lispFunc find-if-not pprint-fill zerop syn match lispFunc "\" if exists("g:lispsyntax_clisp") @@ -563,50 +563,50 @@ " Define Highlighting: {{{1 if !exists("skip_lisp_syntax_inits") - hi def link lispCommentRegion lispComment + hi def link lispCommentRegion lispComment hi def link lispAtomNmbr lispNumber hi def link lispAtomMark lispMark hi def link lispInStringString lispString - hi def link lispAtom Identifier - hi def link lispAtomBarSymbol Special + hi def link lispAtom Identifier + hi def link lispAtomBarSymbol Special hi def link lispBarSymbol Special hi def link lispComment Comment hi def link lispConcat Statement - hi def link lispDecl Statement - hi def link lispFunc Statement - hi def link lispKey Type - hi def link lispMark Delimiter + hi def link lispDecl Statement + hi def link lispFunc Statement + hi def link lispKey Type + hi def link lispMark Delimiter hi def link lispNumber Number hi def link lispParenError Error - hi def link lispEscapeSpecial Type + hi def link lispEscapeSpecial Type hi def link lispString String - hi def link lispTodo Todo - hi def link lispVar Statement + hi def link lispTodo Todo + hi def link lispVar Statement if exists("g:lisp_rainbow") && g:lisp_rainbow != 0 if &bg == "dark" - hi def hlLevel0 ctermfg=red guifg=red1 - hi def hlLevel1 ctermfg=yellow guifg=orange1 - hi def hlLevel2 ctermfg=green guifg=yellow1 - hi def hlLevel3 ctermfg=cyan guifg=greenyellow - hi def hlLevel4 ctermfg=magenta guifg=green1 - hi def hlLevel5 ctermfg=red guifg=springgreen1 - hi def hlLevel6 ctermfg=yellow guifg=cyan1 - hi def hlLevel7 ctermfg=green guifg=slateblue1 - hi def hlLevel8 ctermfg=cyan guifg=magenta1 - hi def hlLevel9 ctermfg=magenta guifg=purple1 + hi def hlLevel0 ctermfg=red guifg=red1 + hi def hlLevel1 ctermfg=yellow guifg=orange1 + hi def hlLevel2 ctermfg=green guifg=yellow1 + hi def hlLevel3 ctermfg=cyan guifg=greenyellow + hi def hlLevel4 ctermfg=magenta guifg=green1 + hi def hlLevel5 ctermfg=red guifg=springgreen1 + hi def hlLevel6 ctermfg=yellow guifg=cyan1 + hi def hlLevel7 ctermfg=green guifg=slateblue1 + hi def hlLevel8 ctermfg=cyan guifg=magenta1 + hi def hlLevel9 ctermfg=magenta guifg=purple1 else - hi def hlLevel0 ctermfg=red guifg=red3 - hi def hlLevel1 ctermfg=darkyellow guifg=orangered3 - hi def hlLevel2 ctermfg=darkgreen guifg=orange2 - hi def hlLevel3 ctermfg=blue guifg=yellow3 - hi def hlLevel4 ctermfg=darkmagenta guifg=olivedrab4 - hi def hlLevel5 ctermfg=red guifg=green4 - hi def hlLevel6 ctermfg=darkyellow guifg=paleturquoise3 - hi def hlLevel7 ctermfg=darkgreen guifg=deepskyblue4 - hi def hlLevel8 ctermfg=blue guifg=darkslateblue - hi def hlLevel9 ctermfg=darkmagenta guifg=darkviolet + hi def hlLevel0 ctermfg=red guifg=red3 + hi def hlLevel1 ctermfg=darkyellow guifg=orangered3 + hi def hlLevel2 ctermfg=darkgreen guifg=orange2 + hi def hlLevel3 ctermfg=blue guifg=yellow3 + hi def hlLevel4 ctermfg=darkmagenta guifg=olivedrab4 + hi def hlLevel5 ctermfg=red guifg=green4 + hi def hlLevel6 ctermfg=darkyellow guifg=paleturquoise3 + hi def hlLevel7 ctermfg=darkgreen guifg=deepskyblue4 + hi def hlLevel8 ctermfg=blue guifg=darkslateblue + hi def hlLevel9 ctermfg=darkmagenta guifg=darkviolet endif endif diff -Nru vim-8.0.1453/runtime/syntax/neomuttrc.vim vim-8.0.1766/runtime/syntax/neomuttrc.vim --- vim-8.0.1453/runtime/syntax/neomuttrc.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/neomuttrc.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,10 +1,10 @@ " Vim syntax file " Language: NeoMutt setup files " Maintainer: Guillaume Brogi -" Last Change: 2017 Oct 28 +" Last Change: 2018-03-25 " Original version based on syntax/muttrc.vim -" This file covers NeoMutt 20170912 +" This file covers NeoMutt 2018-03-23 " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -134,7 +134,7 @@ " Format escapes and conditionals syntax match muttrcFormatConditionals2 contained /[^?]*?/ -function s:escapesConditionals(baseName, sequence, alignment, secondary) +function! s:escapesConditionals(baseName, sequence, alignment, secondary) exec 'syntax match muttrc' . a:baseName . 'Escapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?\%(' . a:sequence . '\|%\)/' if a:alignment exec 'syntax match muttrc' . a:baseName . 'Escapes contained /%[>|*]./' @@ -146,43 +146,40 @@ endif endfunction -" flatcap compiled a list of formats here: https://pastebin.com/raw/5QXhiP6L -" UPDATE -" The following info was pulled from hdr_format_str in hdrline.c -call s:escapesConditionals('IndexFormat', '[AaBbCcDdEeFfgHIiJKLlMmNnOPqrSsTtuvWXxYyZz(<[{]\|G[a-zA-Z]\+', 1, 1) -" The following info was pulled from alias_format_str in addrbook.c +" CHECKED 2018-04-18 +" Ref: index_format_str() in hdrline.c +call s:escapesConditionals('IndexFormat', '[AaBbCcDdEeFfgHIiJKLlMmNnOPqRrSsTtuvWXxYyZz(<[{]\|G[a-zA-Z]\+', 1, 1) +" Ref: alias_format_str() in addrbook.c syntax match muttrcAliasFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[afnrt%]/ -" The following info was pulled from newsgroup_format_str in browser.c +" Ref: group_index_format_str() in browser.c call s:escapesConditionals('GroupIndexFormat', '[CdfMNns]', 1, 1) -" The following info was pulled from cb_format_str in sidebar.c +" Ref: sidebar_format_str() in sidebar.c call s:escapesConditionals('SidebarFormat', '[BdFLNnSt!]', 1, 1) -" The following info was pulled from query_format_str in query.c +" Ref: query_format_str() in query.c call s:escapesConditionals('QueryFormat', '[acent]', 0, 1) -" The following info was pulled from mutt_attach_fmt in recvattach.c +" Ref: attach_format_str() in recvattach.c call s:escapesConditionals('AttachFormat', '[CcDdeFfIMmnQsTtuX]', 1, 1) -" The following info was pulled from compose_format_str in compose.c +" Ref: compose_format_str() in compose.c syntax match muttrcComposeFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[ahlv%]/ syntax match muttrcComposeFormatEscapes contained /%[>|*]./ -" The following info was pulled from folder_format_str in browser.c -call s:escapesConditionals('FolderFormat', '[CDdfFglNstu]', 1, 0) -" The following info was pulled from mix_entry_fmt in remailer.c +" Ref: folder_format_str() in browser.c +call s:escapesConditionals('FolderFormat', '[CDdFfglmNnstu]', 1, 0) +" Ref: mix_format_str() in remailer.c call s:escapesConditionals('MixFormat', '[acns]', 0, 0) -" The following info was pulled from crypt_entry_fmt in crypt-gpgme.c -" and pgp_entry_fmt in pgpkey.c (note that crypt_entry_fmt supports -" 'p', but pgp_entry_fmt does not). +" Ref: status_format_str() in status.c +call s:escapesConditionals('StatusFormat', '[bdFfhLlMmnoPpRrSstuVv]', 1, 1) +" Ref: fmt_smime_command() in ncrypt/smime.c +call s:escapesConditionals('SmimeFormat', '[aCcdfiks]', 0, 1) +" Ref: crypt_format_str() in ncrypt/crypt_gpgme.c +" Ref: pgp_entry_fmt() in ncrypt/pgpkey.c +" Note: crypt_format_str() supports 'p', but pgp_entry_fmt() does not call s:escapesConditionals('PGPFormat', '[acfklnptu[]', 0, 0) -" The following info was pulled from _mutt_fmt_pgp_command in -" pgpinvoke.c +" Ref: fmt_pgp_command() ncrypt/pgpinvoke.c call s:escapesConditionals('PGPCmdFormat', '[afprs]', 0, 1) -" The following info was pulled from status_format_str in status.c -call s:escapesConditionals('StatusFormat', '[bdFfhLlMmnoPprSstuVu]', 1, 1) -" This matches the documentation, but directly contradicts the code -" (according to the code, this should be identical to the -" muttrcPGPCmdFormatEscapes + +" This matches the documentation, but directly contradicts the code +" (according to the code, this should be identical to the muttrcPGPCmdFormatEscapes syntax match muttrcPGPGetKeysFormatEscapes contained /%\%(\%(-\?[0-9]\+\)\?\%(\.[0-9]\+\)\?\)\?[:_]\?[acfklntu[%]/ -" The following info was pulled from _mutt_fmt_smime_command in -" smime.c -call s:escapesConditionals('SmimeFormat', '[aCcdfiks]', 0, 1) syntax region muttrcTimeEscapes contained start=+%{+ end=+}+ contains=muttrcStrftimeEscapes syntax region muttrcTimeEscapes contained start=+%\[+ end=+\]+ contains=muttrcStrftimeEscapes @@ -190,36 +187,36 @@ syntax region muttrcTimeEscapes contained start=+%<+ end=+>+ contains=muttrcStrftimeEscapes syntax region muttrcPGPTimeEscapes contained start=+%\[+ end=+\]+ contains=muttrcStrftimeEscapes -syntax match muttrcVarEqualsAliasFmt contained skipwhite "=" nextgroup=muttrcAliasFormatStr -syntax match muttrcVarEqualsAttachFmt contained skipwhite "=" nextgroup=muttrcAttachFormatStr -syntax match muttrcVarEqualsComposeFmt contained skipwhite "=" nextgroup=muttrcComposeFormatStr -syntax match muttrcVarEqualsFolderFmt contained skipwhite "=" nextgroup=muttrcFolderFormatStr -syntax match muttrcVarEqualsIdxFmt contained skipwhite "=" nextgroup=muttrcIndexFormatStr -syntax match muttrcVarEqualsGrpIdxFmt contained skipwhite "=" nextgroup=muttrcGroupIndexFormatStr -syntax match muttrcVarEqualsMixFmt contained skipwhite "=" nextgroup=muttrcMixFormatStr -syntax match muttrcVarEqualsPGPFmt contained skipwhite "=" nextgroup=muttrcPGPFormatStr -syntax match muttrcVarEqualsQueryFmt contained skipwhite "=" nextgroup=muttrcQueryFormatStr -syntax match muttrcVarEqualsPGPCmdFmt contained skipwhite "=" nextgroup=muttrcPGPCmdFormatStr -syntax match muttrcVarEqualsSdbFmt contained skipwhite "=" nextgroup=muttrcSidebarFormatStr -syntax match muttrcVarEqualsStatusFmt contained skipwhite "=" nextgroup=muttrcStatusFormatStr +syntax match muttrcVarEqualsAliasFmt contained skipwhite "=" nextgroup=muttrcAliasFormatStr +syntax match muttrcVarEqualsAttachFmt contained skipwhite "=" nextgroup=muttrcAttachFormatStr +syntax match muttrcVarEqualsComposeFmt contained skipwhite "=" nextgroup=muttrcComposeFormatStr +syntax match muttrcVarEqualsFolderFmt contained skipwhite "=" nextgroup=muttrcFolderFormatStr +syntax match muttrcVarEqualsGrpIdxFmt contained skipwhite "=" nextgroup=muttrcGroupIndexFormatStr +syntax match muttrcVarEqualsIdxFmt contained skipwhite "=" nextgroup=muttrcIndexFormatStr +syntax match muttrcVarEqualsMixFmt contained skipwhite "=" nextgroup=muttrcMixFormatStr +syntax match muttrcVarEqualsPGPCmdFmt contained skipwhite "=" nextgroup=muttrcPGPCmdFormatStr +syntax match muttrcVarEqualsPGPFmt contained skipwhite "=" nextgroup=muttrcPGPFormatStr syntax match muttrcVarEqualsPGPGetKeysFmt contained skipwhite "=" nextgroup=muttrcPGPGetKeysFormatStr -syntax match muttrcVarEqualsSmimeFmt contained skipwhite "=" nextgroup=muttrcSmimeFormatStr -syntax match muttrcVarEqualsStrftimeFmt contained skipwhite "=" nextgroup=muttrcStrftimeFormatStr +syntax match muttrcVarEqualsQueryFmt contained skipwhite "=" nextgroup=muttrcQueryFormatStr +syntax match muttrcVarEqualsSdbFmt contained skipwhite "=" nextgroup=muttrcSidebarFormatStr +syntax match muttrcVarEqualsSmimeFmt contained skipwhite "=" nextgroup=muttrcSmimeFormatStr +syntax match muttrcVarEqualsStatusFmt contained skipwhite "=" nextgroup=muttrcStatusFormatStr +syntax match muttrcVarEqualsStrftimeFmt contained skipwhite "=" nextgroup=muttrcStrftimeFormatStr syntax match muttrcVPrefix contained /[?&]/ nextgroup=muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +" CHECKED 2018-04-18 " List of the different screens in mutt -" UPDATE -syntax keyword muttrcMenu contained alias attach browser compose editor index pager postpone pgp mix query generic +syntax keyword muttrcMenu contained alias attach browser compose editor generic index key_select_pgp key_select_smime mix pager pgp postpone query smime syntax match muttrcMenuList "\S\+" contained contains=muttrcMenu syntax match muttrcMenuCommas /,/ contained +" CHECKED 2018-04-18 " List of hooks in Commands in init.h -" UPDATE syntax keyword muttrcHooks contained skipwhite - \ account-hook append-hook charset-hook - \ close-hook crypt-hook fcc-hook fcc-save-hook folder-hook iconv-hook mbox-hook - \ message-hook open-hook pgp-hook reply-hook save-hook send-hook send2-hook + \ account-hook append-hook close-hook crypt-hook fcc-hook fcc-save-hook + \ folder-hook iconv-hook mbox-hook message-hook open-hook pgp-hook + \ reply-hook save-hook send-hook send2-hook syntax keyword muttrcHooks skipwhite shutdown-hook startup-hook timeout-hook nextgroup=muttrcCommand syntax region muttrcSpamPattern contained skipwhite keepend start=+'+ skip=+\\'+ end=+'+ contains=muttrcPattern nextgroup=muttrcString,muttrcStringNL @@ -375,28 +372,29 @@ syntax keyword muttrcMono contained mono skipwhite nextgroup=muttrcColorField,muttrcColorCompose syntax match muttrcMonoLine "^\s*mono\s\+\S\+" skipwhite nextgroup=muttrcMonoAttrib contains=muttrcMono +" CHECKED 2018-04-18 " List of fields in Fields in color.c -" UPDATE -syntax keyword muttrcColorField skipwhite contained - \ attach_headers attachment bold error hdrdefault index_author index_collapsed - \ index_date index_label index_number index_size index_subject index_tags - \ indicator markers message normal progress prompt quoted search sidebar_divider +syntax keyword muttrcColorField skipwhite contained + \ attachment attach_headers body bold error hdrdefault header index + \ index_author index_collapsed index_date index_flags index_label + \ index_number index_size index_subject index_tag index_tags indicator + \ markers message normal progress prompt quoted search sidebar_divider \ sidebar_flagged sidebar_highlight sidebar_indicator sidebar_new \ sidebar_ordinary sidebar_spoolfile signature status tilde tree underline - \ body header index index_flags index_tag \ nextgroup=muttrcColor syntax match muttrcColorField contained "\" syntax match muttrcColorCompose skipwhite contained /\s*compose\s*/ nextgroup=muttrcColorComposeField + +" CHECKED 2018-04-18 " List of fields in ComposeFields in color.c -" UPDATE syntax keyword muttrcColorComposeField skipwhite contained - \ header security_encrypt security_sign security_both security_none + \ header security_both security_encrypt security_none security_sign \ nextgroup=muttrcColorFG,muttrcColorFGNL syntax region muttrcColorLine keepend start=/^\s*color\s\+/ skip=+\\$+ end=+$+ contains=muttrcColorKeyword,muttrcComment,muttrcUnHighlightSpace -function s:boolQuadGen(type, vars, deprecated) +function! s:boolQuadGen(type, vars, deprecated) let l:novars = copy(a:vars) call map(l:novars, '"no" . v:val') let l:invvars = copy(a:vars) @@ -414,104 +412,107 @@ exec 'syntax keyword muttrcVar' . l:type . ' skipwhite contained ' . join(l:invvars) . ' nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr' endfunction +" CHECKED 2018-04-18 " List of DT_BOOL in MuttVars in init.h -" UPDATE call s:boolQuadGen('Bool', [ - \ 'allow_8bit', 'allow_ansi', 'arrow_cursor', 'ascii_chars', 'askbcc', 'askcc', - \ 'ask_follow_up', 'ask_x_comment_to', 'attach_split', 'autoedit', 'auto_tag', - \ 'beep', 'beep_new', 'bounce_delivered', 'braille_friendly', 'check_mbox_size', - \ 'check_new', 'collapse_all', 'collapse_flagged', 'collapse_unread', - \ 'confirmappend', 'confirmcreate', 'crypt_autoencrypt', 'crypt_autopgp', - \ 'crypt_autosign', 'crypt_autosmime', 'crypt_confirmhook', - \ 'crypt_opportunistic_encrypt', 'crypt_replyencrypt', 'crypt_replysign', - \ 'crypt_replysignencrypted', 'crypt_timestamp', 'crypt_use_gpgme', - \ 'crypt_use_pka', 'delete_untag', 'digest_collapse', 'duplicate_threads', - \ 'edit_headers', 'encode_from', 'fast_reply', 'fcc_clear', 'flag_safe', - \ 'followup_to', 'force_name', 'forward_decode', 'forward_decrypt', - \ 'forward_quote', 'forward_references', 'hdrs', 'header', - \ 'header_cache_compress', 'header_color_partial', 'help', 'hidden_host', - \ 'hide_limited', 'hide_missing', 'hide_thread_subject', 'hide_top_limited', - \ 'hide_top_missing', 'history_remove_dups', 'honor_disposition', 'idn_decode', - \ 'idn_encode', 'ignore_linear_white_space', 'ignore_list_reply_to', - \ 'imap_check_subscribed', 'imap_idle', 'imap_list_subscribed', 'imap_passive', - \ 'imap_peek', 'imap_servernoise', 'implicit_autoview', 'include_onlyfirst', - \ 'keep_flagged', 'keywords_legacy', 'keywords_standard', 'mailcap_sanitize', - \ 'mail_check_recent', 'mail_check_stats', 'maildir_check_cur', - \ 'maildir_header_cache_verify', 'maildir_trash', 'markers', 'mark_old', - \ 'menu_move_off', 'menu_scroll', 'message_cache_clean', 'meta_key', 'metoo', - \ 'mh_purge', 'mime_forward_decode', 'mime_subject', 'mime_type_query_first', - \ 'narrow_tree', 'nm_record', 'nntp_listgroup', 'nntp_load_description', - \ 'pager_stop', 'pgp_auto_decode', 'pgp_autoinline', 'pgp_check_exit', - \ 'pgp_ignore_subkeys', 'pgp_long_ids', 'pgp_replyinline', - \ 'pgp_retainable_sigs', 'pgp_self_encrypt', 'pgp_show_unusable', - \ 'pgp_strict_enc', 'pgp_use_gpg_agent', 'pipe_decode', 'pipe_split', - \ 'pop_auth_try_all', 'pop_last', 'postpone_encrypt', 'print_decode', - \ 'print_split', 'prompt_after', 'read_only', 'reflow_space_quotes', - \ 'reflow_text', 'reply_self', 'reply_with_xorig', 'resolve', - \ 'resume_draft_files', 'resume_edited_draft_files', 'reverse_alias', - \ 'reverse_name', 'reverse_realname', 'rfc2047_parameters', 'save_address', - \ 'save_empty', 'save_name', 'save_unsubscribed', 'score', 'show_new_news', - \ 'show_only_unread', 'sidebar_folder_indent', 'sidebar_new_mail_only', - \ 'sidebar_next_new_wrap', 'sidebar_on_right', 'sidebar_short_path', - \ 'sidebar_visible', 'sig_dashes', 'sig_on_top', 'smart_wrap', - \ 'smime_ask_cert_label', 'smime_decrypt_use_default_key', 'smime_is_default', - \ 'smime_self_encrypt', 'sort_re', 'ssl_force_tls', 'ssl_use_sslv2', - \ 'ssl_use_sslv3', 'ssl_usesystemcerts', 'ssl_use_tlsv1', 'ssl_use_tlsv1_1', - \ 'ssl_use_tlsv1_2', 'ssl_verify_dates', 'ssl_verify_host', - \ 'ssl_verify_partial_chains', 'status_on_top', 'strict_threads', 'suspend', - \ 'text_flowed', 'thorough_search', 'thread_received', 'tilde', 'ts_enabled', - \ 'uncollapse_jump', 'uncollapse_new', 'use_8bitmime', 'use_domain', - \ 'use_envelope_from', 'use_from', 'use_ipv6', 'user_agent', - \ 'virtual_spoolfile', 'wait_key', 'weed', 'wrap_search', 'write_bcc', - \ 'x_comment_to' + \ 'allow_8bit', 'allow_ansi', 'arrow_cursor', 'ascii_chars', 'askbcc', + \ 'askcc', 'ask_follow_up', 'ask_x_comment_to', 'attach_split', 'autoedit', + \ 'auto_tag', 'beep', 'beep_new', 'bounce_delivered', 'braille_friendly', + \ 'change_folder_next', 'check_mbox_size', 'check_new', 'collapse_all', + \ 'collapse_flagged', 'collapse_unread', 'confirmappend', 'confirmcreate', + \ 'crypt_autoencrypt', 'crypt_autopgp', 'crypt_autosign', 'crypt_autosmime', + \ 'crypt_confirmhook', 'crypt_opportunistic_encrypt', 'crypt_replyencrypt', + \ 'crypt_replysign', 'crypt_replysignencrypted', 'crypt_timestamp', + \ 'crypt_use_gpgme', 'crypt_use_pka', 'delete_untag', 'digest_collapse', + \ 'duplicate_threads', 'edit_headers', 'encode_from', 'fast_reply', + \ 'fcc_clear', 'flag_safe', 'followup_to', 'force_name', 'forward_decode', + \ 'forward_decrypt', 'forward_quote', 'forward_references', 'hdrs', + \ 'header', 'header_cache_compress', 'header_color_partial', 'help', + \ 'hidden_host', 'hide_limited', 'hide_missing', 'hide_thread_subject', + \ 'hide_top_limited', 'hide_top_missing', 'history_remove_dups', + \ 'honor_disposition', 'idn_decode', 'idn_encode', 'ignore_list_reply_to', + \ 'imap_check_subscribed', 'imap_idle', 'imap_list_subscribed', + \ 'imap_passive', 'imap_peek', 'imap_servernoise', 'implicit_autoview', + \ 'include_onlyfirst', 'keep_flagged', 'mailcap_sanitize', + \ 'maildir_check_cur', 'maildir_header_cache_verify', 'maildir_trash', + \ 'mail_check_recent', 'mail_check_stats', 'markers', 'mark_old', + \ 'menu_move_off', 'menu_scroll', 'message_cache_clean', 'meta_key', + \ 'metoo', 'mh_purge', 'mime_forward_decode', 'mime_subject', + \ 'mime_type_query_first', 'narrow_tree', 'nm_record', 'nntp_listgroup', + \ 'nntp_load_description', 'pager_stop', 'pgp_autoinline', + \ 'pgp_auto_decode', 'pgp_check_exit', 'pgp_ignore_subkeys', 'pgp_long_ids', + \ 'pgp_replyinline', 'pgp_retainable_sigs', 'pgp_self_encrypt', + \ 'pgp_show_unusable', 'pgp_strict_enc', 'pgp_use_gpg_agent', 'pipe_decode', + \ 'pipe_split', 'pop_auth_try_all', 'pop_last', 'postpone_encrypt', + \ 'print_decode', 'print_split', 'prompt_after', 'read_only', + \ 'reflow_space_quotes', 'reflow_text', 'reply_self', 'reply_with_xorig', + \ 'resolve', 'resume_draft_files', 'resume_edited_draft_files', + \ 'reverse_alias', 'reverse_name', 'reverse_realname', 'rfc2047_parameters', + \ 'save_address', 'save_empty', 'save_name', 'save_unsubscribed', 'score', + \ 'show_new_news', 'show_only_unread', 'sidebar_folder_indent', + \ 'sidebar_new_mail_only', 'sidebar_next_new_wrap', 'sidebar_on_right', + \ 'sidebar_short_path', 'sidebar_visible', 'sig_dashes', 'sig_on_top', + \ 'smart_wrap', 'smime_ask_cert_label', 'smime_decrypt_use_default_key', + \ 'smime_is_default', 'smime_self_encrypt', 'sort_re', 'ssl_force_tls', + \ 'ssl_usesystemcerts', 'ssl_use_sslv2', 'ssl_use_sslv3', 'ssl_use_tlsv1', + \ 'ssl_use_tlsv1_1', 'ssl_use_tlsv1_2', 'ssl_verify_dates', + \ 'ssl_verify_host', 'ssl_verify_partial_chains', 'status_on_top', + \ 'strict_threads', 'suspend', 'text_flowed', 'thorough_search', + \ 'thread_received', 'tilde', 'ts_enabled', 'uncollapse_jump', + \ 'uncollapse_new', 'user_agent', 'use_8bitmime', 'use_domain', + \ 'use_envelope_from', 'use_from', 'use_ipv6', 'virtual_spoolfile', + \ 'wait_key', 'weed', 'wrap_search', 'write_bcc', 'x_comment_to' \ ], 0) +" CHECKED 2018-04-18 " Deprecated Bools -" UPDATE " List of DT_SYNONYM synonyms of Bools in MuttVars in init.h call s:boolQuadGen('Bool', [ - \ 'edit_hdrs', 'envelope_from', 'forw_decode', 'forw_decrypt', 'forw_quote', - \ 'pgp_autoencrypt', 'pgp_autosign', 'pgp_auto_traditional', - \ 'pgp_create_traditional', 'pgp_replyencrypt', 'pgp_replysign', - \ 'pgp_replysignencrypted', 'xterm_set_titles' + \ 'edit_hdrs', 'envelope_from', 'forw_decode', 'forw_decrypt', + \ 'forw_quote', 'ignore_linear_white_space', 'pgp_autoencrypt', + \ 'pgp_autosign', 'pgp_auto_traditional', 'pgp_create_traditional', + \ 'pgp_replyencrypt', 'pgp_replysign', 'pgp_replysignencrypted', + \ 'xterm_set_titles' \ ], 1) +" CHECKED 2018-04-18 " List of DT_QUAD in MuttVars in init.h -" UPDATE call s:boolQuadGen('Quad', [ \ 'abort_noattach', 'abort_nosubject', 'abort_unmodified', 'bounce', \ 'catchup_newsgroup', 'copy', 'crypt_verify_sig', 'delete', 'fcc_attach', \ 'followup_to_poster', 'forward_edit', 'honor_followup_to', 'include', - \ 'mime_forward', 'mime_forward_rest', 'move', 'pgp_encrypt_self', - \ 'pgp_mime_auto', 'pop_delete', 'pop_reconnect', 'post_moderated', 'postpone', - \ 'print', 'quit', 'recall', 'reply_to', 'smime_encrypt_self', 'ssl_starttls', + \ 'mime_forward', 'mime_forward_rest', 'move', 'pgp_mime_auto', + \ 'pop_delete', 'pop_reconnect', 'postpone', 'post_moderated', 'print', + \ 'quit', 'recall', 'reply_to', 'ssl_starttls' \ ], 0) +" CHECKED 2018-04-18 " Deprecated Quads -" UPDATE " List of DT_SYNONYM synonyms of Quads in MuttVars in init.h call s:boolQuadGen('Quad', [ - \ 'mime_fwd', 'pgp_verify_sig' + \ 'mime_fwd', 'pgp_encrypt_self', 'pgp_verify_sig', 'smime_encrypt_self' \ ], 1) +" CHECKED 2018-04-18 " List of DT_NUMBER in MuttVars in init.h -" UPDATE syntax keyword muttrcVarNum skipwhite contained \ connect_timeout debug_level history imap_keepalive imap_pipeline_depth - \ imap_poll_timeout mail_check mail_check_stats_interval menu_context net_inc - \ nm_db_limit nm_open_timeout nm_query_window_current_position + \ imap_poll_timeout mail_check mail_check_stats_interval menu_context + \ net_inc nm_db_limit nm_open_timeout nm_query_window_current_position \ nm_query_window_duration nntp_context nntp_poll pager_context \ pager_index_lines pgp_timeout pop_checkinterval read_inc reflow_wrap - \ save_history score_threshold_delete score_threshold_flag score_threshold_read - \ search_context sendmail_wait sidebar_width skip_quoted_offset sleep_time - \ smime_timeout ssl_min_dh_prime_bits time_inc timeout wrap wrap_headers - \ wrapmargin write_inc + \ save_history score_threshold_delete score_threshold_flag + \ score_threshold_read search_context sendmail_wait sidebar_component_depth + \ sidebar_width skip_quoted_offset sleep_time smime_timeout + \ ssl_min_dh_prime_bits timeout time_inc wrap wrap_headers write_inc + \ nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +syntax keyword muttrcVarDeprecatedNum contained skipwhite + \ wrapmargin \ nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +" CHECKED 2018-04-18 " List of DT_STRING in MuttVars in init.h -" UPDATE " Special cases first, and all the rest at the end -" A lot of special cases are format, flatcap compiled a list here https://pastebin.com/raw/5QXhiP6L " Formats themselves must be updated in their respective groups " See s:escapesConditionals syntax match muttrcVarStr contained skipwhite 'my_[a-zA-Z0-9_]\+' nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr @@ -523,49 +524,52 @@ " Deprecated format syntax keyword muttrcVarDeprecatedStr contained skipwhite hdr_format msg_format nextgroup=muttrcVarEqualsIdxFmt syntax keyword muttrcVarStr contained skipwhite mix_entry_format nextgroup=muttrcVarEqualsMixFmt -syntax keyword muttrcVarStr contained skipwhite - \ pgp_decode_command pgp_verify_command pgp_decrypt_command - \ pgp_clearsign_command pgp_sign_command pgp_encrypt_sign_command - \ pgp_encrypt_only_command pgp_import_command pgp_export_command - \ pgp_verify_key_command pgp_list_secring_command pgp_list_pubring_command +syntax keyword muttrcVarStr contained skipwhite + \ pgp_clearsign_command pgp_decode_command pgp_decrypt_command + \ pgp_encrypt_only_command pgp_encrypt_sign_command pgp_export_command + \ pgp_import_command pgp_list_pubring_command pgp_list_secring_command + \ pgp_sign_command pgp_verify_command pgp_verify_key_command \ nextgroup=muttrcVarEqualsPGPCmdFmt syntax keyword muttrcVarStr contained skipwhite pgp_entry_format nextgroup=muttrcVarEqualsPGPFmt syntax keyword muttrcVarStr contained skipwhite pgp_getkeys_command nextgroup=muttrcVarEqualsPGPGetKeysFmt syntax keyword muttrcVarStr contained skipwhite query_format nextgroup=muttrcVarEqualsQueryFmt syntax keyword muttrcVarStr contained skipwhite - \ smime_decrypt_command smime_verify_command smime_verify_opaque_command - \ smime_sign_command smime_sign_opaque_command smime_encrypt_command - \ smime_pk7out_command smime_get_cert_command smime_get_signer_cert_command - \ smime_import_cert_command smime_get_cert_email_command + \ smime_decrypt_command smime_encrypt_command smime_get_cert_command + \ smime_get_cert_email_command smime_get_signer_cert_command + \ smime_import_cert_command smime_pk7out_command smime_sign_command + \ smime_verify_command smime_verify_opaque_command \ nextgroup=muttrcVarEqualsSmimeFmt syntax keyword muttrcVarStr contained skipwhite ts_icon_format ts_status_format status_format nextgroup=muttrcVarEqualsStatusFmt " Deprecated format syntax keyword muttrcVarDeprecatedStr contained skipwhite xterm_icon xterm_title nextgroup=muttrcVarEqualsStatusFmt syntax keyword muttrcVarStr contained skipwhite date_format nextgroup=muttrcVarEqualsStrftimeFmt -syntax keyword muttrcVarStr contained skipwhite group_index_format nextgroup=muttrcVarEqualsGrpIdxFmt +syntax keyword muttrcVarStr contained skipwhite group_index_format nextgroup=muttrcVarEqualsGrpIdxFmt syntax keyword muttrcVarStr contained skipwhite sidebar_format nextgroup=muttrcVarEqualsSdbFmt syntax keyword muttrcVarStr contained skipwhite \ assumed_charset attach_charset attach_sep attribution_locale charset - \ config_charset content_type default_hook dsn_notify dsn_return empty_subject - \ escape forward_attribution_intro forward_attribution_trailer forward_format - \ header_cache_pagesize hostname imap_authenticators imap_delim_chars - \ imap_headers imap_login imap_pass imap_user indent_string mailcap_path - \ mark_macro_prefix mh_seq_flagged mh_seq_replied mh_seq_unseen - \ mime_type_query_command newsgroups_charset news_server nm_default_uri - \ nm_exclude_tags nm_hidden_tags nm_query_type nm_query_window_current_search - \ nm_query_window_timebase nm_record_tags nm_unread_tag nntp_authenticators - \ nntp_pass nntp_user pgp_self_encrypt_as pgp_sign_as pipe_sep - \ pop_authenticators pop_host pop_pass pop_user post_indent_string - \ postpone_encrypt_as preconnect realname send_charset + \ config_charset content_type default_hook dsn_notify dsn_return + \ empty_subject escape forward_attribution_intro forward_attribution_trailer + \ forward_format header_cache_pagesize hidden_tags hostname + \ imap_authenticators imap_delim_chars imap_headers imap_login imap_pass + \ imap_user indent_string mailcap_path mark_macro_prefix mh_seq_flagged + \ mh_seq_replied mh_seq_unseen mime_type_query_command newsgroups_charset + \ news_server nm_default_uri nm_exclude_tags nm_query_type + \ nm_query_window_current_search nm_query_window_timebase nm_record_tags + \ nm_unread_tag nntp_authenticators nntp_pass nntp_user pgp_default_key + \ pgp_sign_as pipe_sep pop_authenticators pop_host pop_pass pop_user + \ postpone_encrypt_as post_indent_string preconnect realname send_charset \ show_multipart_alternative sidebar_delim_chars sidebar_divider_char \ sidebar_indent_string simple_search smime_default_key smime_encrypt_with - \ smime_self_encrypt_as smime_sign_digest_alg smtp_authenticators smtp_pass - \ smtp_url spam_separator ssl_ciphers tunnel xlabel_delimiter + \ smime_sign_as smime_sign_digest_alg smtp_authenticators smtp_pass smtp_url + \ spam_separator ssl_ciphers tunnel \ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr " Deprecated strings syntax keyword muttrcVarDeprecatedStr contained skipwhite - \ forw_format indent_str post_indent_str smime_sign_as + \ forw_format indent_str pgp_self_encrypt_as post_indent_str + \ smime_self_encrypt_as \ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr + +" CHECKED 2018-04-18 " List of DT_ADDRESS syntax keyword muttrcVarStr contained skipwhite envelope_from_address from nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr " List of DT_HCACHE @@ -574,6 +578,8 @@ syntax keyword muttrcVarStr contained skipwhite mbox_type nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr " List of DT_MBTABLE syntax keyword muttrcVarStr contained skipwhite flag_chars from_chars status_chars to_chars nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr + +" CHECKED 2018-04-18 " List of DT_PATH syntax keyword muttrcVarStr contained skipwhite \ alias_file certificate_file debug_file display_filter editor entropy_file @@ -583,20 +589,24 @@ \ smime_certificates smime_keys spoolfile ssl_ca_certificates_file \ ssl_client_cert tmpdir trash visual \ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr -" List of deprecated DT_PATH -syntax keyword muttrcVarDeprecatedStr contained skipwhite print_cmd nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr + +" CHECKED 2018-04-18 " List of DT_REGEX syntax keyword muttrcVarStr contained skipwhite - \ attach_keyword gecos_mask mask pgp_decryption_okay pgp_good_sign quote_regexp - \ reply_regexp smileys + \ abort_noattach_regex gecos_mask mask pgp_decryption_okay pgp_good_sign + \ quote_regex reply_regex smileys \ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +" List of deprecated DT_PATH +syntax keyword muttrcVarDeprecatedStr contained skipwhite print_cmd nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +" List of deprecated DT_REGEX +syntax keyword muttrcVarDeprecatedStr contained skipwhite abort_noattach_regexp attach_keyword quote_regexp reply_regexp nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr " List of DT_SORT syntax keyword muttrcVarStr contained skipwhite \ pgp_sort_keys sidebar_sort_method sort sort_alias sort_aux sort_browser \ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr +" CHECKED 2018-04-18 " List of commands in Commands in init.h -" UPDATE " Remember to remove hooks, they have already been dealt with syntax keyword muttrcCommand skipwhite charset-hook nextgroup=muttrcRXString syntax keyword muttrcCommand skipwhite unhook nextgroup=muttrcHooks @@ -609,19 +619,16 @@ syntax keyword muttrcCommand skipwhite set unset reset toggle nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr,muttrcVarDeprecatedBool,muttrcVarDeprecatedQuad,muttrcVarDeprecatedStr syntax keyword muttrcCommand skipwhite exec nextgroup=muttrcFunction syntax keyword muttrcCommand skipwhite - \ alternative_order attachments auto_view hdr_order ifdef ifndef ignore lua - \ lua-source mailboxes mailto_allow mime_lookup my_hdr push score setenv - \ sidebar_whitelist source subjectrx tag-formats tag-transforms - \ unalternative_order unattachments unauto_view uncolor unhdr_order unignore - \ unmailboxes unmailto_allow unmime_lookup unmono unmy_hdr unscore unsetenv - \ unsidebar_whitelist unsubjectrx unvirtual-mailboxes virtual-mailboxes + \ alternative_order attachments auto_view finish hdr_order ifdef ifndef + \ ignore lua lua-source mailboxes mailto_allow mime_lookup my_hdr push score + \ setenv sidebar_whitelist source subjectrx subscribe-to tag-formats + \ tag-transforms unalternative_order unattachments unauto_view uncolor + \ unhdr_order unignore unmailboxes unmailto_allow unmime_lookup unmono + \ unmy_hdr unscore unsetenv unsidebar_whitelist unsubjectrx unsubscribe-from + \ unvirtual-mailboxes virtual-mailboxes +" CHECKED 2018-04-18 " List of functions in functions.h -" UPDATE -syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -632,8 +639,8 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -643,10 +650,10 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -654,8 +661,8 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -668,7 +675,6 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -676,13 +682,13 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -696,11 +702,14 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -723,11 +732,13 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -739,29 +750,32 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -770,8 +784,8 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -782,8 +796,8 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -801,40 +815,41 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -846,8 +861,8 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -855,8 +870,8 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -864,11 +879,12 @@ syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" -syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" +syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" syntax match muttrcFunction contained "\" @@ -1029,4 +1045,5 @@ let &cpo = s:cpo_save unlet s:cpo_save -"EOF vim: ts=8 noet tw=100 sw=8 sts=0 ft=vim + +" vim: ts=8 noet tw=100 sw=8 sts=0 ft=vim isk+=- diff -Nru vim-8.0.1453/runtime/syntax/ninja.vim vim-8.0.1766/runtime/syntax/ninja.vim --- vim-8.0.1453/runtime/syntax/ninja.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/ninja.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,16 +1,16 @@ " ninja build file syntax. " Language: ninja build file as described at -" http://martine.github.com/ninja/manual.html -" Version: 1.4 -" Last Change: 2014/05/13 +" http://ninja-build.org/manual.html +" Version: 1.5 +" Last Change: 2018/04/05 " Maintainer: Nicolas Weber -" Version 1.4 of this script is in the upstream vim repository and will be +" Version 1.5 of this script is in the upstream vim repository and will be " included in the next vim release. If you change this, please send your change " upstream. " ninja lexer and parser are at -" https://github.com/martine/ninja/blob/master/src/lexer.in.cc -" https://github.com/martine/ninja/blob/master/src/manifest_parser.cc +" https://github.com/ninja-build/ninja/blob/master/src/lexer.in.cc +" https://github.com/ninja-build/ninja/blob/master/src/manifest_parser.cc if exists("b:current_syntax") finish @@ -21,7 +21,10 @@ syn case match -syn match ninjaComment /#.*/ contains=@Spell +" Comments are only matched when the # is at the beginning of the line (with +" optional whitespace), as long as the prior line didn't end with a $ +" continuation. +syn match ninjaComment /\(\$\n\)\@ -" Original author: Dirk van Deun +" Language: Scheme (R7RS) +" Last Change: 2018-01-06 +" Author: Evan Hanson +" Maintainer: Evan Hanson +" Previous Author: Dirk van Deun +" Previous Maintainer: Sergey Khorev +" URL: https://foldling.org/vim/syntax/scheme.vim -" This script incorrectly recognizes some junk input as numerals: -" parsing the complete system of Scheme numerals using the pattern -" language is practically impossible: I did a lax approximation. - -" MzScheme extensions can be activated with setting is_mzscheme variable - -" Suggestions and bug reports are solicited by the author. - -" Initializing: - -" quit when a syntax file was already loaded -if exists("b:current_syntax") +if exists('b:current_syntax') finish endif -let s:cpo_save = &cpo +let s:cpo = &cpo set cpo&vim -syn case ignore +syn match schemeParentheses "[^ '`\t\n()\[\]";]\+" +syn match schemeParentheses "[)\]]" -" Fascist highlighting: everything that doesn't fit the rules is an error... +syn match schemeIdentifier /[^ '`\t\n()\[\]"|;][^ '`\t\n()\[\]"|;]*/ -syn match schemeError ![^ \t()\[\]";]*! -syn match schemeError ")" +syn region schemeQuote matchgroup=schemeData start=/'[`']*/ end=/[ \t\n()\[\]";]/me=e-1 +syn region schemeQuote matchgroup=schemeData start=/'['`]*"/ skip=/\\[\\"]/ end=/"/ +syn region schemeQuote matchgroup=schemeData start=/'['`]*|/ skip=/\\[\\|]/ end=/|/ +syn region schemeQuote matchgroup=schemeData start=/'['`]*#\?(/ end=/)/ contains=ALLBUT,schemeQuasiquote,schemeQuasiquoteForm,schemeUnquote,schemeForm,schemeDatumCommentForm,schemeImport,@schemeImportCluster,@schemeSyntaxCluster -" Quoted and backquoted stuff +syn region schemeQuasiquote matchgroup=schemeData start=/`['`]*/ end=/[ \t\n()\[\]";]/me=e-1 +syn region schemeQuasiquote matchgroup=schemeData start=/`['`]*#\?(/ end=/)/ contains=ALLBUT,schemeQuote,schemeQuoteForm,schemeForm,schemeDatumCommentForm,schemeImport,@schemeImportCluster,@schemeSyntaxCluster -syn region schemeQuoted matchgroup=Delimiter start="['`]" end=![ \t()\[\]";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc - -syn region schemeQuoted matchgroup=Delimiter start="['`](" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc -syn region schemeQuoted matchgroup=Delimiter start="['`]#(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc - -syn region schemeStrucRestricted matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc -syn region schemeStrucRestricted matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc - -" Popular Scheme extension: -" using [] as well as () -syn region schemeStrucRestricted matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc -syn region schemeStrucRestricted matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc - -syn region schemeUnquote matchgroup=Delimiter start="," end=![ \t\[\]()";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc -syn region schemeUnquote matchgroup=Delimiter start=",@" end=![ \t\[\]()";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc - -syn region schemeUnquote matchgroup=Delimiter start=",(" end=")" contains=ALL -syn region schemeUnquote matchgroup=Delimiter start=",@(" end=")" contains=ALL - -syn region schemeUnquote matchgroup=Delimiter start=",#(" end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc -syn region schemeUnquote matchgroup=Delimiter start=",@#(" end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc - -syn region schemeUnquote matchgroup=Delimiter start=",\[" end="\]" contains=ALL -syn region schemeUnquote matchgroup=Delimiter start=",@\[" end="\]" contains=ALL - -syn region schemeUnquote matchgroup=Delimiter start=",#\[" end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc -syn region schemeUnquote matchgroup=Delimiter start=",@#\[" end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc - -" R5RS Scheme Functions and Syntax: - -setlocal iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_ - -syn keyword schemeSyntax lambda and or if cond case define let let* letrec -syn keyword schemeSyntax begin do delay set! else => -syn keyword schemeSyntax quote quasiquote unquote unquote-splicing -syn keyword schemeSyntax define-syntax let-syntax letrec-syntax syntax-rules -" R6RS -syn keyword schemeSyntax define-record-type fields protocol - -syn keyword schemeFunc not boolean? eq? eqv? equal? pair? cons car cdr set-car! -syn keyword schemeFunc set-cdr! caar cadr cdar cddr caaar caadr cadar caddr -syn keyword schemeFunc cdaar cdadr cddar cdddr caaaar caaadr caadar caaddr -syn keyword schemeFunc cadaar cadadr caddar cadddr cdaaar cdaadr cdadar cdaddr -syn keyword schemeFunc cddaar cddadr cdddar cddddr null? list? list length -syn keyword schemeFunc append reverse list-ref memq memv member assq assv assoc -syn keyword schemeFunc symbol? symbol->string string->symbol number? complex? -syn keyword schemeFunc real? rational? integer? exact? inexact? = < > <= >= -syn keyword schemeFunc zero? positive? negative? odd? even? max min + * - / abs -syn keyword schemeFunc quotient remainder modulo gcd lcm numerator denominator -syn keyword schemeFunc floor ceiling truncate round rationalize exp log sin cos -syn keyword schemeFunc tan asin acos atan sqrt expt make-rectangular make-polar -syn keyword schemeFunc real-part imag-part magnitude angle exact->inexact -syn keyword schemeFunc inexact->exact number->string string->number char=? -syn keyword schemeFunc char-ci=? char? char-ci>? char<=? -syn keyword schemeFunc char-ci<=? char>=? char-ci>=? char-alphabetic? char? -syn keyword schemeFunc char-numeric? char-whitespace? char-upper-case? -syn keyword schemeFunc char-lower-case? -syn keyword schemeFunc char->integer integer->char char-upcase char-downcase -syn keyword schemeFunc string? make-string string string-length string-ref -syn keyword schemeFunc string-set! string=? string-ci=? string? string-ci>? string<=? string-ci<=? string>=? -syn keyword schemeFunc string-ci>=? substring string-append vector? make-vector -syn keyword schemeFunc vector vector-length vector-ref vector-set! procedure? -syn keyword schemeFunc apply map for-each call-with-current-continuation -syn keyword schemeFunc call-with-input-file call-with-output-file input-port? -syn keyword schemeFunc output-port? current-input-port current-output-port -syn keyword schemeFunc open-input-file open-output-file close-input-port -syn keyword schemeFunc close-output-port eof-object? read read-char peek-char -syn keyword schemeFunc write display newline write-char call/cc -syn keyword schemeFunc list-tail string->list list->string string-copy -syn keyword schemeFunc string-fill! vector->list list->vector vector-fill! -syn keyword schemeFunc force with-input-from-file with-output-to-file -syn keyword schemeFunc char-ready? load transcript-on transcript-off eval -syn keyword schemeFunc dynamic-wind port? values call-with-values -syn keyword schemeFunc scheme-report-environment null-environment -syn keyword schemeFunc interaction-environment -" R6RS -syn keyword schemeFunc make-eq-hashtable make-eqv-hashtable make-hashtable -syn keyword schemeFunc hashtable? hashtable-size hashtable-ref hashtable-set! -syn keyword schemeFunc hashtable-delete! hashtable-contains? hashtable-update! -syn keyword schemeFunc hashtable-copy hashtable-clear! hashtable-keys -syn keyword schemeFunc hashtable-entries hashtable-equivalence-function hashtable-hash-function -syn keyword schemeFunc hashtable-mutable? equal-hash string-hash string-ci-hash symbol-hash -syn keyword schemeFunc find for-all exists filter partition fold-left fold-right -syn keyword schemeFunc remp remove remv remq memp assp cons* - -" ... so that a single + or -, inside a quoted context, would not be -" interpreted as a number (outside such contexts, it's a schemeFunc) - -syn match schemeDelimiter !\.[ \t\[\]()";]!me=e-1 -syn match schemeDelimiter !\.$! -" ... and a single dot is not a number but a delimiter - -" This keeps all other stuff unhighlighted, except *stuff* and : - -syn match schemeOther ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*, -syn match schemeError ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, - -syn match schemeOther "\.\.\." -syn match schemeError !\.\.\.[^ \t\[\]()";]\+! -" ... a special identifier - -syn match schemeConstant ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]\+\*[ \t\[\]()";],me=e-1 -syn match schemeConstant ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]\+\*$, -syn match schemeError ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, - -syn match schemeConstant ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[ \t\[\]()";],me=e-1 -syn match schemeConstant ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>$, -syn match schemeError ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, - -" Non-quoted lists, and strings: - -syn region schemeStruc matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALL -syn region schemeStruc matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALL - -syn region schemeStruc matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALL -syn region schemeStruc matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALL - -" Simple literals: -syn region schemeString start=+\%(\\\)\@?^_~0-9+.@#%]\+" - " anything limited by |'s is identifier - syn match schemeOther "|[^|]\+|" - - syn match schemeCharacter "#\\\%(return\|tab\)" - - " Modules require stmt - syn keyword schemeExtSyntax module require dynamic-require lib prefix all-except prefix-all-except rename - " modules provide stmt - syn keyword schemeExtSyntax provide struct all-from all-from-except all-defined all-defined-except - " Other from MzScheme - syn keyword schemeExtSyntax with-handlers when unless instantiate define-struct case-lambda syntax-case - syn keyword schemeExtSyntax free-identifier=? bound-identifier=? module-identifier=? syntax-object->datum - syn keyword schemeExtSyntax datum->syntax-object - syn keyword schemeExtSyntax let-values let*-values letrec-values set!-values fluid-let parameterize begin0 - syn keyword schemeExtSyntax error raise opt-lambda define-values unit unit/sig define-signature - syn keyword schemeExtSyntax invoke-unit/sig define-values/invoke-unit/sig compound-unit/sig import export - syn keyword schemeExtSyntax link syntax quasisyntax unsyntax with-syntax - - syn keyword schemeExtFunc format system-type current-extension-compiler current-extension-linker - syn keyword schemeExtFunc use-standard-linker use-standard-compiler - syn keyword schemeExtFunc find-executable-path append-object-suffix append-extension-suffix - syn keyword schemeExtFunc current-library-collection-paths current-extension-compiler-flags make-parameter - syn keyword schemeExtFunc current-directory build-path normalize-path current-extension-linker-flags - syn keyword schemeExtFunc file-exists? directory-exists? delete-directory/files delete-directory delete-file - syn keyword schemeExtFunc system compile-file system-library-subpath getenv putenv current-standard-link-libraries - syn keyword schemeExtFunc remove* file-size find-files fold-files directory-list shell-execute split-path - syn keyword schemeExtFunc current-error-port process/ports process printf fprintf open-input-string open-output-string - syn keyword schemeExtFunc get-output-string - " exceptions - syn keyword schemeExtFunc exn exn:application:arity exn:application:continuation exn:application:fprintf:mismatch - syn keyword schemeExtFunc exn:application:mismatch exn:application:type exn:application:mismatch exn:break exn:i/o:filesystem exn:i/o:port - syn keyword schemeExtFunc exn:i/o:port:closed exn:i/o:tcp exn:i/o:udp exn:misc exn:misc:application exn:misc:unsupported exn:module exn:read - syn keyword schemeExtFunc exn:read:non-char exn:special-comment exn:syntax exn:thread exn:user exn:variable exn:application:mismatch - syn keyword schemeExtFunc exn? exn:application:arity? exn:application:continuation? exn:application:fprintf:mismatch? exn:application:mismatch? - syn keyword schemeExtFunc exn:application:type? exn:application:mismatch? exn:break? exn:i/o:filesystem? exn:i/o:port? exn:i/o:port:closed? - syn keyword schemeExtFunc exn:i/o:tcp? exn:i/o:udp? exn:misc? exn:misc:application? exn:misc:unsupported? exn:module? exn:read? exn:read:non-char? - syn keyword schemeExtFunc exn:special-comment? exn:syntax? exn:thread? exn:user? exn:variable? exn:application:mismatch? - " Command-line parsing - syn keyword schemeExtFunc command-line current-command-line-arguments once-any help-labels multi once-each - - " syntax quoting, unquoting and quasiquotation - syn region schemeUnquote matchgroup=Delimiter start="#," end=![ \t\[\]()";]!me=e-1 contains=ALL - syn region schemeUnquote matchgroup=Delimiter start="#,@" end=![ \t\[\]()";]!me=e-1 contains=ALL - syn region schemeUnquote matchgroup=Delimiter start="#,(" end=")" contains=ALL - syn region schemeUnquote matchgroup=Delimiter start="#,@(" end=")" contains=ALL - syn region schemeUnquote matchgroup=Delimiter start="#,\[" end="\]" contains=ALL - syn region schemeUnquote matchgroup=Delimiter start="#,@\[" end="\]" contains=ALL - syn region schemeQuoted matchgroup=Delimiter start="#['`]" end=![ \t()\[\]";]!me=e-1 contains=ALL - syn region schemeQuoted matchgroup=Delimiter start="#['`](" matchgroup=Delimiter end=")" contains=ALL - - " Identifiers are very liberal in MzScheme/Racket - syn match schemeOther ![^()[\]{}",'`;#|\\ ]\+! - - " Language setting - syn match schemeLang "#lang [-+_/A-Za-z0-9]\+\>" - - " Various number forms - syn match schemeNumber "[-+]\=[0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\>" - syn match schemeNumber "[-+]\=\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\>" - syn match schemeNumber "[-+]\=[0-9]\+/[0-9]\+\>" - syn match schemeNumber "\([-+]\=\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\)\=[-+]\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\=i\>" -endif +syn region schemeUnquote matchgroup=schemeParentheses start=/,/ end=/[ `'\t\n\[\]()";]/me=e-1 contained contains=ALLBUT,schemeDatumCommentForm,@schemeImportCluster +syn region schemeUnquote matchgroup=schemeParentheses start=/,@/ end=/[ `'\t\n\[\]()";]/me=e-1 contained contains=ALLBUT,schemeDatumCommentForm,@schemeImportCluster +syn region schemeUnquote matchgroup=schemeParentheses start=/,(/ end=/)/ contained contains=ALLBUT,schemeDatumCommentForm,@schemeImportCluster +syn region schemeUnquote matchgroup=schemeParentheses start=/,@(/ end=/)/ contained contains=ALLBUT,schemeDatumCommentForm,@schemeImportCluster +syn region schemeQuoteForm matchgroup=schemeData start=/(/ end=/)/ contained contains=ALLBUT,schemeQuasiquote,schemeQuasiquoteForm,schemeUnquote,schemeForm,schemeDatumCommentForm,schemeImport,@schemeImportCluster,@schemeSyntaxCluster +syn region schemeQuasiquoteForm matchgroup=schemeData start=/(/ end=/)/ contained contains=ALLBUT,schemeQuote,schemeForm,schemeDatumCommentForm,schemeImport,@schemeImportCluster,@schemeSyntaxCluster -if exists("b:is_chicken") || exists("is_chicken") - " multiline comment - syntax region schemeMultilineComment start=/#|/ end=/|#/ contains=@Spell,schemeMultilineComment - - syn match schemeOther "##[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" - syn match schemeExtSyntax "#:[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" - - syn keyword schemeExtSyntax unit uses declare hide foreign-declare foreign-parse foreign-parse/spec - syn keyword schemeExtSyntax foreign-lambda foreign-lambda* define-external define-macro load-library - syn keyword schemeExtSyntax let-values let*-values letrec-values ->string require-extension - syn keyword schemeExtSyntax let-optionals let-optionals* define-foreign-variable define-record - syn keyword schemeExtSyntax pointer tag-pointer tagged-pointer? define-foreign-type - syn keyword schemeExtSyntax require require-for-syntax cond-expand and-let* receive argc+argv - syn keyword schemeExtSyntax fixnum? fx= fx> fx< fx>= fx<= fxmin fxmax - syn keyword schemeExtFunc ##core#inline ##sys#error ##sys#update-errno - - " here-string - syn region schemeString start=+#<<\s*\z(.*\)+ end=+^\z1$+ contains=@Spell - - if filereadable(expand(":p:h")."/cpp.vim") - unlet! b:current_syntax - syn include @ChickenC :p:h/cpp.vim - syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-declare "+ end=+")\@=+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+foreign-declare\s*#<<\z(.*\)$+hs=s+15 end=+^\z1$+ contains=@ChickenC - syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-parse "+ end=+")\@=+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+foreign-parse\s*#<<\z(.*\)$+hs=s+13 end=+^\z1$+ contains=@ChickenC - syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-parse/spec "+ end=+")\@=+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+foreign-parse/spec\s*#<<\z(.*\)$+hs=s+18 end=+^\z1$+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+#>+ end=+<#+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+#>?+ end=+<#+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+#>!+ end=+<#+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+#>\$+ end=+<#+ contains=@ChickenC - syn region ChickenC matchgroup=schemeComment start=+#>%+ end=+<#+ contains=@ChickenC - endif - - " suggested by Alex Queiroz - syn match schemeExtSyntax "#![-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" - syn region schemeString start=+#<#\s*\z(.*\)+ end=+^\z1$+ contains=@Spell -endif +syn region schemeString start=/\(\\\)\@/ +syn match schemeNumber /#x[+\-]*[0-9a-fA-F]\+\>/ -syn sync match matchPlace grouphere NONE "^[^ \t]" -" ... i.e. synchronize on a line that starts at the left margin +syn match schemeBoolean /#t\(rue\)\?/ +syn match schemeBoolean /#f\(alse\)\?/ -" Define the default highlighting. -" Only when an item doesn't have highlighting yet +syn match schemeCharacter /#\\.[^ `'\t\n\[\]()]*/ +syn match schemeCharacter /#\\x[0-9a-fA-F]\+/ -hi def link schemeSyntax Statement -hi def link schemeFunc Function +syn match schemeComment /;.*$/ -hi def link schemeString String -hi def link schemeCharacter Character -hi def link schemeNumber Number -hi def link schemeBoolean Boolean +syn region schemeMultilineComment start=/#|/ end=/|#/ contains=schemeMultilineComment -hi def link schemeDelimiter Delimiter -hi def link schemeConstant Constant +syn region schemeForm matchgroup=schemeParentheses start="(" end=")" contains=ALLBUT,schemeUnquote,schemeDatumCommentForm,@schemeImportCluster +syn region schemeForm matchgroup=schemeParentheses start="\[" end="\]" contains=ALLBUT,schemeUnquote,schemeDatumCommentForm,@schemeImportCluster -hi def link schemeComment Comment -hi def link schemeMultilineComment Comment -hi def link schemeError Error +syn region schemeVector matchgroup=schemeData start="#(" end=")" contains=ALLBUT,schemeQuasiquote,schemeQuasiquoteForm,schemeUnquote,schemeForm,schemeDatumCommentForm,schemeImport,@schemeImportCluster,@schemeSyntaxCluster +syn region schemeVector matchgroup=schemeData start="#[fsu]\d\+(" end=")" contains=schemeNumber,schemeComment,schemeDatumComment -hi def link schemeExtSyntax Type -hi def link schemeExtFunc PreProc +if exists('g:is_chicken') || exists('b:is_chicken') + syn region schemeImport matchgroup=schemeImport start="\(([ \t\n]*\)\@<=\(import\|import-syntax\|use\|require-extension\)\(-for-syntax\)\?\>" end=")"me=e-1 contained contains=schemeImportForm,schemeIdentifier,schemeComment,schemeDatumComment +else + syn region schemeImport matchgroup=schemeImport start="\(([ \t\n]*\)\@<=\(import\)\>" end=")"me=e-1 contained contains=schemeImportForm,schemeIdentifier,schemeComment,schemeDatumComment +endif -hi def link schemeLang PreProc +syn match schemeImportKeyword "\(([ \t\n]*\)\@<=\(except\|only\|prefix\|rename\|srfi\)\>" +syn region schemeImportForm matchgroup=schemeParentheses start="(" end=")" contained contains=schemeIdentifier,schemeComment,schemeDatumComment,@schemeImportCluster +syn cluster schemeImportCluster contains=schemeImportForm,schemeImportKeyword + +syn region schemeDatumComment matchgroup=schemeDatumComment start=/#;[ \t\n`']*/ end=/[ \t\n()\[\]";]/me=e-1 +syn region schemeDatumComment matchgroup=schemeDatumComment start=/#;[ \t\n`']*"/ skip=/\\[\\"]/ end=/"/ +syn region schemeDatumComment matchgroup=schemeDatumComment start=/#;[ \t\n`']*|/ skip=/\\[\\|]/ end=/|/ +syn region schemeDatumComment matchgroup=schemeDatumComment start=/#;[ \t\n`']*\(#\([usf]\d\+\)\?\)\?(/ end=/)/ contains=schemeDatumCommentForm +syn region schemeDatumCommentForm start="(" end=")" contained contains=schemeDatumCommentForm + +syn cluster schemeSyntaxCluster contains=schemeFunction,schemeKeyword,schemeSyntax,schemeExtraSyntax,schemeLibrarySyntax,schemeSyntaxSyntax + +syn keyword schemeLibrarySyntax define-library +syn keyword schemeLibrarySyntax export +syn keyword schemeLibrarySyntax include +syn keyword schemeLibrarySyntax include-ci +syn keyword schemeLibrarySyntax include-library-declarations +syn keyword schemeLibrarySyntax library +syn keyword schemeLibrarySyntax cond-expand + +syn keyword schemeSyntaxSyntax define-syntax +syn keyword schemeSyntaxSyntax let-syntax +syn keyword schemeSyntaxSyntax letrec-syntax +syn keyword schemeSyntaxSyntax syntax-rules + +syn keyword schemeSyntax => +syn keyword schemeSyntax and +syn keyword schemeSyntax begin +syn keyword schemeSyntax case +syn keyword schemeSyntax case-lambda +syn keyword schemeSyntax cond +syn keyword schemeSyntax define +syn keyword schemeSyntax define-record-type +syn keyword schemeSyntax define-values +syn keyword schemeSyntax delay +syn keyword schemeSyntax delay-force +syn keyword schemeSyntax do +syn keyword schemeSyntax else +syn keyword schemeSyntax guard +syn keyword schemeSyntax if +syn keyword schemeSyntax lambda +syn keyword schemeSyntax let +syn keyword schemeSyntax let* +syn keyword schemeSyntax let*-values +syn keyword schemeSyntax let-values +syn keyword schemeSyntax letrec +syn keyword schemeSyntax letrec* +syn keyword schemeSyntax or +syn keyword schemeSyntax parameterize +syn keyword schemeSyntax quasiquote +syn keyword schemeSyntax quote +syn keyword schemeSyntax set! +syn keyword schemeSyntax unless +syn keyword schemeSyntax unquote +syn keyword schemeSyntax unquote-splicing +syn keyword schemeSyntax when + +syn keyword schemeFunction * +syn keyword schemeFunction + +syn keyword schemeFunction - +syn keyword schemeFunction / +syn keyword schemeFunction < +syn keyword schemeFunction <= +syn keyword schemeFunction = +syn keyword schemeFunction > +syn keyword schemeFunction >= +syn keyword schemeFunction abs +syn keyword schemeFunction acos +syn keyword schemeFunction acos +syn keyword schemeFunction angle +syn keyword schemeFunction append +syn keyword schemeFunction apply +syn keyword schemeFunction asin +syn keyword schemeFunction assoc +syn keyword schemeFunction assq +syn keyword schemeFunction assv +syn keyword schemeFunction atan +syn keyword schemeFunction binary-port? +syn keyword schemeFunction boolean=? +syn keyword schemeFunction boolean? +syn keyword schemeFunction bytevector +syn keyword schemeFunction bytevector-append +syn keyword schemeFunction bytevector-append +syn keyword schemeFunction bytevector-copy +syn keyword schemeFunction bytevector-copy! +syn keyword schemeFunction bytevector-length +syn keyword schemeFunction bytevector-u8-ref +syn keyword schemeFunction bytevector-u8-set! +syn keyword schemeFunction bytevector? +syn keyword schemeFunction caaaar +syn keyword schemeFunction caaadr +syn keyword schemeFunction caaar +syn keyword schemeFunction caadar +syn keyword schemeFunction caaddr +syn keyword schemeFunction caadr +syn keyword schemeFunction caar +syn keyword schemeFunction cadaar +syn keyword schemeFunction cadadr +syn keyword schemeFunction cadar +syn keyword schemeFunction caddar +syn keyword schemeFunction cadddr +syn keyword schemeFunction caddr +syn keyword schemeFunction cadr +syn keyword schemeFunction call-with-current-continuation +syn keyword schemeFunction call-with-input-file +syn keyword schemeFunction call-with-output-file +syn keyword schemeFunction call-with-port +syn keyword schemeFunction call-with-values +syn keyword schemeFunction call/cc +syn keyword schemeFunction car +syn keyword schemeFunction cdaaar +syn keyword schemeFunction cdaadr +syn keyword schemeFunction cdaar +syn keyword schemeFunction cdadar +syn keyword schemeFunction cdaddr +syn keyword schemeFunction cdadr +syn keyword schemeFunction cdar +syn keyword schemeFunction cddaar +syn keyword schemeFunction cddadr +syn keyword schemeFunction cddar +syn keyword schemeFunction cdddar +syn keyword schemeFunction cddddr +syn keyword schemeFunction cdddr +syn keyword schemeFunction cddr +syn keyword schemeFunction cdr +syn keyword schemeFunction ceiling +syn keyword schemeFunction char->integer +syn keyword schemeFunction char-alphabetic? +syn keyword schemeFunction char-ci<=? +syn keyword schemeFunction char-ci=? +syn keyword schemeFunction char-ci>? +syn keyword schemeFunction char-downcase +syn keyword schemeFunction char-foldcase +syn keyword schemeFunction char-lower-case? +syn keyword schemeFunction char-numeric? +syn keyword schemeFunction char-ready? +syn keyword schemeFunction char-upcase +syn keyword schemeFunction char-upper-case? +syn keyword schemeFunction char-whitespace? +syn keyword schemeFunction char<=? +syn keyword schemeFunction char=? +syn keyword schemeFunction char>? +syn keyword schemeFunction char? +syn keyword schemeFunction close-input-port +syn keyword schemeFunction close-output-port +syn keyword schemeFunction close-port +syn keyword schemeFunction command-line +syn keyword schemeFunction complex? +syn keyword schemeFunction cons +syn keyword schemeFunction cos +syn keyword schemeFunction current-error-port +syn keyword schemeFunction current-input-port +syn keyword schemeFunction current-jiffy +syn keyword schemeFunction current-output-port +syn keyword schemeFunction current-second +syn keyword schemeFunction delete-file +syn keyword schemeFunction denominator +syn keyword schemeFunction digit-value +syn keyword schemeFunction display +syn keyword schemeFunction dynamic-wind +syn keyword schemeFunction emergency-exit +syn keyword schemeFunction environment +syn keyword schemeFunction eof-object +syn keyword schemeFunction eof-object? +syn keyword schemeFunction eq? +syn keyword schemeFunction equal? +syn keyword schemeFunction eqv? +syn keyword schemeFunction error +syn keyword schemeFunction error-object-irritants +syn keyword schemeFunction error-object-message +syn keyword schemeFunction error-object? +syn keyword schemeFunction eval +syn keyword schemeFunction even? +syn keyword schemeFunction exact +syn keyword schemeFunction exact->inexact +syn keyword schemeFunction exact-integer-sqrt +syn keyword schemeFunction exact-integer? +syn keyword schemeFunction exact? +syn keyword schemeFunction exit +syn keyword schemeFunction exp +syn keyword schemeFunction expt +syn keyword schemeFunction features +syn keyword schemeFunction file-error? +syn keyword schemeFunction file-exists? +syn keyword schemeFunction finite? +syn keyword schemeFunction floor +syn keyword schemeFunction floor-quotient +syn keyword schemeFunction floor-remainder +syn keyword schemeFunction floor/ +syn keyword schemeFunction flush-output-port +syn keyword schemeFunction for-each +syn keyword schemeFunction force +syn keyword schemeFunction gcd +syn keyword schemeFunction get-environment-variable +syn keyword schemeFunction get-environment-variables +syn keyword schemeFunction get-output-bytevector +syn keyword schemeFunction get-output-string +syn keyword schemeFunction imag-part +syn keyword schemeFunction inexact +syn keyword schemeFunction inexact->exact +syn keyword schemeFunction inexact? +syn keyword schemeFunction infinite? +syn keyword schemeFunction input-port-open? +syn keyword schemeFunction input-port? +syn keyword schemeFunction integer->char +syn keyword schemeFunction integer? +syn keyword schemeFunction interaction-environment +syn keyword schemeFunction jiffies-per-second +syn keyword schemeFunction lcm +syn keyword schemeFunction length +syn keyword schemeFunction list +syn keyword schemeFunction list->string +syn keyword schemeFunction list->vector +syn keyword schemeFunction list-copy +syn keyword schemeFunction list-ref +syn keyword schemeFunction list-set! +syn keyword schemeFunction list-tail +syn keyword schemeFunction list? +syn keyword schemeFunction load +syn keyword schemeFunction log +syn keyword schemeFunction magnitude +syn keyword schemeFunction make-bytevector +syn keyword schemeFunction make-list +syn keyword schemeFunction make-parameter +syn keyword schemeFunction make-polar +syn keyword schemeFunction make-promise +syn keyword schemeFunction make-rectangular +syn keyword schemeFunction make-string +syn keyword schemeFunction make-vector +syn keyword schemeFunction map +syn keyword schemeFunction max +syn keyword schemeFunction member +syn keyword schemeFunction memq +syn keyword schemeFunction memv +syn keyword schemeFunction min +syn keyword schemeFunction modulo +syn keyword schemeFunction nan? +syn keyword schemeFunction negative? +syn keyword schemeFunction newline +syn keyword schemeFunction not +syn keyword schemeFunction null-environment +syn keyword schemeFunction null? +syn keyword schemeFunction number->string +syn keyword schemeFunction number? +syn keyword schemeFunction numerator +syn keyword schemeFunction odd? +syn keyword schemeFunction open-binary-input-file +syn keyword schemeFunction open-binary-output-file +syn keyword schemeFunction open-input-bytevector +syn keyword schemeFunction open-input-file +syn keyword schemeFunction open-input-string +syn keyword schemeFunction open-output-bytevector +syn keyword schemeFunction open-output-file +syn keyword schemeFunction open-output-string +syn keyword schemeFunction output-port-open? +syn keyword schemeFunction output-port? +syn keyword schemeFunction pair? +syn keyword schemeFunction peek-char +syn keyword schemeFunction peek-u8 +syn keyword schemeFunction port? +syn keyword schemeFunction positive? +syn keyword schemeFunction procedure? +syn keyword schemeFunction promise? +syn keyword schemeFunction quotient +syn keyword schemeFunction raise +syn keyword schemeFunction raise-continuable +syn keyword schemeFunction rational? +syn keyword schemeFunction rationalize +syn keyword schemeFunction read +syn keyword schemeFunction read-bytevector +syn keyword schemeFunction read-bytevector! +syn keyword schemeFunction read-char +syn keyword schemeFunction read-error? +syn keyword schemeFunction read-line +syn keyword schemeFunction read-string +syn keyword schemeFunction read-u8 +syn keyword schemeFunction real-part +syn keyword schemeFunction real? +syn keyword schemeFunction remainder +syn keyword schemeFunction reverse +syn keyword schemeFunction round +syn keyword schemeFunction scheme-report-environment +syn keyword schemeFunction set-car! +syn keyword schemeFunction set-cdr! +syn keyword schemeFunction sin +syn keyword schemeFunction sqrt +syn keyword schemeFunction square +syn keyword schemeFunction string +syn keyword schemeFunction string->list +syn keyword schemeFunction string->number +syn keyword schemeFunction string->symbol +syn keyword schemeFunction string->utf8 +syn keyword schemeFunction string->vector +syn keyword schemeFunction string-append +syn keyword schemeFunction string-ci<=? +syn keyword schemeFunction string-ci=? +syn keyword schemeFunction string-ci>? +syn keyword schemeFunction string-copy +syn keyword schemeFunction string-copy! +syn keyword schemeFunction string-downcase +syn keyword schemeFunction string-fill! +syn keyword schemeFunction string-foldcase +syn keyword schemeFunction string-for-each +syn keyword schemeFunction string-length +syn keyword schemeFunction string-map +syn keyword schemeFunction string-ref +syn keyword schemeFunction string-set! +syn keyword schemeFunction string-upcase +syn keyword schemeFunction string<=? +syn keyword schemeFunction string=? +syn keyword schemeFunction string>? +syn keyword schemeFunction string? +syn keyword schemeFunction substring +syn keyword schemeFunction symbol->string +syn keyword schemeFunction symbol=? +syn keyword schemeFunction symbol? +syn keyword schemeFunction syntax-error +syn keyword schemeFunction tan +syn keyword schemeFunction textual-port? +syn keyword schemeFunction transcript-off +syn keyword schemeFunction transcript-on +syn keyword schemeFunction truncate +syn keyword schemeFunction truncate-quotient +syn keyword schemeFunction truncate-remainder +syn keyword schemeFunction truncate/ +syn keyword schemeFunction u8-ready? +syn keyword schemeFunction utf8->string +syn keyword schemeFunction values +syn keyword schemeFunction vector +syn keyword schemeFunction vector->list +syn keyword schemeFunction vector->string +syn keyword schemeFunction vector-append +syn keyword schemeFunction vector-copy +syn keyword schemeFunction vector-copy! +syn keyword schemeFunction vector-fill! +syn keyword schemeFunction vector-for-each +syn keyword schemeFunction vector-length +syn keyword schemeFunction vector-map +syn keyword schemeFunction vector-ref +syn keyword schemeFunction vector-set! +syn keyword schemeFunction vector? +syn keyword schemeFunction with-exception-handler +syn keyword schemeFunction with-input-from-file +syn keyword schemeFunction with-output-to-file +syn keyword schemeFunction write +syn keyword schemeFunction write-bytevector +syn keyword schemeFunction write-char +syn keyword schemeFunction write-shared +syn keyword schemeFunction write-simple +syn keyword schemeFunction write-string +syn keyword schemeFunction write-u8 +syn keyword schemeFunction zero? + +hi def link schemeBoolean Boolean +hi def link schemeCharacter Character +hi def link schemeComment Comment +hi def link schemeConstant Constant +hi def link schemeData Delimiter +hi def link schemeDatumComment Comment +hi def link schemeDatumCommentForm Comment +hi def link schemeDelimiter Delimiter +hi def link schemeError Error +hi def link schemeExtraSyntax Underlined +hi def link schemeFunction Function +hi def link schemeIdentifier Normal +hi def link schemeImport PreProc +hi def link schemeImportKeyword PreProc +hi def link schemeKeyword Type +hi def link schemeLibrarySyntax PreProc +hi def link schemeMultilineComment Comment +hi def link schemeNumber Number +hi def link schemeParentheses Normal +hi def link schemeQuasiquote Delimiter +hi def link schemeQuote Delimiter +hi def link schemeSpecialSyntax Special +hi def link schemeString String +hi def link schemeSymbol Normal +hi def link schemeSyntax Statement +hi def link schemeSyntaxSyntax PreProc +hi def link schemeTypeSyntax Type +let b:did_scheme_syntax = 1 -let b:current_syntax = "scheme" +if exists('b:is_chicken') || exists('g:is_chicken') + exe 'ru! syntax/chicken.vim' +endif -let &cpo = s:cpo_save -unlet s:cpo_save +unlet b:did_scheme_syntax +let b:current_syntax = 'scheme' +let &cpo = s:cpo +unlet s:cpo diff -Nru vim-8.0.1453/runtime/syntax/sh.vim vim-8.0.1766/runtime/syntax/sh.vim --- vim-8.0.1453/runtime/syntax/sh.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/sh.vim 2018-04-26 20:30:33.000000000 +0000 @@ -2,8 +2,8 @@ " Language: shell (sh) Korn shell (ksh) bash (sh) " Maintainer: Charles E. Campbell " Previous Maintainer: Lennart Schultz -" Last Change: Oct 02, 2017 -" Version: 172 +" Last Change: Mar 19, 2018 +" Version: 174 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH " For options and settings, please use: :help ft-sh-syntax " This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) @@ -121,7 +121,7 @@ " Clusters: contains=@... clusters {{{1 "================================== syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsacError,shCurlyError,shParenError,shTestError,shOK -if exists("b:is_kornshell") +if exists("b:is_kornshell") || exists("b:is_bash") syn cluster ErrorList add=shDTestError endif syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shHereString,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor @@ -164,7 +164,7 @@ " Alias: {{{1 " ===== -if exists("b:is_kornshell") || exists("b:is_bash") +if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix") syn match shStatement "\" syn region shAlias matchgroup=shStatement start="\\s\+\(\h[-._[:alnum:]]\+\)\@=" skip="\\$" end="\>\|`" syn region shAlias matchgroup=shStatement start="\\s\+\(\h[-._[:alnum:]]\+=\)\@=" skip="\\$" end="=" @@ -186,7 +186,7 @@ syn match shCurlyError "}" syn match shParenError ")" syn match shOK '\.\(done\|fi\|in\|esac\)' - if exists("b:is_kornshell") + if exists("b:is_kornshell") || exists("b:is_bash") syn match shDTestError "]]" endif syn match shTestError "]" @@ -245,12 +245,14 @@ ShFoldIfDoFor syn region shFor matchgroup=shLoop start="\]\+\)\"" matchgroup=shHereDoc02 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc03 start="<<-\s*\z([^ \t|>]\+\)" matchgroup=shHereDoc03 end="^\s*\z1\s*$" contains=@shDblQuoteList -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*'\z([^']\+\)'" matchgroup=shHereDoc04 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*'\z([^']\+\)'" matchgroup=shHereDoc05 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*\"\z([^ \t|>]\+\)\"" matchgroup=shHereDoc06 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\\\_$\_s*\z([^ \t|>]\+\)" matchgroup=shHereDoc07 end="^\z1\s*$" contains=@shDblQuoteList -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<\s*\\\_$\_s*'\z([^ \t|>]\+\)'" matchgroup=shHereDoc08 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<\s*\\\_$\_s*\"\z([^ \t|>]\+\)\"" matchgroup=shHereDoc09 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*\\\_$\_s*\z([^ \t|>]\+\)" matchgroup=shHereDoc10 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<-\s*\\\_$\_s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc11 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\\\_$\_s*'\z([^ \t|>]\+\)'" matchgroup=shHereDoc12 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<-\s*\\\_$\_s*\"\z([^ \t|>]\+\)\"" matchgroup=shHereDoc13 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<\\\z([^ \t|>]\+\)" matchgroup=shHereDoc14 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<-\s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc15 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc01 start="<<\s*\\\=\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc01 end="^\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc02 start="<<\s*\"\z([^ \t0-9|>]\+\)\"" matchgroup=shHereDoc02 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc03 start="<<-\s*\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc03 end="^\s*\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*'\z([^'0-9]\+\)'" matchgroup=shHereDoc04 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*'\z([^'0-9]\+\)'" matchgroup=shHereDoc05 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*\"\z([^ \t0-9|>]\+\)\"" matchgroup=shHereDoc06 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\\\_$\_s*\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc07 end="^\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<\s*\\\_$\_s*'\z([^ \t0-9|>]\+\)'" matchgroup=shHereDoc08 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<\s*\\\_$\_s*\"\z([^ \t0-9|>]\+\)\"" matchgroup=shHereDoc09 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*\\\_$\_s*\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc10 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<-\s*\\\_$\_s*\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc11 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\\\_$\_s*'\z([^ \t0-9|>]\+\)'" matchgroup=shHereDoc12 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<-\s*\\\_$\_s*\"\z([^ \t0-9|>]\+\)\"" matchgroup=shHereDoc13 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc14 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<-\s*\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc15 end="^\s*\z1\s*$" " Here Strings: {{{1 " ============= @@ -405,7 +406,7 @@ if exists("b:is_bash") syn region shSetList oneline matchgroup=shSet start="\<\(declare\|typeset\|local\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|=" contains=@shIdList syn region shSetList oneline matchgroup=shSet start="\\ze[^/]" end="\ze[;|)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+=" contains=@shIdList -elseif exists("b:is_kornshell") +elseif exists("b:is_kornshell") || exists("b:is_posix") syn region shSetList oneline matchgroup=shSet start="\<\(typeset\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList syn region shSetList oneline matchgroup=shSet start="\\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList else @@ -439,14 +440,14 @@ syn match shDerefSimple "\$[-#*@!?]" nextgroup=@shNoZSList syn match shDerefSimple "\$\$" nextgroup=@shNoZSList syn match shDerefSimple "\${\d}" nextgroup=@shNoZSList -if exists("b:is_bash") || exists("b:is_kornshell") +if exists("b:is_bash") || exists("b:is_kornshell") || exists("b:is_posix") syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList nextgroup=@shSpecialNoZS syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList nextgroup=@shSpecialNoZS endif " ksh: ${!var[*]} array index list syntax: {{{1 " ======================================== -if exists("b:is_kornshell") +if exists("b:is_kornshell") || exists("b:is_posix") syn region shDeref matchgroup=PreProc start="\${!" end="}" contains=@shDerefVarArray endif @@ -464,7 +465,7 @@ syn match shDerefSpecial contained "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp syn match shDerefVar contained "{\@<=\h\w*" nextgroup=@shDerefVarList syn match shDerefVar contained '\d' nextgroup=@shDerefVarList -if exists("b:is_kornshell") +if exists("b:is_kornshell") || exists("b:is_posix") syn match shDerefVar contained "{\@<=\h\w*[[:alnum:]_.]*" nextgroup=@shDerefVarList endif @@ -490,7 +491,7 @@ endif syn match shDerefOp contained ":\=[-=?]" nextgroup=@shDerefPatternList syn match shDerefOp contained ":\=+" nextgroup=@shDerefPatternList -if exists("b:is_bash") || exists("b:is_kornshell") +if exists("b:is_bash") || exists("b:is_kornshell") || exists("b:is_posix") syn match shDerefOp contained "#\{1,2}" nextgroup=@shDerefPatternList syn match shDerefOp contained "%\{1,2}" nextgroup=@shDerefPatternList syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern @@ -537,7 +538,7 @@ " Useful ksh Keywords: {{{1 " ==================== -if exists("b:is_kornshell") || exists("b:is_bash") +if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix") syn keyword shStatement autoload bg false fc fg functions getopts hash history integer jobs let nohup printf r stop suspend times true type unalias whence if exists("b:is_posix") syn keyword shStatement command @@ -635,6 +636,7 @@ hi def link shSingleQuote shString hi def link shSource shOperator hi def link shStringSpecial shSpecial + hi def link shSpecialStart shSpecial hi def link shSubShRegion shOperator hi def link shTestOpr shConditional hi def link shTestPattern shString @@ -652,7 +654,7 @@ hi def link shDerefOff shDerefOp hi def link shDerefLen shDerefOff endif - if exists("b:is_kornshell") + if exists("b:is_kornshell") || exists("b:is_posix") hi def link kshSpecialVariables shShellVariables hi def link kshStatement shStatement endif @@ -669,7 +671,7 @@ hi def link shInError Error hi def link shParenError Error hi def link shTestError Error - if exists("b:is_kornshell") + if exists("b:is_kornshell") || exists("b:is_posix") hi def link shDTestError Error endif endif @@ -725,6 +727,8 @@ let b:current_syntax = "bash" elseif exists("b:is_kornshell") let b:current_syntax = "ksh" +elseif exists("b:is_posix") + let b:current_syntax = "posix" else let b:current_syntax = "sh" endif diff -Nru vim-8.0.1453/runtime/syntax/tex.vim vim-8.0.1766/runtime/syntax/tex.vim --- vim-8.0.1453/runtime/syntax/tex.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/tex.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Charles E. Campbell -" Last Change: Dec 11, 2017 -" Version: 107 +" Last Change: Mar 30, 2018 +" Version: 109 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 @@ -396,7 +396,7 @@ " Bad Math (mismatched): {{{1 if !exists("g:tex_no_math") && !s:tex_no_error - syn match texBadMath "\\end\s*{\s*\(array\|bBpvV]matrix\|split\|smallmatrix\)\s*}" + syn match texBadMath "\\end\s*{\s*\(array\|[bBpvV]matrix\|split\|smallmatrix\)\s*}" syn match texBadMath "\\end\s*{\s*\(displaymath\|equation\|eqnarray\|math\)\*\=\s*}" syn match texBadMath "\\[\])]" endif @@ -1012,6 +1012,48 @@ syn match texMathSymbol '\\hat{y}' contained conceal cchar=Å· syn match texMathSymbol '\\hat{Y}' contained conceal cchar=Ŷ " syn match texMathSymbol '\\bar{a}' contained conceal cchar=aÌ… + + syn match texMathSymbol '\\dot{B}' contained conceal cchar=Ḃ + syn match texMathSymbol '\\dot{b}' contained conceal cchar=ḃ + syn match texMathSymbol '\\dot{D}' contained conceal cchar=Ḋ + syn match texMathSymbol '\\dot{d}' contained conceal cchar=ḋ + syn match texMathSymbol '\\dot{F}' contained conceal cchar=Ḟ + syn match texMathSymbol '\\dot{f}' contained conceal cchar=ḟ + syn match texMathSymbol '\\dot{H}' contained conceal cchar=Ḣ + syn match texMathSymbol '\\dot{h}' contained conceal cchar=ḣ + syn match texMathSymbol '\\dot{M}' contained conceal cchar=á¹€ + syn match texMathSymbol '\\dot{m}' contained conceal cchar=á¹ + syn match texMathSymbol '\\dot{N}' contained conceal cchar=Ṅ + syn match texMathSymbol '\\dot{n}' contained conceal cchar=á¹… + syn match texMathSymbol '\\dot{P}' contained conceal cchar=á¹– + syn match texMathSymbol '\\dot{p}' contained conceal cchar=á¹— + syn match texMathSymbol '\\dot{R}' contained conceal cchar=Ṙ + syn match texMathSymbol '\\dot{r}' contained conceal cchar=á¹™ + syn match texMathSymbol '\\dot{S}' contained conceal cchar=á¹  + syn match texMathSymbol '\\dot{s}' contained conceal cchar=ṡ + syn match texMathSymbol '\\dot{T}' contained conceal cchar=Ṫ + syn match texMathSymbol '\\dot{t}' contained conceal cchar=ṫ + syn match texMathSymbol '\\dot{W}' contained conceal cchar=Ẇ + syn match texMathSymbol '\\dot{w}' contained conceal cchar=ẇ + syn match texMathSymbol '\\dot{X}' contained conceal cchar=Ẋ + syn match texMathSymbol '\\dot{x}' contained conceal cchar=ẋ + syn match texMathSymbol '\\dot{Y}' contained conceal cchar=Ẏ + syn match texMathSymbol '\\dot{y}' contained conceal cchar=Ạ+ syn match texMathSymbol '\\dot{Z}' contained conceal cchar=Å» + syn match texMathSymbol '\\dot{z}' contained conceal cchar=ż + + syn match texMathSymbol '\\dot{C}' contained conceal cchar=ÄŠ + syn match texMathSymbol '\\dot{c}' contained conceal cchar=Ä‹ + syn match texMathSymbol '\\dot{E}' contained conceal cchar=Ä– + syn match texMathSymbol '\\dot{e}' contained conceal cchar=Ä— + syn match texMathSymbol '\\dot{G}' contained conceal cchar=Ä  + syn match texMathSymbol '\\dot{g}' contained conceal cchar=Ä¡ + syn match texMathSymbol '\\dot{I}' contained conceal cchar=Ä° + + syn match texMathSymbol '\\dot{A}' contained conceal cchar=Ȧ + syn match texMathSymbol '\\dot{a}' contained conceal cchar=ȧ + syn match texMathSymbol '\\dot{O}' contained conceal cchar=È® + syn match texMathSymbol '\\dot{o}' contained conceal cchar=ȯ endif " Greek {{{2 diff -Nru vim-8.0.1453/runtime/syntax/vim.vim vim-8.0.1766/runtime/syntax/vim.vim --- vim-8.0.1453/runtime/syntax/vim.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/syntax/vim.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,9 +1,9 @@ " Vim syntax file " Language: Vim 8.0 script " Maintainer: Charles E. Campbell -" Last Change: Dec 15, 2017 -" Version: 8.0-07 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM +" Last Change: February 13, 2018 +" Version: 8.0-12 +" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Automatically generated keyword lists: {{{1 " Quit when a syntax file was already loaded {{{2 @@ -24,9 +24,9 @@ syn keyword vimCommand contained abc[lear] argdo au bel[owright] bp[revious] bro[wse] cNf[ile] cal[l] cd cfir[st] che[ckpath] clo[se] col[der] conf[irm] cs debug deletep delp diffp[atch] dj[ump] dr[op] ec em[enu] ene[w] filet fir[st] foldo[pen] grepa[dd] helpf[ind] i imapc[lear] j[oin] keepj[umps] lad[dexpr] lb[uffer] lcscope lfdo lgrepa[dd] lmak[e] loadk lp[revious] luado ma[rk] messages mod[e] nbc[lose] noautocmd nu[mber] opt[ions] pc[lose] popu[p] prof[ile] ptN[ext] ptn[ext] pw[d] pyf[ile] pyxfile rec[over] reg[isters] ri[ght] rubyf[ile] sIe sIr sav[eas] sbl[ast] sc scl scscope sf[ind] sge sgr sig sip sm[ap] sno[magic] sp[lit] spellu[ndo] src srn startg[replace] sun[hide] sw[apname] syntime tabN[ext] tabfir[st] tabo[nly] tc[l] th[row] tmapc[lear] tr[ewind] u[ndo] unl ve[rsion] vim[grep] vs[plit] win[size] wp[revious] wv[iminfo] xmenu xunmenu syn keyword vimCommand contained abo[veleft] arge[dit] bN[ext] bf[irst] br[ewind] bufdo c[hange] cat[ch] cdo cg[etfile] checkt[ime] cmapc[lear] colo[rscheme] cope[n] cscope debugg[reedy] deletl dep diffpu[t] dl ds[earch] echoe[rr] en[dif] ex filetype fix[del] for gui helpg[rep] ia in ju[mps] keepp[atterns] laddb[uffer] lbo[ttom] ld[o] lfir[st] lh[elpgrep] lmapc[lear] loadkeymap lpf[ile] luafile mak[e] mk[exrc] mz[scheme] nbs[tart] noh[lsearch] o[pen] ownsyntax pe[rl] pp[op] profd[el] pta[g] ptp[revious] py3 python3 q[uit] red[o] res[ize] rightb[elow] rundo sIg sN[ext] sbN[ext] sbm[odified] scI scp se[t] sfir[st] sgi sh[ell] sign sir sme snoreme spe[llgood] spellw[rong] sre[wind] srp startr[eplace] sunme sy t tabc[lose] tabl[ast] tabp[revious] tcld[o] tj[ump] tn[ext] try una[bbreviate] unlo[ckvar] verb[ose] vimgrepa[dd] wN[ext] winc[md] wq x[it] xnoreme xwininfo syn keyword vimCommand contained al[l] argg[lobal] b[uffer] bl[ast] brea[k] buffers cabc[lear] cb[uffer] ce[nter] cgetb[uffer] chi[story] cn[ext] com cp[revious] cstag delc[ommand] deletp di[splay] diffs[plit] dli[st] dsp[lit] echom[sg] endf[unction] exi[t] filt[er] fo[ld] fu[nction] gvim helpt[ags] iabc[lear] intro k lN[ext] laddf[ile] lc[d] le[ft] lg[etfile] lhi[story] lne[xt] loc[kmarks] lr[ewind] lv[imgrep] marks mks[ession] mzf[ile] new nor ol[dfiles] p[rint] ped[it] pre[serve] promptf[ind] ptf[irst] ptr[ewind] py3do pythonx qa[ll] redi[r] ret[ab] ru[ntime] rv[iminfo] sIl sa[rgument] sb[uffer] sbn[ext] sce scr[iptnames] setf[iletype] sg sgl si sil[ent] sl[eep] smenu snoremenu spelld[ump] spr[evious] srg st[op] stj[ump] sunmenu syn tN[ext] tabd[o] tabm[ove] tabr[ewind] tclf[ile] tl[ast] tno[remap] ts[elect] undoj[oin] uns[ilent] vert[ical] viu[sage] w[rite] windo wqa[ll] xa[ll] xnoremenu y[ank] -syn keyword vimCommand contained ar[gs] argl[ocal] ba[ll] bm[odified] breaka[dd] bun[load] cad[dbuffer] cbo[ttom] cex[pr] cgete[xpr] cl[ist] cnew[er] comc[lear] cpf[ile] cuna[bbrev] delel delf[unction] dif[fupdate] difft[his] do e[dit] echon endfo[r] exu[sage] fin[d] foldc[lose] g h[elp] hi if is[earch] kee[pmarks] lNf[ile] lan[guage] lch[dir] lefta[bove] lgetb[uffer] ll lnew[er] lockv[ar] ls lvimgrepa[dd] mat[ch] mksp[ell] +syn keyword vimCommand contained ar[gs] argl[ocal] ba[ll] bm[odified] breaka[dd] bun[load] cad[dbuffer] cbo[ttom] cex[pr] cgete[xpr] cl[ist] cnew[er] comc[lear] cpf[ile] cuna[bbrev] delel delf[unction] dif[fupdate] difft[his] do e[dit] echon endfo[r] exu[sage] fin[d] foldc[lose] g h[elp] hi if is[earch] kee[pmarks] lNf[ile] lan[guage] lch[dir] lefta[bove] lgetb[uffer] ll lnew[er] lockv[ar] ls lvimgrepa[dd] mat[ch] mksp[ell] syn match vimCommand contained "\" -syn keyword vimStdPlugin contained DiffOrig Man N[ext] P[rint] S TOhtml XMLent XMLns +syn keyword vimStdPlugin contained DiffOrig Man N[ext] P[rint] S TOhtml XMLent XMLns " vimOptions are caught only when contained in a vimSet {{{2 syn keyword vimOption contained acd ambw arshape background ballooneval bg bomb bs cb ch cinoptions cms commentstring copyindent cscopepathcomp csprg cursorbind delcombine digraph eadirection emo equalprg expandtab fdls fex fileignorecase fml foldlevel formatexpr gcr go guifontset helpheight history hlsearch imactivatekey imi imstyle indentkeys isf isprint km laststatus lisp loadplugins lz mat maxmempattern mh mmp more mouses mzq number opendevice paragraphs penc pi previewheight printmbcharset pvw rdt renderoptions rl ru sbo scrollbind secure shcf shelltemp shortmess showtabline sj smd spell splitbelow ssl stl sw sxe tabpagemax tags tbs termguicolors tf title tms ts ttybuiltin tx undolevels vbs viewdir vop wd wic wildmode winheight wm wrapscan @@ -36,21 +36,21 @@ syn keyword vimOption contained aleph arab autowrite backupdir belloff bk bri bufhidden cdpath cindent cm colorcolumn completeopt cpoptions cscopetag csto debug dictionary display ef endofline esckeys fdc fdt fileencoding fixeol foldcolumn foldminlines fp gfn gtl guipty hi hkp ignorecase imcmdline imsf incsearch infercase isk keymap langmenu linebreak lm lsp makeef maxfuncdepth menc mls modelines mousehide mp nf oft pa patchmode pfn popt printexpr pt pyxversion regexpengine ri rop rulerformat scl scs sessionoptions shellquote shiftround showfulltag sidescrolloff smartindent sol spellsuggest sr stal sua swf syntax tagcase tbi term textauto tildeop tk top ttimeoutlen ttyscroll ul ur verbosefile viminfofile wb wh wildignore window winwidth wop writedelay syn keyword vimOption contained allowrevins arabic autowriteall backupext beval bkc briopt buflisted cedit cink cmdheight columns concealcursor cpt cscopetagorder csverb deco diff dy efm eol et fde fen fileencodings fk foldenable foldnestmax fs gfs gtt guitablabel hid hl im imd imst inde insertmode iskeyword keymodel langnoremap lines lmap luadll makeencoding maxmapdepth menuitems mm modifiable mousem mps nrformats ofu packpath path ph pp printfont pumheight qe relativenumber rightleft rs runtimepath scr sect sft shellredir shiftwidth showmatch signcolumn smarttab sp spf srr startofline suffixes switchbuf ta taglength tbidi termbidi textmode timeout tl tpm ttm ttytype undodir ut vfile virtualedit wc whichwrap wildignorecase winfixheight wiv wrap ws syn keyword vimOption contained altkeymap arabicshape aw backupskip bex bl brk buftype cf cinkeys cmdwinheight com conceallevel crb cscopeverbose cuc def diffexpr ea ei ep eventignore fdi fenc fileformat fkmap foldexpr foldopen fsync gfw guicursor guitabtooltip hidden hlg imactivatefunc imdisable imstatusfunc indentexpr is isp keywordprg langremap linespace lnr lw makeprg maxmem mfd mmd modified mousemodel msm nu omnifunc para pdev pheader preserveindent printheader pvh quoteescape remap rightleftcmd rtp sb scroll sections sh shellslash shm showmode siso smc spc spl ss statusline suffixesadd sws tabline tagrelative tbis termencoding textwidth timeoutlen tm tr tty tw undofile vb vi visualbell wcm wi wildmenu winfixwidth wiw wrapmargin ww -syn keyword vimOption contained ambiwidth ari awa balloondelay bexpr bo browsedir casemap cfu cino cmp comments confirm cryptmethod cspc cul define diffopt ead ek equalalways ex fdl fencs fileformats flp foldignore foldtext ft ghr guifont helpfile highlight hls +syn keyword vimOption contained ambiwidth ari awa balloondelay bexpr bo browsedir casemap cfu cino cmp comments confirm cryptmethod cspc cul define diffopt ead ek equalalways ex fdl fencs fileformats flp foldignore foldtext ft ghr guifont helpfile highlight hls " vimOptions: These are the turn-off setting variants {{{2 syn keyword vimOption contained noacd noallowrevins noantialias noarabic noarshape noautoread noaw noballooneval nobinary nobomb nobuflisted nocin noconfirm nocrb nocscopeverbose nocsverb nocursorbind nodeco nodiff noeb noek noendofline noerrorbells noex nofen nofixendofline nofkmap nofsync noguipty nohk nohkp noic noim noimd noinf nois nolangnoremap nolazyredraw nolinebreak nolist noloadplugins nolrm noma nomagic noml nomodeline nomodified nomousef nomousehide nonumber noopendevice nopi nopreviewwindow nopvw norelativenumber norestorescreen nori norl noro noru nosb noscb noscs nosft noshelltemp noshortname noshowfulltag noshowmode nosm nosmartindent nosmd nosol nosplitbelow nospr nossl nostartofline noswapfile nota notagrelative notbi notbs noterse notextmode notgst notimeout noto notr nottybuiltin notx noundofile novisualbell nowarn noweirdinvert nowfw nowildignorecase nowinfixheight nowiv nowrap nowrite nowritebackup syn keyword vimOption contained noai noaltkeymap noar noarabicshape noautochdir noautowrite noawa nobeval nobk nobreakindent nocf nocindent nocopyindent nocscoperelative nocsre nocuc nocursorcolumn nodelcombine nodigraph noed noemo noeol noesckeys noexpandtab nofic nofixeol nofoldenable nogd nohid nohkmap nohls noicon noimc noimdisable noinfercase nojoinspaces nolangremap nolbr nolisp nolnr nolpl nolz nomacatsui nomh nomod nomodifiable nomore nomousefocus nonu noodev nopaste nopreserveindent noprompt noreadonly noremap norevins norightleft nornu nors noruler nosc noscrollbind nosecure noshellslash noshiftround noshowcmd noshowmatch nosi nosmartcase nosmarttab nosn nospell nosplitright nosr nosta nostmp noswf notagbsearch notagstack notbidi notermbidi notextauto notf notildeop notitle notop nottimeout nottyfast noudf novb nowa nowb nowfh nowic nowildmenu nowinfixwidth nowmnu nowrapscan nowriteany nows -syn keyword vimOption contained noakm noanti noarab noari noautoindent noautowriteall nobackup nobin nobl nobri noci nocompatible nocp nocscopetag nocst nocul nocursorline nodg noea noedcompatible noemoji noequalalways noet noexrc nofileignorecase nofk nofs nogdefault nohidden nohkmapp nohlsearch noignorecase noimcmdline noincsearch noinsertmode nojs +syn keyword vimOption contained noakm noanti noarab noari noautoindent noautowriteall nobackup nobin nobl nobri noci nocompatible nocp nocscopetag nocst nocul nocursorline nodg noea noedcompatible noemoji noequalalways noet noexrc nofileignorecase nofk nofs nogdefault nohidden nohkmapp nohlsearch noignorecase noimcmdline noincsearch noinsertmode nojs " vimOptions: These are the invertible variants {{{2 syn keyword vimOption contained invacd invallowrevins invantialias invarabic invarshape invautoread invaw invballooneval invbinary invbomb invbuflisted invcin invconfirm invcrb invcscopeverbose invcsverb invcursorbind invdeco invdiff inveb invek invendofline inverrorbells invex invfen invfixendofline invfkmap invfsync invguipty invhk invhkp invic invim invimd invinf invis invlangnoremap invlazyredraw invlinebreak invlist invloadplugins invlrm invma invmagic invml invmodeline invmodified invmousef invmousehide invnumber invopendevice invpi invpreviewwindow invpvw invrelativenumber invrestorescreen invri invrl invro invru invsb invscb invscs invsft invshelltemp invshortname invshowfulltag invshowmode invsm invsmartindent invsmd invsol invsplitbelow invspr invssl invstartofline invswapfile invta invtagrelative invtbi invtbs invterse invtextmode invtgst invtimeout invto invtr invttybuiltin invtx invundofile invvisualbell invwarn invweirdinvert invwfw invwildignorecase invwinfixheight invwiv invwrap invwrite invwritebackup syn keyword vimOption contained invai invaltkeymap invar invarabicshape invautochdir invautowrite invawa invbeval invbk invbreakindent invcf invcindent invcopyindent invcscoperelative invcsre invcuc invcursorcolumn invdelcombine invdigraph inved invemo inveol invesckeys invexpandtab invfic invfixeol invfoldenable invgd invhid invhkmap invhls invicon invimc invimdisable invinfercase invjoinspaces invlangremap invlbr invlisp invlnr invlpl invlz invmacatsui invmh invmod invmodifiable invmore invmousefocus invnu invodev invpaste invpreserveindent invprompt invreadonly invremap invrevins invrightleft invrnu invrs invruler invsc invscrollbind invsecure invshellslash invshiftround invshowcmd invshowmatch invsi invsmartcase invsmarttab invsn invspell invsplitright invsr invsta invstmp invswf invtagbsearch invtagstack invtbidi invtermbidi invtextauto invtf invtildeop invtitle invtop invttimeout invttyfast invudf invvb invwa invwb invwfh invwic invwildmenu invwinfixwidth invwmnu invwrapscan invwriteany invws -syn keyword vimOption contained invakm invanti invarab invari invautoindent invautowriteall invbackup invbin invbl invbri invci invcompatible invcp invcscopetag invcst invcul invcursorline invdg invea invedcompatible invemoji invequalalways invet invexrc invfileignorecase invfk invfs invgdefault invhidden invhkmapp invhlsearch invignorecase invimcmdline invincsearch invinsertmode invjs +syn keyword vimOption contained invakm invanti invarab invari invautoindent invautowriteall invbackup invbin invbl invbri invci invcompatible invcp invcscopetag invcst invcul invcursorline invdg invea invedcompatible invemoji invequalalways invet invexrc invfileignorecase invfk invfs invgdefault invhidden invhkmapp invhlsearch invignorecase invimcmdline invincsearch invinsertmode invjs " termcap codes (which can also be set) {{{2 syn keyword vimOption contained t_8b t_AB t_al t_bc t_BE t_ce t_cl t_Co t_Cs t_CV t_db t_DL t_EI t_F2 t_F4 t_F6 t_F8 t_fs t_IE t_k1 t_k2 t_K3 t_K4 t_K5 t_K6 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_PE t_PS t_RB t_RC t_RF t_RI t_RS t_RV t_Sb t_SC t_se t_Sf t_SH t_SI t_so t_sr t_SR t_te t_Te t_ti t_ts t_Ts t_u7 t_ue t_us t_ut t_vb t_ve t_vi t_vs t_VS t_WP t_WS t_xn t_xs t_ZH t_ZR -syn keyword vimOption contained t_8f t_AF t_AL t_BD t_cd t_Ce t_cm t_cs t_CS t_da t_dl t_EC t_F1 t_F3 t_F5 t_F7 t_F9 t_GP t_IS t_K1 t_k3 t_k4 t_k5 t_k6 t_k7 +syn keyword vimOption contained t_8f t_AF t_AL t_BD t_cd t_Ce t_cm t_cs t_CS t_da t_dl t_EC t_F1 t_F3 t_F5 t_F7 t_F9 t_GP t_IS t_K1 t_k3 t_k4 t_k5 t_k6 t_k7 syn match vimOption contained "t_%1" syn match vimOption contained "t_#2" syn match vimOption contained "t_#4" @@ -62,17 +62,17 @@ " unsupported settings: some were supported by vi but don't do anything in vim {{{2 " others have been dropped along with msdos support -syn keyword vimErrSetting contained bioskey biosk conskey consk autoprint beautify flash graphic hardtabs mesg novice open op optimize redraw slow slowopen sourceany w300 w1200 w9600 hardtabs ht nobioskey nobiosk noconskey noconsk noautoprint nobeautify noflash nographic nohardtabs nomesg nonovice noopen noop nooptimize noredraw noslow noslowopen nosourceany now300 now1200 now9600 w1200 w300 w9600 +syn keyword vimErrSetting contained bioskey biosk conskey consk autoprint beautify flash graphic hardtabs mesg novice open op optimize redraw slow slowopen sourceany w300 w1200 w9600 hardtabs ht nobioskey nobiosk noconskey noconsk noautoprint nobeautify noflash nographic nohardtabs nomesg nonovice noopen noop nooptimize noredraw noslow noslowopen nosourceany now300 now1200 now9600 w1200 w300 w9600 " AutoCmd Events {{{2 syn case ignore -syn keyword vimAutoEvent contained BufAdd BufCreate BufDelete BufEnter BufFilePost BufFilePre BufHidden BufLeave BufNew BufNewFile BufRead BufReadCmd BufReadPost BufReadPre BufUnload BufWinEnter BufWinLeave BufWipeout BufWrite BufWriteCmd BufWritePost BufWritePre CmdlineEnter CmdlineLeave CmdUndefined CmdwinEnter CmdwinLeave ColorScheme CompleteDone CursorHold CursorHoldI CursorMoved CursorMovedI EncodingChanged FileAppendCmd FileAppendPost FileAppendPre FileChangedRO FileChangedShell FileChangedShellPost FileEncoding FileReadCmd FileReadPost FileReadPre FileType FileWriteCmd FileWritePost FileWritePre FilterReadPost FilterReadPre FilterWritePost FilterWritePre FocusGained FocusLost FuncUndefined GUIEnter GUIFailed InsertChange InsertCharPre InsertEnter InsertLeave MenuPopup OptionSet QuickFixCmdPost QuickFixCmdPre QuitPre RemoteReply SessionLoadPost ShellCmdPost ShellFilterPost SourceCmd SourcePre SpellFileMissing StdinReadPost StdinReadPre SwapExists Syntax TabClosed TabEnter TabLeave TabNew TermChanged TermResponse TextChanged TextChangedI User VimEnter VimLeave VimLeavePre VimResized WinEnter WinLeave WinNew +syn keyword vimAutoEvent contained BufAdd BufCreate BufDelete BufEnter BufFilePost BufFilePre BufHidden BufLeave BufNew BufNewFile BufRead BufReadCmd BufReadPost BufReadPre BufUnload BufWinEnter BufWinLeave BufWipeout BufWrite BufWriteCmd BufWritePost BufWritePre CmdlineEnter CmdlineLeave CmdUndefined CmdwinEnter CmdwinLeave ColorScheme CompleteDone CursorHold CursorHoldI CursorMoved CursorMovedI EncodingChanged FileAppendCmd FileAppendPost FileAppendPre FileChangedRO FileChangedShell FileChangedShellPost FileEncoding FileReadCmd FileReadPost FileReadPre FileType FileWriteCmd FileWritePost FileWritePre FilterReadPost FilterReadPre FilterWritePost FilterWritePre FocusGained FocusLost FuncUndefined GUIEnter GUIFailed InsertChange InsertCharPre InsertEnter InsertLeave MenuPopup OptionSet QuickFixCmdPost QuickFixCmdPre QuitPre RemoteReply SessionLoadPost ShellCmdPost ShellFilterPost SourceCmd SourcePre SpellFileMissing StdinReadPost StdinReadPre SwapExists Syntax TabClosed TabEnter TabLeave TabNew TermChanged TermResponse TextChanged TextChangedI User VimEnter VimLeave VimLeavePre VimResized WinEnter WinLeave WinNew " Highlight commonly used Groupnames {{{2 -syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo +syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo " Default highlighting groups {{{2 -syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu +syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu syn match vimHLGroup contained "Conceal" syn case match @@ -80,52 +80,52 @@ syn keyword vimFuncName contained abs append argv assert_fails assert_notequal atan browsedir bufname byte2line ceil ch_close ch_getbufnr ch_logfile ch_sendexpr cindent complete_add cos cursor diff_filler eval exepath extend filter floor foldclosed foldtextresult garbagecollect getbufvar getcmdline getcompletion getfperm getline getpos gettabinfo getwinposx glob2regpat haslocaldir histget hostname input inputsave isdirectory job_getchannel job_status js_encode len line2byte log10 mapcheck matcharg matchstr mkdir nr2char pow py3eval readfile remote_expr remote_send repeat screenattr search searchpos setbufvar setline setqflist setwinvar simplify soundfold sqrt strcharpart strftime string strridx submatch synID synstack tabpagebuflist tagfiles tanh term_getattr term_getline term_getstatus term_gettty term_sendkeys term_wait test_feedinput test_null_channel test_null_list test_override timer_pause timer_stopall tr undofile values wildmenumode win_findbuf winheight winline winrestview wordcount syn keyword vimFuncName contained acos argc asin assert_false assert_notmatch atan2 bufexists bufnr byteidx changenr ch_close_in ch_getjob ch_open ch_sendraw clearmatches complete_check cosh deepcopy diff_hlID eventhandler exists feedkeys finddir fmod foldclosedend foreground get getchar getcmdpos getcurpos getfsize getloclist getqflist gettabvar getwinposy globpath hasmapto histnr iconv inputdialog inputsecret islocked job_info job_stop json_decode libcall lispindent luaeval match matchdelete matchstrpos mode or prevnonblank pyeval reltime remote_foreground remote_startserver resolve screenchar searchdecl server2client setcharsearch setloclist setreg sha256 sin spellbadword str2float strchars strgetchar strlen strtrans substitute synIDattr system tabpagenr taglist tempname term_getcursor term_getscrolled term_gettitle term_list term_setsize test_alloc_fail test_garbagecollect_now test_null_dict test_null_partial test_settime timer_start tolower trunc undotree virtcol winbufnr win_getid win_id2tabwin winnr winsaveview writefile syn keyword vimFuncName contained add argidx assert_equal assert_inrange assert_report balloon_show buflisted bufwinid byteidxcomp char2nr ch_evalexpr ch_info ch_read ch_setoptions col confirm count delete empty executable exp filereadable findfile fnameescape foldlevel funcref getbufinfo getcharmod getcmdtype getcwd getftime getmatches getreg gettabwinvar getwinvar has histadd hlexists indent inputlist insert isnan job_setoptions join json_encode libcallnr localtime map matchadd matchend max mzeval pathshorten printf pyxeval reltimefloat remote_peek remove reverse screencol searchpair serverlist setcmdpos setmatches settabvar shellescape sinh spellsuggest str2nr strdisplaywidth stridx strpart strwidth synconcealed synIDtrans systemlist tabpagewinnr tan term_getaltscreen term_getjob term_getsize term_getttty term_scrape term_start test_autochdir test_ignore_error test_null_job test_null_string timer_info timer_stop toupper type uniq visualmode wincol win_gotoid win_id2win winrestcmd winwidth xor -syn keyword vimFuncName contained and arglistid assert_exception assert_match assert_true browse bufloaded bufwinnr call ch_canread ch_evalraw ch_log ch_readraw ch_status complete copy cscope_connection did_filetype escape execute expand filewritable float2nr fnamemodify foldtext function getbufline getcharsearch getcmdwintype getfontname getftype getpid getregtype getwininfo glob has_key histdel hlID index inputrestore invert items job_start js_decode keys line log maparg matchaddpos matchlist min nextnonblank perleval pumvisible range reltimestr remote_read rename round screenrow searchpairpos setbufline setfperm setpos settabwinvar shiftwidth sort split +syn keyword vimFuncName contained and arglistid assert_exception assert_match assert_true browse bufloaded bufwinnr call ch_canread ch_evalraw ch_log ch_readraw ch_status complete copy cscope_connection did_filetype escape execute expand filewritable float2nr fnamemodify foldtext function getbufline getcharsearch getcmdwintype getfontname getftype getpid getregtype getwininfo glob has_key histdel hlID index inputrestore invert items job_start js_decode keys line log maparg matchaddpos matchlist min nextnonblank perleval pumvisible range reltimestr remote_read rename round screenrow searchpairpos setbufline setfperm setpos settabwinvar shiftwidth sort split "--- syntax here and above generated by mkvimvim --- " Special Vim Highlighting (not automatic) {{{1 " Set up folding commands if exists("g:vimsyn_folding") && g:vimsyn_folding =~# '[aflmpPrt]' - if g:vimsyn_folding =~# 'a' - com! -nargs=* VimFolda fold - else - com! -nargs=* VimFolda + if g:vimsyn_folding =~# 'a' + com! -nargs=* VimFolda fold + else + com! -nargs=* VimFolda endif - if g:vimsyn_folding =~# 'f' - com! -nargs=* VimFoldf fold - else - com! -nargs=* VimFoldf + if g:vimsyn_folding =~# 'f' + com! -nargs=* VimFoldf fold + else + com! -nargs=* VimFoldf endif - if g:vimsyn_folding =~# 'l' - com! -nargs=* VimFoldl fold - else - com! -nargs=* VimFoldl + if g:vimsyn_folding =~# 'l' + com! -nargs=* VimFoldl fold + else + com! -nargs=* VimFoldl endif - if g:vimsyn_folding =~# 'm' - com! -nargs=* VimFoldm fold - else - com! -nargs=* VimFoldm + if g:vimsyn_folding =~# 'm' + com! -nargs=* VimFoldm fold + else + com! -nargs=* VimFoldm endif - if g:vimsyn_folding =~# 'p' - com! -nargs=* VimFoldp fold - else - com! -nargs=* VimFoldp + if g:vimsyn_folding =~# 'p' + com! -nargs=* VimFoldp fold + else + com! -nargs=* VimFoldp endif - if g:vimsyn_folding =~# 'P' - com! -nargs=* VimFoldP fold - else - com! -nargs=* VimFoldP + if g:vimsyn_folding =~# 'P' + com! -nargs=* VimFoldP fold + else + com! -nargs=* VimFoldP endif - if g:vimsyn_folding =~# 'r' - com! -nargs=* VimFoldr fold - else - com! -nargs=* VimFoldr + if g:vimsyn_folding =~# 'r' + com! -nargs=* VimFoldr fold + else + com! -nargs=* VimFoldr endif - if g:vimsyn_folding =~# 't' - com! -nargs=* VimFoldt fold - else - com! -nargs=* VimFoldt + if g:vimsyn_folding =~# 't' + com! -nargs=* VimFoldt fold + else + com! -nargs=* VimFoldt endif else com! -nargs=* VimFolda @@ -164,7 +164,7 @@ syn match vimNumber "\<\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=" skipwhite nextgroup=vimGlobal,vimSubst,vimCommand syn match vimNumber "-\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=" skipwhite nextgroup=vimGlobal,vimSubst,vimCommand syn match vimNumber "\<0[xX]\x\+" -syn match vimNumber "\%(^\|[^a-zA-Z]\)\zs#\x\{6}" +syn match vimNumber "\%(^\|\A\)\zs#\x\{6}" " All vimCommands are contained by vimIsCommands. {{{2 syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimIsCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd @@ -214,7 +214,7 @@ " Operators: {{{2 " ========= syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,vimContinue -syn match vimOper "\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile +syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\(\\|\\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=@vimOperGroup @@ -321,7 +321,7 @@ syn region vimSubstRep4 contained matchgroup=vimSubstDelim start="\z(.\)" skip="\\\\\|\\\z1" end="\z1" matchgroup=vimNotation end="<[cC][rR]>" contains=@vimSubstRepList nextgroup=vimSubstFlagErr oneline syn region vimCollection contained transparent start="\\\@" contains=vimMapModKey,vimMapModErr skipwhite nextgroup=vimMapMod,vimMapLhs +syn match vimMapMod contained "\%#=1\c<\(buffer\|expr\|\(local\)\=leader\|nowait\|plug\|script\|sid\|unique\|silent\)\+>" contains=vimMapModKey,vimMapModErr skipwhite nextgroup=vimMapMod,vimMapLhs syn match vimMapRhs contained ".*" contains=vimNotation,vimCtrlChar skipnl nextgroup=vimMapRhsExtend syn match vimMapRhsExtend contained "^\s*\\.*$" contains=vimContinue syn case ignore @@ -416,27 +416,27 @@ " Angle-Bracket Notation (tnx to Michael Geddes) {{{2 " ====================== syn case ignore -syn match vimNotation "\(\\\|\)\=<\([scamd]-\)\{0,4}x\=\(f\d\{1,2}\|[^ \t:]\|cr\|lf\|linefeed\|return\|k\=del\%[ete]\|bs\|backspace\|tab\|esc\|right\|left\|help\|undo\|insert\|ins\|k\=home\|k\=end\|kplus\|kminus\|kdivide\|kmultiply\|kenter\|kpoint\|space\|k\=\(page\)\=\(\|down\|up\|k\d\>\)\)>" contains=vimBracket -syn match vimNotation "\(\\\|\)\=<\([scam2-4]-\)\{0,4}\(right\|left\|middle\)\(mouse\)\=\(drag\|release\)\=>" contains=vimBracket -syn match vimNotation "\(\\\|\)\=<\(bslash\|plug\|sid\|space\|bar\|nop\|nul\|lt\)>" contains=vimBracket -syn match vimNotation '\(\\\|\)\=[0-9a-z"%#:.\-=]'he=e-1 contains=vimBracket -syn match vimNotation '\(\\\|\)\=<\%(q-\)\=\(line[12]\|count\|bang\|reg\|args\|mods\|f-args\|f-mods\|lt\)>' contains=vimBracket -syn match vimNotation "\(\\\|\)\=<\([cas]file\|abuf\|amatch\|cword\|cWORD\|client\)>" contains=vimBracket +syn match vimNotation "\%#=1\(\\\|\)\=<\([scamd]-\)\{0,4}x\=\(f\d\{1,2}\|[^ \t:]\|cr\|lf\|linefeed\|return\|k\=del\%[ete]\|bs\|backspace\|tab\|esc\|right\|left\|help\|undo\|insert\|ins\|k\=home\|k\=end\|kplus\|kminus\|kdivide\|kmultiply\|kenter\|kpoint\|space\|k\=\(page\)\=\(\|down\|up\|k\d\>\)\)>" contains=vimBracket +syn match vimNotation "\%#=1\(\\\|\)\=<\([scam2-4]-\)\{0,4}\(right\|left\|middle\)\(mouse\)\=\(drag\|release\)\=>" contains=vimBracket +syn match vimNotation "\%#=1\(\\\|\)\=<\(bslash\|plug\|sid\|space\|bar\|nop\|nul\|lt\)>" contains=vimBracket +syn match vimNotation '\(\\\|\)\=[0-9a-z"%#:.\-=]'he=e-1 contains=vimBracket +syn match vimNotation '\%#=1\(\\\|\)\=<\%(q-\)\=\(line[12]\|count\|bang\|reg\|args\|mods\|f-args\|f-mods\|lt\)>' contains=vimBracket +syn match vimNotation "\%#=1\(\\\|\)\=<\([cas]file\|abuf\|amatch\|cword\|cWORD\|client\)>" contains=vimBracket syn match vimBracket contained "[\\<>]" syn case match " User Function Highlighting {{{2 " (following Gautam Iyer's suggestion) " ========================== -syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_]\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute -syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_]\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\" contains=vimNotation +syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute +syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\" contains=vimNotation syn match vimNotFunc "\\|\\|\\|\" " Errors And Warnings: {{{2 " ==================== if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimfunctionerror") syn match vimFunctionError "\s\zs[a-z0-9]\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank -" syn match vimFunctionError "\s\zs\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)[0-9]\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank +" syn match vimFunctionError "\s\zs\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\d\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank syn match vimElseIfErr "\" syn match vimBufnrWarn /\" +syn match vimSynKeyOpt contained "\%#=1\<\(conceal\|contained\|transparent\|skipempty\|skipwhite\|skipnl\)\>" syn cluster vimFuncBodyList add=vimSynType " Syntax: match {{{2 syn cluster vimSynMtchGroup contains=vimMtchComment,vimSynContains,vimSynError,vimSynMtchOpt,vimSynNextgroup,vimSynRegPat,vimNotation syn keyword vimSynType contained match skipwhite nextgroup=vimSynMatchRegion syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\h\w*" matchgroup=vimSep end="|\|$" contains=@vimSynMtchGroup -syn match vimSynMtchOpt contained "\<\(conceal\|transparent\|contained\|excludenl\|keepend\|skipempty\|skipwhite\|display\|extend\|skipnl\|fold\)\>" +syn match vimSynMtchOpt contained "\%#=1\<\(conceal\|transparent\|contained\|excludenl\|keepend\|skipempty\|skipwhite\|display\|extend\|skipnl\|fold\)\>" if has("conceal") syn match vimSynMtchOpt contained "\" +syn match vimSynRegOpt contained "\%#=1\<\(conceal\(ends\)\=\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|keepend\|oneline\|extend\|skipnl\|fold\)\>" syn match vimSynReg contained "\(start\|skip\|end\)="he=e-1 nextgroup=vimSynRegPat syn match vimSynMtchGrp contained "matchgroup=" nextgroup=vimGroup,vimHLGroup syn region vimSynRegPat contained extend start="\z([-`~!@#$%^&*_=+;:'",./?]\)" skip="\\\\\|\\\z1" end="\z1" contains=@vimSynRegPatGroup skipwhite nextgroup=vimSynPatMod,vimSynReg -syn match vimSynPatMod contained "\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=" -syn match vimSynPatMod contained "\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=," nextgroup=vimSynPatMod +syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=" +syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=," nextgroup=vimSynPatMod syn match vimSynPatMod contained "lc=\d\+" syn match vimSynPatMod contained "lc=\d\+," nextgroup=vimSynPatMod syn region vimSynPatRange contained start="\[" skip="\\\\\|\\]" end="]" @@ -553,7 +553,7 @@ " ============ syn cluster vimHighlightCluster contains=vimHiLink,vimHiClear,vimHiKeyList,vimComment if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimhictermerror") - syn match vimHiCtermError contained "[^0-9]\i*" + syn match vimHiCtermError contained "\D\i*" endif syn match vimHighlight "\" skipwhite nextgroup=vimHiBang,@vimHighlightCluster syn match vimHiBang contained "!" skipwhite nextgroup=@vimHighlightCluster @@ -645,6 +645,7 @@ endif if (g:vimsyn_embed =~# 'l' && has("lua")) && filereadable(s:luapath) unlet! b:current_syntax + syn cluster vimFuncBodyList add=vimLuaRegion exe "syn include @vimLuaScript ".s:luapath VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimLuaScript VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*$+ end=+\.$+ contains=@vimLuaScript @@ -667,6 +668,7 @@ endif if (g:vimsyn_embed =~# 'p' && has("perl")) && filereadable(s:perlpath) unlet! b:current_syntax + syn cluster vimFuncBodyList add=vimPerlRegion exe "syn include @vimPerlScript ".s:perlpath VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPerlScript VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*$+ end=+\.$+ contains=@vimPerlScript @@ -688,6 +690,7 @@ endfor endif if (g:vimsyn_embed =~# 'r' && has("ruby")) && filereadable(s:rubypath) + syn cluster vimFuncBodyList add=vimRubyRegion unlet! b:current_syntax exe "syn include @vimRubyScript ".s:rubypath VimFoldr syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimRubyScript @@ -709,12 +712,13 @@ endif endfor endif -if g:vimsyn_embed =~# 'P' && (has("python") || has("python3")) && filereadable(s:pythonpath) +if g:vimsyn_embed =~# 'P' && has("pythonx") && filereadable(s:pythonpath) unlet! b:current_syntax + syn cluster vimFuncBodyList add=vimPythonRegion exe "syn include @vimPythonScript ".s:pythonpath VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript - VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript + VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript syn cluster vimFuncBodyList add=vimPythonRegion else @@ -742,6 +746,7 @@ endif if (g:vimsyn_embed =~# 't' && has("tcl")) && filereadable(s:tclpath) unlet! b:current_syntax + syn cluster vimFuncBodyList add=vimTclRegion exe "syn include @vimTclScript ".s:tclpath VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimTclScript VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*$+ end=+\.$+ contains=@vimTclScript @@ -770,6 +775,7 @@ if (g:vimsyn_embed =~# 'm' && has("mzscheme")) && filereadable(s:mzschemepath) unlet! b:current_syntax let s:iskKeep= &isk + syn cluster vimFuncBodyList add=vimMzSchemeRegion exe "syn include @vimMzSchemeScript ".s:mzschemepath let &isk= s:iskKeep unlet s:iskKeep diff -Nru vim-8.0.1453/runtime/tools/shtags.pl vim-8.0.1766/runtime/tools/shtags.pl --- vim-8.0.1453/runtime/tools/shtags.pl 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tools/shtags.pl 2018-04-26 20:30:33.000000000 +0000 @@ -3,11 +3,12 @@ # shtags: create a tags file for perl scripts # # Author: Stephen Riehm -# Last Changed: 96/11/27 19:46:06 -# -# "@(#) shtags 1.1 by S. Riehm" +# Updated by: David Woodfall +# Last Changed: 2018/04/02 # +use Getopt::Std; + # obvious... :-) sub usage { @@ -30,7 +31,7 @@ # # Version information # - @id = split( ', ', 'scripts/bin/shtags, /usr/local/, LOCAL_SCRIPTS, 1.1, 96/11/27, 19:46:06' ); + @id = split( ', ', 'scripts/bin/shtags, /usr/local/, LOCAL_SCRIPTS, 1.2, 18/04/02, 07:37' ); $id[0] =~ s,.*/,,; print <<_EOVERS; $id[0]: $id[3] @@ -45,12 +46,11 @@ # initialisations # ($program = $0) =~ s,.*/,,; -require 'getopts.pl'; # # parse command line # -&Getopts( "t:s:vVwx" ) || &usage(); +getopts( "t:s:vVwx" ) || &usage(); $tags_file = $opt_t || 'tags'; $explicit = $opt_x; $variable_tags = $opt_v; diff -Nru vim-8.0.1453/runtime/tutor/tutor vim-8.0.1766/runtime/tutor/tutor --- vim-8.0.1453/runtime/tutor/tutor 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor 2018-04-26 20:30:33.000000000 +0000 @@ -18,7 +18,7 @@ use. That means that you need to execute the commands to learn them properly. If you only read the text, you will forget the commands! - Now, make sure that your Shift-Lock key is NOT depressed and press + Now, make sure that your Caps-Lock key is NOT depressed and press the j key enough times to move the cursor so that Lesson 1.1 completely fills the screen. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff -Nru vim-8.0.1453/runtime/tutor/tutor.cs vim-8.0.1766/runtime/tutor/tutor.cs --- vim-8.0.1453/runtime/tutor/tutor.cs 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor.cs 2018-04-26 20:30:33.000000000 +0000 @@ -17,7 +17,7 @@ To znamená, ¾e je potøeba si pøíkazy vyzkou¹et pro jejich správné nauèení. Pokud si jen ète¹ text, pøíkazy zapomene¹! - Nyní se pøesvìdète, ¾e Shift-Lock NENÍ stlaèený a nìkolikrát stisknìte + Nyní se pøesvìdète, ¾e Caps-Lock NENÍ stlaèený a nìkolikrát stisknìte klávesu j aby se kurzor posunul natolik, ¾e lekce 1.1 zaplní celou obrazovku. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff -Nru vim-8.0.1453/runtime/tutor/tutor.cs.cp1250 vim-8.0.1766/runtime/tutor/tutor.cs.cp1250 --- vim-8.0.1453/runtime/tutor/tutor.cs.cp1250 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor.cs.cp1250 2018-04-26 20:30:33.000000000 +0000 @@ -17,7 +17,7 @@ To znamená, že je potøeba si pøíkazy vyzkoušet pro jejich správné nauèení. Pokud si jen èteš text, pøíkazy zapomeneš! - Nyní se pøesvìdète, že Shift-Lock NENÍ stlaèený a nìkolikrát stisknìte + Nyní se pøesvìdète, že Caps-Lock NENÍ stlaèený a nìkolikrát stisknìte klávesu j aby se kurzor posunul natolik, že lekce 1.1 zaplní celou obrazovku. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff -Nru vim-8.0.1453/runtime/tutor/tutor.cs.utf-8 vim-8.0.1766/runtime/tutor/tutor.cs.utf-8 --- vim-8.0.1453/runtime/tutor/tutor.cs.utf-8 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor.cs.utf-8 2018-04-26 20:30:33.000000000 +0000 @@ -17,7 +17,7 @@ To znamená, že je potÅ™eba si příkazy vyzkouÅ¡et pro jejich správné nauÄení. Pokud si jen ÄteÅ¡ text, příkazy zapomeneÅ¡! - Nyní se pÅ™esvÄ›dÄte, že Shift-Lock NENà stlaÄený a nÄ›kolikrát stisknÄ›te + Nyní se pÅ™esvÄ›dÄte, že Caps-Lock NENà stlaÄený a nÄ›kolikrát stisknÄ›te klávesu j aby se kurzor posunul natolik, že lekce 1.1 zaplní celou obrazovku. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff -Nru vim-8.0.1453/runtime/tutor/tutor.el vim-8.0.1766/runtime/tutor/tutor.el --- vim-8.0.1453/runtime/tutor/tutor.el 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor.el 2018-04-26 20:30:33.000000000 +0000 @@ -20,7 +20,7 @@ åêôåëåßôå ôéò åíôïëÝò ãéá íá ôéò ìÜèåôå óùóôÜ. Áí äéáâÜæåôå ìüíï ôï êåßìåíï, èá ôéò îå÷Üóåôå! - Ôþñá, âåâáéùèåßôå üôé ôï ðëÞêôñï Shift-Lock ÄÅÍ åßíáé ðáôçìÝíï êáé + Ôþñá, âåâáéùèåßôå üôé ôï ðëÞêôñï Caps-Lock ÄÅÍ åßíáé ðáôçìÝíï êáé ðáôÞóôå ôï ðëÞêôñï j áñêåôÝò öïñÝò ãéá íá ìåôáêéíÞóåôå ôïí äñïìÝá Ýôóé þóôå ôï ÌÜèçìá 1.1 íá ãåìßóåé ðëÞñùò ôçí ïèüíç. diff -Nru vim-8.0.1453/runtime/tutor/tutor.el.cp737 vim-8.0.1766/runtime/tutor/tutor.el.cp737 --- vim-8.0.1453/runtime/tutor/tutor.el.cp737 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor.el.cp737 2018-04-26 20:30:33.000000000 +0000 @@ -20,7 +20,7 @@ œ¡«œ¢œå«œ « ª œ¤«¦¢âª š ˜ ¤˜ « ª £áŸœ«œ ©à©«á. €¤ › ˜™áœ«œ £æ¤¦ «¦ ¡œå£œ¤¦, Ÿ˜ « ª ¥œ®á©œ«œ! - ’騘, ™œ™˜ àŸœå«œ æ«  «¦ §¢ã¡«¨¦ Shift-Lock ƒ„Œ œå¤˜  §˜«ž£â¤¦ ¡˜  + ’騘, ™œ™˜ àŸœå«œ æ«  «¦ §¢ã¡«¨¦ Caps-Lock ƒ„Œ œå¤˜  §˜«ž£â¤¦ ¡˜  §˜«ã©«œ «¦ §¢ã¡«¨¦ j ˜¨¡œ«âª ­¦¨âª š ˜ ¤˜ £œ«˜¡ ¤ã©œ«œ «¦¤ ›¨¦£â˜ â«©  é©«œ «¦ ‹áŸž£˜ 1.1 ¤˜ šœ£å©œ  §¢ã¨àª «ž¤ ¦Ÿæ¤ž. diff -Nru vim-8.0.1453/runtime/tutor/tutor.el.utf-8 vim-8.0.1766/runtime/tutor/tutor.el.utf-8 --- vim-8.0.1453/runtime/tutor/tutor.el.utf-8 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor.el.utf-8 2018-04-26 20:30:33.000000000 +0000 @@ -20,7 +20,7 @@ εκτελείτε τις εντολές για να τις μάθετε σωστά. Αν διαβάζετε μόνο το κείμενο, θα τις ξεχάσετε! - ΤώÏα, βεβαιωθείτε ότι το πλήκτÏο Shift-Lock ΔΕΠείναι πατημένο και + ΤώÏα, βεβαιωθείτε ότι το πλήκτÏο Caps-Lock ΔΕΠείναι πατημένο και πατήστε το πλήκτÏο j αÏκετές φοÏές για να μετακινήσετε τον δÏομέα έτσι ώστε το Μάθημα 1.1 να γεμίσει πλήÏως την οθόνη. diff -Nru vim-8.0.1453/runtime/tutor/tutor.sk vim-8.0.1766/runtime/tutor/tutor.sk --- vim-8.0.1453/runtime/tutor/tutor.sk 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor.sk 2018-04-26 20:30:33.000000000 +0000 @@ -18,7 +18,7 @@ pou¾ívaním. To znamená, ¾e je potrebné si príkazy vyskú¹a», aby bolo uèenie správne. Ak len èitas text, príkazy zabudne¹! - Presvedè sa, ¾e Shift-Lock NIEJE stlaèený a stlaèt klávesu + Presvedè sa, ¾e Caps-Lock NIEJE stlaèený a stlaèt klávesu j niekoµko krát, aby sa kurzor posunul natoµko, ¾e lekcia 1.1 celkom zaplní obrazovku. diff -Nru vim-8.0.1453/runtime/tutor/tutor.sk.cp1250 vim-8.0.1766/runtime/tutor/tutor.sk.cp1250 --- vim-8.0.1453/runtime/tutor/tutor.sk.cp1250 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor.sk.cp1250 2018-04-26 20:30:33.000000000 +0000 @@ -18,7 +18,7 @@ používaním. To znamená, že je potrebné si príkazy vyskúša, aby bolo uèenie správne. Ak len èitas text, príkazy zabudneš! - Presvedè sa, že Shift-Lock NIEJE stlaèený a stlaèt klávesu + Presvedè sa, že Caps-Lock NIEJE stlaèený a stlaèt klávesu j nieko¾ko krát, aby sa kurzor posunul nato¾ko, že lekcia 1.1 celkom zaplní obrazovku. diff -Nru vim-8.0.1453/runtime/tutor/tutor.sk.utf-8 vim-8.0.1766/runtime/tutor/tutor.sk.utf-8 --- vim-8.0.1453/runtime/tutor/tutor.sk.utf-8 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor.sk.utf-8 2018-04-26 20:30:33.000000000 +0000 @@ -18,7 +18,7 @@ používaním. To znamená, že je potrebné si príkazy vyskúšaÅ¥, aby bolo uÄenie správne. Ak len Äitas text, príkazy zabudneÅ¡! - PresvedÄ sa, že Shift-Lock NIEJE stlaÄený a stlaÄt klávesu + PresvedÄ sa, že Caps-Lock NIEJE stlaÄený a stlaÄt klávesu j niekoľko krát, aby sa kurzor posunul natoľko, že lekcia 1.1 celkom zaplní obrazovku. diff -Nru vim-8.0.1453/runtime/tutor/tutor.tr.iso9 vim-8.0.1766/runtime/tutor/tutor.tr.iso9 --- vim-8.0.1453/runtime/tutor/tutor.tr.iso9 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor.tr.iso9 2018-04-26 20:30:33.000000000 +0000 @@ -18,7 +18,7 @@ anlama gelir; komutlarý öðrenmek için doðru bir þekilde çalýþtýrmanýz gerekir. Eðer sadece yazýlanlarý okursanýz komutlarý unutursunuz. - Þimdi Shift-Lock tuþlarýnýzýn basýlý olmadýðýna emin olun ve Ders 1.1'in + Þimdi Caps-Lock tuþlarýnýzýn basýlý olmadýðýna emin olun ve Ders 1.1'in ekraný tamamen doldurmasý için j tuþuna yeterli miktarda basýn. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ders 1.1: ÝMLECÝ HAREKET ETTÝRMEK diff -Nru vim-8.0.1453/runtime/tutor/tutor.tr.utf-8 vim-8.0.1766/runtime/tutor/tutor.tr.utf-8 --- vim-8.0.1453/runtime/tutor/tutor.tr.utf-8 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor.tr.utf-8 2018-04-26 20:30:33.000000000 +0000 @@ -18,7 +18,7 @@ anlama gelir; komutları öğrenmek için doÄŸru bir ÅŸekilde çalıştırmanız gerekir. EÄŸer sadece yazılanları okursanız komutları unutursunuz. - Åžimdi Shift-Lock tuÅŸlarınızın basılı olmadığına emin olun ve Ders 1.1'in + Åžimdi Caps-Lock tuÅŸlarınızın basılı olmadığına emin olun ve Ders 1.1'in ekranı tamamen doldurması için j tuÅŸuna yeterli miktarda basın. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ders 1.1: Ä°MLECÄ° HAREKET ETTÄ°RMEK diff -Nru vim-8.0.1453/runtime/tutor/tutor.utf-8 vim-8.0.1766/runtime/tutor/tutor.utf-8 --- vim-8.0.1453/runtime/tutor/tutor.utf-8 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor.utf-8 2018-04-26 20:30:33.000000000 +0000 @@ -18,7 +18,7 @@ use. That means that you need to execute the commands to learn them properly. If you only read the text, you will forget the commands! - Now, make sure that your Shift-Lock key is NOT depressed and press + Now, make sure that your Caps-Lock key is NOT depressed and press the j key enough times to move the cursor so that Lesson 1.1 completely fills the screen. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff -Nru vim-8.0.1453/runtime/tutor/tutor.vim vim-8.0.1766/runtime/tutor/tutor.vim --- vim-8.0.1453/runtime/tutor/tutor.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/runtime/tutor/tutor.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,12 +1,12 @@ " Vim tutor support file " Author: Eduardo F. Amatria " Maintainer: Bram Moolenaar -" Last Change: 2016 Jul 16 +" Last Change: 2018 Apr 11 " This Vim script is used for detecting if a translation of the " tutor file exist, i.e., a tutor.xx file, where xx is the language. " If the translation does not exist, or no extension is given, -" it defaults to the english version. +" it defaults to the English version. " It is invoked by the vimtutor shell script. diff -Nru vim-8.0.1453/src/auto/configure vim-8.0.1766/src/auto/configure --- vim-8.0.1453/src/auto/configure 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/auto/configure 2018-04-26 20:30:33.000000000 +0000 @@ -679,14 +679,11 @@ PYTHON3_SRC PYTHON3_CFLAGS PYTHON3_LIBS -PYTHON3_CONFDIR vi_cv_path_python3 PYTHON_OBJ PYTHON_SRC PYTHON_CFLAGS -PYTHON_GETPATH_CFLAGS PYTHON_LIBS -PYTHON_CONFDIR vi_cv_path_python PERL_LIBS PERL_CFLAGS @@ -805,8 +802,10 @@ with_plthome enable_perlinterp enable_pythoninterp +with_python_command with_python_config_dir enable_python3interp +with_python3_command with_python3_config_dir enable_tclinterp with_tclsh @@ -1535,8 +1534,10 @@ --with-lua-prefix=PFX Prefix where Lua is installed. --with-luajit Link with LuaJIT instead of Lua. --with-plthome=PLTHOME Use PLTHOME. - --with-python-config-dir=PATH Python's config directory - --with-python3-config-dir=PATH Python's config directory + --with-python-command=NAME name of the Python 2 command (default: python2 or python) + --with-python-config-dir=PATH Python's config directory (deprecated) + --with-python3-command=NAME name of the Python 3 command (default: python3 or python) + --with-python3-config-dir=PATH Python's config directory (deprecated) --with-tclsh=PATH which tclsh to use (default: tclsh8.0) --with-ruby-command=RUBY name of the Ruby command (default: ruby) --with-x use the X Window System @@ -3452,6 +3453,183 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if ${ac_cv_prog_cc_c99+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +#include + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} + +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c99" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c99" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c99" != xno; then : + +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4087,6 +4265,194 @@ fi +if test x"$ac_cv_prog_cc_c99" != xno; then + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5 +$as_echo_n "checking for unsigned long long int... " >&6; } +if ${ac_cv_type_unsigned_long_long_int+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_type_unsigned_long_long_int=yes + if test "x${ac_cv_prog_cc_c99-no}" = xno; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + /* For now, do not test the preprocessor; as of 2007 there are too many + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ + /* Test literals. */ + long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + unsigned long long int ull = 18446744073709551615ULL; + /* Test constant expressions. */ + typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + ? 1 : -1)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63; +int +main () +{ +/* Test availability of runtime routines for shift and division. */ + long long int llmax = 9223372036854775807ll; + unsigned long long int ullmax = 18446744073709551615ull; + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull)); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +else + ac_cv_type_unsigned_long_long_int=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5 +$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; } + if test $ac_cv_type_unsigned_long_long_int = yes; then + +$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5 +$as_echo_n "checking for long long int... " >&6; } +if ${ac_cv_type_long_long_int+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_type_long_long_int=yes + if test "x${ac_cv_prog_cc_c99-no}" = xno; then + ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int + if test $ac_cv_type_long_long_int = yes; then + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #ifndef LLONG_MAX + # define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + # define LLONG_MAX (HALF - 1 + HALF) + #endif +int +main () +{ +long long int n = 1; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_type_long_long_int=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5 +$as_echo "$ac_cv_type_long_long_int" >&6; } + if test $ac_cv_type_long_long_int = yes; then + +$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h + + fi + + if test "$ac_cv_type_long_long_int" = no; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Compiler does not support long long int +See \`config.log' for more details" "$LINENO" 5; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler supports trailing commas" >&5 +$as_echo_n "checking if the compiler supports trailing commas... " >&6; } + trailing_commas=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + enum { + one, + }; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; trailing_commas=yes +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$trailing_commas" = no; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Compiler does not support trailing comma in enum +See \`config.log' for more details" "$LINENO" 5; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler supports C++ comments" >&5 +$as_echo_n "checking if the compiler supports C++ comments... " >&6; } + slash_comments=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +// C++ comments? + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; slash_comments=yes +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$slash_comments" = no; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Compiler does not support C++ comments +See \`config.log' for more details" "$LINENO" 5; } + fi +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-fail-if-missing argument" >&5 $as_echo_n "checking --enable-fail-if-missing argument... " >&6; } @@ -4190,7 +4556,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } MACOS_X=yes - CPPFLAGS="$CPPFLAGS -DMACOS_X" + CPPFLAGS="$CPPFLAGS -D_DARWIN_C_SOURCE -DMACOS_X" { $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-darwin argument" >&5 $as_echo_n "checking --disable-darwin argument... " >&6; } @@ -5849,6 +6215,21 @@ as_fn_error $? "cannot use Python with tiny or small features" "$LINENO" 5 fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-python-command argument" >&5 +$as_echo_n "checking --with-python-command argument... " >&6; } + + +# Check whether --with-python-command was given. +if test "${with_python_command+set}" = set; then : + withval=$with_python_command; vi_cv_path_python="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_python" >&5 +$as_echo "$vi_cv_path_python" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "X$vi_cv_path_python" = "X"; then for ac_prog in python2 python do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -5894,6 +6275,7 @@ test -n "$vi_cv_path_python" && break done + fi if test "X$vi_cv_path_python" != "X"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python version" >&5 @@ -5955,7 +6337,7 @@ # Check whether --with-python-config-dir was given. if test "${with_python_config_dir+set}" = set; then : - withval=$with_python_config_dir; vi_cv_path_python_conf="${withval}" + withval=$with_python_config_dir; vi_cv_path_python_conf="${withval}"; have_python_config_dir=1 fi @@ -6018,11 +6400,7 @@ vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python" fi else - if test "${vi_cv_var_python_version}" = "1.4"; then - vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a" - else - vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}" - fi + vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}" if test -n "${python_LINKFORSHARED}" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then python_link_symbol=`echo ${python_LINKFORSHARED} | sed 's/\([^ \t][^ \t]*[ \t][ \t]*[^ \t][^ \t]*\)[ \t].*/\1/'` python_link_path=`echo ${python_LINKFORSHARED} | sed 's/\([^ \t][^ \t]*[ \t][ \t]*[^ \t][^ \t]*\)[ \t][ \t]*\(.*\)/\2/'` @@ -6058,16 +6436,16 @@ PYTHON_LIBS="${vi_cv_path_python_plibs}" if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then - PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'" + PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}" else - PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'" + PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version}" + fi + if test "X$have_python_config_dir" = "X1" -a "$enable_pythoninterp" = "dynamic"; then + PYTHON_CFLAGS="${PYTHON_CFLAGS} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'" + fi PYTHON_SRC="if_python.c" PYTHON_OBJ="objects/if_python.o" - if test "${vi_cv_var_python_version}" = "1.4"; then - PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o" - fi - PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -pthread should be used" >&5 $as_echo_n "checking if -pthread should be used... " >&6; } @@ -6171,8 +6549,6 @@ - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-python3interp argument" >&5 $as_echo_n "checking --enable-python3interp argument... " >&6; } # Check whether --enable-python3interp was given. @@ -6189,6 +6565,21 @@ as_fn_error $? "cannot use Python with tiny or small features" "$LINENO" 5 fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-python3-command argument" >&5 +$as_echo_n "checking --with-python3-command argument... " >&6; } + + +# Check whether --with-python3-command was given. +if test "${with_python3_command+set}" = set; then : + withval=$with_python3_command; vi_cv_path_python3="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_python3" >&5 +$as_echo "$vi_cv_path_python3" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "X$vi_cv_path_python3" = "X"; then for ac_prog in python3 python do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -6234,6 +6625,7 @@ test -n "$vi_cv_path_python3" && break done + fi if test "X$vi_cv_path_python3" != "X"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python version" >&5 @@ -6312,7 +6704,7 @@ # Check whether --with-python3-config-dir was given. if test "${with_python3_config_dir+set}" = set; then : - withval=$with_python3_config_dir; vi_cv_path_python3_conf="${withval}" + withval=$with_python3_config_dir; vi_cv_path_python3_conf="${withval}"; have_python3_config_dir=1 fi @@ -6390,10 +6782,13 @@ PYTHON3_LIBS="${vi_cv_path_python3_plibs}" if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then - PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'" + PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" else - PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'" + PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" fi + if test "X$have_python3_config_dir" = "X1" -a "$enable_python3interp" = "dynamic"; then + PYTHON3_CFLAGS="${PYTHON3_CFLAGS} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'" + fi PYTHON3_SRC="if_python3.c" PYTHON3_OBJ="objects/if_python3.o" @@ -6497,7 +6892,6 @@ - if test "$python_ok" = yes && test "$python3_ok" = yes; then $as_echo "#define DYNAMIC_PYTHON 1" >>confdefs.h @@ -14316,7 +14710,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need to force -D_FILE_OFFSET_BITS=64" >&5 $as_echo_n "checking whether we need to force -D_FILE_OFFSET_BITS=64... " >&6; } -if echo "$CFLAGS $LUA_CFLAGS $MZSCHEME_CFLAGS $PERL_CFLAGS $PYTHON_GETPATH_CFLAGS $PYTHON_CFLAGS $PYTHON3_CFLAGS $TCL_CFLAGS $RUBY_CFLAGS $GTK_CFLAGS" | grep -q D_FILE_OFFSET_BITS 2>/dev/null; then +if echo "$CFLAGS $LUA_CFLAGS $MZSCHEME_CFLAGS $PERL_CFLAGS $PYTHON_CFLAGS $PYTHON3_CFLAGS $TCL_CFLAGS $RUBY_CFLAGS $GTK_CFLAGS" | grep -q D_FILE_OFFSET_BITS 2>/dev/null; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define _FILE_OFFSET_BITS 64" >>confdefs.h diff -Nru vim-8.0.1453/src/beval.c vim-8.0.1766/src/beval.c --- vim-8.0.1453/src/beval.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/beval.c 2018-04-26 20:30:33.000000000 +0000 @@ -137,7 +137,7 @@ * Show a balloon with "mesg" or "list". */ void -post_balloon(BalloonEval *beval UNUSED, char_u *mesg, list_T *list) +post_balloon(BalloonEval *beval UNUSED, char_u *mesg, list_T *list UNUSED) { # ifdef FEAT_BEVAL_TERM # ifdef FEAT_GUI diff -Nru vim-8.0.1453/src/buffer.c vim-8.0.1766/src/buffer.c --- vim-8.0.1453/src/buffer.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/buffer.c 2018-04-26 20:30:33.000000000 +0000 @@ -27,13 +27,9 @@ #include "vim.h" -#if defined(FEAT_CMDL_COMPL) || defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL) static char_u *buflist_match(regmatch_T *rmp, buf_T *buf, int ignore_case); -# define HAVE_BUFLIST_MATCH static char_u *fname_match(regmatch_T *rmp, char_u *name, int ignore_case); -#endif static void buflist_setfpos(buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options); -static wininfo_T *find_wininfo(buf_T *buf, int skip_diff_buffer); #ifdef UNIX static buf_T *buflist_findname_stat(char_u *ffname, stat_T *st); static int otherfile_buf(buf_T *buf, char_u *ffname, stat_T *stp); @@ -63,9 +59,7 @@ static char *msg_loclist = N_("[Location List]"); static char *msg_qflist = N_("[Quickfix List]"); #endif -#ifdef FEAT_AUTOCMD static char *e_auabort = N_("E855: Autocommands caused command to abort"); -#endif /* Number of times free_buffer() was called. */ static int buf_free_count = 0; @@ -116,17 +110,15 @@ else if (retval == OK) unchanged(curbuf, FALSE); -#ifdef FEAT_AUTOCMD if (retval == OK) { -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE, - curbuf, &retval); -# else + curbuf, &retval); +#else apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf); -# endif - } #endif + } } return retval; } @@ -143,9 +135,7 @@ int flags) /* extra flags for readfile() */ { int retval = OK; -#ifdef FEAT_AUTOCMD bufref_T old_curbuf; -#endif #ifdef FEAT_SYN_HL long old_tw = curbuf->b_p_tw; #endif @@ -188,12 +178,10 @@ return FAIL; } -#ifdef FEAT_AUTOCMD /* The autocommands in readfile() may change the buffer, but only AFTER * reading the file. */ set_bufref(&old_curbuf, curbuf); modified_was_set = FALSE; -#endif /* mark cursor position as being invalid */ curwin->w_valid = 0; @@ -289,11 +277,9 @@ * the changed flag. Unless in readonly mode: "ls | gview -". * When interrupted and 'cpoptions' contains 'i' set changed flag. */ if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL) -#ifdef FEAT_AUTOCMD || modified_was_set /* ":set modified" used in autocmd */ -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL) -# endif #endif ) changed(); @@ -301,6 +287,13 @@ unchanged(curbuf, FALSE); save_file_ff(curbuf); /* keep this fileformat */ + /* Set last_changedtick to avoid triggering a TextChanged autocommand right + * after it was added. */ + curbuf->b_last_changedtick = CHANGEDTICK(curbuf); +#ifdef FEAT_INS_EXPAND + curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf); +#endif + /* require "!" to overwrite the file, because it wasn't read completely */ #ifdef FEAT_EVAL if (aborting()) @@ -315,25 +308,22 @@ foldUpdateAll(curwin); #endif -#ifdef FEAT_AUTOCMD /* need to set w_topline, unless some autocommand already did that. */ if (!(curwin->w_valid & VALID_TOPLINE)) { curwin->w_topline = 1; -# ifdef FEAT_DIFF +#ifdef FEAT_DIFF curwin->w_topfill = 0; -# endif +#endif } -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf, &retval); -# else +#else apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); -# endif #endif if (retval == OK) { -#ifdef FEAT_AUTOCMD /* * The autocommands may have changed the current buffer. Apply the * modelines to the correct buffer, if it still exists and is loaded. @@ -344,22 +334,19 @@ /* Go to the buffer that was opened. */ aucmd_prepbuf(&aco, old_curbuf.br_buf); -#endif do_modelines(0); curbuf->b_flags &= ~(BF_CHECK_RO | BF_NEVERLOADED); -#ifdef FEAT_AUTOCMD -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL apply_autocmds_retval(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf, - &retval); -# else + &retval); +#else apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); -# endif +#endif /* restore curwin/curbuf and a few other things */ aucmd_restbuf(&aco); } -#endif } return retval; @@ -430,6 +417,8 @@ hash_remove(&buf_hashtab, hi); } +static char *e_buflocked = N_("E937: Attempt to delete a buffer that is in use"); + /* * Close the link to a buffer. * "action" is used when there is no longer a window for the buffer. @@ -454,14 +443,12 @@ int action, int abort_if_last UNUSED) { -#ifdef FEAT_AUTOCMD int is_curbuf; int nwindows; bufref_T bufref; int is_curwin = (curwin != NULL && curwin->w_buffer == buf); win_T *the_curwin = curwin; tabpage_T *the_curtab = curtab; -#endif int unload_buf = (action != 0); int del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE); int wipe_buf = (action == DOBUF_WIPE); @@ -491,8 +478,15 @@ if (term_job_running(buf->b_term)) { if (wipe_buf || unload_buf) + { + if (buf->b_locked) + { + EMSG(_(e_buflocked)); + return; + } /* Wiping out or unloading a terminal buffer kills the job. */ free_terminal(buf); + } else { /* The job keeps running, hide the buffer. */ @@ -510,15 +504,13 @@ } #endif -#ifdef FEAT_AUTOCMD /* Disallow deleting the buffer when it is locked (already being closed or * halfway a command that relies on it). Unloading is allowed. */ if (buf->b_locked > 0 && (del_buf || wipe_buf)) { - EMSG(_("E937: Attempt to delete a buffer that is in use")); + EMSG(_(e_buflocked)); return; } -#endif /* check no autocommands closed the window */ if (win != NULL && win_valid_any_tab(win)) @@ -534,7 +526,6 @@ win->w_cursor.col, TRUE); } -#ifdef FEAT_AUTOCMD set_bufref(&bufref, buf); /* When the buffer is no longer in a window, trigger BufWinLeave */ @@ -570,10 +561,10 @@ /* Autocommands made this the only window. */ goto aucmd_abort; } -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return; -# endif +#endif } /* If the buffer was in curwin and the window has changed, go back to that @@ -587,7 +578,6 @@ } nwindows = buf->b_nwindows; -#endif /* decrease the link count from windows (unless not in any window) */ if (buf->b_nwindows > 0) @@ -595,7 +585,7 @@ #ifdef FEAT_DIFF if (diffopt_hiddenoff() && !unload_buf && buf->b_nwindows == 0) - diff_buf_delete(buf); /* Clear 'diff' for hidden buffer. */ + diff_buf_delete(buf); /* Clear 'diff' for hidden buffer. */ #endif /* Return when a window is displaying the buffer or when it's not @@ -620,23 +610,20 @@ * Free all things allocated for this buffer. * Also calls the "BufDelete" autocommands when del_buf is TRUE. */ -#ifdef FEAT_AUTOCMD /* Remember if we are closing the current buffer. Restore the number of * windows, so that autocommands in buf_freeall() don't get confused. */ is_curbuf = (buf == curbuf); buf->b_nwindows = nwindows; -#endif buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0)); -#ifdef FEAT_AUTOCMD /* Autocommands may have deleted the buffer. */ if (!bufref_valid(&bufref)) return; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return; -# endif +#endif /* * It's possible that autocommands change curbuf to the one being deleted. @@ -655,10 +642,6 @@ * Decrement the count for the close we do here. */ if (buf->b_nwindows > 0) --buf->b_nwindows; -#endif - - /* Change directories when the 'acd' option is set. */ - DO_AUTOCHDIR /* * Remove the buffer from the list. @@ -735,7 +718,6 @@ void buf_freeall(buf_T *buf, int flags) { -#ifdef FEAT_AUTOCMD int is_curbuf = (buf == curbuf); bufref_T bufref; int is_curwin = (curwin != NULL && curwin->w_buffer == buf); @@ -781,10 +763,10 @@ unblock_autocmds(); } -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return; -# endif +#endif /* * It's possible that autocommands change curbuf to the one being deleted. @@ -794,7 +776,6 @@ */ if (buf == curbuf && !is_curbuf) return; -#endif #ifdef FEAT_DIFF diff_buf_delete(buf); /* Can't use 'diff' for unloaded buffer. */ #endif @@ -873,7 +854,6 @@ buf_hashtab_remove(buf); -#ifdef FEAT_AUTOCMD aubuflocal_remove(buf); if (autocmd_busy) @@ -884,7 +864,6 @@ au_pending_free_buf = buf; } else -#endif vim_free(buf); } @@ -947,8 +926,7 @@ map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */ #endif #ifdef FEAT_MBYTE - vim_free(buf->b_start_fenc); - buf->b_start_fenc = NULL; + VIM_CLEAR(buf->b_start_fenc); #endif } @@ -975,7 +953,6 @@ } } -#if defined(FEAT_LISTCMDS) || defined(PROTO) /* * Go to another buffer. Handles the result of the ATTENTION dialog. */ @@ -986,42 +963,41 @@ int dir, int count) { -# if defined(HAS_SWAP_EXISTS_ACTION) +#if defined(HAS_SWAP_EXISTS_ACTION) bufref_T old_curbuf; set_bufref(&old_curbuf, curbuf); swap_exists_action = SEA_DIALOG; -# endif +#endif (void)do_buffer(*eap->cmd == 's' ? DOBUF_SPLIT : DOBUF_GOTO, start, dir, count, eap->forceit); -# if defined(HAS_SWAP_EXISTS_ACTION) +#if defined(HAS_SWAP_EXISTS_ACTION) if (swap_exists_action == SEA_QUIT && *eap->cmd == 's') { -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that * aborting() returns FALSE when closing a window. */ enter_cleanup(&cs); -# endif +# endif /* Quitting means closing the split window, nothing else. */ win_close(curwin, TRUE); swap_exists_action = SEA_NONE; swap_exists_did_quit = TRUE; -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); -# endif +# endif } else handle_swap_exists(&old_curbuf); -# endif -} #endif +} #if defined(HAS_SWAP_EXISTS_ACTION) || defined(PROTO) /* @@ -1031,17 +1007,17 @@ void handle_swap_exists(bufref_T *old_curbuf) { -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) cleanup_T cs; # endif -#ifdef FEAT_SYN_HL +# ifdef FEAT_SYN_HL long old_tw = curbuf->b_p_tw; -#endif +# endif buf_T *buf; if (swap_exists_action == SEA_QUIT) { -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* Reset the error/interrupt/exception state here so that * aborting() returns FALSE when closing a buffer. */ enter_cleanup(&cs); @@ -1061,14 +1037,14 @@ if (buf != NULL) { enter_buffer(buf); -#ifdef FEAT_SYN_HL +# ifdef FEAT_SYN_HL if (old_tw != curbuf->b_p_tw) check_colorcolumn(curwin); -#endif +# endif } /* If "old_curbuf" is NULL we are in big trouble here... */ -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); @@ -1076,7 +1052,7 @@ } else if (swap_exists_action == SEA_RECOVER) { -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* Reset the error/interrupt/exception state here so that * aborting() returns FALSE when closing a buffer. */ enter_cleanup(&cs); @@ -1089,7 +1065,7 @@ cmdline_row = msg_row; do_modelines(0); -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); @@ -1099,7 +1075,6 @@ } #endif -#if defined(FEAT_LISTCMDS) || defined(PROTO) /* * do_bufdel() - delete or unload buffer(s) * @@ -1226,10 +1201,6 @@ return errormsg; } -#endif /* FEAT_LISTCMDS */ - -#if defined(FEAT_LISTCMDS) || defined(FEAT_PYTHON) \ - || defined(FEAT_PYTHON3) || defined(PROTO) static int empty_curbuf(int close_others, int forceit, int action); @@ -1386,7 +1357,6 @@ need_mouse_correct = TRUE; #endif -#ifdef FEAT_LISTCMDS /* * delete buffer buf from memory and/or the list */ @@ -1395,6 +1365,12 @@ int forward; bufref_T bufref; + if (buf->b_locked) + { + EMSG(_(e_buflocked)); + return FAIL; + } + set_bufref(&bufref, buf); /* When unloading or deleting a buffer that's already unloaded and @@ -1408,12 +1384,10 @@ if ((p_confirm || cmdmod.confirm) && p_write) { dialog_changed(buf, FALSE); -# ifdef FEAT_AUTOCMD if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! It's not changed * now. */ return FAIL; -# endif /* If it's still changed fail silently, the dialog already * mentioned why it fails. */ if (bufIsChanged(buf)) @@ -1448,9 +1422,7 @@ * a window with this buffer. */ while (buf == curbuf -#ifdef FEAT_AUTOCMD && !(curwin->w_closing || curwin->w_buffer->b_locked > 0) -#endif && (!ONE_WINDOW || first_tabpage->tp_next != NULL)) { if (win_close(curwin, FALSE) == FAIL) @@ -1480,15 +1452,10 @@ */ buf = NULL; /* selected buffer */ bp = NULL; /* used when no loaded buffer found */ -#ifdef FEAT_AUTOCMD if (au_new_curbuf.br_buf != NULL && bufref_valid(&au_new_curbuf)) buf = au_new_curbuf.br_buf; -# ifdef FEAT_JUMPLIST - else -# endif -#endif #ifdef FEAT_JUMPLIST - if (curwin->w_jumplistlen > 0) + else if (curwin->w_jumplistlen > 0) { int jumpidx; @@ -1593,7 +1560,6 @@ if (win_split(0, 0) == FAIL) return FAIL; } -#endif /* go to current buffer - nothing to do */ if (buf == curbuf) @@ -1607,17 +1573,13 @@ #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if ((p_confirm || cmdmod.confirm) && p_write) { -# ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); -# endif dialog_changed(curbuf, FALSE); -# ifdef FEAT_AUTOCMD if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! */ return FAIL; -# endif } if (bufIsChanged(curbuf)) #endif @@ -1630,22 +1592,18 @@ /* Go to the other buffer. */ set_curbuf(buf, action); -#if defined(FEAT_LISTCMDS) \ - && (defined(FEAT_SCROLLBIND) || defined(FEAT_CURSORBIND)) if (action == DOBUF_SPLIT) { RESET_BINDING(curwin); /* reset 'scrollbind' and 'cursorbind' */ } -#endif -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (aborting()) /* autocmds may abort script processing */ return FAIL; #endif return OK; } -#endif /* * Set current buffer to "buf". Executes autocommands and closes current @@ -1682,17 +1640,15 @@ set_bufref(&prevbufref, prevbuf); set_bufref(&newbufref, buf); -#ifdef FEAT_AUTOCMD /* Autocommands may delete the curren buffer and/or the buffer we wan to go * to. In those cases don't close the buffer. */ if (!apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf) || (bufref_valid(&prevbufref) && bufref_valid(&newbufref) -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL && !aborting() -# endif - )) #endif + )) { #ifdef FEAT_SYN_HL if (prevbuf == curwin->w_buffer) @@ -1700,7 +1656,7 @@ #endif if (unload) close_windows(prevbuf, FALSE); -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (bufref_valid(&prevbufref) && !aborting()) #else if (bufref_valid(&prevbufref)) @@ -1718,16 +1674,14 @@ curwin = previouswin; } } -#ifdef FEAT_AUTOCMD /* An autocommand may have deleted "buf", already entered it (e.g., when * it did ":bunload") or aborted the script processing. * If curwin->w_buffer is null, enter_buffer() will make it valid again */ if ((buf_valid(buf) && buf != curbuf -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL && !aborting() -# endif - ) || curwin->w_buffer == NULL) #endif + ) || curwin->w_buffer == NULL) { enter_buffer(buf); #ifdef FEAT_SYN_HL @@ -1777,9 +1731,7 @@ curwin->w_cursor.coladd = 0; #endif curwin->w_set_curswant = TRUE; -#ifdef FEAT_AUTOCMD curwin->w_topline_was_set = FALSE; -#endif /* mark cursor position as being invalid */ curwin->w_valid = 0; @@ -1787,13 +1739,11 @@ /* Make sure the buffer is loaded. */ if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */ { -#ifdef FEAT_AUTOCMD /* If there is no filetype, allow for detecting one. Esp. useful for * ":ball" used in a autocommand. If there already is a filetype we * might prefer to keep it. */ if (*curbuf->b_p_ft == NUL) did_filetype = FALSE; -#endif open_buffer(FALSE, NULL, 0); } @@ -1802,14 +1752,12 @@ if (!msg_silent) need_fileinfo = TRUE; /* display file info after redraw */ (void)buf_check_timestamp(curbuf, FALSE); /* check if file changed */ -#ifdef FEAT_AUTOCMD curwin->w_topline = 1; -# ifdef FEAT_DIFF +#ifdef FEAT_DIFF curwin->w_topfill = 0; -# endif +#endif apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); -#endif } /* If autocommands did not change the cursor position, restore cursor lnum @@ -1821,10 +1769,8 @@ #ifdef FEAT_TITLE maketitle(); #endif -#ifdef FEAT_AUTOCMD /* when autocmds didn't change it */ if (curwin->w_topline == 1 && !curwin->w_topline_was_set) -#endif scroll_cursor_halfway(FALSE); /* redisplay at correct position */ #ifdef FEAT_NETBEANS_INTG @@ -1833,7 +1779,7 @@ #endif /* Change directories when the 'acd' option is set. */ - DO_AUTOCHDIR + DO_AUTOCHDIR; #ifdef FEAT_KEYMAP if (curbuf->b_kmap_state & KEYMAP_INIT) @@ -1862,7 +1808,7 @@ { if ((starting == 0 || test_autochdir) && curbuf->b_ffname != NULL - && vim_chdirfile(curbuf->b_ffname) == OK) + && vim_chdirfile(curbuf->b_ffname, "auto") == OK) shorten_fnames(TRUE); } #endif @@ -1879,10 +1825,10 @@ } void -no_write_message_nobang(void) +no_write_message_nobang(buf_T *buf UNUSED) { #ifdef FEAT_TERMINAL - if (term_job_running(curbuf->b_term)) + if (term_job_running(buf->b_term)) EMSG(_("E948: Job still running")); else #endif @@ -1896,6 +1842,20 @@ static int top_file_num = 1; /* highest file number */ /* + * Return TRUE if the current buffer is empty, unnamed, unmodified and used in + * only one window. That means it can be re-used. + */ + int +curbuf_reusable(void) +{ + return (curbuf != NULL + && curbuf->b_ffname == NULL + && curbuf->b_nwindows <= 1 + && (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY()) + && !curbufIsChanged()); +} + +/* * Add a file name to the buffer list. Return a pointer to the buffer. * If the same file name already exists return a pointer to that buffer. * If it does not exist, or if fname == NULL, a new entry is created. @@ -1952,11 +1912,9 @@ if ((flags & BLN_LISTED) && !buf->b_p_bl) { -#ifdef FEAT_AUTOCMD bufref_T bufref; -#endif + buf->b_p_bl = TRUE; -#ifdef FEAT_AUTOCMD set_bufref(&bufref, buf); if (!(flags & BLN_DUMMY)) { @@ -1964,7 +1922,6 @@ && !bufref_valid(&bufref)) return NULL; } -#endif } return buf; } @@ -1978,28 +1935,20 @@ * buffer.) */ buf = NULL; - if ((flags & BLN_CURBUF) - && curbuf != NULL - && curbuf->b_ffname == NULL - && curbuf->b_nwindows <= 1 - && (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY())) + if ((flags & BLN_CURBUF) && curbuf_reusable()) { buf = curbuf; -#ifdef FEAT_AUTOCMD /* It's like this buffer is deleted. Watch out for autocommands that * change curbuf! If that happens, allocate a new buffer anyway. */ if (curbuf->b_p_bl) apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); if (buf == curbuf) apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf); -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return NULL; -# endif #endif -#ifdef FEAT_AUTOCMD if (buf == curbuf) -#endif { /* Make sure 'bufhidden' and 'buftype' are empty */ clear_string_option(&buf->b_p_bh); @@ -2040,10 +1989,8 @@ if ((ffname != NULL && (buf->b_ffname == NULL || buf->b_sfname == NULL)) || buf->b_wininfo == NULL) { - vim_free(buf->b_ffname); - buf->b_ffname = NULL; - vim_free(buf->b_sfname); - buf->b_sfname = NULL; + VIM_CLEAR(buf->b_ffname); + VIM_CLEAR(buf->b_sfname); if (buf != curbuf) free_buffer(buf); return NULL; @@ -2055,7 +2002,7 @@ buf_freeall(buf, 0); if (buf != curbuf) /* autocommands deleted the buffer! */ return NULL; -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (aborting()) /* autocmds may abort script processing */ return NULL; #endif @@ -2134,7 +2081,6 @@ clrallmarks(buf); /* clear marks */ fmarks_check_names(buf); /* check file marks for this file */ buf->b_p_bl = (flags & BLN_LISTED) ? TRUE : FALSE; /* init 'buflisted' */ -#ifdef FEAT_AUTOCMD if (!(flags & BLN_DUMMY)) { bufref_T bufref; @@ -2152,12 +2098,11 @@ && !bufref_valid(&bufref)) return NULL; } -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return NULL; -# endif - } #endif + } return buf; } @@ -2236,9 +2181,7 @@ #ifdef FEAT_SEARCHPATH clear_string_option(&buf->b_p_sua); #endif -#ifdef FEAT_AUTOCMD clear_string_option(&buf->b_p_ft); -#endif #ifdef FEAT_CINDENT clear_string_option(&buf->b_p_cink); clear_string_option(&buf->b_p_cino); @@ -2321,10 +2264,8 @@ text_locked_msg(); return FAIL; } -#ifdef FEAT_AUTOCMD if (curbuf_locked()) return FAIL; -#endif /* altfpos may be changed by getfile(), get it now */ if (lnum == 0) @@ -2479,8 +2420,6 @@ return NULL; } -#if defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL) \ - || defined(PROTO) /* * Find file in buffer list by a regexp pattern. * Return fnum of the found buffer. @@ -2602,7 +2541,6 @@ EMSG2(_("E94: No matching buffer for %s"), pattern); return match; } -#endif #if defined(FEAT_CMDL_COMPL) || defined(PROTO) @@ -2712,7 +2650,6 @@ #endif /* FEAT_CMDL_COMPL */ -#ifdef HAVE_BUFLIST_MATCH /* * Check for a match on the file name for buffer "buf" with regprog "prog". */ @@ -2763,7 +2700,6 @@ return match; } -#endif /* * Find a file in the buffer list by buffer number. @@ -3008,7 +2944,6 @@ return buflist_findfpos(buf)->lnum; } -#if defined(FEAT_LISTCMDS) || defined(PROTO) /* * List all known file names (for :files and :buffers command). */ @@ -3020,18 +2955,34 @@ int i; int ro_char; int changed_char; +#ifdef FEAT_TERMINAL + int job_running; + int job_none_open; +#endif for (buf = firstbuf; buf != NULL && !got_int; buf = buf->b_next) { +#ifdef FEAT_TERMINAL + job_running = term_job_running(buf->b_term); + job_none_open = job_running && term_none_open(buf->b_term); +#endif /* skip unlisted buffers, unless ! was used */ if ((!buf->b_p_bl && !eap->forceit && !vim_strchr(eap->arg, 'u')) || (vim_strchr(eap->arg, 'u') && buf->b_p_bl) || (vim_strchr(eap->arg, '+') && ((buf->b_flags & BF_READERR) || !bufIsChanged(buf))) || (vim_strchr(eap->arg, 'a') - && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows == 0)) + && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows == 0)) || (vim_strchr(eap->arg, 'h') - && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows != 0)) + && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows != 0)) +#ifdef FEAT_TERMINAL + || (vim_strchr(eap->arg, 'R') + && (!job_running || (job_running && job_none_open))) + || (vim_strchr(eap->arg, '?') + && (!job_running || (job_running && !job_none_open))) + || (vim_strchr(eap->arg, 'F') + && (job_running || buf->b_term == NULL)) +#endif || (vim_strchr(eap->arg, '-') && buf->b_p_ma) || (vim_strchr(eap->arg, '=') && !buf->b_p_ro) || (vim_strchr(eap->arg, 'x') && !(buf->b_flags & BF_READERR)) @@ -3092,7 +3043,6 @@ ui_breakcheck(); } } -#endif /* * Get file name and line number for file 'fnum'. @@ -3139,10 +3089,8 @@ if (ffname == NULL || *ffname == NUL) { /* Removing the name. */ - vim_free(buf->b_ffname); - vim_free(buf->b_sfname); - buf->b_ffname = NULL; - buf->b_sfname = NULL; + VIM_CLEAR(buf->b_ffname); + VIM_CLEAR(buf->b_sfname); #ifdef UNIX st.st_dev = (dev_T)-1; #endif @@ -4264,8 +4212,7 @@ if (*skipdigits(str) == NUL) { num = atoi((char *)str); - vim_free(str); - str = NULL; + VIM_CLEAR(str); itemisflag = FALSE; } } @@ -4377,7 +4324,6 @@ : _("[Help]")); break; -#ifdef FEAT_AUTOCMD case STL_FILETYPE: if (*wp->w_buffer->b_p_ft != NUL && STRLEN(wp->w_buffer->b_p_ft) < TMPLEN - 3) @@ -4400,7 +4346,6 @@ str = tmp; } break; -#endif #if defined(FEAT_QUICKFIX) case STL_PREVIEWFLAG: @@ -5022,20 +4967,18 @@ if (!buf_hide(buf) && buf->b_nwindows <= 1 && bufIsChanged(buf)) { -#ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); -#endif + (void)autowrite(buf, FALSE); -#ifdef FEAT_AUTOCMD + /* check if autocommands removed the window */ if (!win_valid(wp) || !bufref_valid(&bufref)) { wpnext = firstwin; /* start all over... */ continue; } -#endif } /* don't close last window */ if (ONE_WINDOW @@ -5044,11 +4987,10 @@ else { win_close(wp, !buf_hide(buf) && !bufIsChanged(buf)); -#ifdef FEAT_AUTOCMD + /* check if autocommands removed the next window */ if (!win_valid(wpnext)) wpnext = firstwin; /* start all over... */ -#endif } } } @@ -5058,11 +5000,10 @@ if (had_tab == 0 || tpnext == NULL) break; -# ifdef FEAT_AUTOCMD /* check if autocommands removed the next tab page */ if (!valid_tabpage(tpnext)) tpnext = first_tabpage; /* start all over...*/ -# endif + goto_tabpage_tp(tpnext, TRUE, TRUE); } @@ -5073,11 +5014,9 @@ if (count > opened_len || count <= 0) count = opened_len; -#ifdef FEAT_AUTOCMD /* Don't execute Win/Buf Enter/Leave autocommands here. */ ++autocmd_no_enter; ++autocmd_no_leave; -#endif last_curwin = curwin; last_curtab = curtab; win_enter(lastwin, FALSE); @@ -5123,10 +5062,8 @@ if (split_ret == FAIL) continue; } -#ifdef FEAT_AUTOCMD else /* first window: do autocmd for leaving this buffer */ --autocmd_no_leave; -#endif /* * edit file "i" @@ -5142,10 +5079,8 @@ ((buf_hide(curwin->w_buffer) || bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0) + ECMD_OLDBUF, curwin); -#ifdef FEAT_AUTOCMD if (use_firstwin) ++autocmd_no_leave; -#endif use_firstwin = FALSE; } ui_breakcheck(); @@ -5158,9 +5093,8 @@ /* Remove the "lock" on the argument list. */ alist_unlink(alist); -#ifdef FEAT_AUTOCMD --autocmd_no_enter; -#endif + /* restore last referenced tabpage's curwin */ if (last_curtab != new_curtab) { @@ -5175,13 +5109,10 @@ if (win_valid(new_curwin)) win_enter(new_curwin, FALSE); -#ifdef FEAT_AUTOCMD --autocmd_no_leave; -#endif vim_free(opened); } -# if defined(FEAT_LISTCMDS) || defined(PROTO) /* * Open a window for a number of buffers. */ @@ -5232,18 +5163,13 @@ - tabline_height() : wp->w_width != Columns) || (had_tab > 0 && wp != firstwin)) && !ONE_WINDOW -#ifdef FEAT_AUTOCMD - && !(wp->w_closing || wp->w_buffer->b_locked > 0) -#endif - ) + && !(wp->w_closing || wp->w_buffer->b_locked > 0)) { win_close(wp, FALSE); -#ifdef FEAT_AUTOCMD wpnext = firstwin; /* just in case an autocommand does something strange with windows */ tpnext = first_tabpage; /* start all over...*/ open_wins = 0; -#endif } else ++open_wins; @@ -5260,14 +5186,10 @@ * open one. Otherwise move the window to the right position. * Watch out for autocommands that delete buffers or windows! */ -#ifdef FEAT_AUTOCMD /* Don't execute Win/Buf Enter/Leave autocommands here. */ ++autocmd_no_enter; -#endif win_enter(lastwin, FALSE); -#ifdef FEAT_AUTOCMD ++autocmd_no_leave; -#endif for (buf = firstbuf; buf != NULL && open_wins < count; buf = buf->b_next) { /* Check if this buffer needs a window */ @@ -5295,11 +5217,10 @@ if (wp == NULL && split_ret == OK) { -#ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); -#endif + /* Split the window and put the buffer in it */ p_ea_save = p_ea; p_ea = TRUE; /* use space from all windows */ @@ -5314,20 +5235,18 @@ swap_exists_action = SEA_DIALOG; #endif set_curbuf(buf, DOBUF_GOTO); -#ifdef FEAT_AUTOCMD if (!bufref_valid(&bufref)) { /* autocommands deleted the buffer!!! */ #if defined(HAS_SWAP_EXISTS_ACTION) swap_exists_action = SEA_NONE; -# endif +#endif break; } -#endif #if defined(HAS_SWAP_EXISTS_ACTION) if (swap_exists_action == SEA_QUIT) { -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that @@ -5341,7 +5260,7 @@ swap_exists_action = SEA_NONE; swap_exists_did_quit = TRUE; -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not * discarded by a new aborting error, interrupt, or uncaught * exception. */ @@ -5368,13 +5287,9 @@ if (had_tab > 0 && tabpage_index(NULL) <= p_tpm) cmdmod.tab = 9999; } -#ifdef FEAT_AUTOCMD --autocmd_no_enter; -#endif win_enter(firstwin, FALSE); /* back to first window */ -#ifdef FEAT_AUTOCMD --autocmd_no_leave; -#endif /* * Close superfluous windows. @@ -5383,15 +5298,12 @@ { r = (buf_hide(wp->w_buffer) || !bufIsChanged(wp->w_buffer) || autowrite(wp->w_buffer, FALSE) == OK); -#ifdef FEAT_AUTOCMD if (!win_valid(wp)) { /* BufWrite Autocommands made the window invalid, start over */ wp = lastwin; } - else -#endif - if (r) + else if (r) { win_close(wp, !buf_hide(wp->w_buffer)); --open_wins; @@ -5405,7 +5317,6 @@ } } } -# endif /* FEAT_LISTCMDS */ static int chk_modeline(linenr_T, int); @@ -6242,12 +6153,10 @@ if (on != curbuf->b_p_bl) { curbuf->b_p_bl = on; -#ifdef FEAT_AUTOCMD if (on) apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf); else apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); -#endif } } @@ -6320,13 +6229,11 @@ if (buf->b_fnum == top_file_num - 1) --top_file_num; -#ifdef FEAT_AUTOCMD if (!aucmd) /* Don't trigger BufDelete autocommands here. */ block_autocmds(); -#endif + close_buffer(NULL, buf, DOBUF_WIPE, FALSE); -#ifdef FEAT_AUTOCMD + if (!aucmd) unblock_autocmds(); -#endif } diff -Nru vim-8.0.1453/src/channel.c vim-8.0.1766/src/channel.c --- vim-8.0.1453/src/channel.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/channel.c 2018-04-26 20:30:33.000000000 +0000 @@ -158,6 +158,7 @@ static int did_log_msg = TRUE; +#ifndef PROTO /* prototype is in vim.h */ void ch_log(channel_T *ch, const char *fmt, ...) { @@ -174,6 +175,14 @@ did_log_msg = TRUE; } } +#endif + + static void +ch_error(channel_T *ch, const char *fmt, ...) +#ifdef USE_PRINTF_FORMAT_ATTRIBUTE + __attribute__((format(printf, 2, 3))) +#endif + ; static void ch_error(channel_T *ch, const char *fmt, ...) @@ -317,8 +326,8 @@ /* If there is no callback then nobody can get readahead. If the fd is * closed and there is no readahead then the callback won't be called. */ has_sock_msg = channel->ch_part[PART_SOCK].ch_fd != INVALID_FD - || channel->ch_part[PART_SOCK].ch_head.rq_next != NULL - || channel->ch_part[PART_SOCK].ch_json_head.jq_next != NULL; + || channel->ch_part[PART_SOCK].ch_head.rq_next != NULL + || channel->ch_part[PART_SOCK].ch_json_head.jq_next != NULL; has_out_msg = channel->ch_part[PART_OUT].ch_fd != INVALID_FD || channel->ch_part[PART_OUT].ch_head.rq_next != NULL || channel->ch_part[PART_OUT].ch_json_head.jq_next != NULL; @@ -336,6 +345,15 @@ } /* + * Return TRUE if "channel" is closeable (i.e. all readable fds are closed). + */ + static int +channel_can_close(channel_T *channel) +{ + return channel->ch_to_be_closed == 0; +} + +/* * Close a channel and free all its resources. */ static void @@ -663,9 +681,9 @@ { char *p; - /* When using host->h_addr directly ubsan warns for it to not be - * aligned. First copy the pointer to aviod that. */ - memcpy(&p, &host->h_addr, sizeof(p)); + /* When using host->h_addr_list[0] directly ubsan warns for it to not + * be aligned. First copy the pointer to avoid that. */ + memcpy(&p, &host->h_addr_list[0], sizeof(p)); memcpy((char *)&server.sin_addr, p, host->h_length); } @@ -883,7 +901,7 @@ channel->ch_nb_close_cb = nb_close_cb; channel->ch_hostname = (char *)vim_strsave((char_u *)hostname); channel->ch_port = port_in; - channel->ch_to_be_closed |= (1 << PART_SOCK); + channel->ch_to_be_closed |= (1U << PART_SOCK); #ifdef FEAT_GUI channel_gui_register_one(channel, PART_SOCK); @@ -979,7 +997,8 @@ } *fd = INVALID_FD; - channel->ch_to_be_closed &= ~(1 << part); + /* channel is closed, may want to end the job if it was the last */ + channel->ch_to_be_closed &= ~(1U << part); } } @@ -990,6 +1009,12 @@ { ch_close_part(channel, PART_IN); channel->CH_IN_FD = in; +# if defined(UNIX) + /* Do not end the job when all output channels are closed, wait until + * the job ended. */ + if (isatty(in)) + channel->ch_to_be_closed |= (1U << PART_IN); +# endif } if (out != INVALID_FD) { @@ -998,7 +1023,7 @@ # endif ch_close_part(channel, PART_OUT); channel->CH_OUT_FD = out; - channel->ch_to_be_closed |= (1 << PART_OUT); + channel->ch_to_be_closed |= (1U << PART_OUT); # if defined(FEAT_GUI) channel_gui_register_one(channel, PART_OUT); # endif @@ -1010,7 +1035,7 @@ # endif ch_close_part(channel, PART_ERR); channel->CH_ERR_FD = err; - channel->ch_to_be_closed |= (1 << PART_ERR); + channel->ch_to_be_closed |= (1U << PART_ERR); # if defined(FEAT_GUI) channel_gui_register_one(channel, PART_ERR); # endif @@ -1442,8 +1467,8 @@ ch_close_part(channel, PART_IN); } else - ch_log(channel, "Still %d more lines to write", - buf->b_ml.ml_line_count - lnum + 1); + ch_log(channel, "Still %ld more lines to write", + (long)(buf->b_ml.ml_line_count - lnum + 1)); } /* @@ -1536,8 +1561,8 @@ else if (written > 1) ch_log(channel, "written %d lines to channel", written); if (lnum < buf->b_ml.ml_line_count) - ch_log(channel, "Still %d more lines to write", - buf->b_ml.ml_line_count - lnum); + ch_log(channel, "Still %ld more lines to write", + (long)(buf->b_ml.ml_line_count - lnum)); in_part->ch_buf_bot = lnum; } @@ -2081,7 +2106,8 @@ { *rettv = item->jq_value; if (tv->v_type == VAR_NUMBER) - ch_log(channel, "Getting JSON message %d", tv->vval.v_number); + ch_log(channel, "Getting JSON message %ld", + (long)tv->vval.v_number); remove_json_node(head, item); return OK; } @@ -2978,8 +3004,7 @@ channel_clear(channel_T *channel) { ch_log(channel, "Clearing channel"); - vim_free(channel->ch_hostname); - channel->ch_hostname = NULL; + VIM_CLEAR(channel->ch_hostname); channel_clear_one(channel, PART_SOCK); channel_clear_one(channel, PART_OUT); channel_clear_one(channel, PART_ERR); @@ -4151,8 +4176,9 @@ if (ret > 0 && in_part->ch_fd != INVALID_FD && FD_ISSET(in_part->ch_fd, wfds)) { - channel_write_input(channel); + /* Clear the flag first, ch_fd may change in channel_write_input(). */ FD_CLR(in_part->ch_fd, wfds); + channel_write_input(channel); --ret; } } @@ -4190,9 +4216,9 @@ } while (channel != NULL) { - if (channel->ch_to_be_closed == 0) + if (channel_can_close(channel)) { - channel->ch_to_be_closed = (1 << PART_COUNT); + channel->ch_to_be_closed = (1U << PART_COUNT); channel_close_now(channel); /* channel may have been freed, start over */ channel = first_channel; @@ -4459,7 +4485,7 @@ return OK; if (tv->v_type != VAR_DICT) { - EMSG(_(e_invarg)); + EMSG(_(e_dictreq)); return FAIL; } dict = tv->vval.v_dict; @@ -4542,7 +4568,7 @@ opt->jo_io_buf[part] = get_tv_number(item); if (opt->jo_io_buf[part] <= 0) { - EMSG2(_(e_invarg2), get_tv_string(item)); + EMSG3(_(e_invargNval), hi->hi_key, get_tv_string(item)); return FAIL; } if (buflist_findnr(opt->jo_io_buf[part]) == NULL) @@ -4591,7 +4617,7 @@ *lp = get_tv_number(item); if (*lp < 0) { - EMSG2(_(e_invarg2), get_tv_string(item)); + EMSG3(_(e_invargNval), hi->hi_key, get_tv_string(item)); return FAIL; } } @@ -4602,7 +4628,7 @@ opt->jo_set |= JO_CHANNEL; if (item->v_type != VAR_CHANNEL) { - EMSG2(_(e_invarg2), "channel"); + EMSG2(_(e_invargval), "channel"); return FAIL; } opt->jo_channel = item->vval.v_channel; @@ -4615,7 +4641,7 @@ opt->jo_callback = get_callback(item, &opt->jo_partial); if (opt->jo_callback == NULL) { - EMSG2(_(e_invarg2), "callback"); + EMSG2(_(e_invargval), "callback"); return FAIL; } } @@ -4627,7 +4653,7 @@ opt->jo_out_cb = get_callback(item, &opt->jo_out_partial); if (opt->jo_out_cb == NULL) { - EMSG2(_(e_invarg2), "out_cb"); + EMSG2(_(e_invargval), "out_cb"); return FAIL; } } @@ -4639,7 +4665,7 @@ opt->jo_err_cb = get_callback(item, &opt->jo_err_partial); if (opt->jo_err_cb == NULL) { - EMSG2(_(e_invarg2), "err_cb"); + EMSG2(_(e_invargval), "err_cb"); return FAIL; } } @@ -4651,7 +4677,7 @@ opt->jo_close_cb = get_callback(item, &opt->jo_close_partial); if (opt->jo_close_cb == NULL) { - EMSG2(_(e_invarg2), "close_cb"); + EMSG2(_(e_invargval), "close_cb"); return FAIL; } } @@ -4664,7 +4690,7 @@ never = TRUE; else if (STRCMP(val, "auto") != 0) { - EMSG2(_(e_invarg2), "drop"); + EMSG3(_(e_invargNval), "drop", val); return FAIL; } opt->jo_drop_never = never; @@ -4677,7 +4703,7 @@ opt->jo_exit_cb = get_callback(item, &opt->jo_exit_partial); if (opt->jo_exit_cb == NULL) { - EMSG2(_(e_invarg2), "exit_cb"); + EMSG2(_(e_invargval), "exit_cb"); return FAIL; } } @@ -4690,7 +4716,7 @@ opt->jo_term_name = get_tv_string_chk(item); if (opt->jo_term_name == NULL) { - EMSG2(_(e_invarg2), "term_name"); + EMSG2(_(e_invargval), "term_name"); return FAIL; } } @@ -4701,7 +4727,7 @@ val = get_tv_string(item); if (STRCMP(val, "open") != 0 && STRCMP(val, "close") != 0) { - EMSG2(_(e_invarg2), val); + EMSG3(_(e_invargNval), "term_finish", val); return FAIL; } opt->jo_set2 |= JO2_TERM_FINISH; @@ -4725,7 +4751,7 @@ } if (p == NULL) { - EMSG2(_(e_invarg2), "term_opencmd"); + EMSG2(_(e_invargval), "term_opencmd"); return FAIL; } } @@ -4739,7 +4765,7 @@ p = opt->jo_eof_chars = get_tv_string_chk(item); if (p == NULL) { - EMSG2(_(e_invarg2), "term_opencmd"); + EMSG2(_(e_invargval), "eof_chars"); return FAIL; } } @@ -4747,45 +4773,109 @@ { if (!(supported2 & JO2_TERM_ROWS)) break; - opt->jo_set |= JO2_TERM_ROWS; + opt->jo_set2 |= JO2_TERM_ROWS; opt->jo_term_rows = get_tv_number(item); } else if (STRCMP(hi->hi_key, "term_cols") == 0) { if (!(supported2 & JO2_TERM_COLS)) break; - opt->jo_set |= JO2_TERM_COLS; + opt->jo_set2 |= JO2_TERM_COLS; opt->jo_term_cols = get_tv_number(item); } else if (STRCMP(hi->hi_key, "vertical") == 0) { if (!(supported2 & JO2_VERTICAL)) break; - opt->jo_set |= JO2_VERTICAL; + opt->jo_set2 |= JO2_VERTICAL; opt->jo_vertical = get_tv_number(item); } else if (STRCMP(hi->hi_key, "curwin") == 0) { if (!(supported2 & JO2_CURWIN)) break; - opt->jo_set |= JO2_CURWIN; + opt->jo_set2 |= JO2_CURWIN; opt->jo_curwin = get_tv_number(item); } else if (STRCMP(hi->hi_key, "hidden") == 0) { if (!(supported2 & JO2_HIDDEN)) break; - opt->jo_set |= JO2_HIDDEN; + opt->jo_set2 |= JO2_HIDDEN; opt->jo_hidden = get_tv_number(item); } + else if (STRCMP(hi->hi_key, "norestore") == 0) + { + if (!(supported2 & JO2_NORESTORE)) + break; + opt->jo_set2 |= JO2_NORESTORE; + opt->jo_term_norestore = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "term_kill") == 0) + { + if (!(supported2 & JO2_TERM_KILL)) + break; + opt->jo_set2 |= JO2_TERM_KILL; + opt->jo_term_kill = get_tv_string_chk(item); + } +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + else if (STRCMP(hi->hi_key, "ansi_colors") == 0) + { + int n = 0; + listitem_T *li; + long_u rgb[16]; + + if (!(supported2 & JO2_ANSI_COLORS)) + break; + + if (item == NULL || item->v_type != VAR_LIST + || item->vval.v_list == NULL) + { + EMSG2(_(e_invargval), "ansi_colors"); + return FAIL; + } + + li = item->vval.v_list->lv_first; + for (; li != NULL && n < 16; li = li->li_next, n++) + { + char_u *color_name; + guicolor_T guicolor; + + color_name = get_tv_string_chk(&li->li_tv); + if (color_name == NULL) + return FAIL; + + guicolor = GUI_GET_COLOR(color_name); + if (guicolor == INVALCOLOR) + return FAIL; + + rgb[n] = GUI_MCH_GET_RGB(guicolor); + } + + if (n != 16 || li != NULL) + { + EMSG2(_(e_invargval), "ansi_colors"); + return FAIL; + } + + opt->jo_set2 |= JO2_ANSI_COLORS; + memcpy(opt->jo_ansi_colors, rgb, sizeof(rgb)); + } +# endif #endif else if (STRCMP(hi->hi_key, "env") == 0) { if (!(supported2 & JO2_ENV)) break; - opt->jo_set |= JO2_ENV; + if (item->v_type != VAR_DICT) + { + EMSG2(_(e_invargval), "env"); + return FAIL; + } + opt->jo_set2 |= JO2_ENV; opt->jo_env = item->vval.v_dict; - ++item->vval.v_dict->dv_refcount; + if (opt->jo_env != NULL) + ++opt->jo_env->dv_refcount; } else if (STRCMP(hi->hi_key, "cwd") == 0) { @@ -4794,10 +4884,10 @@ opt->jo_cwd = get_tv_string_buf_chk(item, opt->jo_cwd_buf); if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd)) { - EMSG2(_(e_invarg2), "cwd"); + EMSG2(_(e_invargval), "cwd"); return FAIL; } - opt->jo_set |= JO2_CWD; + opt->jo_set2 |= JO2_CWD; } else if (STRCMP(hi->hi_key, "waittime") == 0) { @@ -4839,7 +4929,7 @@ opt->jo_part = PART_OUT; else { - EMSG2(_(e_invarg2), val); + EMSG3(_(e_invargNval), "part", val); return FAIL; } } @@ -4859,7 +4949,7 @@ opt->jo_soe_buf); if (opt->jo_stoponexit == NULL) { - EMSG2(_(e_invarg2), "stoponexit"); + EMSG2(_(e_invargval), "stoponexit"); return FAIL; } } @@ -4928,6 +5018,8 @@ static void job_free_contents(job_T *job) { + int i; + ch_log(job->jv_channel, "Freeing job"); if (job->jv_channel != NULL) { @@ -4945,6 +5037,12 @@ vim_free(job->jv_tty_out); vim_free(job->jv_stoponexit); free_callback(job->jv_exit_cb, job->jv_exit_partial); + if (job->jv_argv != NULL) + { + for (i = 0; job->jv_argv[i] != NULL; i++) + vim_free(job->jv_argv[i]); + vim_free(job->jv_argv); + } } static void @@ -4998,6 +5096,15 @@ } /* + * Return TRUE if the channel of "job" is closeable. + */ + static int +job_channel_can_close(job_T *job) +{ + return job->jv_channel != NULL && channel_can_close(job->jv_channel); +} + +/* * Return TRUE if the job should not be freed yet. Do not free the job when * it has not ended yet and there is a "stoponexit" flag, an exit callback * or when the associated channel will do something with the job output. @@ -5127,6 +5234,10 @@ /* Ready to cleanup the job. */ job->jv_status = JOB_FINISHED; + /* When only channel-in is kept open, close explicitly. */ + if (job->jv_channel != NULL) + ch_close_part(job->jv_channel, PART_IN); + if (job->jv_exit_cb != NULL) { typval_T argv[3]; @@ -5331,8 +5442,9 @@ for (job = first_job; job != NULL; job = job->jv_next) /* Only should check if the channel has been closed, if the channel is * open the job won't exit. */ - if (job->jv_status == JOB_STARTED && job->jv_exit_cb != NULL - && !job_channel_still_useful(job)) + if ((job->jv_status == JOB_STARTED && !job_channel_still_useful(job)) + || (job->jv_status == JOB_FINISHED + && job_channel_can_close(job))) return TRUE; return FALSE; } @@ -5370,23 +5482,26 @@ /* * Create a job and return it. Implements job_start(). + * "argv_arg" is only for Unix. + * When "argv_arg" is NULL then "argvars" is used. * The returned job has a refcount of one. * Returns NULL when out of memory. */ job_T * -job_start(typval_T *argvars, jobopt_T *opt_arg) +job_start(typval_T *argvars, char **argv_arg, jobopt_T *opt_arg) { job_T *job; char_u *cmd = NULL; -#if defined(UNIX) -# define USE_ARGV char **argv = NULL; int argc = 0; +#if defined(UNIX) +# define USE_ARGV #else garray_T ga; #endif jobopt_T opt; ch_part_T part; + int i; job = job_alloc(); if (job == NULL) @@ -5461,6 +5576,21 @@ job_set_options(job, &opt); +#ifdef USE_ARGV + if (argv_arg != NULL) + { + /* Make a copy of argv_arg for job->jv_argv. */ + for (i = 0; argv_arg[i] != NULL; i++) + argc++; + argv = (char **)alloc(sizeof(char_u *) * (argc + 1)); + if (argv == NULL) + goto theend; + for (i = 0; i < argc; i++) + argv[i] = (char *)vim_strsave((char_u *)argv_arg[i]); + argv[argc] = NULL; + } + else +#endif if (argvars[0].v_type == VAR_STRING) { /* Command is a string. */ @@ -5470,11 +5600,9 @@ EMSG(_(e_invarg)); goto theend; } -#ifdef USE_ARGV - if (mch_parse_cmd(cmd, FALSE, &argv, &argc) == FAIL) + + if (build_argv_from_string(cmd, &argv, &argc) == FAIL) goto theend; - argv[argc] = NULL; -#endif } else if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL @@ -5485,35 +5613,24 @@ } else { - list_T *l = argvars[0].vval.v_list; -#ifdef USE_ARGV - listitem_T *li; - char_u *s; + list_T *l = argvars[0].vval.v_list; - /* Pass argv[] to mch_call_shell(). */ - argv = (char **)alloc(sizeof(char *) * (l->lv_len + 1)); - if (argv == NULL) + if (build_argv_from_list(l, &argv, &argc) == FAIL) goto theend; - for (li = l->lv_first; li != NULL; li = li->li_next) - { - s = get_tv_string_chk(&li->li_tv); - if (s == NULL) - goto theend; - argv[argc++] = (char *)s; - } - argv[argc] = NULL; -#else +#ifndef USE_ARGV if (win32_build_cmd(l, &ga) == FAIL) goto theend; cmd = ga.ga_data; #endif } + /* Save the command used to start the job. */ + job->jv_argv = (char_u **)argv; + #ifdef USE_ARGV if (ch_log_active()) { garray_T ga; - int i; ga_init2(&ga, (int)sizeof(char), 200); for (i = 0; i < argc; ++i) @@ -5536,11 +5653,11 @@ channel_write_in(job->jv_channel); theend: -#ifdef USE_ARGV - vim_free(argv); -#else +#ifndef USE_ARGV vim_free(ga.ga_data); #endif + if ((char_u **)argv != job->jv_argv) + vim_free(argv); free_job_options(&opt); return job; } @@ -5576,6 +5693,8 @@ { dictitem_T *item; varnumber_T nr; + list_T *l; + int i; dict_add_nr_str(dict, "status", 0L, (char_u *)job_status(job)); @@ -5604,6 +5723,34 @@ dict_add_nr_str(dict, "exitval", job->jv_exitval, NULL); dict_add_nr_str(dict, "exit_cb", 0L, job->jv_exit_cb); dict_add_nr_str(dict, "stoponexit", 0L, job->jv_stoponexit); + + l = list_alloc(); + if (l != NULL) + { + dict_add_list(dict, "cmd", l); + if (job->jv_argv != NULL) + for (i = 0; job->jv_argv[i] != NULL; i++) + list_append_string(l, job->jv_argv[i], -1); + } +} + +/* + * Implementation of job_info() to return info for all jobs. + */ + void +job_info_all(list_T *l) +{ + job_T *job; + typval_T tv; + + for (job = first_job; job != NULL; job = job->jv_next) + { + tv.v_type = VAR_JOB; + tv.vval.v_job = job; + + if (list_append_tv(l, &tv) != OK) + return; + } } /* diff -Nru vim-8.0.1453/src/charset.c vim-8.0.1766/src/charset.c --- vim-8.0.1453/src/charset.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/charset.c 2018-04-26 20:30:33.000000000 +0000 @@ -1417,7 +1417,12 @@ colnr_T vcol; curwin->w_p_list = FALSE; - getvcol(curwin, posp, NULL, &vcol, NULL); +#ifdef FEAT_VIRTUALEDIT + if (posp->coladd) + getvvcol(curwin, posp, NULL, &vcol, NULL); + else +#endif + getvcol(curwin, posp, NULL, &vcol, NULL); curwin->w_p_list = list_save; return vcol; } @@ -1787,7 +1792,6 @@ return p; } -#if defined(FEAT_LISTCMDS) || defined(FEAT_SIGNS) || defined(PROTO) /* * skiptowhite_esc: Like skiptowhite(), but also skip escaped chars */ @@ -1802,7 +1806,6 @@ } return p; } -#endif /* * Getdigits: Get a number from a string and skip over it. diff -Nru vim-8.0.1453/src/config.aap.in vim-8.0.1766/src/config.aap.in --- vim-8.0.1453/src/config.aap.in 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/config.aap.in 2018-04-26 20:30:33.000000000 +0000 @@ -47,8 +47,6 @@ PYTHON_OBJ = @PYTHON_OBJ@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_CONFDIR = @PYTHON_CONFDIR@ -PYTHON_GETPATH_CFLAGS = @PYTHON_GETPATH_CFLAGS@ TCL = @vi_cv_path_tcl@ TCL_SRC = @TCL_SRC@ diff -Nru vim-8.0.1453/src/config.mk.in vim-8.0.1766/src/config.mk.in --- vim-8.0.1453/src/config.mk.in 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/config.mk.in 2018-04-26 20:30:33.000000000 +0000 @@ -65,14 +65,11 @@ PYTHON_OBJ = @PYTHON_OBJ@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_CONFDIR = @PYTHON_CONFDIR@ -PYTHON_GETPATH_CFLAGS = @PYTHON_GETPATH_CFLAGS@ PYTHON3_SRC = @PYTHON3_SRC@ PYTHON3_OBJ = @PYTHON3_OBJ@ PYTHON3_CFLAGS = @PYTHON3_CFLAGS@ PYTHON3_LIBS = @PYTHON3_LIBS@ -PYTHON3_CONFDIR = @PYTHON3_CONFDIR@ TCL = @vi_cv_path_tcl@ TCL_SRC = @TCL_SRC@ diff -Nru vim-8.0.1453/src/configure.ac vim-8.0.1766/src/configure.ac --- vim-8.0.1453/src/configure.ac 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/configure.ac 2018-04-26 20:30:33.000000000 +0000 @@ -11,7 +11,7 @@ AC_PROG_MAKE_SET dnl Checks for programs. -AC_PROG_CC dnl required by almost everything +AC_PROG_CC_C99 dnl required by almost everything AC_PROG_CPP dnl required by header file checks AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP AC_PROG_FGREP dnl finds working grep -F @@ -29,6 +29,39 @@ AC_HEADER_STDC AC_HEADER_SYS_WAIT +dnl Check that the C99 features that Vim uses are supported: +if test x"$ac_cv_prog_cc_c99" != xno; then + dnl If the compiler doesn't explicitly support C99, then check + dnl for the specific features Vim uses + + AC_TYPE_LONG_LONG_INT + if test "$ac_cv_type_long_long_int" = no; then + AC_MSG_FAILURE([Compiler does not support long long int]) + fi + + AC_MSG_CHECKING([if the compiler supports trailing commas]) + trailing_commas=no + AC_TRY_COMPILE([], [ + enum { + one, + };], + [AC_MSG_RESULT(yes); trailing_commas=yes], + [AC_MSG_RESULT(no)]) + if test "$trailing_commas" = no; then + AC_MSG_FAILURE([Compiler does not support trailing comma in enum]) + fi + + AC_MSG_CHECKING([if the compiler supports C++ comments]) + slash_comments=no + AC_TRY_COMPILE([], + [// C++ comments?], + [AC_MSG_RESULT(yes); slash_comments=yes], + [AC_MSG_RESULT(no)]) + if test "$slash_comments" = no; then + AC_MSG_FAILURE([Compiler does not support C++ comments]) + fi +fi + dnl Check for the flag that fails if stuff are missing. AC_MSG_CHECKING(--enable-fail-if-missing argument) @@ -135,7 +168,7 @@ if test "`(uname) 2>/dev/null`" = Darwin; then AC_MSG_RESULT(yes) MACOS_X=yes - CPPFLAGS="$CPPFLAGS -DMACOS_X" + CPPFLAGS="$CPPFLAGS -D_DARWIN_C_SOURCE -DMACOS_X" AC_MSG_CHECKING(--disable-darwin argument) AC_ARG_ENABLE(darwin, @@ -1117,7 +1150,15 @@ fi dnl -- find the python executable - AC_PATH_PROGS(vi_cv_path_python, python2 python) + AC_MSG_CHECKING(--with-python-command argument) + AC_SUBST(vi_cv_path_python) + AC_ARG_WITH(python-command, [ --with-python-command=NAME name of the Python 2 command (default: python2 or python)], + vi_cv_path_python="$withval"; AC_MSG_RESULT($vi_cv_path_python), + AC_MSG_RESULT(no)) + + if test "X$vi_cv_path_python" = "X"; then + AC_PATH_PROGS(vi_cv_path_python, python2 python) + fi if test "X$vi_cv_path_python" != "X"; then dnl -- get its version number @@ -1156,8 +1197,8 @@ dnl -- where the Python implementation library archives are AC_ARG_WITH(python-config-dir, - [ --with-python-config-dir=PATH Python's config directory], - [ vi_cv_path_python_conf="${withval}" ] ) + [ --with-python-config-dir=PATH Python's config directory (deprecated)], + [ vi_cv_path_python_conf="${withval}"; have_python_config_dir=1 ] ) AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf, [ @@ -1211,11 +1252,7 @@ vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python" fi else - if test "${vi_cv_var_python_version}" = "1.4"; then - vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a" - else - vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}" - fi + vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}" dnl -- Check if the path contained in python_LINKFORSHARED is dnl usable for vim build. If not, make and try other dnl candidates. @@ -1251,16 +1288,17 @@ PYTHON_LIBS="${vi_cv_path_python_plibs}" if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then - PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'" + PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}" else - PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'" + PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version}" + fi + if test "X$have_python_config_dir" = "X1" -a "$enable_pythoninterp" = "dynamic"; then + dnl Define PYTHON_HOME if --with-python-config-dir was used + PYTHON_CFLAGS="${PYTHON_CFLAGS} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'" + fi PYTHON_SRC="if_python.c" PYTHON_OBJ="objects/if_python.o" - if test "${vi_cv_var_python_version}" = "1.4"; then - PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o" - fi - PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" dnl On FreeBSD linking with "-pthread" is required to use threads. dnl _THREAD_SAFE must be used for compiling then. @@ -1329,9 +1367,7 @@ fi fi -AC_SUBST(PYTHON_CONFDIR) AC_SUBST(PYTHON_LIBS) -AC_SUBST(PYTHON_GETPATH_CFLAGS) AC_SUBST(PYTHON_CFLAGS) AC_SUBST(PYTHON_SRC) AC_SUBST(PYTHON_OBJ) @@ -1348,7 +1384,15 @@ fi dnl -- find the python3 executable - AC_PATH_PROGS(vi_cv_path_python3, python3 python) + AC_MSG_CHECKING(--with-python3-command argument) + AC_SUBST(vi_cv_path_python3) + AC_ARG_WITH(python3-command, [ --with-python3-command=NAME name of the Python 3 command (default: python3 or python)], + vi_cv_path_python3="$withval"; AC_MSG_RESULT($vi_cv_path_python3), + AC_MSG_RESULT(no)) + + if test "X$vi_cv_path_python3" = "X"; then + AC_PATH_PROGS(vi_cv_path_python3, python3 python) + fi if test "X$vi_cv_path_python3" != "X"; then dnl -- get its version number @@ -1398,8 +1442,8 @@ dnl -- where the Python implementation library archives are AC_ARG_WITH(python3-config-dir, - [ --with-python3-config-dir=PATH Python's config directory], - [ vi_cv_path_python3_conf="${withval}" ] ) + [ --with-python3-config-dir=PATH Python's config directory (deprecated)], + [ vi_cv_path_python3_conf="${withval}"; have_python3_config_dir=1 ] ) AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf, [ @@ -1460,10 +1504,14 @@ PYTHON3_LIBS="${vi_cv_path_python3_plibs}" if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then - PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'" + PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" else - PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'" + PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" fi + if test "X$have_python3_config_dir" = "X1" -a "$enable_python3interp" = "dynamic"; then + dnl Define PYTHON3_HOME if --with-python-config-dir was used + PYTHON3_CFLAGS="${PYTHON3_CFLAGS} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'" + fi PYTHON3_SRC="if_python3.c" PYTHON3_OBJ="objects/if_python3.o" @@ -1533,7 +1581,6 @@ fi fi -AC_SUBST(PYTHON3_CONFDIR) AC_SUBST(PYTHON3_LIBS) AC_SUBST(PYTHON3_CFLAGS) AC_SUBST(PYTHON3_SRC) @@ -4373,7 +4420,7 @@ dnl consistent value. It's therefore safest to force the use of the define dnl if it's present in any of the *_CFLAGS variables. AC_MSG_CHECKING(whether we need to force -D_FILE_OFFSET_BITS=64) -if echo "$CFLAGS $LUA_CFLAGS $MZSCHEME_CFLAGS $PERL_CFLAGS $PYTHON_GETPATH_CFLAGS $PYTHON_CFLAGS $PYTHON3_CFLAGS $TCL_CFLAGS $RUBY_CFLAGS $GTK_CFLAGS" | grep -q D_FILE_OFFSET_BITS 2>/dev/null; then +if echo "$CFLAGS $LUA_CFLAGS $MZSCHEME_CFLAGS $PERL_CFLAGS $PYTHON_CFLAGS $PYTHON3_CFLAGS $TCL_CFLAGS $RUBY_CFLAGS $GTK_CFLAGS" | grep -q D_FILE_OFFSET_BITS 2>/dev/null; then AC_MSG_RESULT(yes) AC_DEFINE(_FILE_OFFSET_BITS, 64) else diff -Nru vim-8.0.1453/src/crypt.c vim-8.0.1766/src/crypt.c --- vim-8.0.1453/src/crypt.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/crypt.c 2018-04-26 20:30:33.000000000 +0000 @@ -118,6 +118,9 @@ NULL, NULL, crypt_blowfish_encode, crypt_blowfish_decode, }, + + /* NOTE: when adding a new method, use some random bytes for the magic key, + * to avoid that a text file is recognized as encrypted. */ }; #define CRYPT_MAGIC_LEN 12 /* cannot change */ @@ -349,10 +352,7 @@ state = crypt_create(method_nr, key, salt, salt_len, seed, seed_len); if (state == NULL) - { - vim_free(*header); - *header = NULL; - } + VIM_CLEAR(*header); return state; } diff -Nru vim-8.0.1453/src/dehqx.py vim-8.0.1766/src/dehqx.py --- vim-8.0.1453/src/dehqx.py 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/dehqx.py 2018-04-26 20:30:33.000000000 +0000 @@ -1,7 +1,7 @@ # Python script to get both the data and resource fork from a BinHex encoded # file. # Author: MURAOKA Taro -# Last Change: 2012 Jun 29 +# Last Change: 2018 Mar 27 # # Copyright (C) 2003,12 MURAOKA Taro # THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. @@ -15,11 +15,13 @@ out = conv.FName out_data = out out_rsrc = out + '.rsrcfork' -#print 'out_rsrc=' + out_rsrc -print 'In file: ' + input + +# This uses the print statement on Python 2, print function on Python 3. +#print('out_rsrc=' + out_rsrc) +print('In file: ' + input) outfile = open(out_data, 'wb') -print ' Out data fork: ' + out_data +print(' Out data fork: ' + out_data) while 1: d = conv.read(128000) if not d: break @@ -29,7 +31,7 @@ d = conv.read_rsrc(128000) if d: - print ' Out rsrc fork: ' + out_rsrc + print(' Out rsrc fork: ' + out_rsrc) outfile = open(out_rsrc, 'wb') outfile.write(d) while 1: diff -Nru vim-8.0.1453/src/diff.c vim-8.0.1766/src/diff.c --- vim-8.0.1453/src/diff.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/diff.c 2018-04-26 20:30:33.000000000 +0000 @@ -872,13 +872,9 @@ (diff_flags & DIFF_ICASE) ? "-i " : "", tmp_orig, tmp_new); append_redir(cmd, (int)len, p_srr, tmp_diff); -#ifdef FEAT_AUTOCMD block_autocmds(); /* Avoid ShellCmdPost stuff */ -#endif (void)call_shell(cmd, SHELL_FILTER|SHELL_SILENT|SHELL_DOOUT); -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif vim_free(cmd); } } @@ -984,13 +980,9 @@ * cooked mode to allow the user to respond to prompts. */ vim_snprintf((char *)buf, buflen, "patch -o %s %s < %s", tmp_new, tmp_orig, esc_name); -#ifdef FEAT_AUTOCMD block_autocmds(); /* Avoid ShellCmdPost stuff */ -#endif (void)call_shell(buf, SHELL_FILTER | SHELL_COOKED); -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif } #ifdef UNIX @@ -1052,11 +1044,9 @@ eap->arg = newname; ex_file(eap); -#ifdef FEAT_AUTOCMD /* Do filetype detection with the new name. */ if (au_has_group((char_u *)"filetypedetect")) do_cmdline_cmd((char_u *)":doau filetypedetect BufRead"); -#endif } } } @@ -1170,16 +1160,12 @@ # endif /* Use 'scrollbind' and 'cursorbind' when available */ -#ifdef FEAT_SCROLLBIND if (!wp->w_p_diff) wp->w_p_scb_save = wp->w_p_scb; wp->w_p_scb = TRUE; -#endif -#ifdef FEAT_CURSORBIND if (!wp->w_p_diff) wp->w_p_crb_save = wp->w_p_crb; wp->w_p_crb = TRUE; -#endif if (!wp->w_p_diff) wp->w_p_wrap_save = wp->w_p_wrap; wp->w_p_wrap = FALSE; @@ -1209,10 +1195,8 @@ /* make sure topline is not halfway a fold */ changed_window_setting_win(wp); # endif -#ifdef FEAT_SCROLLBIND if (vim_strchr(p_sbo, 'h') == NULL) do_cmdline_cmd((char_u *)"set sbo+=hor"); -#endif /* Save the current values, to be restored in ex_diffoff(). */ wp->w_p_diff_saved = TRUE; @@ -1231,9 +1215,7 @@ ex_diffoff(exarg_T *eap) { win_T *wp; -#ifdef FEAT_SCROLLBIND int diffwin = FALSE; -#endif FOR_ALL_WINDOWS(wp) { @@ -1247,14 +1229,10 @@ if (wp->w_p_diff_saved) { -#ifdef FEAT_SCROLLBIND if (wp->w_p_scb) wp->w_p_scb = wp->w_p_scb_save; -#endif -#ifdef FEAT_CURSORBIND if (wp->w_p_crb) wp->w_p_crb = wp->w_p_crb_save; -#endif if (!wp->w_p_wrap) wp->w_p_wrap = wp->w_p_wrap_save; #ifdef FEAT_FOLDING @@ -1286,20 +1264,16 @@ /* Note: 'sbo' is not restored, it's a global option. */ diff_buf_adjust(wp); } -#ifdef FEAT_SCROLLBIND diffwin |= wp->w_p_diff; -#endif } /* Also remove hidden buffers from the list. */ if (eap->forceit) diff_buf_clear(); -#ifdef FEAT_SCROLLBIND /* Remove "hor" from from 'scrollopt' if there are no diff windows left. */ if (!diffwin && vim_strchr(p_sbo, 'h') != NULL) do_cmdline_cmd((char_u *)"set sbo-=hor"); -#endif } /* diff -Nru vim-8.0.1453/src/digraph.c vim-8.0.1766/src/digraph.c --- vim-8.0.1453/src/digraph.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/digraph.c 2018-04-26 20:30:33.000000000 +0000 @@ -1975,6 +1975,41 @@ } /* + * Find a digraph for "val". If found return the string to display it. + * If not found return NULL. + */ + char_u * +get_digraph_for_char(val) + int val; +{ + int i; + int use_defaults; + digr_T *dp; + static char_u r[3]; + + for (use_defaults = 0; use_defaults <= 1; use_defaults++) + { + if (use_defaults == 0) + dp = (digr_T *)user_digraphs.ga_data; + else + dp = digraphdefault; + for (i = 0; use_defaults ? dp->char1 != NUL + : i < user_digraphs.ga_len; ++i) + { + if (dp->result == val) + { + r[0] = dp->char1; + r[1] = dp->char2; + r[2] = NUL; + return r; + } + ++dp; + } + } + return NULL; +} + +/* * Get a digraph. Used after typing CTRL-K on the command line or in normal * mode. * Returns composed character, or NUL when ESC was used. diff -Nru vim-8.0.1453/src/dosinst.c vim-8.0.1766/src/dosinst.c --- vim-8.0.1453/src/dosinst.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/dosinst.c 2018-04-26 20:30:33.000000000 +0000 @@ -23,7 +23,14 @@ #define GVIMEXT32_PATH "GvimExt32\\gvimext.dll" /* Macro to do an error check I was typing over and over */ -#define CHECK_REG_ERROR(code) if (code != ERROR_SUCCESS) { printf("%ld error number: %ld\n", (long)__LINE__, (long)code); return 1; } +#define CHECK_REG_ERROR(code) \ + do { \ + if (code != ERROR_SUCCESS) \ + { \ + printf("%ld error number: %ld\n", (long)__LINE__, (long)code); \ + return 1; \ + } \ + } while (0) int has_vim = 0; /* installable vim.exe exists */ int has_gvim = 0; /* installable gvim.exe exists */ @@ -1200,8 +1207,8 @@ /* If the path has a space: When using cmd.exe (Win NT/2000/XP) put * quotes around the diff command and rely on the default value of - * shellxquote to solve the quoting problem for the whole command. - * + * shellxquote to solve the quoting problem for the whole command. + * * Otherwise put a double quote just before the space and at the * end of the command. Putting quotes around the whole thing * doesn't work on Win 95/98/ME. This is mostly guessed! */ diff -Nru vim-8.0.1453/src/edit.c vim-8.0.1766/src/edit.c --- vim-8.0.1453/src/edit.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/edit.c 2018-04-26 20:30:33.000000000 +0000 @@ -17,39 +17,41 @@ /* * definitions used for CTRL-X submode */ -#define CTRL_X_WANT_IDENT 0x100 +# define CTRL_X_WANT_IDENT 0x100 -#define CTRL_X_NOT_DEFINED_YET 1 -#define CTRL_X_SCROLL 2 -#define CTRL_X_WHOLE_LINE 3 -#define CTRL_X_FILES 4 -#define CTRL_X_TAGS (5 + CTRL_X_WANT_IDENT) -#define CTRL_X_PATH_PATTERNS (6 + CTRL_X_WANT_IDENT) -#define CTRL_X_PATH_DEFINES (7 + CTRL_X_WANT_IDENT) -#define CTRL_X_FINISHED 8 -#define CTRL_X_DICTIONARY (9 + CTRL_X_WANT_IDENT) -#define CTRL_X_THESAURUS (10 + CTRL_X_WANT_IDENT) -#define CTRL_X_CMDLINE 11 -#define CTRL_X_FUNCTION 12 -#define CTRL_X_OMNI 13 -#define CTRL_X_SPELL 14 -#define CTRL_X_LOCAL_MSG 15 /* only used in "ctrl_x_msgs" */ -#define CTRL_X_EVAL 16 /* for builtin function complete() */ +# define CTRL_X_NORMAL 0 /* CTRL-N CTRL-P completion, default */ +# define CTRL_X_NOT_DEFINED_YET 1 +# define CTRL_X_SCROLL 2 +# define CTRL_X_WHOLE_LINE 3 +# define CTRL_X_FILES 4 +# define CTRL_X_TAGS (5 + CTRL_X_WANT_IDENT) +# define CTRL_X_PATH_PATTERNS (6 + CTRL_X_WANT_IDENT) +# define CTRL_X_PATH_DEFINES (7 + CTRL_X_WANT_IDENT) +# define CTRL_X_FINISHED 8 +# define CTRL_X_DICTIONARY (9 + CTRL_X_WANT_IDENT) +# define CTRL_X_THESAURUS (10 + CTRL_X_WANT_IDENT) +# define CTRL_X_CMDLINE 11 +# define CTRL_X_FUNCTION 12 +# define CTRL_X_OMNI 13 +# define CTRL_X_SPELL 14 +# define CTRL_X_LOCAL_MSG 15 /* only used in "ctrl_x_msgs" */ +# define CTRL_X_EVAL 16 /* for builtin function complete() */ -#define CTRL_X_MSG(i) ctrl_x_msgs[(i) & ~CTRL_X_WANT_IDENT] -#define CTRL_X_MODE_LINE_OR_EVAL(m) (m == CTRL_X_WHOLE_LINE || m == CTRL_X_EVAL) +# define CTRL_X_MSG(i) ctrl_x_msgs[(i) & ~CTRL_X_WANT_IDENT] +# define CTRL_X_MODE_LINE_OR_EVAL(m) ((m) == CTRL_X_WHOLE_LINE || (m) == CTRL_X_EVAL) +/* Message for CTRL-X mode, index is ctrl_x_mode. */ static char *ctrl_x_msgs[] = { - N_(" Keyword completion (^N^P)"), /* ctrl_x_mode == 0, ^P/^N compl. */ + N_(" Keyword completion (^N^P)"), /* CTRL_X_NORMAL, ^P/^N compl. */ N_(" ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)"), - NULL, + NULL, /* CTRL_X_SCROLL: depends on state */ N_(" Whole line completion (^L^N^P)"), N_(" File name completion (^F^N^P)"), N_(" Tag completion (^]^N^P)"), N_(" Path pattern completion (^N^P)"), N_(" Definition completion (^D^N^P)"), - NULL, + NULL, /* CTRL_X_FINISHED */ N_(" Dictionary completion (^K^N^P)"), N_(" Thesaurus completion (^T^N^P)"), N_(" Command-line completion (^V^N^P)"), @@ -61,10 +63,10 @@ }; static char e_hitend[] = N_("Hit end of paragraph"); -#ifdef FEAT_COMPL_FUNC +# ifdef FEAT_COMPL_FUNC static char e_complwin[] = N_("E839: Completion function changed window"); static char e_compldel[] = N_("E840: Completion function deleted text"); -#endif +# endif /* * Structure used to store one match for insert completion. @@ -83,8 +85,8 @@ int cp_number; /* sequence number */ }; -#define ORIGINAL_TEXT (1) /* the original text when the expansion begun */ -#define FREE_FNAME (2) +# define ORIGINAL_TEXT (1) /* the original text when the expansion begun */ +# define FREE_FNAME (2) /* * All the current matches are stored in a list. @@ -127,6 +129,9 @@ * FALSE the word to be completed must be located. */ static int compl_started = FALSE; +/* Which Ctrl-X mode are we in? */ +static int ctrl_x_mode = CTRL_X_NORMAL; + /* Set when doing something for completion that may call edit() recursively, * which is not allowed. */ static int compl_busy = FALSE; @@ -174,10 +179,10 @@ static int ins_compl_prep(int c); static void ins_compl_fixRedoBufForLeader(char_u *ptr_arg); static buf_T *ins_compl_next_buf(buf_T *buf, int flag); -#if defined(FEAT_COMPL_FUNC) || defined(FEAT_EVAL) +# if defined(FEAT_COMPL_FUNC) || defined(FEAT_EVAL) static void ins_compl_add_list(list_T *list); static void ins_compl_add_dict(dict_T *dict); -#endif +# endif static int ins_compl_get_exp(pos_T *ini); static void ins_compl_delete(void); static void ins_compl_insert(int in_compl_func); @@ -268,7 +273,7 @@ static void ins_try_si(int c); #endif static colnr_T get_nolist_virtcol(void); -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) static char_u *do_insert_char_pre(int c); #endif @@ -383,7 +388,6 @@ ins_compl_clear(); /* clear stuff for CTRL-X mode */ #endif -#ifdef FEAT_AUTOCMD /* * Trigger InsertEnter autocommands. Do not do this for "r" or "grx". */ @@ -391,7 +395,7 @@ { pos_T save_cursor = curwin->w_cursor; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (cmdchar == 'R') ptr = (char_u *)"r"; else if (cmdchar == 'V') @@ -400,7 +404,7 @@ ptr = (char_u *)"i"; set_vim_var_string(VV_INSERTMODE, ptr, 1); set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */ -# endif +#endif apply_autocmds(EVENT_INSERTENTER, NULL, NULL, FALSE, curbuf); /* Make sure the cursor didn't move. Do call check_cursor_col() in @@ -410,9 +414,9 @@ * line number is still valid (lines may have been deleted). * Do not restore if v:char was set to a non-empty string. */ if (!EQUAL_POS(curwin->w_cursor, save_cursor) -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL && *get_vim_var_str(VV_CHAR) == NUL -# endif +#endif && save_cursor.lnum <= curbuf->b_ml.ml_line_count) { int save_state = State; @@ -423,7 +427,6 @@ State = save_state; } } -#endif #ifdef FEAT_CONCEAL /* Check if the cursor line needs redrawing before changing State. If @@ -516,7 +519,7 @@ */ if (curbuf->b_p_iminsert == B_IMODE_LMAP) State |= LANGMAP; -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD im_set_active(curbuf->b_p_iminsert == B_IMODE_IM); #endif @@ -761,15 +764,11 @@ */ ins_redraw(TRUE); -#ifdef FEAT_SCROLLBIND if (curwin->w_p_scb) do_check_scrollbind(TRUE); -#endif -#ifdef FEAT_CURSORBIND if (curwin->w_p_crb) do_check_cursorbind(); -#endif update_curswant(); old_topline = curwin->w_topline; #ifdef FEAT_DIFF @@ -800,10 +799,8 @@ c = safe_vgetc(); } while (c == K_IGNORE || c == K_NOP); -#ifdef FEAT_AUTOCMD /* Don't want K_CURSORHOLD for the second key, e.g., after CTRL-V. */ did_cursorhold = TRUE; -#endif #ifdef FEAT_RIGHTLEFT if (p_hkmap && KeyTyped) @@ -851,7 +848,7 @@ * completion: Add to "compl_leader". */ if (ins_compl_accept_char(c)) { -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) /* Trigger InsertCharPre. */ char_u *str = do_insert_char_pre(c); char_u *p; @@ -1025,12 +1022,10 @@ if (ins_esc(&count, cmdchar, nomove)) { -#ifdef FEAT_AUTOCMD if (cmdchar != 'r' && cmdchar != 'v') apply_autocmds(EVENT_INSERTLEAVE, NULL, NULL, FALSE, curbuf); did_cursorhold = FALSE; -#endif return (c == Ctrl_O); } continue; @@ -1229,12 +1224,10 @@ case K_IGNORE: /* Something mapped to nothing */ break; -#ifdef FEAT_AUTOCMD case K_CURSORHOLD: /* Didn't type something for a while. */ apply_autocmds(EVENT_CURSORHOLDI, NULL, NULL, FALSE, curbuf); did_cursorhold = TRUE; break; -#endif #ifdef FEAT_GUI_W32 /* On Win32 ignore , we get it when closing the window was @@ -1381,7 +1374,7 @@ goto doESCkey; } #endif - if (ins_eol(c) && !p_im) + if (ins_eol(c) == FAIL && !p_im) goto doESCkey; /* out of memory */ auto_format(FALSE, FALSE); inserted_space = FALSE; @@ -1449,7 +1442,8 @@ /* if 'complete' is empty then plain ^P is no longer special, * but it is under other ^X modes */ if (*curbuf->b_p_cpt == NUL - && ctrl_x_mode != 0 + && (ctrl_x_mode == CTRL_X_NORMAL + || ctrl_x_mode == CTRL_X_WHOLE_LINE) && !(compl_cont_status & CONT_LOCAL)) goto normalchar; @@ -1482,7 +1476,7 @@ /* * Insert a normal character. */ -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) if (!p_paste) { /* Trigger InsertCharPre. */ @@ -1559,16 +1553,14 @@ break; } /* end of switch (c) */ -#ifdef FEAT_AUTOCMD /* If typed something may trigger CursorHoldI again. */ if (c != K_CURSORHOLD -# ifdef FEAT_COMPL_FUNC - /* but not in CTRL-X mode, a script can't restore the state */ - && ctrl_x_mode == 0 -# endif +#ifdef FEAT_COMPL_FUNC + /* but not in CTRL-X mode, a script can't restore the state */ + && ctrl_x_mode == CTRL_X_NORMAL +#endif ) did_cursorhold = FALSE; -#endif /* If the cursor was moved we didn't just insert a space */ if (arrow_used) @@ -1577,7 +1569,7 @@ #ifdef FEAT_CINDENT if (can_cindent && cindent_on() # ifdef FEAT_INS_EXPAND - && ctrl_x_mode == 0 + && ctrl_x_mode == CTRL_X_NORMAL # endif ) { @@ -1618,25 +1610,17 @@ if (char_avail()) return; -#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL) +#if defined(FEAT_CONCEAL) /* Trigger CursorMoved if the cursor moved. Not when the popup menu is * visible, the command might delete it. */ - if (ready && ( -# ifdef FEAT_AUTOCMD - has_cursormovedI() -# endif -# if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL) - || -# endif -# ifdef FEAT_CONCEAL - curwin->w_p_cole > 0 + if (ready && (has_cursormovedI() +# if defined(FEAT_CONCEAL) + || curwin->w_p_cole > 0 # endif ) -# ifdef FEAT_AUTOCMD - && !EQUAL_POS(last_cursormoved, curwin->w_cursor) -# endif + && !EQUAL_POS(last_cursormoved, curwin->w_cursor) # ifdef FEAT_INS_EXPAND - && !pum_visible() + && !pum_visible() # endif ) { @@ -1648,7 +1632,6 @@ if (syntax_present(curwin) && must_redraw) update_screen(0); # endif -# ifdef FEAT_AUTOCMD if (has_cursormovedI()) { /* Make sure curswant is correct, an autocommand may call @@ -1656,36 +1639,40 @@ update_curswant(); apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, FALSE, curbuf); } -# endif # ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0) { -# ifdef FEAT_AUTOCMD conceal_old_cursor_line = last_cursormoved.lnum; -# endif conceal_new_cursor_line = curwin->w_cursor.lnum; conceal_update_lines = TRUE; } # endif -# ifdef FEAT_AUTOCMD last_cursormoved = curwin->w_cursor; -# endif } #endif -#ifdef FEAT_AUTOCMD /* Trigger TextChangedI if b_changedtick differs. */ if (ready && has_textchangedI() - && last_changedtick != CHANGEDTICK(curbuf) -# ifdef FEAT_INS_EXPAND + && curbuf->b_last_changedtick != CHANGEDTICK(curbuf) +#ifdef FEAT_INS_EXPAND && !pum_visible() -# endif +#endif ) { - if (last_changedtick_buf == curbuf) - apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf); - last_changedtick_buf = curbuf; - last_changedtick = CHANGEDTICK(curbuf); + apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf); + curbuf->b_last_changedtick = CHANGEDTICK(curbuf); + } + +#ifdef FEAT_INS_EXPAND + /* Trigger TextChangedP if b_changedtick differs. When the popupmenu closes + * TextChangedI will need to trigger for backwards compatibility, thus use + * different b_last_changedtick* variables. */ + if (ready && has_textchangedP() + && curbuf->b_last_changedtick_pum != CHANGEDTICK(curbuf) + && pum_visible()) + { + apply_autocmds(EVENT_TEXTCHANGEDP, NULL, NULL, FALSE, curbuf); + curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf); } #endif @@ -2242,6 +2229,24 @@ } /* + * Whether other than default completion has been selected. + */ + int +ctrl_x_mode_not_default(void) +{ + return ctrl_x_mode != CTRL_X_NORMAL; +} + +/* + * Whether CTRL-X was typed without a following character. + */ + int +ctrl_x_mode_not_defined_yet(void) +{ + return ctrl_x_mode == CTRL_X_NOT_DEFINED_YET; +} + +/* * Return TRUE if the 'dict' or 'tsr' option can be used. */ static int @@ -2254,7 +2259,7 @@ ) : (*curbuf->b_p_tsr == NUL && *p_tsr == NUL)) { - ctrl_x_mode = 0; + ctrl_x_mode = CTRL_X_NORMAL; edit_submode = NULL; msg_attr(dict_opt ? (char_u *)_("'dictionary' option is empty") : (char_u *)_("'thesaurus' option is empty"), @@ -2830,7 +2835,7 @@ int save_w_leftcol = curwin->w_leftcol; /* If already doing completions stop it. */ - if (ctrl_x_mode != 0) + if (ctrl_x_mode != CTRL_X_NORMAL) ins_compl_prep(' '); ins_compl_clear(); ins_compl_free(); @@ -2904,8 +2909,7 @@ if (compl_match_array != NULL) { pum_undisplay(); - vim_free(compl_match_array); - compl_match_array = NULL; + VIM_CLEAR(compl_match_array); } } @@ -3407,10 +3411,8 @@ compl_T *match; int i; - vim_free(compl_pattern); - compl_pattern = NULL; - vim_free(compl_leader); - compl_leader = NULL; + VIM_CLEAR(compl_pattern); + VIM_CLEAR(compl_leader); if (compl_first_match == NULL) return; @@ -3442,13 +3444,10 @@ compl_cont_status = 0; compl_started = FALSE; compl_matches = 0; - vim_free(compl_pattern); - compl_pattern = NULL; - vim_free(compl_leader); - compl_leader = NULL; + VIM_CLEAR(compl_pattern); + VIM_CLEAR(compl_leader); edit_submode_extra = NULL; - vim_free(compl_orig_text); - compl_orig_text = NULL; + VIM_CLEAR(compl_orig_text); compl_enter_selects = FALSE; /* clear v:completed_item */ set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED)); @@ -3657,7 +3656,9 @@ { char_u *p; - /* Replace the original text entry. */ + /* Replace the original text entry. + * The ORIGINAL_TEXT flag is either at the first item or might possibly be + * at the last item for backward completion */ if (compl_first_match->cp_flags & ORIGINAL_TEXT) /* safety check */ { p = vim_strsave(str); @@ -3667,6 +3668,16 @@ compl_first_match->cp_str = p; } } + else if (compl_first_match->cp_prev != NULL + && (compl_first_match->cp_prev->cp_flags & ORIGINAL_TEXT)) + { + p = vim_strsave(str); + if (p != NULL) + { + vim_free(compl_first_match->cp_prev->cp_str); + compl_first_match->cp_prev->cp_str = p; + } + } } /* @@ -3736,7 +3747,7 @@ /* Set "compl_get_longest" when finding the first matches. */ if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET - || (ctrl_x_mode == 0 && !compl_started)) + || (ctrl_x_mode == CTRL_X_NORMAL && !compl_started)) { compl_get_longest = (strstr((char *)p_cot, "longest") != NULL); compl_used_match = TRUE; @@ -3841,19 +3852,19 @@ else compl_cont_mode = CTRL_X_NOT_DEFINED_YET; } - ctrl_x_mode = 0; + ctrl_x_mode = CTRL_X_NORMAL; edit_submode = NULL; showmode(); break; } } - else if (ctrl_x_mode != 0) + else if (ctrl_x_mode != CTRL_X_NORMAL) { /* We're already in CTRL-X mode, do we stay in it? */ if (!vim_is_ctrl_x_key(c)) { if (ctrl_x_mode == CTRL_X_SCROLL) - ctrl_x_mode = 0; + ctrl_x_mode = CTRL_X_NORMAL; else ctrl_x_mode = CTRL_X_FINISHED; edit_submode = NULL; @@ -3867,8 +3878,8 @@ * 'Pattern not found') until another key is hit, then go back to * showing what mode we are in. */ showmode(); - if ((ctrl_x_mode == 0 && c != Ctrl_N && c != Ctrl_P && c != Ctrl_R - && !ins_compl_pum_key(c)) + if ((ctrl_x_mode == CTRL_X_NORMAL && c != Ctrl_N && c != Ctrl_P + && c != Ctrl_R && !ins_compl_pum_key(c)) || ctrl_x_mode == CTRL_X_FINISHED) { /* Get here when we have finished typing a sequence of ^N and @@ -3951,7 +3962,7 @@ compl_matches = 0; if (!shortmess(SHM_COMPLETIONMENU)) msg_clr_cmdline(); /* necessary for "noshowmode" */ - ctrl_x_mode = 0; + ctrl_x_mode = CTRL_X_NORMAL; compl_enter_selects = FALSE; if (edit_submode != NULL) { @@ -3972,19 +3983,15 @@ if (want_cindent && in_cinkeys(KEY_COMPLETE, ' ', inindent(0))) do_c_expr_indent(); #endif -#ifdef FEAT_AUTOCMD /* Trigger the CompleteDone event to give scripts a chance to act * upon the completion. */ apply_autocmds(EVENT_COMPLETEDONE, NULL, NULL, FALSE, curbuf); -#endif } } -#ifdef FEAT_AUTOCMD else if (ctrl_x_mode == CTRL_X_LOCAL_MSG) /* Trigger the CompleteDone event to give scripts a chance to act * upon the (possibly failed) completion. */ apply_autocmds(EVENT_COMPLETEDONE, NULL, NULL, FALSE, curbuf); -#endif /* reset continue_* if we left expansion-mode, if we stay they'll be * (re)set properly in ins_complete() */ @@ -4218,6 +4225,8 @@ (char_u *)"kind", FALSE); cptext[CPT_INFO] = get_dict_string(tv->vval.v_dict, (char_u *)"info", FALSE); + cptext[CPT_USER_DATA] = get_dict_string(tv->vval.v_dict, + (char_u *)"user_data", FALSE); if (get_dict_string(tv->vval.v_dict, (char_u *)"icase", FALSE) != NULL) icase = get_dict_number(tv->vval.v_dict, (char_u *)"icase"); if (get_dict_string(tv->vval.v_dict, (char_u *)"dup", FALSE) != NULL) @@ -4292,7 +4301,8 @@ /* For ^N/^P pick a new entry from e_cpt if compl_started is off, * or if found_all says this entry is done. For ^X^L only use the * entries from 'complete' that look in loaded buffers. */ - if ((ctrl_x_mode == 0 || CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) + if ((ctrl_x_mode == CTRL_X_NORMAL + || CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) && (!compl_started || found_all)) { found_all = FALSE; @@ -4304,7 +4314,7 @@ first_match_pos = *ini; /* Move the cursor back one character so that ^N can match the * word immediately after the cursor. */ - if (ctrl_x_mode == 0 && dec(&first_match_pos) < 0) + if (ctrl_x_mode == CTRL_X_NORMAL && dec(&first_match_pos) < 0) { /* Move the cursor to after the last character in the * buffer, so that word at start of buffer is found @@ -4437,8 +4447,8 @@ /* Find up to TAG_MANY matches. Avoids that an enormous number * of matches is found when compl_pattern is empty */ if (find_tags(compl_pattern, &num_matches, &matches, - TAG_REGEXP | TAG_NAMES | TAG_NOIC | - TAG_INS_COMP | (ctrl_x_mode ? TAG_VERBOSE : 0), + TAG_REGEXP | TAG_NAMES | TAG_NOIC | TAG_INS_COMP + | (ctrl_x_mode != CTRL_X_NORMAL ? TAG_VERBOSE : 0), TAG_MANY, curbuf->b_ffname) == OK && num_matches > 0) { ins_compl_add_matches(num_matches, matches, p_ic); @@ -4633,8 +4643,10 @@ found_new_match = OK; /* break the loop for specialized modes (use 'complete' just for the - * generic ctrl_x_mode == 0) or when we've found a new match */ - if ((ctrl_x_mode != 0 && !CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) + * generic ctrl_x_mode == CTRL_X_NORMAL) or when we've found a new + * match */ + if ((ctrl_x_mode != CTRL_X_NORMAL + && !CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) || found_new_match != FAIL) { if (got_int) @@ -4643,7 +4655,8 @@ if (type != -1) ins_compl_check_keys(0, FALSE); - if ((ctrl_x_mode != 0 && !CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) + if ((ctrl_x_mode != CTRL_X_NORMAL + && !CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) || compl_interrupted) break; compl_started = TRUE; @@ -4659,13 +4672,13 @@ } compl_started = TRUE; - if ((ctrl_x_mode == 0 || CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) + if ((ctrl_x_mode == CTRL_X_NORMAL || CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)) && *e_cpt == NUL) /* Got to end of 'complete' */ found_new_match = FAIL; i = -1; /* total of matches, unknown */ - if (found_new_match == FAIL - || (ctrl_x_mode != 0 && !CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode))) + if (found_new_match == FAIL || (ctrl_x_mode != CTRL_X_NORMAL + && !CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode))) i = ins_compl_make_cyclic(); if (compl_old_match != NULL) @@ -4736,6 +4749,8 @@ EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_KIND])); dict_add_nr_str(dict, "info", 0L, EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_INFO])); + dict_add_nr_str(dict, "user_data", 0L, + EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_USER_DATA])); } set_vim_var_dict(VV_COMPLETED_ITEM, dict); if (!in_compl_func) @@ -4999,12 +5014,12 @@ ins_compl_check_keys(int frequency, int in_compl_func) { static int count = 0; + int c; - int c; - - /* Don't check when reading keys from a script. That would break the test - * scripts */ - if (using_script()) + /* Don't check when reading keys from a script, :normal or feedkeys(). + * That would break the test scripts. But do check for keys when called + * from complete_check(). */ + if (!in_compl_func && (using_script() || ex_normal_busy)) return; /* Only do this at regular intervals */ @@ -5166,8 +5181,9 @@ * it is a continued search */ compl_cont_status &= ~CONT_INTRPT; /* remove INTRPT */ - if (ctrl_x_mode == 0 || ctrl_x_mode == CTRL_X_PATH_PATTERNS - || ctrl_x_mode == CTRL_X_PATH_DEFINES) + if (ctrl_x_mode == CTRL_X_NORMAL + || ctrl_x_mode == CTRL_X_PATH_PATTERNS + || ctrl_x_mode == CTRL_X_PATH_DEFINES) { if (compl_startpos.lnum != curwin->w_cursor.lnum) { @@ -5219,7 +5235,8 @@ if (!(compl_cont_status & CONT_ADDING)) /* normal expansion */ { compl_cont_mode = ctrl_x_mode; - if (ctrl_x_mode != 0) /* Remove LOCAL if ctrl_x_mode != 0 */ + if (ctrl_x_mode != CTRL_X_NORMAL) + /* Remove LOCAL if ctrl_x_mode != CTRL_X_NORMAL */ compl_cont_status = 0; compl_cont_status |= CONT_N_ADDS; compl_startpos = curwin->w_cursor; @@ -5228,7 +5245,7 @@ } /* Work out completion pattern and original text -- webb */ - if (ctrl_x_mode == 0 || (ctrl_x_mode & CTRL_X_WANT_IDENT)) + if (ctrl_x_mode == CTRL_X_NORMAL || (ctrl_x_mode & CTRL_X_WANT_IDENT)) { if ((compl_cont_status & CONT_SOL) || ctrl_x_mode == CTRL_X_PATH_DEFINES) @@ -5445,7 +5462,7 @@ return FAIL; if (col == -3) { - ctrl_x_mode = 0; + ctrl_x_mode = CTRL_X_NORMAL; edit_submode = NULL; if (!shortmess(SHM_COMPLETIONMENU)) msg_clr_cmdline(); @@ -5545,10 +5562,8 @@ if (compl_orig_text == NULL || ins_compl_add(compl_orig_text, -1, p_ic, NULL, NULL, 0, ORIGINAL_TEXT, FALSE) != OK) { - vim_free(compl_pattern); - compl_pattern = NULL; - vim_free(compl_orig_text); - compl_orig_text = NULL; + VIM_CLEAR(compl_pattern); + VIM_CLEAR(compl_orig_text); return FAIL; } @@ -5604,7 +5619,7 @@ * (such as M in M'exico) if not tried already. -- Acevedo */ if ( compl_length > 1 || (compl_cont_status & CONT_ADDING) - || (ctrl_x_mode != 0 + || (ctrl_x_mode != CTRL_X_NORMAL && ctrl_x_mode != CTRL_X_PATH_PATTERNS && ctrl_x_mode != CTRL_X_PATH_DEFINES)) compl_cont_status &= ~CONT_N_ADDS; @@ -6187,10 +6202,7 @@ #ifdef FEAT_RIGHTLEFT && !p_ri #endif -#ifdef FEAT_AUTOCMD - && !has_insertcharpre() -#endif - ) + && !has_insertcharpre()) { #define INPUT_BUFLEN 100 char_u buf[INPUT_BUFLEN + 1]; @@ -7177,11 +7189,9 @@ void free_last_insert(void) { - vim_free(last_insert); - last_insert = NULL; + VIM_CLEAR(last_insert); # ifdef FEAT_INS_EXPAND - vim_free(compl_orig_text); - compl_orig_text = NULL; + VIM_CLEAR(compl_orig_text); # endif } #endif @@ -7809,8 +7819,7 @@ static void replace_flush(void) { - vim_free(replace_stack); - replace_stack = NULL; + VIM_CLEAR(replace_stack); replace_stack_len = 0; replace_stack_nr = 0; } @@ -8370,7 +8379,7 @@ ++no_u_sync; if (regname == '=') { -# ifdef FEAT_MBYTE +# ifdef HAVE_INPUT_METHOD int im_on = im_get_status(); # endif /* Sync undo when evaluating the expression calls setline() or @@ -8378,7 +8387,7 @@ u_sync_once = 2; regname = get_expr_register(); -# ifdef FEAT_MBYTE +# ifdef HAVE_INPUT_METHOD /* Restore the Input Method. */ if (im_on) im_set_active(TRUE); @@ -8507,12 +8516,12 @@ { curbuf->b_p_iminsert = B_IMODE_LMAP; State |= LANGMAP; -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD im_set_active(FALSE); #endif } } -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD else { /* There are no ":lmap" mappings, toggle IM */ @@ -8659,7 +8668,7 @@ } } -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD /* Disable IM to allow typing English directly for Normal mode commands. * When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as * well). */ @@ -8809,7 +8818,6 @@ } #endif -#ifdef FEAT_AUTOCMD # ifdef FEAT_EVAL set_vim_var_string(VV_INSERTMODE, (char_u *)((State & REPLACE_FLAG) ? "i" : @@ -8819,7 +8827,6 @@ "r"), 1); # endif apply_autocmds(EVENT_INSERTCHANGE, NULL, NULL, FALSE, curbuf); -#endif if (State & REPLACE_FLAG) State = INSERT | (State & LANGMAP); else @@ -8912,7 +8919,17 @@ || do_join(2, FALSE, TRUE, FALSE, FALSE) == FAIL) vim_beep(BO_BS); else + { curwin->w_cursor.col = temp; +#ifdef FEAT_VREPLACE + /* Adjust orig_line_count in case more lines have been deleted than + * have been added. That makes sure, that open_line() later + * can access all buffer lines correctly */ + if (State & VREPLACE_FLAG && + orig_line_count > curbuf->b_ml.ml_line_count) + orig_line_count = curbuf->b_ml.ml_line_count; +#endif + } } else if (del_char(FALSE) == FAIL) /* delete char under cursor */ vim_beep(BO_BS); @@ -10184,7 +10201,7 @@ /* * Handle CR or NL in insert mode. - * Return TRUE when out of memory or can't undo. + * Return FAIL when out of memory or can't undo. */ static int ins_eol(int c) @@ -10192,9 +10209,9 @@ int i; if (echeck_abbr(c + ABBR_OFF)) - return FALSE; + return OK; if (stop_arrow() == FAIL) - return TRUE; + return FAIL; undisplay_dollar(); /* @@ -10249,7 +10266,7 @@ foldOpenCursor(); #endif - return (!i); + return i; } #ifdef FEAT_DIGRAPHS @@ -10539,7 +10556,7 @@ return curwin->w_virtcol; } -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) /* * Handle the InsertCharPre autocommand. * "c" is the character that was typed. @@ -10556,11 +10573,11 @@ if (!has_insertcharpre()) return NULL; -#ifdef FEAT_MBYTE +# ifdef FEAT_MBYTE if (has_mbyte) buf[(*mb_char2bytes)(c, buf)] = NUL; else -#endif +# endif { buf[0] = c; buf[1] = NUL; diff -Nru vim-8.0.1453/src/eval.c vim-8.0.1766/src/eval.c --- vim-8.0.1453/src/eval.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/eval.c 2018-04-26 20:30:33.000000000 +0000 @@ -361,10 +361,7 @@ { p = &vimvars[i]; if (p->vv_di.di_tv.v_type == VAR_STRING) - { - vim_free(p->vv_str); - p->vv_str = NULL; - } + VIM_CLEAR(p->vv_str); else if (p->vv_di.di_tv.v_type == VAR_LIST) { list_unref(p->vv_list); @@ -569,14 +566,11 @@ } /* free the collected output */ - vim_free(redir_ga.ga_data); - redir_ga.ga_data = NULL; + VIM_CLEAR(redir_ga.ga_data); - vim_free(redir_lval); - redir_lval = NULL; + VIM_CLEAR(redir_lval); } - vim_free(redir_varname); - redir_varname = NULL; + VIM_CLEAR(redir_varname); } # if defined(FEAT_MBYTE) || defined(PROTO) @@ -1009,10 +1003,7 @@ tv = (typval_T *)alloc(sizeof(typval_T)); if (tv != NULL && eval0(arg, tv, nextcmd, TRUE) == FAIL) - { - vim_free(tv); - tv = NULL; - } + VIM_CLEAR(tv); return tv; } @@ -3213,8 +3204,7 @@ if (vidx < VV_LEN) return cat_prefix_varname('v', (char_u *)vimvars[vidx++].vv_name); - vim_free(varnamebuf); - varnamebuf = NULL; + VIM_CLEAR(varnamebuf); varnamebuflen = 0; return NULL; } @@ -3247,22 +3237,6 @@ } /* - * types for expressions. - */ -typedef enum -{ - TYPE_UNKNOWN = 0 - , TYPE_EQUAL /* == */ - , TYPE_NEQUAL /* != */ - , TYPE_GREATER /* > */ - , TYPE_GEQUAL /* >= */ - , TYPE_SMALLER /* < */ - , TYPE_SEQUAL /* <= */ - , TYPE_MATCH /* =~ */ - , TYPE_NOMATCH /* !~ */ -} exptype_T; - -/* * The "evaluate" argument: When FALSE, the argument is only parsed but not * executed. The function may return OK, but the rettv will be of type * VAR_UNKNOWN. The function still returns FAIL for a syntax error. @@ -3541,9 +3515,6 @@ exptype_T type = TYPE_UNKNOWN; int type_is = FALSE; /* TRUE for "is" and "isnot" */ int len = 2; - varnumber_T n1, n2; - char_u *s1, *s2; - char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; int ic; /* @@ -3625,197 +3596,12 @@ clear_tv(rettv); return FAIL; } - if (evaluate) { - if (type_is && rettv->v_type != var2.v_type) - { - /* For "is" a different type always means FALSE, for "notis" - * it means TRUE. */ - n1 = (type == TYPE_NEQUAL); - } - else if (rettv->v_type == VAR_LIST || var2.v_type == VAR_LIST) - { - if (type_is) - { - n1 = (rettv->v_type == var2.v_type - && rettv->vval.v_list == var2.vval.v_list); - if (type == TYPE_NEQUAL) - n1 = !n1; - } - else if (rettv->v_type != var2.v_type - || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) - { - if (rettv->v_type != var2.v_type) - EMSG(_("E691: Can only compare List with List")); - else - EMSG(_("E692: Invalid operation for List")); - clear_tv(rettv); - clear_tv(&var2); - return FAIL; - } - else - { - /* Compare two Lists for being equal or unequal. */ - n1 = list_equal(rettv->vval.v_list, var2.vval.v_list, - ic, FALSE); - if (type == TYPE_NEQUAL) - n1 = !n1; - } - } - - else if (rettv->v_type == VAR_DICT || var2.v_type == VAR_DICT) - { - if (type_is) - { - n1 = (rettv->v_type == var2.v_type - && rettv->vval.v_dict == var2.vval.v_dict); - if (type == TYPE_NEQUAL) - n1 = !n1; - } - else if (rettv->v_type != var2.v_type - || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) - { - if (rettv->v_type != var2.v_type) - EMSG(_("E735: Can only compare Dictionary with Dictionary")); - else - EMSG(_("E736: Invalid operation for Dictionary")); - clear_tv(rettv); - clear_tv(&var2); - return FAIL; - } - else - { - /* Compare two Dictionaries for being equal or unequal. */ - n1 = dict_equal(rettv->vval.v_dict, var2.vval.v_dict, - ic, FALSE); - if (type == TYPE_NEQUAL) - n1 = !n1; - } - } - - else if (rettv->v_type == VAR_FUNC || var2.v_type == VAR_FUNC - || rettv->v_type == VAR_PARTIAL || var2.v_type == VAR_PARTIAL) - { - if (type != TYPE_EQUAL && type != TYPE_NEQUAL) - { - EMSG(_("E694: Invalid operation for Funcrefs")); - clear_tv(rettv); - clear_tv(&var2); - return FAIL; - } - if ((rettv->v_type == VAR_PARTIAL - && rettv->vval.v_partial == NULL) - || (var2.v_type == VAR_PARTIAL - && var2.vval.v_partial == NULL)) - /* when a partial is NULL assume not equal */ - n1 = FALSE; - else if (type_is) - { - if (rettv->v_type == VAR_FUNC && var2.v_type == VAR_FUNC) - /* strings are considered the same if their value is - * the same */ - n1 = tv_equal(rettv, &var2, ic, FALSE); - else if (rettv->v_type == VAR_PARTIAL - && var2.v_type == VAR_PARTIAL) - n1 = (rettv->vval.v_partial == var2.vval.v_partial); - else - n1 = FALSE; - } - else - n1 = tv_equal(rettv, &var2, ic, FALSE); - if (type == TYPE_NEQUAL) - n1 = !n1; - } - -#ifdef FEAT_FLOAT - /* - * If one of the two variables is a float, compare as a float. - * When using "=~" or "!~", always compare as string. - */ - else if ((rettv->v_type == VAR_FLOAT || var2.v_type == VAR_FLOAT) - && type != TYPE_MATCH && type != TYPE_NOMATCH) - { - float_T f1, f2; + int ret = typval_compare(rettv, &var2, type, type_is, ic); - if (rettv->v_type == VAR_FLOAT) - f1 = rettv->vval.v_float; - else - f1 = get_tv_number(rettv); - if (var2.v_type == VAR_FLOAT) - f2 = var2.vval.v_float; - else - f2 = get_tv_number(&var2); - n1 = FALSE; - switch (type) - { - case TYPE_EQUAL: n1 = (f1 == f2); break; - case TYPE_NEQUAL: n1 = (f1 != f2); break; - case TYPE_GREATER: n1 = (f1 > f2); break; - case TYPE_GEQUAL: n1 = (f1 >= f2); break; - case TYPE_SMALLER: n1 = (f1 < f2); break; - case TYPE_SEQUAL: n1 = (f1 <= f2); break; - case TYPE_UNKNOWN: - case TYPE_MATCH: - case TYPE_NOMATCH: break; /* avoid gcc warning */ - } - } -#endif - - /* - * If one of the two variables is a number, compare as a number. - * When using "=~" or "!~", always compare as string. - */ - else if ((rettv->v_type == VAR_NUMBER || var2.v_type == VAR_NUMBER) - && type != TYPE_MATCH && type != TYPE_NOMATCH) - { - n1 = get_tv_number(rettv); - n2 = get_tv_number(&var2); - switch (type) - { - case TYPE_EQUAL: n1 = (n1 == n2); break; - case TYPE_NEQUAL: n1 = (n1 != n2); break; - case TYPE_GREATER: n1 = (n1 > n2); break; - case TYPE_GEQUAL: n1 = (n1 >= n2); break; - case TYPE_SMALLER: n1 = (n1 < n2); break; - case TYPE_SEQUAL: n1 = (n1 <= n2); break; - case TYPE_UNKNOWN: - case TYPE_MATCH: - case TYPE_NOMATCH: break; /* avoid gcc warning */ - } - } - else - { - s1 = get_tv_string_buf(rettv, buf1); - s2 = get_tv_string_buf(&var2, buf2); - if (type != TYPE_MATCH && type != TYPE_NOMATCH) - i = ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2); - else - i = 0; - n1 = FALSE; - switch (type) - { - case TYPE_EQUAL: n1 = (i == 0); break; - case TYPE_NEQUAL: n1 = (i != 0); break; - case TYPE_GREATER: n1 = (i > 0); break; - case TYPE_GEQUAL: n1 = (i >= 0); break; - case TYPE_SMALLER: n1 = (i < 0); break; - case TYPE_SEQUAL: n1 = (i <= 0); break; - - case TYPE_MATCH: - case TYPE_NOMATCH: - n1 = pattern_match(s2, s1, ic); - if (type == TYPE_NOMATCH) - n1 = !n1; - break; - - case TYPE_UNKNOWN: break; /* avoid gcc warning */ - } - } - clear_tv(rettv); clear_tv(&var2); - rettv->v_type = VAR_NUMBER; - rettv->vval.v_number = n1; + return ret; } } @@ -5339,11 +5125,9 @@ FOR_ALL_TAB_WINDOWS(tp, wp) abort = abort || set_ref_in_item(&wp->w_winvar.di_tv, copyID, NULL, NULL); -#ifdef FEAT_AUTOCMD if (aucmd_win != NULL) abort = abort || set_ref_in_item(&aucmd_win->w_winvar.di_tv, copyID, NULL, NULL); -#endif /* tabpage-local variables */ FOR_ALL_TABPAGES(tp) @@ -6096,10 +5880,7 @@ /* next try expanding things like $VIM and ${HOME} */ string = expand_env_save(name - 1); if (string != NULL && *string == '$') - { - vim_free(string); - string = NULL; - } + VIM_CLEAR(string); } name[len] = cc; @@ -6777,7 +6558,6 @@ return NULL; } -#if defined(FEAT_AUTOCMD) || defined(PROTO) /* * Set v:cmdarg. * If "eap" != NULL, use "eap" to generate the value and return the old value. @@ -6810,7 +6590,7 @@ len += 7; if (eap->force_ff != 0) - len += (unsigned)STRLEN(eap->cmd + eap->force_ff) + 6; + len += 10; /* " ++ff=unix" */ # ifdef FEAT_MBYTE if (eap->force_enc != 0) len += (unsigned)STRLEN(eap->cmd + eap->force_enc) + 7; @@ -6834,8 +6614,10 @@ if (eap->force_ff != 0) sprintf((char *)newval + STRLEN(newval), " ++ff=%s", - eap->cmd + eap->force_ff); -# ifdef FEAT_MBYTE + eap->force_ff == 'u' ? "unix" + : eap->force_ff == 'd' ? "dos" + : "mac"); +#ifdef FEAT_MBYTE if (eap->force_enc != 0) sprintf((char *)newval + STRLEN(newval), " ++enc=%s", eap->cmd + eap->force_enc); @@ -6845,15 +6627,14 @@ STRCPY(newval + STRLEN(newval), " ++bad=drop"); else if (eap->bad_char != 0) sprintf((char *)newval + STRLEN(newval), " ++bad=%c", eap->bad_char); -# endif +#endif vimvars[VV_CMDARG].vv_str = newval; return oldval; } -#endif /* * Get the value of internal variable "name". - * Return OK or FAIL. + * Return OK or FAIL. If OK is returned "rettv" must be cleared. */ int get_var_tv( @@ -7116,8 +6897,7 @@ func_unref(varp->vval.v_string); /* FALLTHROUGH */ case VAR_STRING: - vim_free(varp->vval.v_string); - varp->vval.v_string = NULL; + VIM_CLEAR(varp->vval.v_string); break; case VAR_PARTIAL: partial_unref(varp->vval.v_partial); @@ -7325,7 +7105,7 @@ { case VAR_NUMBER: vim_snprintf((char *)buf, NUMBUFLEN, "%lld", - (varnumber_T)varp->vval.v_number); + (long long)varp->vval.v_number); return buf; case VAR_FUNC: case VAR_PARTIAL: @@ -8433,7 +8213,7 @@ win_T * find_win_by_nr( typval_T *vp, - tabpage_T *tp UNUSED) /* NULL for current tab page */ + tabpage_T *tp) /* NULL for current tab page */ { win_T *wp; int nr; @@ -9052,6 +8832,75 @@ } void +assert_equalfile(typval_T *argvars) +{ + char_u buf1[NUMBUFLEN]; + char_u buf2[NUMBUFLEN]; + char_u *fname1 = get_tv_string_buf_chk(&argvars[0], buf1); + char_u *fname2 = get_tv_string_buf_chk(&argvars[1], buf2); + garray_T ga; + FILE *fd1; + FILE *fd2; + + if (fname1 == NULL || fname2 == NULL) + return; + + IObuff[0] = NUL; + fd1 = mch_fopen((char *)fname1, READBIN); + if (fd1 == NULL) + { + vim_snprintf((char *)IObuff, IOSIZE, (char *)e_notread, fname1); + } + else + { + fd2 = mch_fopen((char *)fname2, READBIN); + if (fd2 == NULL) + { + fclose(fd1); + vim_snprintf((char *)IObuff, IOSIZE, (char *)e_notread, fname2); + } + else + { + int c1, c2; + long count = 0; + + for (;;) + { + c1 = fgetc(fd1); + c2 = fgetc(fd2); + if (c1 == EOF) + { + if (c2 != EOF) + STRCPY(IObuff, "first file is shorter"); + break; + } + else if (c2 == EOF) + { + STRCPY(IObuff, "second file is shorter"); + break; + } + else if (c1 != c2) + { + vim_snprintf((char *)IObuff, IOSIZE, + "difference at byte %ld", count); + break; + } + ++count; + } + fclose(fd1); + fclose(fd2); + } + } + if (IObuff[0] != NUL) + { + prepare_assert_error(&ga); + ga_concat(&ga, IObuff); + assert_error(&ga); + ga_clear(&ga); + } +} + + void assert_match_common(typval_T *argvars, assert_type_T atype) { garray_T ga; @@ -9166,6 +9015,29 @@ } void +assert_beeps(typval_T *argvars) +{ + char_u *cmd = get_tv_string_chk(&argvars[0]); + garray_T ga; + + called_vim_beep = FALSE; + suppress_errthrow = TRUE; + emsg_silent = FALSE; + do_cmdline_cmd(cmd); + if (!called_vim_beep) + { + prepare_assert_error(&ga); + ga_concat(&ga, (char_u *)"command did not beep: "); + ga_concat(&ga, cmd); + assert_error(&ga); + ga_clear(&ga); + } + + suppress_errthrow = FALSE; + emsg_on_display = FALSE; +} + + void assert_fails(typval_T *argvars) { char_u *cmd = get_tv_string_chk(&argvars[0]); @@ -9292,6 +9164,258 @@ } } +/* + * Compare "typ1" and "typ2". Put the result in "typ1". + */ + int +typval_compare( + typval_T *typ1, /* first operand */ + typval_T *typ2, /* second operand */ + exptype_T type, /* operator */ + int type_is, /* TRUE for "is" and "isnot" */ + int ic) /* ignore case */ +{ + int i; + varnumber_T n1, n2; + char_u *s1, *s2; + char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; + + if (type_is && typ1->v_type != typ2->v_type) + { + /* For "is" a different type always means FALSE, for "notis" + * it means TRUE. */ + n1 = (type == TYPE_NEQUAL); + } + else if (typ1->v_type == VAR_LIST || typ2->v_type == VAR_LIST) + { + if (type_is) + { + n1 = (typ1->v_type == typ2->v_type + && typ1->vval.v_list == typ2->vval.v_list); + if (type == TYPE_NEQUAL) + n1 = !n1; + } + else if (typ1->v_type != typ2->v_type + || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) + { + if (typ1->v_type != typ2->v_type) + EMSG(_("E691: Can only compare List with List")); + else + EMSG(_("E692: Invalid operation for List")); + clear_tv(typ1); + return FAIL; + } + else + { + /* Compare two Lists for being equal or unequal. */ + n1 = list_equal(typ1->vval.v_list, typ2->vval.v_list, + ic, FALSE); + if (type == TYPE_NEQUAL) + n1 = !n1; + } + } + + else if (typ1->v_type == VAR_DICT || typ2->v_type == VAR_DICT) + { + if (type_is) + { + n1 = (typ1->v_type == typ2->v_type + && typ1->vval.v_dict == typ2->vval.v_dict); + if (type == TYPE_NEQUAL) + n1 = !n1; + } + else if (typ1->v_type != typ2->v_type + || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) + { + if (typ1->v_type != typ2->v_type) + EMSG(_("E735: Can only compare Dictionary with Dictionary")); + else + EMSG(_("E736: Invalid operation for Dictionary")); + clear_tv(typ1); + return FAIL; + } + else + { + /* Compare two Dictionaries for being equal or unequal. */ + n1 = dict_equal(typ1->vval.v_dict, typ2->vval.v_dict, + ic, FALSE); + if (type == TYPE_NEQUAL) + n1 = !n1; + } + } + + else if (typ1->v_type == VAR_FUNC || typ2->v_type == VAR_FUNC + || typ1->v_type == VAR_PARTIAL || typ2->v_type == VAR_PARTIAL) + { + if (type != TYPE_EQUAL && type != TYPE_NEQUAL) + { + EMSG(_("E694: Invalid operation for Funcrefs")); + clear_tv(typ1); + return FAIL; + } + if ((typ1->v_type == VAR_PARTIAL + && typ1->vval.v_partial == NULL) + || (typ2->v_type == VAR_PARTIAL + && typ2->vval.v_partial == NULL)) + /* when a partial is NULL assume not equal */ + n1 = FALSE; + else if (type_is) + { + if (typ1->v_type == VAR_FUNC && typ2->v_type == VAR_FUNC) + /* strings are considered the same if their value is + * the same */ + n1 = tv_equal(typ1, typ2, ic, FALSE); + else if (typ1->v_type == VAR_PARTIAL + && typ2->v_type == VAR_PARTIAL) + n1 = (typ1->vval.v_partial == typ2->vval.v_partial); + else + n1 = FALSE; + } + else + n1 = tv_equal(typ1, typ2, ic, FALSE); + if (type == TYPE_NEQUAL) + n1 = !n1; + } + +#ifdef FEAT_FLOAT + /* + * If one of the two variables is a float, compare as a float. + * When using "=~" or "!~", always compare as string. + */ + else if ((typ1->v_type == VAR_FLOAT || typ2->v_type == VAR_FLOAT) + && type != TYPE_MATCH && type != TYPE_NOMATCH) + { + float_T f1, f2; + + if (typ1->v_type == VAR_FLOAT) + f1 = typ1->vval.v_float; + else + f1 = get_tv_number(typ1); + if (typ2->v_type == VAR_FLOAT) + f2 = typ2->vval.v_float; + else + f2 = get_tv_number(typ2); + n1 = FALSE; + switch (type) + { + case TYPE_EQUAL: n1 = (f1 == f2); break; + case TYPE_NEQUAL: n1 = (f1 != f2); break; + case TYPE_GREATER: n1 = (f1 > f2); break; + case TYPE_GEQUAL: n1 = (f1 >= f2); break; + case TYPE_SMALLER: n1 = (f1 < f2); break; + case TYPE_SEQUAL: n1 = (f1 <= f2); break; + case TYPE_UNKNOWN: + case TYPE_MATCH: + case TYPE_NOMATCH: break; /* avoid gcc warning */ + } + } +#endif + + /* + * If one of the two variables is a number, compare as a number. + * When using "=~" or "!~", always compare as string. + */ + else if ((typ1->v_type == VAR_NUMBER || typ2->v_type == VAR_NUMBER) + && type != TYPE_MATCH && type != TYPE_NOMATCH) + { + n1 = get_tv_number(typ1); + n2 = get_tv_number(typ2); + switch (type) + { + case TYPE_EQUAL: n1 = (n1 == n2); break; + case TYPE_NEQUAL: n1 = (n1 != n2); break; + case TYPE_GREATER: n1 = (n1 > n2); break; + case TYPE_GEQUAL: n1 = (n1 >= n2); break; + case TYPE_SMALLER: n1 = (n1 < n2); break; + case TYPE_SEQUAL: n1 = (n1 <= n2); break; + case TYPE_UNKNOWN: + case TYPE_MATCH: + case TYPE_NOMATCH: break; /* avoid gcc warning */ + } + } + else + { + s1 = get_tv_string_buf(typ1, buf1); + s2 = get_tv_string_buf(typ2, buf2); + if (type != TYPE_MATCH && type != TYPE_NOMATCH) + i = ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2); + else + i = 0; + n1 = FALSE; + switch (type) + { + case TYPE_EQUAL: n1 = (i == 0); break; + case TYPE_NEQUAL: n1 = (i != 0); break; + case TYPE_GREATER: n1 = (i > 0); break; + case TYPE_GEQUAL: n1 = (i >= 0); break; + case TYPE_SMALLER: n1 = (i < 0); break; + case TYPE_SEQUAL: n1 = (i <= 0); break; + + case TYPE_MATCH: + case TYPE_NOMATCH: + n1 = pattern_match(s2, s1, ic); + if (type == TYPE_NOMATCH) + n1 = !n1; + break; + + case TYPE_UNKNOWN: break; /* avoid gcc warning */ + } + } + clear_tv(typ1); + typ1->v_type = VAR_NUMBER; + typ1->vval.v_number = n1; + + return OK; +} + + char_u * +typval_tostring(arg) + typval_T *arg; +{ + char_u *tofree; + char_u numbuf[NUMBUFLEN]; + char_u *ret = NULL; + + if (arg == NULL) + return vim_strsave((char_u *)"(does not exist)"); + ret = tv2string(arg, &tofree, numbuf, 0); + /* Make a copy if we have a value but it's not in allocated memory. */ + if (ret != NULL && tofree == NULL) + ret = vim_strsave(ret); + return ret; +} + + int +var_exists(char_u *var) +{ + char_u *name; + char_u *tofree; + typval_T tv; + int len = 0; + int n = FALSE; + + /* get_name_len() takes care of expanding curly braces */ + name = var; + len = get_name_len(&var, &tofree, TRUE, FALSE); + if (len > 0) + { + if (tofree != NULL) + name = tofree; + n = (get_var_tv(name, len, &tv, NULL, FALSE, TRUE) == OK); + if (n) + { + /* handle d.key, l[idx], f(expr) */ + n = (handle_subscript(&var, &tv, TRUE, FALSE) == OK); + if (n) + clear_tv(&tv); + } + } + if (*var != NUL) + n = FALSE; + + vim_free(tofree); + return n; +} #endif /* FEAT_EVAL */ diff -Nru vim-8.0.1453/src/evalfunc.c vim-8.0.1766/src/evalfunc.c --- vim-8.0.1453/src/evalfunc.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/evalfunc.c 2018-04-26 20:30:33.000000000 +0000 @@ -44,7 +44,9 @@ static void f_argidx(typval_T *argvars, typval_T *rettv); static void f_arglistid(typval_T *argvars, typval_T *rettv); static void f_argv(typval_T *argvars, typval_T *rettv); +static void f_assert_beeps(typval_T *argvars, typval_T *rettv); static void f_assert_equal(typval_T *argvars, typval_T *rettv); +static void f_assert_equalfile(typval_T *argvars, typval_T *rettv); static void f_assert_exception(typval_T *argvars, typval_T *rettv); static void f_assert_fails(typval_T *argvars, typval_T *rettv); static void f_assert_false(typval_T *argvars, typval_T *rettv); @@ -164,6 +166,7 @@ static void f_getbufinfo(typval_T *argvars, typval_T *rettv); static void f_getbufline(typval_T *argvars, typval_T *rettv); static void f_getbufvar(typval_T *argvars, typval_T *rettv); +static void f_getchangelist(typval_T *argvars, typval_T *rettv); static void f_getchar(typval_T *argvars, typval_T *rettv); static void f_getcharmod(typval_T *argvars, typval_T *rettv); static void f_getcharsearch(typval_T *argvars, typval_T *rettv); @@ -180,6 +183,7 @@ static void f_getfsize(typval_T *argvars, typval_T *rettv); static void f_getftime(typval_T *argvars, typval_T *rettv); static void f_getftype(typval_T *argvars, typval_T *rettv); +static void f_getjumplist(typval_T *argvars, typval_T *rettv); static void f_getline(typval_T *argvars, typval_T *rettv); static void f_getloclist(typval_T *argvars UNUSED, typval_T *rettv UNUSED); static void f_getmatches(typval_T *argvars, typval_T *rettv); @@ -193,6 +197,7 @@ static void f_gettabvar(typval_T *argvars, typval_T *rettv); static void f_gettabwinvar(typval_T *argvars, typval_T *rettv); static void f_getwininfo(typval_T *argvars, typval_T *rettv); +static void f_getwinpos(typval_T *argvars, typval_T *rettv); static void f_getwinposx(typval_T *argvars, typval_T *rettv); static void f_getwinposy(typval_T *argvars, typval_T *rettv); static void f_getwinvar(typval_T *argvars, typval_T *rettv); @@ -425,6 +430,7 @@ static void f_tolower(typval_T *argvars, typval_T *rettv); static void f_toupper(typval_T *argvars, typval_T *rettv); static void f_tr(typval_T *argvars, typval_T *rettv); +static void f_trim(typval_T *argvars, typval_T *rettv); #ifdef FEAT_FLOAT static void f_trunc(typval_T *argvars, typval_T *rettv); #endif @@ -482,7 +488,9 @@ #ifdef FEAT_FLOAT {"asin", 1, 1, f_asin}, /* WJMc */ #endif + {"assert_beeps", 1, 2, f_assert_beeps}, {"assert_equal", 2, 3, f_assert_equal}, + {"assert_equalfile", 2, 2, f_assert_equalfile}, {"assert_exception", 1, 2, f_assert_exception}, {"assert_fails", 1, 2, f_assert_fails}, {"assert_false", 1, 2, f_assert_false}, @@ -604,6 +612,7 @@ {"getbufinfo", 0, 1, f_getbufinfo}, {"getbufline", 2, 3, f_getbufline}, {"getbufvar", 2, 3, f_getbufvar}, + {"getchangelist", 1, 1, f_getchangelist}, {"getchar", 0, 1, f_getchar}, {"getcharmod", 0, 0, f_getcharmod}, {"getcharsearch", 0, 0, f_getcharsearch}, @@ -621,6 +630,7 @@ {"getfsize", 1, 1, f_getfsize}, {"getftime", 1, 1, f_getftime}, {"getftype", 1, 1, f_getftype}, + {"getjumplist", 0, 2, f_getjumplist}, {"getline", 1, 2, f_getline}, {"getloclist", 1, 2, f_getloclist}, {"getmatches", 0, 0, f_getmatches}, @@ -633,6 +643,7 @@ {"gettabvar", 2, 3, f_gettabvar}, {"gettabwinvar", 3, 4, f_gettabwinvar}, {"getwininfo", 0, 1, f_getwininfo}, + {"getwinpos", 0, 1, f_getwinpos}, {"getwinposx", 0, 0, f_getwinposx}, {"getwinposy", 0, 0, f_getwinposy}, {"getwinvar", 2, 3, f_getwinvar}, @@ -671,7 +682,7 @@ {"items", 1, 1, f_items}, #ifdef FEAT_JOB_CHANNEL {"job_getchannel", 1, 1, f_job_getchannel}, - {"job_info", 1, 1, f_job_info}, + {"job_info", 0, 1, f_job_info}, {"job_setoptions", 2, 2, f_job_setoptions}, {"job_start", 1, 2, f_job_start}, {"job_status", 1, 1, f_job_status}, @@ -730,7 +741,7 @@ {"pow", 2, 2, f_pow}, #endif {"prevnonblank", 1, 1, f_prevnonblank}, - {"printf", 2, 19, f_printf}, + {"printf", 1, 19, f_printf}, {"pumvisible", 0, 0, f_pumvisible}, #ifdef FEAT_PYTHON3 {"py3eval", 1, 1, f_py3eval}, @@ -841,7 +852,13 @@ #endif {"tempname", 0, 0, f_tempname}, #ifdef FEAT_TERMINAL + {"term_dumpdiff", 2, 3, f_term_dumpdiff}, + {"term_dumpload", 1, 2, f_term_dumpload}, + {"term_dumpwrite", 2, 3, f_term_dumpwrite}, {"term_getaltscreen", 1, 1, f_term_getaltscreen}, +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + {"term_getansicolors", 1, 1, f_term_getansicolors}, +# endif {"term_getattr", 2, 2, f_term_getattr}, {"term_getcursor", 1, 1, f_term_getcursor}, {"term_getjob", 1, 1, f_term_getjob}, @@ -854,6 +871,12 @@ {"term_list", 0, 0, f_term_list}, {"term_scrape", 2, 2, f_term_scrape}, {"term_sendkeys", 2, 2, f_term_sendkeys}, +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + {"term_setansicolors", 2, 2, f_term_setansicolors}, +# endif + {"term_setkill", 2, 2, f_term_setkill}, + {"term_setrestore", 2, 2, f_term_setrestore}, + {"term_setsize", 3, 3, f_term_setsize}, {"term_start", 1, 2, f_term_start}, {"term_wait", 1, 2, f_term_wait}, #endif @@ -884,6 +907,7 @@ {"tolower", 1, 1, f_tolower}, {"toupper", 1, 1, f_toupper}, {"tr", 3, 3, f_tr}, + {"trim", 1, 2, f_trim}, #ifdef FEAT_FLOAT {"trunc", 1, 1, f_trunc}, #endif @@ -1273,6 +1297,15 @@ } /* + * "assert_beeps(cmd [, error])" function + */ + static void +f_assert_beeps(typval_T *argvars, typval_T *rettv UNUSED) +{ + assert_beeps(argvars); +} + +/* * "assert_equal(expected, actual[, msg])" function */ static void @@ -1282,6 +1315,15 @@ } /* + * "assert_equalfile(fname-one, fname-two)" function + */ + static void +f_assert_equalfile(typval_T *argvars, typval_T *rettv UNUSED) +{ + assert_equalfile(argvars); +} + +/* * "assert_notequal(expected, actual[, msg])" function */ static void @@ -1447,6 +1489,8 @@ /* Skip the first and last item, they are always empty. */ for (i = 1; i < size - 1; ++i) list_append_string(rettv->vval.v_list, array[i].pum_text, -1); + while (size > 0) + vim_free(array[--size].pum_text); vim_free(array); } } @@ -1956,7 +2000,7 @@ if (argvars[1].v_type != VAR_UNKNOWN) channel = get_channel_arg(&argvars[1], FALSE, FALSE, 0); - ch_log(channel, (char *)msg); + ch_log(channel, "%s", msg); } /* @@ -2635,9 +2679,7 @@ static void f_did_filetype(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { -#ifdef FEAT_AUTOCMD rettv->vval.v_number = did_filetype; -#endif } /* @@ -2987,9 +3029,7 @@ f_exists(typval_T *argvars, typval_T *rettv) { char_u *p; - char_u *name; int n = FALSE; - int len = 0; p = get_tv_string(&argvars[0]); if (*p == '$') /* environment variable */ @@ -3022,38 +3062,14 @@ } else if (*p == '#') { -#ifdef FEAT_AUTOCMD if (p[1] == '#') n = autocmd_supported(p + 2); else n = au_exists(p + 1); -#endif } else /* internal variable */ { - char_u *tofree; - typval_T tv; - - /* get_name_len() takes care of expanding curly braces */ - name = p; - len = get_name_len(&p, &tofree, TRUE, FALSE); - if (len > 0) - { - if (tofree != NULL) - name = tofree; - n = (get_var_tv(name, len, &tv, NULL, FALSE, TRUE) == OK); - if (n) - { - /* handle d.key, l[idx], f(expr) */ - n = (handle_subscript(&p, &tv, TRUE, FALSE) == OK); - if (n) - clear_tv(&tv); - } - } - if (*p != NUL) - n = FALSE; - - vim_free(tofree); + n = var_exists(p); } rettv->vval.v_number = n; @@ -4356,6 +4372,61 @@ } /* + * "getchangelist()" function + */ + static void +f_getchangelist(typval_T *argvars, typval_T *rettv) +{ +#ifdef FEAT_JUMPLIST + buf_T *buf; + int i; + list_T *l; + dict_T *d; +#endif + + if (rettv_list_alloc(rettv) != OK) + return; + +#ifdef FEAT_JUMPLIST + (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + ++emsg_off; + buf = get_buf_tv(&argvars[0], FALSE); + --emsg_off; + if (buf == NULL) + return; + + l = list_alloc(); + if (l == NULL) + return; + + if (list_append_list(rettv->vval.v_list, l) == FAIL) + return; + /* + * The current window change list index tracks only the position in the + * current buffer change list. For other buffers, use the change list + * length as the current index. + */ + list_append_number(rettv->vval.v_list, + (varnumber_T)((buf == curwin->w_buffer) + ? curwin->w_changelistidx : buf->b_changelistlen)); + + for (i = 0; i < buf->b_changelistlen; ++i) + { + if (buf->b_changelist[i].lnum == 0) + continue; + if ((d = dict_alloc()) == NULL) + return; + if (list_append_dict(l, d) == FAIL) + return; + dict_add_nr_str(d, "lnum", (long)buf->b_changelist[i].lnum, NULL); + dict_add_nr_str(d, "col", (long)buf->b_changelist[i].col, NULL); +# ifdef FEAT_VIRTUALEDIT + dict_add_nr_str(d, "coladd", (long)buf->b_changelist[i].coladd, NULL); +# endif + } +#endif +} +/* * "getchar()" function */ static void @@ -4613,16 +4684,21 @@ { win_T *wp = NULL; char_u *cwd; + int global = FALSE; rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - wp = find_tabwin(&argvars[0], &argvars[1]); - if (wp != NULL) + if (argvars[0].v_type == VAR_NUMBER && argvars[0].vval.v_number == -1) + global = TRUE; + else + wp = find_tabwin(&argvars[0], &argvars[1]); + + if (wp != NULL && wp->w_localdir != NULL) + rettv->vval.v_string = vim_strsave(wp->w_localdir); + else if (wp != NULL || global) { - if (wp->w_localdir != NULL) - rettv->vval.v_string = vim_strsave(wp->w_localdir); - else if (globaldir != NULL) + if (globaldir != NULL) rettv->vval.v_string = vim_strsave(globaldir); else { @@ -4834,6 +4910,60 @@ } /* + * "getjumplist()" function + */ + static void +f_getjumplist(typval_T *argvars, typval_T *rettv) +{ +#ifdef FEAT_JUMPLIST + win_T *wp; + int i; + list_T *l; + dict_T *d; +#endif + + if (rettv_list_alloc(rettv) != OK) + return; + +#ifdef FEAT_JUMPLIST + wp = find_tabwin(&argvars[0], &argvars[1]); + if (wp == NULL) + return; + + l = list_alloc(); + if (l == NULL) + return; + + if (list_append_list(rettv->vval.v_list, l) == FAIL) + return; + list_append_number(rettv->vval.v_list, (varnumber_T)wp->w_jumplistidx); + + cleanup_jumplist(wp, TRUE); + + for (i = 0; i < wp->w_jumplistlen; ++i) + { + if (wp->w_jumplist[i].fmark.mark.lnum == 0) + continue; + if ((d = dict_alloc()) == NULL) + return; + if (list_append_dict(l, d) == FAIL) + return; + dict_add_nr_str(d, "lnum", (long)wp->w_jumplist[i].fmark.mark.lnum, + NULL); + dict_add_nr_str(d, "col", (long)wp->w_jumplist[i].fmark.mark.col, + NULL); +# ifdef FEAT_VIRTUALEDIT + dict_add_nr_str(d, "coladd", (long)wp->w_jumplist[i].fmark.mark.coladd, + NULL); +# endif + dict_add_nr_str(d, "bufnr", (long)wp->w_jumplist[i].fmark.fnum, NULL); + if (wp->w_jumplist[i].fname != NULL) + dict_add_nr_str(d, "filename", 0L, wp->w_jumplist[i].fname); + } +#endif +} + +/* * "getline(lnum, [end])" function */ static void @@ -5406,6 +5536,38 @@ } /* + * "getwinpos({timeout})" function + */ + static void +f_getwinpos(typval_T *argvars UNUSED, typval_T *rettv) +{ + int x = -1; + int y = -1; + + if (rettv_list_alloc(rettv) == FAIL) + return; +#ifdef FEAT_GUI + if (gui.in_use) + (void)gui_mch_get_winpos(&x, &y); +# if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE) + else +# endif +#endif +#if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE) + { + varnumber_T timeout = 100; + + if (argvars[0].v_type != VAR_UNKNOWN) + timeout = get_tv_number(&argvars[0]); + term_get_winpos(&x, &y, timeout); + } +#endif + list_append_number(rettv->vval.v_list, (varnumber_T)x); + list_append_number(rettv->vval.v_list, (varnumber_T)y); +} + + +/* * "getwinposx()" function */ static void @@ -5426,7 +5588,7 @@ { int x, y; - if (term_get_winpos(&x, &y) == OK) + if (term_get_winpos(&x, &y, (varnumber_T)100) == OK) rettv->vval.v_number = x; } #endif @@ -5453,7 +5615,7 @@ { int x, y; - if (term_get_winpos(&x, &y) == OK) + if (term_get_winpos(&x, &y, (varnumber_T)100) == OK) rettv->vval.v_number = y; } #endif @@ -5605,11 +5767,11 @@ "beos", #endif #ifdef MACOS_X - "mac", /* Mac OS X (and, once, Mac OS Classic) */ - "osx", /* Mac OS X */ + "mac", /* Mac OS X (and, once, Mac OS Classic) */ + "osx", /* Mac OS X */ # ifdef MACOS_X_DARWIN - "macunix", /* Mac OS X, with the darwin feature */ - "osxdarwin", /* synonym for macunix */ + "macunix", /* Mac OS X, with the darwin feature */ + "osxdarwin", /* synonym for macunix */ # endif #endif #ifdef __QNX__ @@ -5642,9 +5804,7 @@ #ifdef FEAT_ARABIC "arabic", #endif -#ifdef FEAT_AUTOCMD "autocmd", -#endif #ifdef FEAT_AUTOSERVERNAME "autoservername", #endif @@ -5703,9 +5863,7 @@ #ifdef FEAT_CSCOPE "cscope", #endif -#ifdef FEAT_CURSORBIND "cursorbind", -#endif #ifdef CURSOR_SHAPE "cursorshape", #endif @@ -5829,9 +5987,7 @@ #ifdef FEAT_LISP "lispindent", #endif -#ifdef FEAT_LISTCMDS "listcmds", -#endif #ifdef FEAT_LOCALMAP "localmap", #endif @@ -5955,9 +6111,7 @@ #if defined(FEAT_RUBY) && !defined(DYNAMIC_RUBY) "ruby", #endif -#ifdef FEAT_SCROLLBIND "scrollbind", -#endif #ifdef FEAT_CMDL_INFO "showcmd", "cmdline_info", @@ -6051,6 +6205,9 @@ #ifdef FEAT_VREPLACE "vreplace", #endif +#ifdef FEAT_VTP + "vtp", +#endif #ifdef FEAT_WILDIGN "wildignore", #endif @@ -6202,9 +6359,9 @@ else if (STRICMP(name, "syntax_items") == 0) n = syntax_present(curwin); #endif -#if defined(WIN3264) - else if (STRICMP(name, "win95") == 0) - n = FALSE; /* Win9x is no more supported. */ +#ifdef FEAT_VTP + else if (STRICMP(name, "vcon") == 0) + n = has_vtp_working(); #endif #ifdef FEAT_NETBEANS_INTG else if (STRICMP(name, "netbeans_enabled") == 0) @@ -6850,10 +7007,15 @@ static void f_job_info(typval_T *argvars, typval_T *rettv) { - job_T *job = get_job_arg(&argvars[0]); + if (argvars[0].v_type != VAR_UNKNOWN) + { + job_T *job = get_job_arg(&argvars[0]); - if (job != NULL && rettv_dict_alloc(rettv) != FAIL) - job_info(job, rettv->vval.v_dict); + if (job != NULL && rettv_dict_alloc(rettv) != FAIL) + job_info(job, rettv->vval.v_dict); + } + else if (rettv_list_alloc(rettv) == OK) + job_info_all(rettv->vval.v_list); } /* @@ -6882,7 +7044,7 @@ rettv->v_type = VAR_JOB; if (check_restricted() || check_secure()) return; - rettv->vval.v_job = job_start(argvars, NULL); + rettv->vval.v_job = job_start(argvars, NULL, NULL); } /* @@ -7901,22 +8063,32 @@ dir = get_tv_string_buf(&argvars[0], buf); if (*dir == NUL) - rettv->vval.v_number = FAIL; - else - { - if (*gettail(dir) == NUL) - /* remove trailing slashes */ - *gettail_sep(dir) = NUL; + return; - if (argvars[1].v_type != VAR_UNKNOWN) + if (*gettail(dir) == NUL) + /* remove trailing slashes */ + *gettail_sep(dir) = NUL; + + if (argvars[1].v_type != VAR_UNKNOWN) + { + if (argvars[2].v_type != VAR_UNKNOWN) { - if (argvars[2].v_type != VAR_UNKNOWN) - prot = (int)get_tv_number_chk(&argvars[2], NULL); - if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0) - mkdir_recurse(dir, prot); + prot = (int)get_tv_number_chk(&argvars[2], NULL); + if (prot == -1) + return; + } + if (STRCMP(get_tv_string(&argvars[1]), "p") == 0) + { + if (mch_isdir(dir)) + { + /* With the "p" flag it's OK if the dir already exists. */ + rettv->vval.v_number = OK; + return; + } + mkdir_recurse(dir, prot); } - rettv->vval.v_number = prot == -1 ? FAIL : vim_mkdir_emsg(dir, prot); } + rettv->vval.v_number = vim_mkdir_emsg(dir, prot); } #endif @@ -7977,7 +8149,7 @@ #ifdef FEAT_INS_EXPAND if (ins_compl_active()) buf[1] = 'c'; - else if (ctrl_x_mode == 1) + else if (ctrl_x_mode_not_defined_yet()) buf[1] = 'x'; #endif } @@ -9215,10 +9387,7 @@ if (*q != NUL) STRMOVE(remain, q - 1); else - { - vim_free(remain); - remain = NULL; - } + VIM_CLEAR(remain); } /* If the result is a relative path name, make it explicitly relative to @@ -10025,7 +10194,7 @@ } rettv->vval.v_number = 1; /* FAIL */ - if (line == NULL || lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1) + if (line == NULL || lnum > curbuf->b_ml.ml_line_count + 1) break; /* When coming here from Insert mode, sync undo, so that this can be @@ -12780,7 +12949,7 @@ } /* - * Unref/free "callback" and "partial" retured by get_callback(). + * Unref/free "callback" and "partial" returned by get_callback(). */ void free_callback(char_u *callback, partial_T *partial) @@ -13056,6 +13225,72 @@ rettv->vval.v_string = ga.ga_data; } +/* + * "trim({expr})" function + */ + static void +f_trim(typval_T *argvars, typval_T *rettv) +{ + char_u buf1[NUMBUFLEN]; + char_u buf2[NUMBUFLEN]; + char_u *head = get_tv_string_buf_chk(&argvars[0], buf1); + char_u *mask = NULL; + char_u *tail; + char_u *prev; + char_u *p; + int c1; + + rettv->v_type = VAR_STRING; + if (head == NULL) + { + rettv->vval.v_string = NULL; + return; + } + + if (argvars[1].v_type == VAR_STRING) + mask = get_tv_string_buf_chk(&argvars[1], buf2); + + while (*head != NUL) + { + c1 = PTR2CHAR(head); + if (mask == NULL) + { + if (c1 > ' ' && c1 != 0xa0) + break; + } + else + { + for (p = mask; *p != NUL; MB_PTR_ADV(p)) + if (c1 == PTR2CHAR(p)) + break; + if (*p == NUL) + break; + } + MB_PTR_ADV(head); + } + + for (tail = head + STRLEN(head); tail > head; tail = prev) + { + prev = tail; + MB_PTR_BACK(head, prev); + c1 = PTR2CHAR(prev); + if (mask == NULL) + { + if (c1 > ' ' && c1 != 0xa0) + break; + } + else + { + for (p = mask; *p != NUL; MB_PTR_ADV(p)) + if (c1 == PTR2CHAR(p)) + break; + if (*p == NUL) + break; + } + } + rettv->vval.v_string = vim_strnsave(head, (int)(tail - head)); +} + #ifdef FEAT_FLOAT /* * "trunc({float})" function diff -Nru vim-8.0.1453/src/ex_cmds2.c vim-8.0.1766/src/ex_cmds2.c --- vim-8.0.1453/src/ex_cmds2.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/ex_cmds2.c 2018-04-26 20:30:33.000000000 +0000 @@ -73,6 +73,16 @@ static void do_checkbacktracelevel(void); static void do_showbacktrace(char_u *cmd); +static char_u *debug_oldval = NULL; /* old and newval for debug expressions */ +static char_u *debug_newval = NULL; +static int debug_expr = 0; /* use debug_expr */ + + int +has_watchexpr(void) +{ + return debug_expr; +} + /* * do_debug(): Debug mode. * Repeatedly get Ex commands, until told to continue normal execution. @@ -135,13 +145,24 @@ if (!debug_did_msg) MSG(_("Entering Debug mode. Type \"cont\" to continue.")); + if (debug_oldval != NULL) + { + smsg((char_u *)_("Oldval = \"%s\""), debug_oldval); + vim_free(debug_oldval); + debug_oldval = NULL; + } + if (debug_newval != NULL) + { + smsg((char_u *)_("Newval = \"%s\""), debug_newval); + vim_free(debug_newval); + debug_newval = NULL; + } if (sourcing_name != NULL) msg(sourcing_name); if (sourcing_lnum != 0) smsg((char_u *)_("line %ld: %s"), (long)sourcing_lnum, cmd); else smsg((char_u *)_("cmd: %s"), cmd); - /* * Repeat getting a command and executing it. */ @@ -528,11 +549,15 @@ struct debuggy { int dbg_nr; /* breakpoint number */ - int dbg_type; /* DBG_FUNC or DBG_FILE */ - char_u *dbg_name; /* function or file name */ + int dbg_type; /* DBG_FUNC, DBG_FILE or DBG_EXPR */ + char_u *dbg_name; /* function, expression or file name */ regprog_T *dbg_prog; /* regexp program */ linenr_T dbg_lnum; /* line number in function or file */ int dbg_forceit; /* ! used */ +#ifdef FEAT_EVAL + typval_T *dbg_val; /* last result of watchexpression */ +#endif + int dbg_level; /* stored nested level for expr */ }; static garray_T dbg_breakp = {0, 0, sizeof(struct debuggy), 4, NULL}; @@ -546,6 +571,7 @@ #endif #define DBG_FUNC 1 #define DBG_FILE 2 +#define DBG_EXPR 3 static int dbg_parsearg(char_u *arg, garray_T *gap); static linenr_T debuggy_find(int file,char_u *fname, linenr_T after, garray_T *gap, int *fp); @@ -589,6 +615,12 @@ bp->dbg_type = DBG_FILE; here = TRUE; } + else if ( +#ifdef FEAT_PROFILE + gap != &prof_ga && +#endif + STRNCMP(p, "expr", 4) == 0) + bp->dbg_type = DBG_EXPR; else { EMSG2(_(e_invarg2), p); @@ -624,6 +656,12 @@ bp->dbg_name = vim_strsave(p); else if (here) bp->dbg_name = vim_strsave(curbuf->b_ffname); + else if (bp->dbg_type == DBG_EXPR) + { + bp->dbg_name = vim_strsave(p); + if (bp->dbg_name != NULL) + bp->dbg_val = eval_expr(bp->dbg_name, NULL); + } else { /* Expand the file name in the same way as do_source(). This means @@ -671,26 +709,35 @@ bp = &DEBUGGY(gap, gap->ga_len); bp->dbg_forceit = eap->forceit; - pat = file_pat_to_reg_pat(bp->dbg_name, NULL, NULL, FALSE); - if (pat != NULL) + if (bp->dbg_type != DBG_EXPR) { - bp->dbg_prog = vim_regcomp(pat, RE_MAGIC + RE_STRING); - vim_free(pat); - } - if (pat == NULL || bp->dbg_prog == NULL) - vim_free(bp->dbg_name); - else - { - if (bp->dbg_lnum == 0) /* default line number is 1 */ - bp->dbg_lnum = 1; + pat = file_pat_to_reg_pat(bp->dbg_name, NULL, NULL, FALSE); + if (pat != NULL) + { + bp->dbg_prog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + vim_free(pat); + } + if (pat == NULL || bp->dbg_prog == NULL) + vim_free(bp->dbg_name); + else + { + if (bp->dbg_lnum == 0) /* default line number is 1 */ + bp->dbg_lnum = 1; #ifdef FEAT_PROFILE - if (eap->cmdidx != CMD_profile) + if (eap->cmdidx != CMD_profile) #endif - { - DEBUGGY(gap, gap->ga_len).dbg_nr = ++last_breakp; - ++debug_tick; + { + DEBUGGY(gap, gap->ga_len).dbg_nr = ++last_breakp; + ++debug_tick; + } + ++gap->ga_len; } - ++gap->ga_len; + } + else + { + /* DBG_EXPR */ + DEBUGGY(gap, gap->ga_len++).dbg_nr = ++last_breakp; + ++debug_tick; } } } @@ -750,7 +797,7 @@ } else { - /* ":breakdel {func|file} [lnum] {name}" */ + /* ":breakdel {func|file|expr} [lnum] {name}" */ if (dbg_parsearg(eap->arg, gap) == FAIL) return; bp = &DEBUGGY(gap, gap->ga_len); @@ -778,6 +825,11 @@ while (gap->ga_len > 0) { vim_free(DEBUGGY(gap, todel).dbg_name); +#ifdef FEAT_EVAL + if (DEBUGGY(gap, todel).dbg_type == DBG_EXPR + && DEBUGGY(gap, todel).dbg_val != NULL) + free_tv(DEBUGGY(gap, todel).dbg_val); +#endif vim_regfree(DEBUGGY(gap, todel).dbg_prog); --gap->ga_len; if (todel < gap->ga_len) @@ -814,11 +866,15 @@ bp = &BREAKP(i); if (bp->dbg_type == DBG_FILE) home_replace(NULL, bp->dbg_name, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)_("%3d %s %s line %ld"), + if (bp->dbg_type != DBG_EXPR) + smsg((char_u *)_("%3d %s %s line %ld"), bp->dbg_nr, bp->dbg_type == DBG_FUNC ? "func" : "file", bp->dbg_type == DBG_FUNC ? bp->dbg_name : NameBuff, (long)bp->dbg_lnum); + else + smsg((char_u *)_("%3d expr %s"), + bp->dbg_nr, bp->dbg_name); } } @@ -889,7 +945,8 @@ /* Skip entries that are not useful or are for a line that is beyond * an already found breakpoint. */ bp = &DEBUGGY(gap, i); - if (((bp->dbg_type == DBG_FILE) == file && ( + if (((bp->dbg_type == DBG_FILE) == file && + bp->dbg_type != DBG_EXPR && ( #ifdef FEAT_PROFILE gap == &prof_ga || #endif @@ -910,6 +967,63 @@ } got_int |= prev_got_int; } +#ifdef FEAT_EVAL + else if (bp->dbg_type == DBG_EXPR) + { + typval_T *tv; + int line = FALSE; + + prev_got_int = got_int; + got_int = FALSE; + + tv = eval_expr(bp->dbg_name, NULL); + if (tv != NULL) + { + if (bp->dbg_val == NULL) + { + debug_oldval = typval_tostring(NULL); + bp->dbg_val = tv; + debug_newval = typval_tostring(bp->dbg_val); + line = TRUE; + } + else + { + if (typval_compare(tv, bp->dbg_val, TYPE_EQUAL, + TRUE, FALSE) == OK + && tv->vval.v_number == FALSE) + { + typval_T *v; + + line = TRUE; + debug_oldval = typval_tostring(bp->dbg_val); + /* Need to evaluate again, typval_compare() overwrites + * "tv". */ + v = eval_expr(bp->dbg_name, NULL); + debug_newval = typval_tostring(v); + free_tv(bp->dbg_val); + bp->dbg_val = v; + } + free_tv(tv); + } + } + else if (bp->dbg_val != NULL) + { + debug_oldval = typval_tostring(bp->dbg_val); + debug_newval = typval_tostring(NULL); + free_tv(bp->dbg_val); + bp->dbg_val = NULL; + line = TRUE; + } + + if (line) + { + lnum = after > 0 ? after : 1; + break; + } + + got_int |= prev_got_int; + } +#endif } if (name != fname) vim_free(name); @@ -1298,7 +1412,6 @@ if (this_due <= 1) { bevalexpr_due_set = FALSE; - if (balloonEval == NULL) { balloonEval = (BalloonEval *)alloc(sizeof(BalloonEval)); @@ -1307,7 +1420,7 @@ if (balloonEval != NULL) general_beval_cb(balloonEval, 0); } - else if (this_due > 0 && (next_due == -1 || next_due > this_due)) + else if (next_due == -1 || next_due > this_due) next_due = this_due; } #endif @@ -1932,17 +2045,15 @@ FOR_ALL_BUFFERS(buf) if (bufIsChanged(buf) && !buf->b_p_ro) { -#ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); -#endif + (void)buf_write_all(buf, FALSE); -#ifdef FEAT_AUTOCMD + /* an autocommand may have deleted the buffer */ if (!bufref_valid(&bufref)) buf = firstbuf; -#endif } } @@ -1954,11 +2065,9 @@ check_changed(buf_T *buf, int flags) { int forceit = (flags & CCGD_FORCEIT); -#ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); -#endif if ( !forceit && bufIsChanged(buf) @@ -1980,24 +2089,22 @@ # endif )) ++count; -# ifdef FEAT_AUTOCMD if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! It's not changed now. */ return FALSE; -# endif + dialog_changed(buf, count > 1); -# ifdef FEAT_AUTOCMD + if (!bufref_valid(&bufref)) /* Autocommand deleted buffer, oops! It's not changed now. */ return FALSE; -# endif return bufIsChanged(buf); } #endif if (flags & CCGD_EXCMD) no_write_message(); else - no_write_message_nobang(); + no_write_message_nobang(curbuf); return TRUE; } return FALSE; @@ -2084,11 +2191,9 @@ ) && !buf2->b_p_ro) { -#ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf2); -#endif #ifdef FEAT_BROWSE /* May get file name, when there is none */ browse_save_fname(buf2); @@ -2097,11 +2202,10 @@ buf2->b_fname, buf2->b_ffname, FALSE) == OK) /* didn't hit Cancel */ (void)buf_write_all(buf2, FALSE); -#ifdef FEAT_AUTOCMD + /* an autocommand may have deleted the buffer */ if (!bufref_valid(&bufref)) buf2 = firstbuf; -#endif } } } @@ -2150,7 +2254,7 @@ /* * Return TRUE if any buffer was changed and cannot be abandoned. * That changed buffer becomes the current buffer. - * When "unload" is true the current buffer is unloaded instead of making it + * When "unload" is TRUE the current buffer is unloaded instead of making it * hidden. This is used for ":q!". */ int @@ -2168,6 +2272,7 @@ tabpage_T *tp; win_T *wp; + /* Make a list of all buffers, with the most important ones first. */ FOR_ALL_BUFFERS(buf) ++bufcount; @@ -2180,17 +2285,19 @@ /* curbuf */ bufnrs[bufnum++] = curbuf->b_fnum; - /* buf in curtab */ + + /* buffers in current tab */ FOR_ALL_WINDOWS(wp) if (wp->w_buffer != curbuf) add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); - /* buf in other tab */ + /* buffers in other tabs */ FOR_ALL_TABPAGES(tp) if (tp != curtab) for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); - /* any other buf */ + + /* any other buffer */ FOR_ALL_BUFFERS(buf) add_bufnum(bufnrs, &bufnum, buf->b_fnum); @@ -2204,6 +2311,14 @@ bufref_T bufref; set_bufref(&bufref, buf); +#ifdef FEAT_TERMINAL + if (term_job_running(buf->b_term)) + { + if (term_try_stop_job(buf) == FAIL) + break; + } + else +#endif /* Try auto-writing the buffer. If this fails but the buffer no * longer exists it's not changed, that's OK. */ if (check_changed(buf, (p_awa ? CCGD_AW : 0) @@ -2216,6 +2331,7 @@ if (i >= bufnum) goto theend; + /* Get here if "buf" cannot be abandoned. */ ret = TRUE; exiting = FALSE; #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) @@ -2257,19 +2373,15 @@ FOR_ALL_TAB_WINDOWS(tp, wp) if (wp->w_buffer == buf) { -#ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); -#endif + goto_tabpage_win(tp, wp); -#ifdef FEAT_AUTOCMD + /* Paranoia: did autocms wipe out the buffer with changes? */ if (!bufref_valid(&bufref)) - { goto theend; - } -#endif goto buf_found; } buf_found: @@ -2307,20 +2419,16 @@ buf_write_all(buf_T *buf, int forceit) { int retval; -#ifdef FEAT_AUTOCMD buf_T *old_curbuf = curbuf; -#endif retval = (buf_write(buf, buf->b_ffname, buf->b_fname, (linenr_T)1, buf->b_ml.ml_line_count, NULL, FALSE, forceit, TRUE, FALSE)); -#ifdef FEAT_AUTOCMD if (curbuf != old_curbuf) { msg_source(HL_ATTR(HLF_W)); MSG(_("Warning: Entered other buffer unexpectedly (check autocommands)")); } -#endif return retval; } @@ -2332,9 +2440,7 @@ static int do_arglist(char_u *str, int what, int after); static void alist_check_arg_idx(void); static int editing_arg_idx(win_T *win); -#ifdef FEAT_LISTCMDS static int alist_add_list(int count, char_u **files, int after); -#endif #define AL_SET 1 #define AL_ADD 2 #define AL_DEL 3 @@ -2433,7 +2539,6 @@ } #endif -#if defined(FEAT_GUI) || defined(FEAT_CLIENTSERVER) || defined(PROTO) /* * Redefine the argument list. */ @@ -2442,7 +2547,6 @@ { do_arglist(str, AL_SET, 0); } -#endif /* * "what" == AL_SET: Redefine the argument list to 'str'. @@ -2461,10 +2565,8 @@ int exp_count; char_u **exp_files; int i; -#ifdef FEAT_LISTCMDS char_u *p; int match; -#endif int arg_escaped = TRUE; /* @@ -2484,7 +2586,6 @@ if (get_arglist(&new_ga, str, arg_escaped) == FAIL) return FAIL; -#ifdef FEAT_LISTCMDS if (what == AL_DEL) { regmatch_T regmatch; @@ -2531,7 +2632,6 @@ ga_clear(&new_ga); } else -#endif { i = expand_wildcards(new_ga.ga_len, (char_u **)new_ga.ga_data, &exp_count, &exp_files, EW_DIR|EW_FILE|EW_ADDSLASH|EW_NOTFOUND); @@ -2542,14 +2642,12 @@ return FAIL; } -#ifdef FEAT_LISTCMDS if (what == AL_ADD) { (void)alist_add_list(exp_count, exp_files, after); vim_free(exp_files); } else /* what == AL_SET */ -#endif alist_set(ALIST(curwin), exp_count, exp_files, FALSE, NULL, 0); } @@ -2631,16 +2729,11 @@ if (eap->cmdidx != CMD_args) { -#if defined(FEAT_LISTCMDS) alist_unlink(ALIST(curwin)); if (eap->cmdidx == CMD_argglobal) ALIST(curwin) = &global_alist; else /* eap->cmdidx == CMD_arglocal */ alist_new(); -#else - ex_ni(eap); - return; -#endif } if (!ends_excmd(*eap->arg)) @@ -2651,31 +2744,28 @@ */ ex_next(eap); } - else -#if defined(FEAT_LISTCMDS) - if (eap->cmdidx == CMD_args) -#endif + else if (eap->cmdidx == CMD_args) { /* * ":args": list arguments. */ if (ARGCOUNT > 0) { - /* Overwrite the command, for a short list there is no scrolling - * required and no wait_return(). */ - gotocmdline(TRUE); - for (i = 0; i < ARGCOUNT; ++i) + char_u **items = (char_u **)alloc(sizeof(char_u *) * ARGCOUNT); + + if (items != NULL) { - if (i == curwin->w_arg_idx) - msg_putchar('['); - msg_outtrans(alist_name(&ARGLIST[i])); - if (i == curwin->w_arg_idx) - msg_putchar(']'); - msg_putchar(' '); + /* Overwrite the command, for a short list there is no + * scrolling required and no wait_return(). */ + gotocmdline(TRUE); + + for (i = 0; i < ARGCOUNT; ++i) + items[i] = alist_name(&ARGLIST[i]); + list_in_columns(items, ARGCOUNT, curwin->w_arg_idx); + vim_free(items); } } } -#if defined(FEAT_LISTCMDS) else if (eap->cmdidx == CMD_arglocal) { garray_T *gap = &curwin->w_alist->al_ga; @@ -2694,7 +2784,6 @@ ++gap->ga_len; } } -#endif } /* @@ -2845,7 +2934,6 @@ } } -#if defined(FEAT_LISTCMDS) || defined(PROTO) /* * ":argedit" */ @@ -2853,6 +2941,8 @@ ex_argedit(exarg_T *eap) { int i = eap->addr_count ? (int)eap->line2 : curwin->w_arg_idx + 1; + // Whether curbuf will be reused, curbuf->b_ffname will be set. + int curbuf_is_reusable = curbuf_reusable(); if (do_arglist(eap->arg, AL_ADD, i) == FAIL) return; @@ -2860,8 +2950,9 @@ maketitle(); #endif - if (curwin->w_arg_idx == 0 && (curbuf->b_ml.ml_flags & ML_EMPTY) - && curbuf->b_ffname == NULL) + if (curwin->w_arg_idx == 0 + && (curbuf->b_ml.ml_flags & ML_EMPTY) + && (curbuf->b_ffname == NULL || curbuf_is_reusable)) i = 0; /* Edit the argument. */ if (i < ARGCOUNT) @@ -2942,7 +3033,7 @@ tabpage_T *tp; buf_T *buf = curbuf; int next_fnum = 0; -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) +#if defined(FEAT_SYN_HL) char_u *save_ei = NULL; #endif char_u *p_shm_save; @@ -2960,7 +3051,7 @@ } #endif -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) +#if defined(FEAT_SYN_HL) if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo) /* Don't do syntax HL autocommands. Skipping the syntax file is a * great speed improvement. */ @@ -3138,11 +3229,10 @@ if (eap->cmdidx == CMD_windo) { validate_cursor(); /* cursor may have moved */ -#ifdef FEAT_SCROLLBIND + /* required when 'scrollbind' has been set */ if (curwin->w_p_scb) do_check_scrollbind(TRUE); -#endif } if (eap->cmdidx == CMD_windo || eap->cmdidx == CMD_tabdo) @@ -3154,7 +3244,7 @@ listcmd_busy = FALSE; } -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) +#if defined(FEAT_SYN_HL) if (save_ei != NULL) { au_event_restore(save_ei); @@ -3194,7 +3284,8 @@ for (i = 0; i < count; ++i) { ARGLIST[after + i].ae_fname = files[i]; - ARGLIST[after + i].ae_fnum = buflist_add(files[i], BLN_LISTED); + ARGLIST[after + i].ae_fnum = + buflist_add(files[i], BLN_LISTED | BLN_CURBUF); } ALIST(curwin)->al_ga.ga_len += count; if (old_argcount > 0 && curwin->w_arg_idx >= after) @@ -3207,7 +3298,21 @@ return -1; } -#endif /* FEAT_LISTCMDS */ +#if defined(FEAT_CMDL_COMPL) || defined(PROTO) +/* + * Function given to ExpandGeneric() to obtain the possible arguments of the + * argedit and argdelete commands. + */ + char_u * +get_arglist_name(expand_T *xp UNUSED, int idx) +{ + if (idx >= ARGCOUNT) + return NULL; + + return alist_name(&ARGLIST[idx]); +} +#endif + #ifdef FEAT_EVAL /* @@ -3549,6 +3654,8 @@ } +#if defined(FEAT_EVAL) || defined(PROTO) + /* * Expand wildcards in "pat" and invoke do_source() for each match. */ @@ -3567,13 +3674,11 @@ } } -/* used for "cookie" of add_pack_plugin() */ -static int APP_ADD_DIR; -static int APP_LOAD; -static int APP_BOTH; - - static void -add_pack_plugin(char_u *fname, void *cookie) +/* + * Add the package directory to 'runtimepath'. + */ + static int +add_pack_dir_to_rtp(char_u *fname) { char_u *p4, *p3, *p2, *p1, *p; char_u *insp; @@ -3582,125 +3687,172 @@ int keep; size_t oldlen; size_t addlen; - char_u *afterdir; + char_u *afterdir = NULL; size_t afterlen = 0; - char_u *ffname = fix_fname(fname); + char_u *ffname = NULL; size_t fname_len; char_u *buf = NULL; char_u *rtp_ffname; int match; + int retval = FAIL; + p4 = p3 = p2 = p1 = get_past_head(fname); + for (p = p1; *p; MB_PTR_ADV(p)) + if (vim_ispathsep_nocolon(*p)) + { + p4 = p3; p3 = p2; p2 = p1; p1 = p; + } + + /* now we have: + * rtp/pack/name/start/name + * p4 p3 p2 p1 + * + * find the part up to "pack" in 'runtimepath' */ + c = *++p4; /* append pathsep in order to expand symlink */ + *p4 = NUL; + ffname = fix_fname(fname); + *p4 = c; if (ffname == NULL) - return; - if (cookie != &APP_LOAD && strstr((char *)p_rtp, (char *)ffname) == NULL) - { - /* directory is not yet in 'runtimepath', add it */ - p4 = p3 = p2 = p1 = get_past_head(ffname); - for (p = p1; *p; MB_PTR_ADV(p)) - if (vim_ispathsep_nocolon(*p)) - { - p4 = p3; p3 = p2; p2 = p1; p1 = p; - } - - /* now we have: - * rtp/pack/name/start/name - * p4 p3 p2 p1 - * - * find the part up to "pack" in 'runtimepath' */ - c = *p4; - *p4 = NUL; - - /* Find "ffname" in "p_rtp", ignoring '/' vs '\' differences. */ - fname_len = STRLEN(ffname); - insp = p_rtp; - buf = alloc(MAXPATHL); - if (buf == NULL) - goto theend; - while (*insp != NUL) - { - copy_option_part(&insp, buf, MAXPATHL, ","); - add_pathsep(buf); - rtp_ffname = fix_fname(buf); - if (rtp_ffname == NULL) - goto theend; - match = vim_fnamencmp(rtp_ffname, ffname, fname_len) == 0; - vim_free(rtp_ffname); - if (match) - break; - } + return FAIL; - if (*insp == NUL) - /* not found, append at the end */ - insp = p_rtp + STRLEN(p_rtp); - else - /* append after the matching directory. */ - --insp; - *p4 = c; - - /* check if rtp/pack/name/start/name/after exists */ - afterdir = concat_fnames(ffname, (char_u *)"after", TRUE); - if (afterdir != NULL && mch_isdir(afterdir)) - afterlen = STRLEN(afterdir) + 1; /* add one for comma */ - - oldlen = STRLEN(p_rtp); - addlen = STRLEN(ffname) + 1; /* add one for comma */ - new_rtp = alloc((int)(oldlen + addlen + afterlen + 1)); - /* add one for NUL */ - if (new_rtp == NULL) + /* Find "ffname" in "p_rtp", ignoring '/' vs '\' differences. */ + fname_len = STRLEN(ffname); + insp = p_rtp; + buf = alloc(MAXPATHL); + if (buf == NULL) + goto theend; + while (*insp != NUL) + { + copy_option_part(&insp, buf, MAXPATHL, ","); + add_pathsep(buf); + rtp_ffname = fix_fname(buf); + if (rtp_ffname == NULL) goto theend; - keep = (int)(insp - p_rtp); - mch_memmove(new_rtp, p_rtp, keep); - new_rtp[keep] = ','; - mch_memmove(new_rtp + keep + 1, ffname, addlen); - if (p_rtp[keep] != NUL) - mch_memmove(new_rtp + keep + addlen, p_rtp + keep, - oldlen - keep + 1); - if (afterlen > 0) - { - STRCAT(new_rtp, ","); - STRCAT(new_rtp, afterdir); - } - set_option_value((char_u *)"rtp", 0L, new_rtp, 0); - vim_free(new_rtp); - vim_free(afterdir); + match = vim_fnamencmp(rtp_ffname, ffname, fname_len) == 0; + vim_free(rtp_ffname); + if (match) + break; } - if (cookie != &APP_ADD_DIR) + if (*insp == NUL) + /* not found, append at the end */ + insp = p_rtp + STRLEN(p_rtp); + else + /* append after the matching directory. */ + --insp; + + /* check if rtp/pack/name/start/name/after exists */ + afterdir = concat_fnames(fname, (char_u *)"after", TRUE); + if (afterdir != NULL && mch_isdir(afterdir)) + afterlen = STRLEN(afterdir) + 1; /* add one for comma */ + + oldlen = STRLEN(p_rtp); + addlen = STRLEN(fname) + 1; /* add one for comma */ + new_rtp = alloc((int)(oldlen + addlen + afterlen + 1)); + /* add one for NUL */ + if (new_rtp == NULL) + goto theend; + keep = (int)(insp - p_rtp); + mch_memmove(new_rtp, p_rtp, keep); + new_rtp[keep] = ','; + mch_memmove(new_rtp + keep + 1, fname, addlen); + if (p_rtp[keep] != NUL) + mch_memmove(new_rtp + keep + addlen, p_rtp + keep, oldlen - keep + 1); + if (afterlen > 0) { - static char *plugpat = "%s/plugin/**/*.vim"; - static char *ftpat = "%s/ftdetect/*.vim"; - int len; - char_u *pat; + STRCAT(new_rtp, ","); + STRCAT(new_rtp, afterdir); + } + set_option_value((char_u *)"rtp", 0L, new_rtp, 0); + vim_free(new_rtp); + retval = OK; - len = (int)STRLEN(ffname) + (int)STRLEN(ftpat); - pat = alloc(len); - if (pat == NULL) - goto theend; - vim_snprintf((char *)pat, len, plugpat, ffname); - source_all_matches(pat); +theend: + vim_free(buf); + vim_free(ffname); + vim_free(afterdir); + return retval; +} + +/* + * Load scripts in "plugin" and "ftdetect" directories of the package. + */ + static int +load_pack_plugin(char_u *fname) +{ + static char *plugpat = "%s/plugin/**/*.vim"; + static char *ftpat = "%s/ftdetect/*.vim"; + int len; + char_u *ffname = fix_fname(fname); + char_u *pat = NULL; + int retval = FAIL; -#ifdef FEAT_AUTOCMD + if (ffname == NULL) + return FAIL; + len = (int)STRLEN(ffname) + (int)STRLEN(ftpat); + pat = alloc(len); + if (pat == NULL) + goto theend; + vim_snprintf((char *)pat, len, plugpat, ffname); + source_all_matches(pat); + + { + char_u *cmd = vim_strsave((char_u *)"g:did_load_filetypes"); + + /* If runtime/filetype.vim wasn't loaded yet, the scripts will be + * found when it loads. */ + if (cmd != NULL && eval_to_number(cmd) > 0) { - char_u *cmd = vim_strsave((char_u *)"g:did_load_filetypes"); + do_cmdline_cmd((char_u *)"augroup filetypedetect"); + vim_snprintf((char *)pat, len, ftpat, ffname); + source_all_matches(pat); + do_cmdline_cmd((char_u *)"augroup END"); + } + vim_free(cmd); + } + vim_free(pat); + retval = OK; - /* If runtime/filetype.vim wasn't loaded yet, the scripts will be - * found when it loads. */ - if (cmd != NULL && eval_to_number(cmd) > 0) +theend: + vim_free(ffname); + return retval; +} + +/* used for "cookie" of add_pack_plugin() */ +static int APP_ADD_DIR; +static int APP_LOAD; +static int APP_BOTH; + + static void +add_pack_plugin(char_u *fname, void *cookie) +{ + if (cookie != &APP_LOAD) + { + char_u *buf = alloc(MAXPATHL); + char_u *p; + int found = FALSE; + + if (buf == NULL) + return; + p = p_rtp; + while (*p != NUL) + { + copy_option_part(&p, buf, MAXPATHL, ","); + if (pathcmp((char *)buf, (char *)fname, -1) == 0) { - do_cmdline_cmd((char_u *)"augroup filetypedetect"); - vim_snprintf((char *)pat, len, ftpat, ffname); - source_all_matches(pat); - do_cmdline_cmd((char_u *)"augroup END"); + found = TRUE; + break; } - vim_free(cmd); } -#endif - vim_free(pat); + vim_free(buf); + if (!found) + /* directory is not yet in 'runtimepath', add it */ + if (add_pack_dir_to_rtp(fname) == FAIL) + return; } -theend: - vim_free(buf); - vim_free(ffname); + if (cookie != &APP_ADD_DIR) + load_pack_plugin(fname); } /* @@ -3773,8 +3925,9 @@ vim_free(pat); } } +#endif -#if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD) +#if defined(FEAT_EVAL) || defined(PROTO) /* * ":options" */ @@ -4170,23 +4323,21 @@ goto theend; } -#ifdef FEAT_AUTOCMD /* Apply SourceCmd autocommands, they should get the file and source it. */ if (has_autocmd(EVENT_SOURCECMD, fname_exp, NULL) && apply_autocmds(EVENT_SOURCECMD, fname_exp, fname_exp, FALSE, curbuf)) { -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL retval = aborting() ? FAIL : OK; -# else +#else retval = OK; -# endif +#endif goto theend; } /* Apply SourcePre autocommands, they may get the file. */ apply_autocmds(EVENT_SOURCEPRE, fname_exp, fname_exp, FALSE, curbuf); -#endif #ifdef USE_FOPEN_NOINH cookie.fp = fopen_noinh_readbin((char *)fname_exp); @@ -5048,7 +5199,6 @@ } #endif -#if defined(FEAT_LISTCMDS) || defined(PROTO) /* * ":checktime [buffer]" */ @@ -5069,7 +5219,6 @@ } no_check_timestamps = save_no_check_timestamps; } -#endif #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ && (defined(FEAT_EVAL) || defined(FEAT_MULTI_LANG)) @@ -5462,8 +5611,7 @@ { for (i = 0; locales[i] != NULL; i++) vim_free(locales[i]); - vim_free(locales); - locales = NULL; + VIM_CLEAR(locales); } } # endif diff -Nru vim-8.0.1453/src/ex_cmds.c vim-8.0.1766/src/ex_cmds.c --- vim-8.0.1453/src/ex_cmds.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/ex_cmds.c 2018-04-26 20:30:33.000000000 +0000 @@ -28,9 +28,7 @@ #endif static int check_readonly(int *forceit, buf_T *buf); -#ifdef FEAT_AUTOCMD static void delbuf_msg(char_u *name); -#endif static int #ifdef __BORLANDC__ _RTLENTRYF @@ -49,6 +47,9 @@ char buf1[20]; char buf2[20]; char_u buf3[7]; +#ifdef FEAT_DIGRAPHS + char_u *dig; +#endif #ifdef FEAT_MBYTE int cc[MAX_MCO]; int ci = 0; @@ -94,7 +95,15 @@ else #endif buf2[0] = NUL; - vim_snprintf((char *)IObuff, IOSIZE, +#ifdef FEAT_DIGRAPHS + dig = get_digraph_for_char(cval); + if (dig != NULL) + vim_snprintf((char *)IObuff, IOSIZE, + _("<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s"), + transchar(c), buf1, buf2, cval, cval, cval, dig); + else +#endif + vim_snprintf((char *)IObuff, IOSIZE, _("<%s>%s%s %d, Hex %02x, Octal %03o"), transchar(c), buf1, buf2, cval, cval, cval); #ifdef FEAT_MBYTE @@ -121,9 +130,19 @@ ) IObuff[len++] = ' '; /* draw composing char on top of a space */ len += (*mb_char2bytes)(c, IObuff + len); - vim_snprintf((char *)IObuff + len, IOSIZE - len, - c < 0x10000 ? _("> %d, Hex %04x, Octal %o") - : _("> %d, Hex %08x, Octal %o"), c, c, c); +#ifdef FEAT_DIGRAPHS + dig = get_digraph_for_char(c); + if (dig != NULL) + vim_snprintf((char *)IObuff + len, IOSIZE - len, + c < 0x10000 ? _("> %d, Hex %04x, Oct %o, Digr %s") + : _("> %d, Hex %08x, Oct %o, Digr %s"), + c, c, c, dig); + else +#endif + vim_snprintf((char *)IObuff + len, IOSIZE - len, + c < 0x10000 ? _("> %d, Hex %04x, Octal %o") + : _("> %d, Hex %08x, Octal %o"), + c, c, c); if (ci == MAX_MCO) break; if (enc_utf8) @@ -1127,9 +1146,7 @@ /* Careful: This may recursively call do_bang() again! (because of * autocommands) */ do_filter(line1, line2, eap, newcmd, do_in, do_out); -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_SHELLFILTERPOST, NULL, NULL, FALSE, curbuf); -#endif } if (free_newcmd) vim_free(newcmd); @@ -1165,9 +1182,7 @@ linenr_T read_linecount; pos_T cursor_save; char_u *cmd_buf; -#ifdef FEAT_AUTOCMD buf_T *old_curbuf = curbuf; -#endif int shell_flags = 0; if (*cmd == NUL) /* no filter command */ @@ -1238,16 +1253,14 @@ { msg_putchar('\n'); /* keep message from buf_write() */ --no_wait_return; -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (!aborting()) #endif (void)EMSG2(_(e_notcreate), itmp); /* will call wait_return */ goto filterend; } -#ifdef FEAT_AUTOCMD if (curbuf != old_curbuf) goto filterend; -#endif if (!do_out) msg_putchar('\n'); @@ -1313,7 +1326,7 @@ if (readfile(otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, READ_FILTER) != OK) { -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (!aborting()) #endif { @@ -1322,10 +1335,8 @@ } goto error; } -#ifdef FEAT_AUTOCMD if (curbuf != old_curbuf) goto filterend; -#endif } read_linecount = curbuf->b_ml.ml_line_count - read_linecount; @@ -1405,13 +1416,11 @@ filterend: -#ifdef FEAT_AUTOCMD if (curbuf != old_curbuf) { --no_wait_return; EMSG(_("E135: *Filter* Autocommands must not change current buffer")); } -#endif if (itmp != NULL) mch_remove(itmp); if (otmp != NULL) @@ -1461,9 +1470,7 @@ * avoid having to type return below. */ msg_putchar('\r'); /* put cursor at start of line */ -#ifdef FEAT_AUTOCMD if (!autocmd_busy) -#endif { #ifdef MSWIN if (!winstart) @@ -1476,11 +1483,7 @@ msg_putchar('\n'); /* may shift screen one line up */ /* warning message before calling the shell */ - if (p_warn -#ifdef FEAT_AUTOCMD - && !autocmd_busy -#endif - && msg_silent == 0) + if (p_warn && !autocmd_busy && msg_silent == 0) FOR_ALL_BUFFERS(buf) if (bufIsChangedNotTerm(buf)) { @@ -1515,14 +1518,12 @@ msg_col = 0; } -#ifdef FEAT_AUTOCMD if (autocmd_busy) { if (msg_silent == 0) redraw_later_clear(); } else -#endif { /* * For ":sh" there is no need to call wait_return(), just redraw. @@ -1591,9 +1592,7 @@ /* display any error messages now */ display_errors(); -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, FALSE, curbuf); -#endif } /* @@ -1957,8 +1956,7 @@ if (!shortname && st_new.st_dev == st_old.st_dev && st_new.st_ino == st_old.st_ino) { - vim_free(tempname); - tempname = NULL; + VIM_CLEAR(tempname); shortname = TRUE; break; } @@ -2959,16 +2957,14 @@ char_u *fname, *sfname, *xfname; buf_T *buf; -#ifdef FEAT_AUTOCMD buf = curbuf; apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); /* buffer changed, don't change name now */ if (buf != curbuf) return FAIL; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return FAIL; -# endif #endif /* * The name of the current buffer will be changed. @@ -2997,11 +2993,10 @@ } vim_free(fname); vim_free(sfname); -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); -#endif + /* Change directories when the 'acd' option is set. */ - DO_AUTOCHDIR + DO_AUTOCHDIR; return OK; } @@ -3178,22 +3173,20 @@ { if (eap->cmdidx == CMD_saveas && alt_buf != NULL) { -#ifdef FEAT_AUTOCMD buf_T *was_curbuf = curbuf; apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, alt_buf); -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (curbuf != was_curbuf || aborting()) -# else +#else if (curbuf != was_curbuf) -# endif +#endif { /* buffer changed, don't change name now */ retval = FAIL; goto theend; } -#endif /* Exchange the file names for the current and the alternate * buffer. This makes it look like we are now editing the buffer * under the new name. Must be done before buf_write(), because @@ -3209,7 +3202,7 @@ alt_buf->b_sfname = curbuf->b_sfname; curbuf->b_sfname = fname; buf_name_changed(curbuf); -#ifdef FEAT_AUTOCMD + apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, alt_buf); if (!alt_buf->b_p_bl) @@ -3217,11 +3210,11 @@ alt_buf->b_p_bl = TRUE; apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, alt_buf); } -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (curbuf != was_curbuf || aborting()) -# else +#else if (curbuf != was_curbuf) -# endif +#endif { /* buffer changed, don't write the file */ retval = FAIL; @@ -3240,7 +3233,6 @@ /* Autocommands may have changed buffer names, esp. when * 'autochdir' is set. */ fname = curbuf->b_sfname; -#endif } name_was_missing = curbuf->b_ffname == NULL; @@ -3262,7 +3254,7 @@ * got changed or set. */ if (eap->cmdidx == CMD_saveas || name_was_missing) { - DO_AUTOCHDIR + DO_AUTOCHDIR; } } @@ -3429,6 +3421,14 @@ FOR_ALL_BUFFERS(buf) { +#ifdef FEAT_TERMINAL + if (exiting && term_job_running(buf->b_term)) + { + no_write_message_nobang(buf); + ++error; + } + else +#endif if (bufIsChanged(buf) && !bt_dontwrite(buf)) { /* @@ -3461,18 +3461,14 @@ } else { -#ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf); -#endif if (buf_write_all(buf, eap->forceit) == FAIL) ++error; -#ifdef FEAT_AUTOCMD /* an autocommand may have deleted the buffer */ if (!bufref_valid(&bufref)) buf = firstbuf; -#endif } eap->forceit = save_forceit; /* check_overwrite() may set it */ } @@ -3576,10 +3572,8 @@ if (text_locked()) return GETFILE_ERROR; -#ifdef FEAT_AUTOCMD if (curbuf_locked()) return GETFILE_ERROR; -#endif if (fnum == 0) { @@ -3674,17 +3668,15 @@ { int other_file; /* TRUE if editing another file */ int oldbuf; /* TRUE if using existing buffer */ -#ifdef FEAT_AUTOCMD int auto_buf = FALSE; /* TRUE if autocommands brought us into the buffer unexpectedly */ char_u *new_name = NULL; +#if defined(FEAT_EVAL) int did_set_swapcommand = FALSE; #endif buf_T *buf; bufref_T bufref; -#if defined(FEAT_AUTOCMD) || defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) bufref_T old_curbuf; -#endif char_u *free_fname = NULL; #ifdef FEAT_BROWSE char_u *browse_file = NULL; @@ -3708,9 +3700,7 @@ if (eap != NULL) command = eap->do_ecmd_cmd; -#if defined(FEAT_AUTOCMD) || defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) set_bufref(&old_curbuf, curbuf); -#endif if (fnum != 0) { @@ -3723,11 +3713,10 @@ #ifdef FEAT_BROWSE if (cmdmod.browse) { -# ifdef FEAT_AUTOCMD if ( -# ifdef FEAT_GUI +# ifdef FEAT_GUI !gui.in_use && -# endif +# endif au_has_group((char_u *)"FileExplorer")) { /* No browsing supported but we do have the file explorer: @@ -3736,7 +3725,6 @@ ffname = (char_u *)"."; } else -# endif { browse_file = do_browse(0, (char_u *)_("Edit File"), ffname, NULL, NULL, NULL, curbuf); @@ -3757,10 +3745,8 @@ fname_case(sfname, 0); /* set correct case for sfname */ #endif -#ifdef FEAT_LISTCMDS if ((flags & ECMD_ADDBUF) && (ffname == NULL || *ffname == NUL)) goto theend; -#endif if (ffname == NULL) other_file = TRUE; @@ -3810,7 +3796,7 @@ */ reset_VIsual(); -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) if ((command != NULL || newlnum > (linenr_T)0) && *get_vim_var_str(VV_SWAPCOMMAND) == NUL) { @@ -3842,9 +3828,7 @@ */ if (other_file) { -#ifdef FEAT_LISTCMDS if (!(flags & ECMD_ADDBUF)) -#endif { if (!cmdmod.keepalt) curwin->w_alt_fnum = curbuf->b_fnum; @@ -3856,7 +3840,6 @@ buf = buflist_findnr(fnum); else { -#ifdef FEAT_LISTCMDS if (flags & ECMD_ADDBUF) { linenr_T tlnum = 1L; @@ -3870,15 +3853,13 @@ (void)buflist_new(ffname, sfname, tlnum, BLN_LISTED); goto theend; } -#endif buf = buflist_new(ffname, sfname, 0L, BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED)); -#ifdef FEAT_AUTOCMD + /* autocommands may change curwin and curbuf */ if (oldwin != NULL) oldwin = curwin; set_bufref(&old_curbuf, curbuf); -#endif } if (buf == NULL) goto theend; @@ -3893,11 +3874,7 @@ (void)buf_check_timestamp(buf, FALSE); /* Check if autocommands made the buffer invalid or changed the * current buffer. */ - if (!bufref_valid(&bufref) -#ifdef FEAT_AUTOCMD - || curbuf != old_curbuf.br_buf -#endif - ) + if (!bufref_valid(&bufref) || curbuf != old_curbuf.br_buf) goto theend; #ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ @@ -3922,7 +3899,6 @@ */ if (buf != curbuf) { -#ifdef FEAT_AUTOCMD /* * Be careful: The autocommands may delete any buffer and change * the current buffer. @@ -3943,13 +3919,13 @@ delbuf_msg(new_name); /* frees new_name */ goto theend; } -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ { vim_free(new_name); goto theend; } -# endif +#endif if (buf == curbuf) /* already in new buffer */ auto_buf = TRUE; else @@ -3962,7 +3938,6 @@ ++buf->b_locked; if (curbuf == old_curbuf.br_buf) -#endif buf_copy_options(buf, BCO_ENTER); /* Close the link to the current buffer. This will set @@ -3971,18 +3946,17 @@ close_buffer(oldwin, curbuf, (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD, FALSE); -#ifdef FEAT_AUTOCMD the_curwin->w_closing = FALSE; --buf->b_locked; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL /* autocmds may abort script processing */ if (aborting() && curwin->w_buffer != NULL) { vim_free(new_name); goto theend; } -# endif +#endif /* Be careful again, like above. */ if (!bufref_valid(&au_new_curbuf)) { @@ -3993,7 +3967,6 @@ if (buf == curbuf) /* already in new buffer */ auto_buf = TRUE; else -#endif { #ifdef FEAT_SYN_HL /* @@ -4026,13 +3999,10 @@ #ifdef FEAT_SPELL did_get_winopts = TRUE; #endif - -#ifdef FEAT_AUTOCMD } vim_free(new_name); au_new_curbuf.br_buf = NULL; au_new_curbuf.br_buf_free_count = 0; -#endif } curwin->w_pcmark.lnum = 1; @@ -4040,11 +4010,7 @@ } else /* !other_file */ { - if ( -#ifdef FEAT_LISTCMDS - (flags & ECMD_ADDBUF) || -#endif - check_fname() == FAIL) + if ((flags & ECMD_ADDBUF) || check_fname() == FAIL) goto theend; oldbuf = (flags & ECMD_OLDBUF); @@ -4055,9 +4021,7 @@ ++RedrawingDisabled; did_inc_redrawing_disabled = TRUE; -#ifdef FEAT_AUTOCMD buf = curbuf; -#endif if ((flags & ECMD_SET_HELP) || keep_help_flag) { prepare_help_buffer(); @@ -4070,21 +4034,19 @@ set_buflisted(TRUE); } -#ifdef FEAT_AUTOCMD /* If autocommands change buffers under our fingers, forget about * editing the file. */ if (buf != curbuf) goto theend; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ goto theend; -# endif +#endif /* Since we are starting to edit a file, consider the filetype to be * unset. Helps for when an autocommand changes files and expects syntax * highlighting to work in the other file. */ did_filetype = FALSE; -#endif /* * other_file oldbuf @@ -4101,14 +4063,13 @@ newlnum = curwin->w_cursor.lnum; solcol = curwin->w_cursor.col; } -#ifdef FEAT_AUTOCMD buf = curbuf; if (buf->b_fname != NULL) new_name = vim_strsave(buf->b_fname); else new_name = NULL; set_bufref(&bufref, buf); -#endif + if (p_ur < 0 || curbuf->b_ml.ml_line_count <= p_ur) { /* Save all the text, so that the reload can be undone. @@ -4117,9 +4078,7 @@ if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, TRUE) == FAIL) { -#ifdef FEAT_AUTOCMD vim_free(new_name); -#endif goto theend; } u_unchanged(curbuf); @@ -4130,7 +4089,7 @@ } else buf_freeall(curbuf, 0); /* free all things for buffer */ -#ifdef FEAT_AUTOCMD + /* If autocommands deleted the buffer we were going to re-edit, give * up and jump to the end. */ if (!bufref_valid(&bufref)) @@ -4145,10 +4104,9 @@ * the autocommands changed the buffer... */ if (buf != curbuf) goto theend; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ goto theend; -# endif #endif buf_clear_file(curbuf); curbuf->b_op_start.lnum = 0; /* clear '[ and '] marks */ @@ -4166,9 +4124,7 @@ */ check_arg_idx(curwin); -#ifdef FEAT_AUTOCMD if (!auto_buf) -#endif { /* * Set cursor and init window before reading the file and executing @@ -4191,7 +4147,7 @@ #endif /* Change directories when the 'acd' option is set. */ - DO_AUTOCHDIR + DO_AUTOCHDIR; /* * Careful: open_buffer() and apply_autocmds() may change the current @@ -4209,7 +4165,7 @@ /* * Open the buffer and read the file. */ -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (should_abort(open_buffer(FALSE, eap, readfile_flags))) retval = FAIL; #else @@ -4222,7 +4178,6 @@ handle_swap_exists(&old_curbuf); #endif } -#ifdef FEAT_AUTOCMD else { /* Read the modelines, but only to set window-local options. Any @@ -4236,7 +4191,6 @@ &retval); } check_arg_idx(curwin); -#endif /* If autocommands change the cursor position or topline, we should * keep it. Also when it moves within a line. */ @@ -4314,11 +4268,7 @@ * Did not read the file, need to show some info about the file. * Do this after setting the cursor. */ - if (oldbuf -#ifdef FEAT_AUTOCMD - && !auto_buf -#endif - ) + if (oldbuf && !auto_buf) { int msg_scroll_save = msg_scroll; @@ -4358,9 +4308,7 @@ if (topline == 0 && command == NULL) p_so = 999; /* force cursor halfway the window */ update_topline(); -#ifdef FEAT_SCROLLBIND curwin->w_scbind_pos = curwin->w_topline; -#endif p_so = n; redraw_curbuf_later(NOT_VALID); /* redraw this buffer later */ } @@ -4368,8 +4316,22 @@ if (p_im) need_start_insertmode = TRUE; - /* Change directories when the 'acd' option is set. */ - DO_AUTOCHDIR +#ifdef FEAT_AUTOCHDIR + /* Change directories when the 'acd' option is set and we aren't already in + * that directory (should already be done above). Expect getcwd() to be + * faster than calling shorten_fnames() unnecessarily. */ + if (p_acd && curbuf->b_ffname != NULL) + { + char_u curdir[MAXPATHL]; + char_u filedir[MAXPATHL]; + + vim_strncpy(filedir, curbuf->b_ffname, MAXPATHL - 1); + *gettail_sep(filedir) = NUL; + if (mch_dirname(curdir, MAXPATHL) != FAIL + && vim_fnamecmp(curdir, filedir) != 0) + do_autochdir(); + } +#endif #if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG) if (curbuf->b_ffname != NULL) @@ -4388,7 +4350,7 @@ theend: if (did_inc_redrawing_disabled) --RedrawingDisabled; -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) if (did_set_swapcommand) set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); #endif @@ -4399,7 +4361,6 @@ return retval; } -#ifdef FEAT_AUTOCMD static void delbuf_msg(char_u *name) { @@ -4409,7 +4370,6 @@ au_new_curbuf.br_buf = NULL; au_new_curbuf.br_buf_free_count = 0; } -#endif static int append_indent = 0; /* autoindent for first line */ @@ -5114,7 +5074,7 @@ */ line2 = eap->line2; for (lnum = eap->line1; lnum <= line2 && !(got_quit -#if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD) +#if defined(FEAT_EVAL) || aborting() #endif ); ++lnum) @@ -5211,8 +5171,7 @@ lnum += regmatch.startpos[0].lnum; sub_firstlnum += regmatch.startpos[0].lnum; nmatch -= regmatch.startpos[0].lnum; - vim_free(sub_firstline); - sub_firstline = NULL; + VIM_CLEAR(sub_firstline); } if (sub_firstline == NULL) @@ -5299,10 +5258,8 @@ setmouse(); /* disable mouse in xterm */ #endif curwin->w_cursor.col = regmatch.startpos[0].col; -#ifdef FEAT_CURSORBIND if (curwin->w_p_crb) do_check_cursorbind(); -#endif /* When 'cpoptions' contains "u" don't sync undo when * asking for confirmation. */ @@ -5374,10 +5331,7 @@ sub_firstline + copycol); if (new_line == NULL) - { - vim_free(orig_line); - orig_line = NULL; - } + VIM_CLEAR(orig_line); else { /* Position the cursor relative to the @@ -5806,8 +5760,7 @@ if (did_sub) ++sub_nlines; vim_free(new_start); /* for when substitute was cancelled */ - vim_free(sub_firstline); /* free the copy of the original line */ - sub_firstline = NULL; + VIM_CLEAR(sub_firstline); /* free the copy of the original line */ } line_breakcheck(); @@ -6833,7 +6786,6 @@ char_u *rt; int mustfree; -#ifdef FEAT_AUTOCMD /* Set filetype to "help" if still needed. */ if (STRCMP(curbuf->b_p_ft, "help") != 0) { @@ -6841,7 +6793,6 @@ set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL); --curbuf_lock; } -#endif #ifdef FEAT_SYN_HL if (!syntax_present(curwin)) @@ -6910,7 +6861,7 @@ copy_option_part(&p, NameBuff, MAXPATHL, ","); mustfree = FALSE; rt = vim_getenv((char_u *)"VIMRUNTIME", &mustfree); - if (fullpathcmp(rt, NameBuff, FALSE) != FPC_SAME) + if (rt != NULL && fullpathcmp(rt, NameBuff, FALSE) != FPC_SAME) { int fcount; char_u **fnames; @@ -6961,8 +6912,7 @@ && fnamecmp(e1, fname + 4) != 0) { /* Not .txt and not .abx, remove it. */ - vim_free(fnames[i1]); - fnames[i1] = NULL; + VIM_CLEAR(fnames[i1]); continue; } if (e1 - f1 != e2 - f2 @@ -6970,11 +6920,8 @@ continue; if (fnamecmp(e1, ".txt") == 0 && fnamecmp(e2, fname + 4) == 0) - { /* use .abx instead of .txt */ - vim_free(fnames[i1]); - fnames[i1] = NULL; - } + VIM_CLEAR(fnames[i1]); } } #endif @@ -8331,7 +8278,6 @@ msg_clr_eos(); } -#if defined(FEAT_GUI) || defined(FEAT_CLIENTSERVER) || defined(PROTO) /* * ":drop" * Opens the first argument in a window. When there are two or more arguments @@ -8411,7 +8357,6 @@ ex_rewind(eap); } } -#endif /* * Skip over the pattern argument of ":vimgrep /pat/[g][j]". diff -Nru vim-8.0.1453/src/ex_cmds.h vim-8.0.1766/src/ex_cmds.h --- vim-8.0.1453/src/ex_cmds.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/ex_cmds.h 2018-04-26 20:30:33.000000000 +0000 @@ -1778,7 +1778,7 @@ int regname; /* register name (NUL if none) */ int force_bin; /* 0, FORCE_BIN or FORCE_NOBIN */ int read_edit; /* ++edit argument */ - int force_ff; /* ++ff= argument (index in cmd[]) */ + int force_ff; /* ++ff= argument (first char of argument) */ #ifdef FEAT_MBYTE int force_enc; /* ++enc= argument (index in cmd[]) */ int bad_char; /* BAD_KEEP, BAD_DROP or replacement byte */ diff -Nru vim-8.0.1453/src/ex_docmd.c vim-8.0.1766/src/ex_docmd.c --- vim-8.0.1453/src/ex_docmd.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/ex_docmd.c 2018-04-26 20:30:33.000000000 +0000 @@ -81,15 +81,8 @@ # define ex_menu ex_ni # define ex_menutranslate ex_ni #endif -#ifdef FEAT_AUTOCMD static void ex_autocmd(exarg_T *eap); static void ex_doautocmd(exarg_T *eap); -#else -# define ex_autocmd ex_ni -# define ex_doautocmd ex_ni -# define ex_doautoall ex_ni -#endif -#ifdef FEAT_LISTCMDS static void ex_bunload(exarg_T *eap); static void ex_buffer(exarg_T *eap); static void ex_bmodified(exarg_T *eap); @@ -97,20 +90,6 @@ static void ex_bprevious(exarg_T *eap); static void ex_brewind(exarg_T *eap); static void ex_blast(exarg_T *eap); -#else -# define ex_bunload ex_ni -# define ex_buffer ex_ni -# define ex_bmodified ex_ni -# define ex_bnext ex_ni -# define ex_bprevious ex_ni -# define ex_brewind ex_ni -# define ex_blast ex_ni -# define buflist_list ex_ni -# define ex_checktime ex_ni -#endif -#if !defined(FEAT_LISTCMDS) -# define ex_buffer_all ex_ni -#endif static char_u *getargcmd(char_u **); static char_u *skip_cmd_arg(char_u *p, int rembs); static int getargopt(exarg_T *eap); @@ -190,20 +169,11 @@ static void ex_shell(exarg_T *eap); static void ex_preserve(exarg_T *eap); static void ex_recover(exarg_T *eap); -#ifndef FEAT_LISTCMDS -# define ex_argedit ex_ni -# define ex_argadd ex_ni -# define ex_argdelete ex_ni -# define ex_listdo ex_ni -#endif static void ex_mode(exarg_T *eap); static void ex_wrongmodifier(exarg_T *eap); static void ex_find(exarg_T *eap); static void ex_open(exarg_T *eap); static void ex_edit(exarg_T *eap); -#if !defined(FEAT_GUI) && !defined(FEAT_CLIENTSERVER) -# define ex_drop ex_ni -#endif #ifndef FEAT_GUI # define ex_gui ex_nogui static void ex_nogui(exarg_T *eap); @@ -213,7 +183,8 @@ #else # define ex_tearoff ex_ni #endif -#if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK)) && defined(FEAT_MENU) +#if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \ + || defined(FEAT_TERM_POPUP_MENU)) && defined(FEAT_MENU) static void ex_popup(exarg_T *eap); #else # define ex_popup ex_ni @@ -237,6 +208,10 @@ # define ex_syntax ex_ni # define ex_ownsyntax ex_ni #endif +#ifndef FEAT_EVAL +# define ex_packadd ex_ni +# define ex_packloadall ex_ni +#endif #if !defined(FEAT_SYN_HL) || !defined(FEAT_PROFILE) # define ex_syntime ex_ni #endif @@ -393,13 +368,8 @@ # define ex_viminfo ex_ni #endif static void ex_behave(exarg_T *eap); -#ifdef FEAT_AUTOCMD static void ex_filetype(exarg_T *eap); static void ex_setfiletype(exarg_T *eap); -#else -# define ex_filetype ex_ni -# define ex_setfiletype ex_ni -#endif #ifndef FEAT_DIFF # define ex_diffoff ex_ni # define ex_diffpatch ex_ni @@ -410,7 +380,7 @@ #endif static void ex_digraphs(exarg_T *eap); static void ex_set(exarg_T *eap); -#if !defined(FEAT_EVAL) || !defined(FEAT_AUTOCMD) +#if !defined(FEAT_EVAL) # define ex_options ex_ni #endif #ifdef FEAT_SEARCH_EXTRA @@ -868,8 +838,7 @@ { /* Each '|' separated command is stored separately in lines_ga, to * be able to jump to it. Don't use next_cmdline now. */ - vim_free(cmdline_copy); - cmdline_copy = NULL; + VIM_CLEAR(cmdline_copy); /* Check if a function has returned or, unless it has an unclosed * try conditional, aborted. */ @@ -1084,8 +1053,7 @@ if (next_cmdline == NULL) { - vim_free(cmdline_copy); - cmdline_copy = NULL; + VIM_CLEAR(cmdline_copy); #ifdef FEAT_CMDHIST /* * If the command was typed, remember it for the ':' register. @@ -1176,6 +1144,13 @@ } } + /* Check for the next breakpoint after a watchexpression */ + if (breakpoint != NULL && has_watchexpr()) + { + *breakpoint = dbg_find_breakpoint(FALSE, fname, sourcing_lnum); + *dbg_tick = debug_tick; + } + /* * When not inside any ":while" loop, clear remembered lines. */ @@ -1759,11 +1734,8 @@ /* avoid that a function call in 'statusline' does this */ && !getline_equal(fgetline, cookie, get_func_line) #endif -#ifdef FEAT_AUTOCMD /* avoid that an autocommand, e.g. QuitPre, does this */ - && !getline_equal(fgetline, cookie, getnextac) -#endif - ) + && !getline_equal(fgetline, cookie, getnextac)) --quitmore; /* @@ -1910,7 +1882,6 @@ case 'n': if (checkforcmd(&ea.cmd, "noautocmd", 3)) { -#ifdef FEAT_AUTOCMD if (cmdmod.save_ei == NULL) { /* Set 'eventignore' to "all". Restore the @@ -1919,7 +1890,6 @@ set_string_option_direct((char_u *)"ei", -1, (char_u *)"all", OPT_FREE, SID_NONE); } -#endif continue; } if (!checkforcmd(&ea.cmd, "noswapfile", 3)) @@ -2300,7 +2270,6 @@ goto doend; } -#ifdef FEAT_AUTOCMD /* If this looks like an undefined user command and there are CmdUndefined * autocommands defined, trigger the matching autocommands. */ if (p != NULL && ea.cmdidx == CMD_SIZE && !ea.skip @@ -2317,9 +2286,12 @@ vim_free(p); /* If the autocommands did something and didn't cause an error, try * finding the command again. */ - p = (ret && !aborting()) ? find_command(&ea, NULL) : ea.cmd; - } + p = (ret +#ifdef FEAT_EVAL + && !aborting() #endif + ) ? find_command(&ea, NULL) : ea.cmd; + } #ifdef FEAT_USR_CMDS if (p == NULL) @@ -2419,7 +2391,6 @@ errormsg = (char_u *)_(get_text_locked_msg()); goto doend; } -#ifdef FEAT_AUTOCMD /* Disallow editing another buffer when "curbuf_lock" is set. * Do allow ":edit" (check for argument later). * Do allow ":checktime" (it's postponed). */ @@ -2429,7 +2400,6 @@ && !IS_USER_CMDIDX(ea.cmdidx) && curbuf_locked()) goto doend; -#endif if (!ni && !(ea.argt & RANGE) && ea.addr_count > 0) { @@ -2847,7 +2817,6 @@ goto doend; } -#ifdef FEAT_LISTCMDS /* * Accept buffer name. Cannot be used at the same time with a buffer * number. Don't do this for a user command. @@ -2876,10 +2845,19 @@ ea.addr_count = 1; ea.arg = skipwhite(p); } -#endif + + /* The :try command saves the emsg_silent flag, reset it here when + * ":silent! try" was used, it should only apply to :try itself. */ + if (ea.cmdidx == CMD_try && did_esilent > 0) + { + emsg_silent -= did_esilent; + if (emsg_silent < 0) + emsg_silent = 0; + did_esilent = 0; + } /* - * 7. Switch on command name. + * 7. Execute the command. * * The "ea" structure holds the arguments that can be used. */ @@ -2959,7 +2937,7 @@ if (verbose_save >= 0) p_verbose = verbose_save; -#ifdef FEAT_AUTOCMD + if (cmdmod.save_ei != NULL) { /* Restore 'eventignore' to the value before ":noautocmd". */ @@ -2967,7 +2945,7 @@ OPT_FREE, SID_NONE); free_string_option(cmdmod.save_ei); } -#endif + if (cmdmod.filter_regmatch.regprog != NULL) vim_regfree(cmdmod.filter_regmatch.regprog); @@ -4013,14 +3991,12 @@ } } break; -#ifdef FEAT_AUTOCMD + case CMD_autocmd: return set_context_in_autocmd(xp, arg, FALSE); - case CMD_doautocmd: case CMD_doautoall: return set_context_in_autocmd(xp, arg, TRUE); -#endif case CMD_set: set_context_in_set_cmd(xp, arg, 0); break; @@ -4109,7 +4085,6 @@ set_context_in_sign_cmd(xp, arg); break; #endif -#ifdef FEAT_LISTCMDS case CMD_bdelete: case CMD_bwipeout: case CMD_bunload: @@ -4122,7 +4097,6 @@ xp->xp_context = EXPAND_BUFFERS; xp->xp_pattern = arg; break; -#endif #ifdef FEAT_USR_CMDS case CMD_USER: case CMD_USER_BUF: @@ -4294,6 +4268,13 @@ break; #endif + case CMD_argdelete: + while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) + arg = xp->xp_pattern + 1; + xp->xp_context = EXPAND_ARGLIST; + xp->xp_pattern = arg; + break; + #endif /* FEAT_CMDL_COMPL */ default: @@ -5327,6 +5308,20 @@ return p; } +#if defined(FEAT_MBYTE) || defined(PROTO) + int +get_bad_opt(char_u *p, exarg_T *eap) +{ + if (STRICMP(p, "keep") == 0) + eap->bad_char = BAD_KEEP; + else if (STRICMP(p, "drop") == 0) + eap->bad_char = BAD_DROP; + else if (MB_BYTE2LEN(*p) == 1 && p[1] == NUL) + eap->bad_char = *p; + return FAIL; +} +#endif + /* * Get "++opt=arg" argument. * Return FAIL or OK. @@ -5406,6 +5401,7 @@ #endif if (check_ff_value(eap->cmd + eap->force_ff) == FAIL) return FAIL; + eap->force_ff = eap->cmd[eap->force_ff]; #ifdef FEAT_MBYTE } else if (pp == &eap->force_enc) @@ -5418,14 +5414,7 @@ { /* Check ++bad= argument. Must be a single-byte character, "keep" or * "drop". */ - p = eap->cmd + bad_char_idx; - if (STRICMP(p, "keep") == 0) - eap->bad_char = BAD_KEEP; - else if (STRICMP(p, "drop") == 0) - eap->bad_char = BAD_DROP; - else if (MB_BYTE2LEN(*p) == 1 && p[1] == NUL) - eap->bad_char = *p; - else + if (get_bad_opt(eap->cmd + bad_char_idx, eap) == FAIL) return FAIL; } #endif @@ -5488,7 +5477,6 @@ map_clear(eap->cmd, eap->arg, TRUE, TRUE); } -#if defined(FEAT_AUTOCMD) || defined(PROTO) static void ex_autocmd(exarg_T *eap) { @@ -5522,9 +5510,7 @@ if (call_do_modelines && did_aucmd) do_modelines(0); } -#endif -#ifdef FEAT_LISTCMDS /* * :[N]bunload[!] [N] [bufname] unload buffer * :[N]bdelete[!] [N] [bufname] delete buffer from buffer list @@ -5623,7 +5609,6 @@ if (eap->do_ecmd_cmd != NULL) do_cmdline_cmd(eap->do_ecmd_cmd); } -#endif int ends_excmd(int c) @@ -5802,11 +5787,9 @@ goto fail; } - vim_free(cmd->uc_rep); - cmd->uc_rep = NULL; + VIM_CLEAR(cmd->uc_rep); #if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) - vim_free(cmd->uc_compl_arg); - cmd->uc_compl_arg = NULL; + VIM_CLEAR(cmd->uc_compl_arg); #endif break; } @@ -5884,6 +5867,7 @@ char *name; } command_complete[] = { + {EXPAND_ARGLIST, "arglist"}, {EXPAND_AUGROUP, "augroup"}, {EXPAND_BEHAVE, "behave"}, {EXPAND_BUFFERS, "buffer"}, @@ -7192,8 +7176,35 @@ settmode(TMODE_RAW); } + static int +before_quit_autocmds(win_T *wp, int quit_all, int forceit) +{ + apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, wp->w_buffer); + + /* Bail out when autocommands closed the window. + * Refuse to quit when the buffer in the last window is being closed (can + * only happen in autocommands). */ + if (!win_valid(wp) + || curbuf_locked() + || (wp->w_buffer->b_nwindows == 1 && wp->w_buffer->b_locked > 0)) + return TRUE; + + if (quit_all || (check_more(FALSE, forceit) == OK && only_one_window())) + { + apply_autocmds(EVENT_EXITPRE, NULL, NULL, FALSE, curbuf); + /* Refuse to quit when locked or when the buffer in the last window is + * being closed (can only happen in autocommands). */ + if (curbuf_locked() + || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) + return TRUE; + } + + return FALSE; +} + /* * ":quit": quit current window, quit Vim if the last window is closed. + * ":{nr}quit": quit window {nr} */ static void ex_quit(exarg_T *eap) @@ -7224,18 +7235,13 @@ else wp = curwin; -#ifdef FEAT_AUTOCMD /* Refuse to quit when locked. */ if (curbuf_locked()) return; - apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, wp->w_buffer); - /* Bail out when autocommands closed the window. - * Refuse to quit when the buffer in the last window is being closed (can - * only happen in autocommands). */ - if (!win_valid(wp) - || (wp->w_buffer->b_nwindows == 1 && wp->w_buffer->b_locked > 0)) + + /* Trigger QuitPre and maybe ExitPre */ + if (before_quit_autocmds(wp, FALSE, eap->forceit)) return; -#endif #ifdef FEAT_NETBEANS_INTG netbeansForcedQuit = eap->forceit; @@ -7308,13 +7314,9 @@ text_locked_msg(); return; } -#ifdef FEAT_AUTOCMD - apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); - /* Refuse to quit when locked or when the buffer in the last window is - * being closed (can only happen in autocommands). */ - if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) + + if (before_quit_autocmds(curwin, TRUE, eap->forceit)) return; -#endif exiting = TRUE; if (eap->forceit || !check_changed_any(FALSE, FALSE)) @@ -7335,11 +7337,7 @@ cmdwin_result = Ctrl_C; else #endif - if (!text_locked() -#ifdef FEAT_AUTOCMD - && !curbuf_locked() -#endif - ) + if (!text_locked() && !curbuf_locked()) { if (eap->addr_count == 0) ex_win_close(eap->forceit, curwin, NULL); @@ -7555,11 +7553,7 @@ tabpage_close_other(tp, eap->forceit); return; } - else if (!text_locked() -#ifdef FEAT_AUTOCMD - && !curbuf_locked() -#endif - ) + else if (!text_locked() && !curbuf_locked()) tabpage_close(eap->forceit); } } @@ -7652,9 +7646,7 @@ break; } -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf); -#endif redraw_tabline = TRUE; if (h != tabline_height()) @@ -7762,7 +7754,7 @@ } /* - * ":exit", ":xit" and ":wq": Write file and exit Vim. + * ":exit", ":xit" and ":wq": Write file and quite the current window. */ static void ex_exit(exarg_T *eap) @@ -7780,13 +7772,9 @@ text_locked_msg(); return; } -#ifdef FEAT_AUTOCMD - apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); - /* Refuse to quit when locked or when the buffer in the last window is - * being closed (can only happen in autocommands). */ - if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) + + if (before_quit_autocmds(curwin, FALSE, eap->forceit)) return; -#endif /* * if more files or windows we won't exit @@ -7891,10 +7879,9 @@ /* Postpone this while editing the command line. */ if (text_locked()) return; -#ifdef FEAT_AUTOCMD if (curbuf_locked()) return; -#endif + /* When the screen is being updated we should not change buffers and * windows structures, it may cause freed memory to be used. */ if (updating_screen) @@ -7982,7 +7969,6 @@ } } -#if defined(FEAT_LISTCMDS) || defined(HAVE_DROP_FILE) || defined(PROTO) /* * Create a new argument list and use it for the current window. */ @@ -8002,7 +7988,6 @@ alist_init(curwin->w_alist); } } -#endif #if !defined(UNIX) || defined(PROTO) /* @@ -8058,6 +8043,14 @@ int fnum_len) { int i; + static int recursive = 0; + + if (recursive) + { + EMSG(_(e_au_recursive)); + return; + } + ++recursive; alist_clear(al); if (ga_grow(&al->al_ga, count) == OK) @@ -8087,6 +8080,8 @@ FreeWild(count, files); if (al == &global_alist) arg_had_last = FALSE; + + --recursive; } /* @@ -8229,11 +8224,10 @@ && eap->cmdidx != CMD_vnew && eap->cmdidx != CMD_new) { -# ifdef FEAT_AUTOCMD if ( -# ifdef FEAT_GUI +# ifdef FEAT_GUI !gui.in_use && -# endif +# endif au_has_group((char_u *)"FileExplorer")) { /* No browsing supported but we do have the file explorer: @@ -8242,7 +8236,6 @@ eap->arg = (char_u *)"."; } else -# endif { fname = do_browse(0, (char_u *)_("Edit File in new window"), eap->arg, NULL, NULL, NULL, curbuf); @@ -8278,20 +8271,18 @@ else if (win_split(eap->addr_count > 0 ? (int)eap->line2 : 0, *eap->cmd == 'v' ? WSP_VERT : 0) != FAIL) { -# ifdef FEAT_SCROLLBIND /* Reset 'scrollbind' when editing another file, but keep it when * doing ":split" without arguments. */ if (*eap->arg != NUL -# ifdef FEAT_BROWSE +# ifdef FEAT_BROWSE || cmdmod.browse -# endif +# endif ) { RESET_BINDING(curwin); } else do_check_scrollbind(FALSE); -# endif do_exedit(eap, old_curwin); } @@ -8646,12 +8637,11 @@ #endif ) { -#ifdef FEAT_AUTOCMD /* Can't edit another file when "curbuf_lock" is set. Only ":edit" * can bring us here, others are stopped earlier. */ if (*eap->arg != NUL && curbuf_locked()) return; -#endif + n = readonlymode; if (eap->cmdidx == CMD_view || eap->cmdidx == CMD_sview) readonlymode = TRUE; @@ -8669,9 +8659,7 @@ + (eap->forceit ? ECMD_FORCEIT : 0) /* after a split we can use an existing buffer */ + (old_curwin != NULL ? ECMD_OLDBUF : 0) -#ifdef FEAT_LISTCMDS + (eap->cmdidx == CMD_badd ? ECMD_ADDBUF : 0 ) -#endif , old_curwin == NULL ? curwin : NULL) == FAIL) { /* Editing the file failed. If the window was split, close it. */ @@ -8680,7 +8668,7 @@ need_hide = (curbufIsChanged() && curbuf->b_nwindows <= 1); if (!need_hide || buf_hide(curbuf)) { -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that @@ -8692,7 +8680,7 @@ #endif win_close(curwin, !need_hide && !buf_hide(curbuf)); -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not * discarded by a new aborting error, interrupt, or * uncaught exception. */ @@ -8759,11 +8747,21 @@ } #endif -#if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK)) && defined(FEAT_MENU) +#if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \ + || defined(FEAT_TERM_POPUP_MENU)) && defined(FEAT_MENU) static void ex_popup(exarg_T *eap) { - gui_make_popup(eap->arg, eap->forceit); +# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) + if (gui.in_use) + gui_make_popup(eap->arg, eap->forceit); +# ifdef FEAT_TERM_POPUP_MENU + else +# endif +# endif +# ifdef FEAT_TERM_POPUP_MENU + pum_make_popup(eap->arg, eap->forceit); +# endif } #endif @@ -8784,7 +8782,6 @@ static void ex_syncbind(exarg_T *eap UNUSED) { -#ifdef FEAT_SCROLLBIND win_T *wp; win_T *save_curwin = curwin; buf_T *save_curbuf = curbuf; @@ -8852,7 +8849,6 @@ ins_typebuf(ctrl_o, REMAP_NONE, 0, TRUE, FALSE); } } -#endif } @@ -8905,7 +8901,7 @@ } if (i != OK) { -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (!aborting()) #endif EMSG2(_(e_notopen), eap->arg); @@ -8940,11 +8936,8 @@ void free_cd_dir(void) { - vim_free(prev_dir); - prev_dir = NULL; - - vim_free(globaldir); - globaldir = NULL; + VIM_CLEAR(prev_dir); + VIM_CLEAR(globaldir); } #endif @@ -8955,8 +8948,7 @@ void post_chdir(int local) { - vim_free(curwin->w_localdir); - curwin->w_localdir = NULL; + VIM_CLEAR(curwin->w_localdir); if (local) { /* If still in global directory, need to remember current @@ -8971,8 +8963,7 @@ { /* We are now in the global directory, no need to remember its * name. */ - vim_free(globaldir); - globaldir = NULL; + VIM_CLEAR(globaldir); } shorten_fnames(TRUE); @@ -8996,10 +8987,8 @@ else #endif { -#ifdef FEAT_AUTOCMD if (allbuf_locked()) return; -#endif if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged() && !eap->forceit) { @@ -9048,11 +9037,17 @@ EMSG(_(e_failed)); else { - post_chdir(eap->cmdidx == CMD_lcd || eap->cmdidx == CMD_lchdir); + int is_local_chdir = eap->cmdidx == CMD_lcd + || eap->cmdidx == CMD_lchdir; + + post_chdir(is_local_chdir); /* Echo the new current directory if the command was typed. */ if (KeyTyped || p_verbose >= 5) ex_pwd(eap); + apply_autocmds(EVENT_DIRCHANGED, + is_local_chdir ? (char_u *)"window" : (char_u *)"global", + new_dir, FALSE, curbuf); } vim_free(tofree); } @@ -9932,7 +9927,7 @@ *dirnow = NUL; if (*dirnow != NUL && (ssop_flags & SSOP_SESDIR)) { - if (vim_chdirfile(fname) == OK) + if (vim_chdirfile(fname, NULL) == OK) shorten_fnames(TRUE); } else if (*dirnow != NUL @@ -10563,21 +10558,15 @@ #define SPEC_SFILE (SPEC_CFILE + 1) "", /* ":so" file line number */ #define SPEC_SLNUM (SPEC_SFILE + 1) -#ifdef FEAT_AUTOCMD "", /* autocommand file name */ -# define SPEC_AFILE (SPEC_SLNUM + 1) +#define SPEC_AFILE (SPEC_SLNUM + 1) "", /* autocommand buffer number */ -# define SPEC_ABUF (SPEC_AFILE + 1) +#define SPEC_ABUF (SPEC_AFILE + 1) "", /* autocommand match name */ -# define SPEC_AMATCH (SPEC_ABUF + 1) -#endif +#define SPEC_AMATCH (SPEC_ABUF + 1) #ifdef FEAT_CLIENTSERVER "" -# ifdef FEAT_AUTOCMD -# define SPEC_CLIENT (SPEC_AMATCH + 1) -# else -# define SPEC_CLIENT (SPEC_SLNUM + 1) -# endif +# define SPEC_CLIENT (SPEC_AMATCH + 1) #endif }; @@ -10776,7 +10765,6 @@ break; #endif -#ifdef FEAT_AUTOCMD case SPEC_AFILE: /* file name for autocommand */ result = autocmd_fname; if (result != NULL && !autocmd_fname_full) @@ -10815,7 +10803,6 @@ } break; -#endif case SPEC_SFILE: /* file name for ":so" command */ result = sourcing_name; if (result == NULL) @@ -10951,7 +10938,6 @@ return retval; } -#if defined(FEAT_AUTOCMD) || defined(PROTO) /* * Expand the string in "arg". * @@ -11013,7 +10999,6 @@ return result; } -#endif #ifdef FEAT_SESSION static int ses_winsizes(FILE *fd, int restore_size, @@ -11115,6 +11100,11 @@ { if (!(only_save_windows && buf->b_nwindows == 0) && !(buf->b_help && !(ssop_flags & SSOP_HELP)) +#ifdef FEAT_TERMINAL + /* skip terminal buffers: finished ones are not useful, others + * will be resurrected and result in a new buffer */ + && !bt_terminal(buf) +#endif && buf->b_fname != NULL && buf->b_p_bl) { @@ -11325,7 +11315,8 @@ /* * Wipe out an empty unnamed buffer we started in. */ - if (put_line(fd, "if exists('s:wipebuf')") == FAIL) + if (put_line(fd, "if exists('s:wipebuf') && s:wipebuf != bufnr('%')") + == FAIL) return FAIL; if (put_line(fd, " silent exe 'bwipe ' . s:wipebuf") == FAIL) return FAIL; @@ -11485,6 +11476,12 @@ static int ses_do_win(win_T *wp) { +#ifdef FEAT_TERMINAL + if (bt_terminal(wp->w_buffer)) + return !term_is_finished(wp->w_buffer) + && (ssop_flags & SSOP_TERMINAL) + && term_should_restore(wp->w_buffer); +#endif if (wp->w_buffer->b_fname == NULL #ifdef FEAT_QUICKFIX /* When 'buftype' is "nofile" can't restore the window contents. */ @@ -11550,13 +11547,21 @@ /* Edit the file. Skip this when ":next" already did it. */ if (add_edit && (!did_next || wp->w_arg_idx_invalid)) { +# ifdef FEAT_TERMINAL + if (bt_terminal(wp->w_buffer)) + { + if (term_write_session(fd, wp) == FAIL) + return FAIL; + } + else +# endif /* * Load the file. */ if (wp->w_buffer->b_ffname != NULL -#ifdef FEAT_QUICKFIX +# ifdef FEAT_QUICKFIX && !bt_nofile(wp->w_buffer) -#endif +# endif ) { /* @@ -11574,8 +11579,7 @@ || fputs(" | else | edit ", fd) < 0 || ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL || fputs(" | endif", fd) < 0 - || - put_eol(fd) == FAIL) + || put_eol(fd) == FAIL) return FAIL; } else @@ -12045,7 +12049,6 @@ return NULL; } -#ifdef FEAT_AUTOCMD static int filetype_detect = FALSE; static int filetype_plugin = FALSE; static int filetype_indent = FALSE; @@ -12159,7 +12162,6 @@ did_filetype = FALSE; } } -#endif static void ex_digraphs(exarg_T *eap UNUSED) @@ -12183,7 +12185,7 @@ flags = OPT_LOCAL; else if (eap->cmdidx == CMD_setglobal) flags = OPT_GLOBAL; -#if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD) && defined(FEAT_BROWSE) +#if defined(FEAT_EVAL) && defined(FEAT_BROWSE) if (cmdmod.browse && flags == 0) ex_options(eap); else diff -Nru vim-8.0.1453/src/ex_getln.c vim-8.0.1766/src/ex_getln.c --- vim-8.0.1453/src/ex_getln.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/ex_getln.c 2018-04-26 20:30:33.000000000 +0000 @@ -146,7 +146,6 @@ #endif -#ifdef FEAT_AUTOCMD static void trigger_cmd_autocmd(int typechar, int evt) { @@ -156,7 +155,6 @@ typestr[1] = NUL; apply_autocmds(evt, typestr, typestr, FALSE, curbuf); } -#endif /* * Abandon the command line. @@ -164,8 +162,7 @@ static void abandon_cmdline(void) { - vim_free(ccline.cmdbuff); - ccline.cmdbuff = NULL; + VIM_CLEAR(ccline.cmdbuff); if (msg_scrolled == 0) compute_cmdrow(); MSG(""); @@ -267,9 +264,7 @@ * custom status line may invoke ":normal". */ struct cmdline_info save_ccline; #endif -#ifdef FEAT_AUTOCMD int cmdline_type; -#endif #ifdef FEAT_EVAL if (firstc == -1) @@ -377,11 +372,11 @@ b_im_ptr = &curbuf->b_p_imsearch; if (*b_im_ptr == B_IMODE_LMAP) State |= LANGMAP; -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD im_set_active(*b_im_ptr == B_IMODE_IM); #endif } -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD else if (p_imcmdline) im_set_active(TRUE); #endif @@ -397,11 +392,9 @@ * terminal mode set to cooked. Need to set raw mode here then. */ settmode(TMODE_RAW); -#ifdef FEAT_AUTOCMD /* Trigger CmdlineEnter autocommands. */ cmdline_type = firstc == NUL ? '-' : firstc; trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINEENTER); -#endif #ifdef FEAT_CMDHIST init_history(); @@ -433,6 +426,10 @@ #endif quit_more = FALSE; /* reset after CTRL-D which had a more-prompt */ + did_emsg = FALSE; /* There can't really be a reason why an error + that occurs while typing a command should + cause the command not to be executed. */ + cursorcmd(); /* set the cursor on the right spot */ /* Get a character. Ignore K_IGNORE and K_NOP, they should not do @@ -500,10 +497,7 @@ && c != K_KPAGEDOWN && c != K_KPAGEUP && c != K_LEFT && c != K_RIGHT && (xpc.xp_numfiles > 0 || (c != Ctrl_P && c != Ctrl_N))) - { - vim_free(lookfor); - lookfor = NULL; - } + VIM_CLEAR(lookfor); #endif /* @@ -1096,8 +1090,7 @@ ) goto cmdline_not_changed; - vim_free(ccline.cmdbuff); /* no commandline to return */ - ccline.cmdbuff = NULL; + VIM_CLEAR(ccline.cmdbuff); /* no commandline to return */ if (!cmd_silent) { #ifdef FEAT_RIGHTLEFT @@ -1137,7 +1130,7 @@ { /* ":lmap" mappings exists, toggle use of mappings. */ State ^= LANGMAP; -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD im_set_active(FALSE); /* Disable input method */ #endif if (b_im_ptr != NULL) @@ -1148,7 +1141,7 @@ *b_im_ptr = B_IMODE_NONE; } } -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD else { /* There are no ":lmap" mappings, toggle IM. When @@ -1951,10 +1944,8 @@ #endif cmdline_changed: -#ifdef FEAT_AUTOCMD /* Trigger CmdlineChanged autocommands. */ trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED); -#endif #ifdef FEAT_SEARCH_EXTRA /* @@ -2165,13 +2156,11 @@ if (some_key_typed) need_wait_return = FALSE; -#ifdef FEAT_AUTOCMD /* Trigger CmdlineLeave autocommands. */ trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVE); -#endif State = save_State; -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD if (b_im_ptr != NULL && *b_im_ptr != B_IMODE_LMAP) im_save_status(b_im_ptr); im_set_active(FALSE); @@ -2271,7 +2260,6 @@ return e_secure; } -#if defined(FEAT_AUTOCMD) || defined(PROTO) /* * Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is * and give an error message. @@ -2301,7 +2289,6 @@ } return FALSE; } -#endif static int cmdline_charsize(int idx) @@ -3683,10 +3670,7 @@ || ccline.cmdbuff[i + j] == '?') break; if ((int)STRLEN(p2) < j) - { - vim_free(p2); - p2 = NULL; - } + VIM_CLEAR(p2); } } } @@ -3832,8 +3816,7 @@ { FreeWild(xp->xp_numfiles, xp->xp_files); xp->xp_numfiles = -1; - vim_free(orig_save); - orig_save = NULL; + VIM_CLEAR(orig_save); } findex = 0; @@ -4992,10 +4975,8 @@ {EXPAND_SYNTIME, get_syntime_arg, TRUE, TRUE}, #endif {EXPAND_HIGHLIGHT, get_highlight_name, TRUE, TRUE}, -#ifdef FEAT_AUTOCMD {EXPAND_EVENTS, get_event_name, TRUE, TRUE}, {EXPAND_AUGROUP, get_augroup_name, TRUE, TRUE}, -#endif #ifdef FEAT_CSCOPE {EXPAND_CSCOPE, get_cscope_name, TRUE, TRUE}, #endif @@ -5012,6 +4993,7 @@ #endif {EXPAND_ENV_VARS, get_env_name, TRUE, TRUE}, {EXPAND_USER, get_users, TRUE, FALSE}, + {EXPAND_ARGLIST, get_arglist_name, TRUE, FALSE}, }; int i; @@ -5324,8 +5306,9 @@ char_u *retstr; char_u *s; char_u *e; - char_u keep; + int keep; garray_T ga; + int skip; retstr = call_user_expand_func(call_func_retstr, xp, num_file, file); if (retstr == NULL) @@ -5338,23 +5321,19 @@ if (e == NULL) e = s + STRLEN(s); keep = *e; - *e = 0; + *e = NUL; + + skip = xp->xp_pattern[0] && vim_regexec(regmatch, s, (colnr_T)0) == 0; + *e = keep; - if (xp->xp_pattern[0] && vim_regexec(regmatch, s, (colnr_T)0) == 0) + if (!skip) { - *e = keep; - if (*e != NUL) - ++e; - continue; + if (ga_grow(&ga, 1) == FAIL) + break; + ((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(s, (int)(e - s)); + ++ga.ga_len; } - if (ga_grow(&ga, 1) == FAIL) - break; - - ((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(s, (int)(e - s)); - ++ga.ga_len; - - *e = keep; if (*e != NUL) ++e; } @@ -6737,8 +6716,7 @@ else concat_history(type); - vim_free(viminfo_history[type]); - viminfo_history[type] = NULL; + VIM_CLEAR(viminfo_history[type]); viminfo_hisidx[type] = 0; } } @@ -6862,8 +6840,7 @@ for (i = 0; i < viminfo_hisidx[type]; ++i) if (viminfo_history[type] != NULL) vim_free(viminfo_history[type][i].hisstr); - vim_free(viminfo_history[type]); - viminfo_history[type] = NULL; + VIM_CLEAR(viminfo_history[type]); viminfo_hisidx[type] = 0; } } @@ -6944,10 +6921,9 @@ /* Save current window sizes. */ win_size_save(&winsizes); -# ifdef FEAT_AUTOCMD /* Don't execute autocommands while creating the window. */ block_autocmds(); -# endif + /* don't use a new tab page */ cmdmod.tab = 0; cmdmod.noswapfile = 1; @@ -6956,9 +6932,7 @@ if (win_split((int)p_cwh, WSP_BOT) == FAIL) { beep_flush(); -# ifdef FEAT_AUTOCMD unblock_autocmds(); -# endif return K_IGNORE; } cmdwin_type = get_cmdline_type(); @@ -6977,12 +6951,10 @@ # endif RESET_BINDING(curwin); -# ifdef FEAT_AUTOCMD /* Do execute autocommands for setting the filetype (load syntax). */ unblock_autocmds(); /* But don't allow switching to another buffer. */ ++curbuf_lock; -# endif /* Showing the prompt may have set need_wait_return, reset it. */ need_wait_return = FALSE; @@ -6997,9 +6969,7 @@ } set_option_value((char_u *)"ft", 0L, (char_u *)"vim", OPT_LOCAL); } -# ifdef FEAT_AUTOCMD --curbuf_lock; -# endif /* Reset 'textwidth' after setting 'filetype' (the Vim filetype plugin * sets 'textwidth' to 78). */ @@ -7045,12 +7015,10 @@ setmouse(); # endif -# ifdef FEAT_AUTOCMD /* Trigger CmdwinEnter autocommands. */ trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINENTER); if (restart_edit != 0) /* autocmd with ":startinsert" */ stuffcharReadbuff(K_NOP); -# endif i = RedrawingDisabled; RedrawingDisabled = 0; @@ -7063,20 +7031,16 @@ RedrawingDisabled = i; -# ifdef FEAT_AUTOCMD - -# ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING save_KeyTyped = KeyTyped; -# endif +# endif /* Trigger CmdwinLeave autocommands. */ trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINLEAVE); -# ifdef FEAT_FOLDING +# ifdef FEAT_FOLDING /* Restore KeyTyped in case it is modified by autocommands */ KeyTyped = save_KeyTyped; -# endif - # endif /* Restore the command line info. */ @@ -7094,7 +7058,7 @@ } else { -# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +# if defined(FEAT_EVAL) /* autocmds may abort script processing */ if (aborting() && cmdwin_result != K_IGNORE) cmdwin_result = Ctrl_C; @@ -7155,10 +7119,8 @@ } } -# ifdef FEAT_AUTOCMD /* Don't execute autocommands while deleting the window. */ block_autocmds(); -# endif # ifdef FEAT_CONCEAL /* Avoid command-line window first character being concealed. */ curwin->w_p_cole = 0; @@ -7176,9 +7138,7 @@ /* Restore window sizes. */ win_size_restore(&winsizes); -# ifdef FEAT_AUTOCMD unblock_autocmds(); -# endif } ga_clear(&winsizes); diff -Nru vim-8.0.1453/src/feature.h vim-8.0.1766/src/feature.h --- vim-8.0.1453/src/feature.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/feature.h 2018-04-26 20:30:33.000000000 +0000 @@ -101,15 +101,6 @@ */ /* - * +listcmds Vim commands for the buffer list and the argument - * list. Without this there is no ":buffer" ":bnext", - * ":bdel", ":argdelete", etc. - */ -#ifdef FEAT_NORMAL -# define FEAT_LISTCMDS -#endif - -/* * +cmdhist Command line history. */ #ifdef FEAT_SMALL @@ -440,17 +431,10 @@ #endif /* - * +autocmd ":autocmd" command - */ -#ifdef FEAT_NORMAL -# define FEAT_AUTOCMD -#endif - -/* * +diff Displaying diffs in a nice way. * Requires +windows and +autocmd. */ -#if defined(FEAT_NORMAL) && defined(FEAT_AUTOCMD) +#if defined(FEAT_NORMAL) # define FEAT_DIFF #endif @@ -703,20 +687,6 @@ #endif /* - * +scrollbind synchronization of split windows - */ -#if defined(FEAT_NORMAL) -# define FEAT_SCROLLBIND -#endif - -/* - * +cursorbind synchronization of split windows - */ -#if defined(FEAT_NORMAL) -# define FEAT_CURSORBIND -#endif - -/* * +menu ":menu" command */ #ifdef FEAT_NORMAL @@ -726,6 +696,13 @@ # endif #endif +/* + * popup menu in a terminal + */ +#if defined(FEAT_MENU) && !defined(ALWAYS_USE_GUI) && defined(FEAT_INS_EXPAND) +# define FEAT_TERM_POPUP_MENU +#endif + /* There are two ways to use XPM. */ #if (defined(HAVE_XM_XPMP_H) && defined(FEAT_GUI_MOTIF)) \ || defined(HAVE_X11_XPM_H) @@ -1266,10 +1243,9 @@ #endif /* - * The Netbeans feature requires +listcmds and +eval. + * The Netbeans feature requires +eval. */ -#if (!defined(FEAT_LISTCMDS) || !defined(FEAT_EVAL)) \ - && defined(FEAT_NETBEANS_INTG) +#if !defined(FEAT_EVAL) && defined(FEAT_NETBEANS_INTG) # undef FEAT_NETBEANS_INTG #endif @@ -1332,7 +1308,8 @@ /* * +balloon_eval_term Allow balloon expression evaluation in the terminal. */ -#if defined(FEAT_HUGE) && defined(UNIX) && defined(FEAT_TIMERS) +#if defined(FEAT_HUGE) && defined(FEAT_TIMERS) && \ + (defined(UNIX) || (defined(WIN32) && !defined(FEAT_GUI_W32))) # define FEAT_BEVAL_TERM #endif @@ -1394,3 +1371,10 @@ || (defined(WIN3264) && defined(FEAT_GUI_W32)) # define FEAT_FILTERPIPE #endif + +/* + * +vtp: Win32 virtual console. + */ +#if !defined(FEAT_GUI) && defined(WIN3264) +# define FEAT_VTP +#endif diff -Nru vim-8.0.1453/src/fileio.c vim-8.0.1766/src/fileio.c --- vim-8.0.1453/src/fileio.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/fileio.c 2018-04-26 20:30:33.000000000 +0000 @@ -47,14 +47,12 @@ static void msg_add_eol(void); static int check_mtime(buf_T *buf, stat_T *s); static int time_differs(long t1, long t2); -#ifdef FEAT_AUTOCMD static int apply_autocmds_exarg(event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf, exarg_T *eap); static int au_find_group(char_u *name); # define AUGROUP_DEFAULT -1 /* default autocmd group */ # define AUGROUP_ERROR -2 /* erroneous autocmd group */ # define AUGROUP_ALL -3 /* all autocmd groups */ -#endif #if defined(FEAT_CRYPT) || defined(FEAT_MBYTE) # define HAS_BW_FLAGS @@ -135,11 +133,8 @@ #ifdef TEMPDIRNAMES static void vim_settempdir(char_u *tempdir); #endif -#ifdef FEAT_AUTOCMD static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name"); -#endif -#ifdef FEAT_AUTOCMD /* * Set by the apply_autocmds_group function if the given event is equal to * EVENT_FILETYPE. Used by the readfile function in order to determine if @@ -149,7 +144,6 @@ * apply_autocmds_group. */ static int au_did_filetype INIT(= FALSE); -#endif void filemess( @@ -307,17 +301,13 @@ char_u conv_rest[CONV_RESTLEN]; int conv_restlen = 0; /* nr of bytes in conv_rest[] */ #endif -#ifdef FEAT_AUTOCMD buf_T *old_curbuf; char_u *old_b_ffname; char_u *old_b_fname; int using_b_ffname; int using_b_fname; -#endif -#ifdef FEAT_AUTOCMD au_did_filetype = FALSE; /* reset before triggering any autocommands */ -#endif curbuf->b_no_eol_lnum = 0; /* in case it was set by the previous read */ @@ -337,7 +327,6 @@ return FAIL; } -#ifdef FEAT_AUTOCMD /* Remember the initial values of curbuf, curbuf->b_ffname and * curbuf->b_fname to detect whether they are altered as a result of * executing nasty autocommands. Also check if "fname" and "sfname" @@ -348,7 +337,6 @@ using_b_ffname = (fname == curbuf->b_ffname) || (sfname == curbuf->b_ffname); using_b_fname = (fname == curbuf->b_fname) || (sfname == curbuf->b_fname); -#endif /* After reading a file the cursor line changes but we don't want to * display the line. */ @@ -369,7 +357,6 @@ fname = sfname; #endif -#ifdef FEAT_AUTOCMD /* * The BufReadCmd and FileReadCmd events intercept the reading process by * executing the associated commands instead. @@ -404,7 +391,6 @@ curbuf->b_op_start = pos; } -#endif if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0) msg_scroll = FALSE; /* overwrite previous file message */ @@ -613,7 +599,6 @@ #endif { check_need_swap(newfile); -#ifdef FEAT_AUTOCMD /* SwapExists autocommand may mess things up */ if (curbuf != old_curbuf || (using_b_ffname @@ -624,7 +609,6 @@ EMSG(_(e_auchangedbuf)); return FAIL; } -#endif } if (dir_of_file_exists(fname)) filemess(curbuf, sfname, (char_u *)_("[New File]"), 0); @@ -641,14 +625,12 @@ if (eap != NULL) set_forced_fenc(eap); #endif -#ifdef FEAT_AUTOCMD apply_autocmds_exarg(EVENT_BUFNEWFILE, sfname, sfname, FALSE, curbuf, eap); -#endif /* remember the current fileformat */ save_file_ff(curbuf); -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (aborting()) /* autocmds may abort script processing */ return FAIL; #endif @@ -701,7 +683,6 @@ #endif { check_need_swap(newfile); -#ifdef FEAT_AUTOCMD if (!read_stdin && (curbuf != old_curbuf || (using_b_ffname && (old_b_ffname != curbuf->b_ffname)) || (using_b_fname && (old_b_fname != curbuf->b_fname)))) @@ -711,7 +692,6 @@ close(fd); return FAIL; } -#endif #ifdef UNIX /* Set swap file protection bits after creating it. */ if (swap_mode > 0 && curbuf->b_ml.ml_mfp != NULL @@ -732,8 +712,11 @@ if (mch_stat((char *)swap_fname, &swap_st) >= 0 && st.st_gid != swap_st.st_gid +# ifdef HAVE_FCHOWN && fchown(curbuf->b_ml.ml_mfp->mf_fd, -1, st.st_gid) - == -1) +# endif + == -1 + ) swap_mode &= 0600; } @@ -764,7 +747,6 @@ try_dos = (vim_strchr(p_ffs, 'd') != NULL); try_unix = (vim_strchr(p_ffs, 'x') != NULL); -#ifdef FEAT_AUTOCMD if (!read_buffer) { int m = msg_scroll; @@ -834,7 +816,6 @@ return FAIL; } } -#endif /* FEAT_AUTOCMD */ /* Autocommands may add lines to the file, need to check if it is empty */ wasempty = (curbuf->b_ml.ml_flags & ML_EMPTY); @@ -1073,8 +1054,7 @@ if (tmpname != NULL) { mch_remove(tmpname); /* delete converted file */ - vim_free(tmpname); - tmpname = NULL; + VIM_CLEAR(tmpname); } } @@ -1412,7 +1392,7 @@ /* If the crypt layer is buffering, not producing * anything yet, need to read more. */ - if (size > 0 && decrypted_size == 0) + if (decrypted_size == 0) continue; if (linerest == 0) @@ -2602,8 +2582,7 @@ #endif msg_add_lines(c, (long)linecnt, filesize); - vim_free(keep_msg); - keep_msg = NULL; + VIM_CLEAR(keep_msg); msg_scrolled_ign = TRUE; #ifdef ALWAYS_USE_GUI /* Don't show the message when reading stdin, it would end up in a @@ -2706,7 +2685,6 @@ } #endif -#ifdef FEAT_AUTOCMD if (!read_stdin && !read_fifo && (!read_buffer || sfname != NULL)) { int m = msg_scroll; @@ -2748,7 +2726,6 @@ return FAIL; # endif } -#endif if (recoverymode && error) return FAIL; @@ -2805,22 +2782,22 @@ int prep_exarg(exarg_T *eap, buf_T *buf) { - eap->cmd = alloc((unsigned)(STRLEN(buf->b_p_ff) + eap->cmd = alloc(15 #ifdef FEAT_MBYTE - + STRLEN(buf->b_p_fenc) + + (unsigned)STRLEN(buf->b_p_fenc) #endif - + 15)); + ); if (eap->cmd == NULL) return FAIL; #ifdef FEAT_MBYTE - sprintf((char *)eap->cmd, "e ++ff=%s ++enc=%s", buf->b_p_ff, buf->b_p_fenc); - eap->force_enc = 14 + (int)STRLEN(buf->b_p_ff); + sprintf((char *)eap->cmd, "e ++enc=%s", buf->b_p_fenc); + eap->force_enc = 8; eap->bad_char = buf->b_bad_char; #else - sprintf((char *)eap->cmd, "e ++ff=%s", buf->b_p_ff); + sprintf((char *)eap->cmd, "e"); #endif - eap->force_ff = 7; + eap->force_ff = *buf->b_p_ff; eap->force_bin = buf->b_p_bin ? FORCE_BIN : FORCE_NOBIN; eap->read_edit = FALSE; @@ -2955,8 +2932,7 @@ if (tmpname != NULL) { mch_remove(tmpname); /* delete converted file */ - vim_free(tmpname); - tmpname = NULL; + VIM_CLEAR(tmpname); } } @@ -3200,9 +3176,7 @@ #endif /* writing everything */ int whole = (start == 1 && end == buf->b_ml.ml_line_count); -#ifdef FEAT_AUTOCMD linenr_T old_line_count = buf->b_ml.ml_line_count; -#endif int attr; int fileformat; int write_bin; @@ -3322,7 +3296,6 @@ buf->b_op_end.lnum = end; buf->b_op_end.col = 0; -#ifdef FEAT_AUTOCMD { aco_save_T aco; int buf_ffname = FALSE; @@ -3512,7 +3485,6 @@ if (buf_fname_s) fname = buf->b_sfname; } -#endif #ifdef FEAT_NETBEANS_INTG if (netbeans_active() && isNetbeansBuffer(buf)) @@ -3945,8 +3917,7 @@ if (st_new.st_dev == st_old.st_dev && st_new.st_ino == st_old.st_ino) { - vim_free(backup); - backup = NULL; /* no backup file to delete */ + VIM_CLEAR(backup); /* no backup file to delete */ /* * may try again with 'shortname' set */ @@ -3980,10 +3951,7 @@ --*wp; /* They all exist??? Must be something wrong. */ if (*wp == 'a') - { - vim_free(backup); - backup = NULL; - } + VIM_CLEAR(backup); } } break; @@ -4010,10 +3978,7 @@ (void)umask(umask_save); #endif if (bfd < 0) - { - vim_free(backup); - backup = NULL; - } + VIM_CLEAR(backup); else { /* Set file protection same as original file, but @@ -4156,10 +4121,7 @@ --*p; /* They all exist??? Must be something wrong! */ if (*p == 'a') - { - vim_free(backup); - backup = NULL; - } + VIM_CLEAR(backup); } } if (backup != NULL) @@ -4177,8 +4139,7 @@ if (vim_rename(fname, backup) == 0) break; - vim_free(backup); /* don't do the rename below */ - backup = NULL; + VIM_CLEAR(backup); /* don't do the rename below */ } } if (backup == NULL && !forceit) @@ -5034,13 +4995,10 @@ ) { unchanged(buf, TRUE); -#ifdef FEAT_AUTOCMD /* b:changedtick is always incremented in unchanged() but that * should not trigger a TextChanged event. */ - if (last_changedtick + 1 == CHANGEDTICK(buf) - && last_changedtick_buf == buf) - last_changedtick = CHANGEDTICK(buf); -#endif + if (buf->b_last_changedtick + 1 == CHANGEDTICK(buf)) + buf->b_last_changedtick = CHANGEDTICK(buf); u_unchanged(buf); u_update_save_nr(buf); } @@ -5080,8 +5038,7 @@ else if (mch_stat(org, &st) < 0) { vim_rename(backup, (char_u *)org); - vim_free(backup); /* don't delete the file */ - backup = NULL; + VIM_CLEAR(backup); /* don't delete the file */ #ifdef UNIX set_file_time((char_u *)org, st_old.st_atime, st_old.st_mtime); #endif @@ -5210,7 +5167,6 @@ } #endif -#ifdef FEAT_AUTOCMD #ifdef FEAT_EVAL if (!should_abort(retval)) #else @@ -5248,7 +5204,6 @@ retval = FALSE; #endif } -#endif got_int |= prev_got_int; @@ -5262,37 +5217,34 @@ static int set_rw_fname(char_u *fname, char_u *sfname) { -#ifdef FEAT_AUTOCMD buf_T *buf = curbuf; /* It's like the unnamed buffer is deleted.... */ if (curbuf->b_p_bl) apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf); -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return FAIL; -# endif +#endif if (curbuf != buf) { /* We are in another buffer now, don't do the renaming. */ EMSG(_(e_auchangedbuf)); return FAIL; } -#endif if (setfname(curbuf, fname, sfname, FALSE) == OK) curbuf->b_flags |= BF_NOTEDITED; -#ifdef FEAT_AUTOCMD /* ....and a new named one is created */ apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, curbuf); if (curbuf->b_p_bl) apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf); -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) /* autocmds may abort script processing */ return FAIL; -# endif +#endif /* Do filetype detection now if 'filetype' is empty. */ if (*curbuf->b_p_ft == NUL) @@ -5301,7 +5253,6 @@ (void)do_doautocmd((char_u *)"filetypedetect BufRead", FALSE, NULL); do_modelines(0); } -#endif return OK; } @@ -5367,7 +5318,7 @@ *p++ = ' '; if (shortmess(SHM_LINES)) vim_snprintf((char *)p, IOSIZE - (p - IObuff), - "%ldL, %lldC", lnum, (varnumber_T)nchars); + "%ldL, %lldC", lnum, (long long)nchars); else { if (lnum == 1) @@ -5379,7 +5330,7 @@ STRCPY(p, _("1 character")); else vim_snprintf((char *)p, IOSIZE - (p - IObuff), - _("%lld characters"), (varnumber_T)nchars); + _("%lld characters"), (long long)nchars); } } @@ -6121,8 +6072,6 @@ } #endif -#if defined(FEAT_VIMINFO) || defined(FEAT_BROWSE) || \ - defined(FEAT_QUICKFIX) || defined(FEAT_AUTOCMD) || defined(PROTO) /* * Try to find a shortname by comparing the fullname with the current * directory. @@ -6146,7 +6095,6 @@ vim_free(dirname); return p; } -#endif /* * Try to find a shortname by comparing the fullname with the current @@ -6228,8 +6176,7 @@ || buf->b_sfname == NULL || mch_isFullName(buf->b_sfname))) { - vim_free(buf->b_sfname); - buf->b_sfname = NULL; + VIM_CLEAR(buf->b_sfname); p = shorten_fname(buf->b_ffname, dirname); if (p != NULL) { @@ -6798,10 +6745,7 @@ } if (!stuff_empty() || global_busy || !typebuf_typed() -#ifdef FEAT_AUTOCMD - || autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0 -#endif - ) + || autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0) need_check_timestamps = TRUE; /* check later */ else { @@ -6915,14 +6859,14 @@ #ifdef FEAT_GUI int save_mouse_correct = need_mouse_correct; #endif -#ifdef FEAT_AUTOCMD static int busy = FALSE; int n; +#ifdef FEAT_EVAL char_u *s; +#endif bufref_T bufref; set_bufref(&bufref, buf); -#endif /* If there is no file name, the buffer is not loaded, 'buftype' is * set, we are in the middle of a save or being called recursively: ignore @@ -6931,9 +6875,7 @@ || buf->b_ml.ml_mfp == NULL || *buf->b_p_bt != NUL || buf->b_saving -#ifdef FEAT_AUTOCMD || busy -#endif #ifdef FEAT_NETBEANS_INTG || isNetbeansBuffer(buf) #endif @@ -6994,17 +6936,16 @@ else reason = "time"; -#ifdef FEAT_AUTOCMD /* * Only give the warning if there are no FileChangedShell * autocommands. * Avoid being called recursively by setting "busy". */ busy = TRUE; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL set_vim_var_string(VV_FCS_REASON, (char_u *)reason, -1); set_vim_var_string(VV_FCS_CHOICE, (char_u *)"", -1); -# endif +#endif ++allbuf_lock; n = apply_autocmds(EVENT_FILECHANGEDSHELL, buf->b_fname, buf->b_fname, FALSE, buf); @@ -7014,18 +6955,17 @@ { if (!bufref_valid(&bufref)) EMSG(_("E246: FileChangedShell autocommand deleted buffer")); -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL s = get_vim_var_str(VV_FCS_CHOICE); if (STRCMP(s, "reload") == 0 && *reason != 'd') reload = TRUE; else if (STRCMP(s, "ask") == 0) n = FALSE; else -# endif +#endif return 2; } if (!n) -#endif { if (*reason == 'd') mesg = _("E211: File \"%s\" no longer available"); @@ -7117,9 +7057,7 @@ } else { -# ifdef FEAT_AUTOCMD if (!autocmd_busy) -# endif { msg_start(); msg_puts_attr(tbuf, HL_ATTR(HLF_E) + MSG_HIST); @@ -7131,9 +7069,9 @@ if (emsg_silent == 0) { out_flush(); -# ifdef FEAT_GUI +#ifdef FEAT_GUI if (!focus) -# endif +#endif /* give the user some time to think about it */ ui_delay(1000L, TRUE); @@ -7168,12 +7106,10 @@ #endif } -#ifdef FEAT_AUTOCMD /* Trigger FileChangedShell when the file was changed in any way. */ if (bufref_valid(&bufref) && retval != 0) (void)apply_autocmds(EVENT_FILECHANGEDSHELLPOST, buf->b_fname, buf->b_fname, FALSE, buf); -#endif #ifdef FEAT_GUI /* restore this in case an autocommand has set it; it would break * 'mousefocus' */ @@ -7257,14 +7193,12 @@ if (saved == OK) { curbuf->b_flags |= BF_CHECK_RO; /* check for RO again */ -#ifdef FEAT_AUTOCMD keep_filetype = TRUE; /* don't detect 'filetype' */ -#endif if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, &ea, flags) != OK) { -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (!aborting()) #endif EMSG2(_("E321: Could not reload \"%s\""), buf->b_fname); @@ -7313,9 +7247,7 @@ curwin->w_cursor = old_cursor; check_cursor(); update_topline(); -#ifdef FEAT_AUTOCMD keep_filetype = FALSE; -#endif #ifdef FEAT_FOLDING { win_T *wp; @@ -7428,8 +7360,7 @@ /* remove the trailing path separator */ gettail(vim_tempdir)[-1] = NUL; delete_recursive(vim_tempdir); - vim_free(vim_tempdir); - vim_tempdir = NULL; + VIM_CLEAR(vim_tempdir); } } @@ -7690,12 +7621,8 @@ /* * Code for automatic commands. - * - * Only included when "FEAT_AUTOCMD" has been defined. */ -#if defined(FEAT_AUTOCMD) || defined(PROTO) - /* * The autocommands are stored in a list for each event. * Autocommands for the same pattern, that are consecutive, are joined @@ -7798,7 +7725,9 @@ {"CursorHoldI", EVENT_CURSORHOLDI}, {"CursorMoved", EVENT_CURSORMOVED}, {"CursorMovedI", EVENT_CURSORMOVEDI}, + {"DirChanged", EVENT_DIRCHANGED}, {"EncodingChanged", EVENT_ENCODINGCHANGED}, + {"ExitPre", EVENT_EXITPRE}, {"FileEncoding", EVENT_ENCODINGCHANGED}, {"FileAppendPost", EVENT_FILEAPPENDPOST}, {"FileAppendPre", EVENT_FILEAPPENDPRE}, @@ -7847,9 +7776,11 @@ {"TabEnter", EVENT_TABENTER}, {"TabLeave", EVENT_TABLEAVE}, {"TermChanged", EVENT_TERMCHANGED}, + {"TerminalOpen", EVENT_TERMINALOPEN}, {"TermResponse", EVENT_TERMRESPONSE}, {"TextChanged", EVENT_TEXTCHANGED}, {"TextChangedI", EVENT_TEXTCHANGEDI}, + {"TextChangedP", EVENT_TEXTCHANGEDP}, {"User", EVENT_USER}, {"VimEnter", EVENT_VIMENTER}, {"VimLeave", EVENT_VIMLEAVE}, @@ -7930,9 +7861,7 @@ static int do_autocmd_event(event_T event, char_u *pat, int nested, char_u *cmd, int forceit, int group); static int apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io, int force, int group, buf_T *buf, exarg_T *eap); static void auto_next_pat(AutoPatCmd *apc, int stop_at_last); -#if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN) static int match_file_pat(char_u *pattern, regprog_T **prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs); -#endif static event_T last_event; @@ -8017,8 +7946,7 @@ static void au_remove_pat(AutoPat *ap) { - vim_free(ap->pat); - ap->pat = NULL; + VIM_CLEAR(ap->pat); ap->buflocal_nr = -1; au_need_clean = TRUE; } @@ -8032,10 +7960,7 @@ AutoCmd *ac; for (ac = ap->cmds; ac != NULL; ac = ac->next) - { - vim_free(ac->cmd); - ac->cmd = NULL; - } + VIM_CLEAR(ac->cmd); au_need_clean = TRUE; } @@ -9034,7 +8959,6 @@ * Search for a visible window containing the current buffer. If there isn't * one then use "aucmd_win". * Set "curbuf" and "curwin" to match "buf". - * When FEAT_AUTOCMD is not defined another version is used, see below. */ void aucmd_prepbuf( @@ -9087,14 +9011,15 @@ aco->use_aucmd_win = TRUE; aucmd_win_used = TRUE; aucmd_win->w_buffer = buf; +#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL) aucmd_win->w_s = &buf->b_s; +#endif ++buf->b_nwindows; win_init_empty(aucmd_win); /* set cursor and topline to safe values */ /* Make sure w_localdir and globaldir are NULL to avoid a chdir() in * win_enter_ext(). */ - vim_free(aucmd_win->w_localdir); - aucmd_win->w_localdir = NULL; + VIM_CLEAR(aucmd_win->w_localdir); aco->globaldir = globaldir; globaldir = NULL; @@ -9129,7 +9054,6 @@ /* * Cleanup after executing autocommands for a (hidden) buffer. * Restore the window as it was (if possible). - * When FEAT_AUTOCMD is not defined another version is used, see below. */ void aucmd_restbuf( @@ -9376,6 +9300,15 @@ } /* + * Return TRUE when there is a TextChangedP autocommand defined. + */ + int +has_textchangedP(void) +{ + return (first_autopat[(int)EVENT_TEXTCHANGEDP] != NULL); +} + +/* * Return TRUE when there is an InsertCharPre autocommand defined. */ int @@ -9418,13 +9351,13 @@ static int apply_autocmds_group( event_T event, - char_u *fname, /* NULL or empty means use actual file name */ - char_u *fname_io, /* fname to use for on cmdline, NULL means + char_u *fname, /* NULL or empty means use actual file name */ + char_u *fname_io, /* fname to use for on cmdline, NULL means use fname */ - int force, /* when TRUE, ignore autocmd_busy */ - int group, /* group ID, or AUGROUP_ALL */ - buf_T *buf, /* buffer for */ - exarg_T *eap) /* command arguments */ + int force, /* when TRUE, ignore autocmd_busy */ + int group, /* group ID, or AUGROUP_ALL */ + buf_T *buf, /* buffer for */ + exarg_T *eap UNUSED) /* command arguments */ { char_u *sfname = NULL; /* short file name */ char_u *tail; @@ -9588,17 +9521,27 @@ { sfname = vim_strsave(fname); /* Don't try expanding FileType, Syntax, FuncUndefined, WindowID, - * ColorScheme or QuickFixCmd* */ + * ColorScheme, QuickFixCmd* or DirChanged */ if (event == EVENT_FILETYPE || event == EVENT_SYNTAX + || event == EVENT_CMDLINECHANGED + || event == EVENT_CMDLINEENTER + || event == EVENT_CMDLINELEAVE + || event == EVENT_CMDWINENTER + || event == EVENT_CMDWINLEAVE + || event == EVENT_CMDUNDEFINED || event == EVENT_FUNCUNDEFINED || event == EVENT_REMOTEREPLY || event == EVENT_SPELLFILEMISSING || event == EVENT_QUICKFIXCMDPRE || event == EVENT_COLORSCHEME || event == EVENT_OPTIONSET - || event == EVENT_QUICKFIXCMDPOST) + || event == EVENT_QUICKFIXCMDPOST + || event == EVENT_DIRCHANGED) + { fname = vim_strsave(fname); + autocmd_fname_full = TRUE; /* don't expand it later */ + } else fname = FullName_save(fname, FALSE); } @@ -9866,8 +9809,7 @@ char_u *name; char *s; - vim_free(sourcing_name); - sourcing_name = NULL; + VIM_CLEAR(sourcing_name); for (ap = apc->curpat; ap != NULL && !got_int; ap = ap->next) { @@ -10222,43 +10164,7 @@ return retval; } -#else /* FEAT_AUTOCMD */ - -/* - * Prepare for executing commands for (hidden) buffer "buf". - * This is the non-autocommand version, it simply saves "curbuf" and sets - * "curbuf" and "curwin" to match "buf". - */ - void -aucmd_prepbuf( - aco_save_T *aco, /* structure to save values in */ - buf_T *buf) /* new curbuf */ -{ - aco->save_curbuf = curbuf; - --curbuf->b_nwindows; - curbuf = buf; - curwin->w_buffer = buf; - ++curbuf->b_nwindows; -} - -/* - * Restore after executing commands for a (hidden) buffer. - * This is the non-autocommand version. - */ - void -aucmd_restbuf( - aco_save_T *aco) /* structure holding saved values */ -{ - --curbuf->b_nwindows; - curbuf = aco->save_curbuf; - curwin->w_buffer = curbuf; - ++curbuf->b_nwindows; -} - -#endif /* FEAT_AUTOCMD */ - -#if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN) || defined(PROTO) /* * Try matching a filename with a "pattern" ("prog" is NULL), or use the * precompiled regprog "prog" ("pattern" is NULL). That avoids calling @@ -10304,7 +10210,6 @@ vim_regfree(regmatch.regprog); return result; } -#endif #if defined(FEAT_WILDIGN) || defined(PROTO) /* @@ -10550,8 +10455,7 @@ EMSG(_("E219: Missing {.")); else EMSG(_("E220: Missing }.")); - vim_free(reg_pat); - reg_pat = NULL; + VIM_CLEAR(reg_pat); } return reg_pat; } diff -Nru vim-8.0.1453/src/getchar.c vim-8.0.1766/src/getchar.c --- vim-8.0.1453/src/getchar.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/getchar.c 2018-04-26 20:30:33.000000000 +0000 @@ -516,7 +516,6 @@ } } -#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) /* * Save redobuff and old_redobuff to save_redobuff and save_old_redobuff. * Used before executing autocommands and user functions. @@ -552,7 +551,6 @@ free_buff(&old_redobuff); old_redobuff = save_redo->sr_old_redobuff; } -#endif /* * Append "s" to the redo buffer. @@ -1854,7 +1852,7 @@ return vgetorpeek(FALSE); } -#if defined(FEAT_TERMRESPONSE) || defined(PROTO) +#if defined(FEAT_TERMRESPONSE) || defined(FEAT_TERMINAL) || defined(PROTO) /* * Like vpeekc(), but don't allow mapping. Do allow checking for terminal * codes. @@ -2115,7 +2113,8 @@ && State != ASKMORE && State != CONFIRM #ifdef FEAT_INS_EXPAND - && !((ctrl_x_mode != 0 && vim_is_ctrl_x_key(c1)) + && !((ctrl_x_mode_not_default() + && vim_is_ctrl_x_key(c1)) || ((compl_cont_status & CONT_LOCAL) && (c1 == Ctrl_N || c1 == Ctrl_P))) #endif @@ -2890,7 +2889,7 @@ + typebuf.tb_len] != NUL) typebuf.tb_noremap[typebuf.tb_off + typebuf.tb_len++] = RM_YES; -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD /* Get IM status right after getting keys, not after the * timeout for a mapping (focus may be lost by then). */ vgetc_im_active = im_get_status(); @@ -3121,10 +3120,8 @@ else #endif if (p[0] == NUL || (p[0] == K_SPECIAL -#ifdef FEAT_AUTOCMD /* timeout may generate K_CURSORHOLD */ && (i < 2 || p[1] != KS_EXTRA || p[2] != (int)KE_CURSORHOLD) -#endif #if defined(WIN3264) && !defined(FEAT_GUI) /* Win32 console passes modifiers */ && (i < 2 || p[1] != KS_MODIFIER) @@ -4122,7 +4119,7 @@ mapblock_T *mp; int hash; # ifdef FEAT_LOCALMAP - int expand_buffer = FALSE; + int exp_buffer = FALSE; validate_maphash(); @@ -4137,14 +4134,14 @@ if (hash > 0) /* there is only one abbr list */ break; #ifdef FEAT_LOCALMAP - if (expand_buffer) + if (exp_buffer) mp = curbuf->b_first_abbr; else #endif mp = first_abbr; } # ifdef FEAT_LOCALMAP - else if (expand_buffer) + else if (exp_buffer) mp = curbuf->b_maphash[hash]; # endif else @@ -4157,9 +4154,9 @@ } } # ifdef FEAT_LOCALMAP - if (expand_buffer) + if (exp_buffer) break; - expand_buffer = TRUE; + exp_buffer = TRUE; } # endif diff -Nru vim-8.0.1453/src/globals.h vim-8.0.1766/src/globals.h --- vim-8.0.1453/src/globals.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/globals.h 2018-04-26 20:30:33.000000000 +0000 @@ -181,6 +181,7 @@ EXTERN int did_emsg; /* set by emsg() when the message is displayed or thrown */ #ifdef FEAT_EVAL +EXTERN int called_vim_beep; /* set if vim_beep() is called */ EXTERN int did_uncaught_emsg; /* emsg() was called and did not cause an exception */ #endif @@ -384,7 +385,6 @@ EXTERN int is_mac_terminal INIT(= FALSE); /* recognized Terminal.app */ #endif -#ifdef FEAT_AUTOCMD EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */ EXTERN int autocmd_no_enter INIT(= FALSE); /* *Enter autocmds disabled */ EXTERN int autocmd_no_leave INIT(= FALSE); /* *Leave autocmds disabled */ @@ -404,7 +404,6 @@ * Free the buffer/window when autocmd_busy is being set to FALSE. */ EXTERN buf_T *au_pending_free_buf INIT(= NULL); EXTERN win_T *au_pending_free_win INIT(= NULL); -#endif #ifdef FEAT_MOUSE /* @@ -571,10 +570,8 @@ EXTERN win_T *curwin; /* currently active window */ -#ifdef FEAT_AUTOCMD EXTERN win_T *aucmd_win; /* window used in aucmd_prepbuf() */ EXTERN int aucmd_win_used INIT(= FALSE); /* aucmd_win is being used */ -#endif /* * The window layout is kept in a tree of frames. topframe points to the top @@ -638,6 +635,7 @@ EXTERN int really_exiting INIT(= FALSE); /* TRUE when we are sure to exit, e.g., after * a deadly signal */ +EXTERN int v_dying INIT(= 0); /* internal value of v:dying */ EXTERN int stdout_isatty INIT(= TRUE); /* is stdout a terminal? */ #if defined(FEAT_AUTOCHDIR) @@ -663,7 +661,6 @@ /* non-zero when changing text and jumping to * another window or buffer is not allowed */ -#ifdef FEAT_AUTOCMD EXTERN int curbuf_lock INIT(= 0); /* non-zero when the current buffer can't be * changed. Used for FileChangedRO. */ @@ -672,7 +669,6 @@ * changed, no buffer can be deleted and * current directory can't be changed. * Used for SwapExists et al. */ -#endif #ifdef FEAT_EVAL # define HAVE_SANDBOX EXTERN int sandbox INIT(= 0); @@ -732,7 +728,6 @@ EXTERN int end_comment_pending INIT(= NUL); #endif -#ifdef FEAT_SCROLLBIND /* * This flag is set after a ":syncbind" to let the check_scrollbind() function * know that it should not attempt to perform scrollbinding due to the scroll @@ -740,7 +735,6 @@ * undo some of the work done by ":syncbind.") -ralston */ EXTERN int did_syncbind INIT(= FALSE); -#endif #ifdef FEAT_SMARTINDENT /* @@ -964,7 +958,6 @@ EXTERN char_u *edit_submode_pre INIT(= NULL); /* prepended to edit_submode */ EXTERN char_u *edit_submode_extra INIT(= NULL);/* appended to edit_submode */ EXTERN hlf_T edit_submode_highl; /* highl. method for extra info */ -EXTERN int ctrl_x_mode INIT(= 0); /* Which Ctrl-X mode are we in? */ #endif EXTERN int no_abbr INIT(= TRUE); /* TRUE when no abbreviations loaded */ @@ -986,15 +979,12 @@ EXTERN int emsg_noredir INIT(= 0); /* don't redirect error messages */ EXTERN int cmd_silent INIT(= FALSE); /* don't echo the command line */ -#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) \ - || defined(FEAT_AUTOCMD) # define HAS_SWAP_EXISTS_ACTION EXTERN int swap_exists_action INIT(= SEA_NONE); /* For dialog when swap file already * exists. */ EXTERN int swap_exists_did_quit INIT(= FALSE); /* Selected "quit" at the dialog. */ -#endif EXTERN char_u *IObuff; /* sprintf's are done in this buffer, size is IOSIZE */ @@ -1022,7 +1012,7 @@ EXTERN int KeyTyped; /* TRUE if user typed current char */ EXTERN int KeyStuffed; /* TRUE if current char from stuffbuf */ -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD EXTERN int vgetc_im_active; /* Input Method was active for last character obtained from vgetc() */ #endif @@ -1075,7 +1065,6 @@ #ifdef FEAT_CMDHIST EXTERN char_u *new_last_cmdline INIT(= NULL); /* new value for last_cmdline */ #endif -#ifdef FEAT_AUTOCMD EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for on cmdline */ EXTERN int autocmd_fname_full; /* autocmd_fname is full path */ EXTERN int autocmd_bufnr INIT(= 0); /* fnum for on cmdline */ @@ -1086,9 +1075,6 @@ = INIT_POS_T(0, 0, 0) # endif ; -EXTERN varnumber_T last_changedtick INIT(= 0); /* for TextChanged event */ -EXTERN buf_T *last_changedtick_buf INIT(= NULL); -#endif EXTERN int postponed_split INIT(= 0); /* for CTRL-W CTRL-] command */ EXTERN int postponed_split_flags INIT(= 0); /* args for win_split() */ @@ -1439,6 +1425,8 @@ EXTERN char_u e_invaddr[] INIT(= N_("E14: Invalid address")); EXTERN char_u e_invarg[] INIT(= N_("E474: Invalid argument")); EXTERN char_u e_invarg2[] INIT(= N_("E475: Invalid argument: %s")); +EXTERN char_u e_invargval[] INIT(= N_("E475: Invalid value for argument %s")); +EXTERN char_u e_invargNval[] INIT(= N_("E475: Invalid value for argument %s: %s")); #ifdef FEAT_EVAL EXTERN char_u e_invexpr2[] INIT(= N_("E15: Invalid expression: %s")); #endif @@ -1595,6 +1583,7 @@ EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name")); #endif EXTERN char_u e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\"")); +EXTERN char_u e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior")); #ifdef FEAT_GUI_MAC EXTERN short disallow_gui INIT(= FALSE); diff -Nru vim-8.0.1453/src/gui_at_sb.c vim-8.0.1766/src/gui_at_sb.c --- vim-8.0.1453/src/gui_at_sb.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/gui_at_sb.c 2018-04-26 20:30:33.000000000 +0000 @@ -645,7 +645,11 @@ static Boolean CompareEvents(XEvent *oldEvent, XEvent *newEvent) { -#define Check(field) if (newEvent->field != oldEvent->field) return False; +#define Check(field) \ + do { \ + if (newEvent->field != oldEvent->field) \ + return False; \ + } while (0) Check(xany.display); Check(xany.type); diff -Nru vim-8.0.1453/src/gui.c vim-8.0.1766/src/gui.c --- vim-8.0.1453/src/gui.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/gui.c 2018-04-26 20:30:33.000000000 +0000 @@ -132,13 +132,11 @@ vim_free(old_term); -#ifdef FEAT_AUTOCMD /* If the GUI started successfully, trigger the GUIEnter event, otherwise * the GUIFailed event. */ gui_mch_update(); apply_autocmds(gui.in_use ? EVENT_GUIENTER : EVENT_GUIFAILED, NULL, NULL, FALSE, curbuf); -#endif --recursive; } @@ -1079,7 +1077,7 @@ gui_undraw_cursor(); if (gui.row < 0) return; -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD if (gui.row != gui.cursor_row || gui.col != gui.cursor_col) im_set_position(gui.row, gui.col); #endif @@ -1137,13 +1135,13 @@ if (id > 0) { cattr = syn_id2colors(id, &cfg, &cbg); -#if defined(FEAT_XIM) || defined(FEAT_HANGULIN) +#if defined(HAVE_INPUT_METHOD) || defined(FEAT_HANGULIN) { static int iid; guicolor_T fg, bg; if ( -# if defined(FEAT_GUI_GTK) && !defined(FEAT_HANGULIN) +# if defined(FEAT_GUI_GTK) && defined(FEAT_XIM) && !defined(FEAT_HANGULIN) preedit_get_status() # else im_get_status() @@ -2954,7 +2952,7 @@ gui_wait_for_chars(long wtime, int tb_change_cnt) { int retval; -#if defined(ELAPSED_FUNC) && defined(FEAT_AUTOCMD) +#if defined(ELAPSED_FUNC) ELAPSED_TYPE start_tv; #endif @@ -2986,7 +2984,7 @@ return retval; } -#if defined(ELAPSED_FUNC) && defined(FEAT_AUTOCMD) +#if defined(ELAPSED_FUNC) ELAPSED_INIT(start_tv); #endif @@ -3003,11 +3001,10 @@ */ if (gui_wait_for_chars_or_timer(p_ut) == OK) retval = OK; -#ifdef FEAT_AUTOCMD else if (trigger_cursorhold() -# ifdef ELAPSED_FUNC +#ifdef ELAPSED_FUNC && ELAPSED_FUNC(start_tv) >= p_ut -# endif +#endif && typebuf.tb_change_cnt == tb_change_cnt) { char_u buf[3]; @@ -3020,7 +3017,6 @@ retval = OK; } -#endif if (retval == FAIL && typebuf.tb_change_cnt == tb_change_cnt) { @@ -3963,9 +3959,7 @@ int sb_num; #ifdef USE_ON_FLY_SCROLL colnr_T old_leftcol = curwin->w_leftcol; -# ifdef FEAT_SCROLLBIND linenr_T old_topline = curwin->w_topline; -# endif # ifdef FEAT_DIFF int old_topfill = curwin->w_topfill; # endif @@ -4130,16 +4124,15 @@ } #ifdef USE_ON_FLY_SCROLL -# ifdef FEAT_SCROLLBIND /* * synchronize other windows, as necessary according to 'scrollbind' */ if (curwin->w_p_scb && ((sb->wp == NULL && curwin->w_leftcol != old_leftcol) || (sb->wp == curwin && (curwin->w_topline != old_topline -# ifdef FEAT_DIFF +# ifdef FEAT_DIFF || curwin->w_topfill != old_topfill -# endif +# endif )))) { do_check_scrollbind(TRUE); @@ -4149,7 +4142,6 @@ updateWindow(wp); setcursor(); } -# endif out_flush_cursor(FALSE, TRUE); #else add_to_input_buf(bytes, byte_count); @@ -4478,9 +4470,7 @@ } if (old_cursor.lnum != wp->w_cursor.lnum) coladvance(wp->w_curswant); -#ifdef FEAT_SCROLLBIND wp->w_scbind_pos = wp->w_topline; -#endif } /* Make sure wp->w_leftcol and wp->w_skipcol are correct. */ @@ -5131,34 +5121,24 @@ void gui_update_screen(void) { -#ifdef FEAT_CONCEAL +# ifdef FEAT_CONCEAL linenr_T conceal_old_cursor_line = 0; linenr_T conceal_new_cursor_line = 0; int conceal_update_lines = FALSE; -#endif +# endif update_topline(); validate_cursor(); -#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL) /* Trigger CursorMoved if the cursor moved. */ - if (!finish_op && ( -# ifdef FEAT_AUTOCMD - has_cursormoved() -# endif -# if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL) - || -# endif + if (!finish_op && (has_cursormoved() # ifdef FEAT_CONCEAL - curwin->w_p_cole > 0 + || curwin->w_p_cole > 0 # endif - ) - && !EQUAL_POS(last_cursormoved, curwin->w_cursor)) + ) && !EQUAL_POS(last_cursormoved, curwin->w_cursor)) { -# ifdef FEAT_AUTOCMD if (has_cursormoved()) apply_autocmds(EVENT_CURSORMOVED, NULL, NULL, FALSE, curbuf); -# endif # ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0) { @@ -5169,11 +5149,10 @@ # endif last_cursormoved = curwin->w_cursor; } -#endif update_screen(0); /* may need to update the screen */ setcursor(); -# if defined(FEAT_CONCEAL) +# ifdef FEAT_CONCEAL if (conceal_update_lines && (conceal_old_cursor_line != conceal_new_cursor_line || conceal_cursor_line(curwin) @@ -5528,7 +5507,7 @@ if (mch_chdir((char *)p) == 0) shorten_fnames(TRUE); } - else if (vim_chdirfile(p) == OK) + else if (vim_chdirfile(p, "drop") == OK) shorten_fnames(TRUE); vim_free(p); } diff -Nru vim-8.0.1453/src/gui_gtk.c vim-8.0.1766/src/gui_gtk.c --- vim-8.0.1453/src/gui_gtk.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/gui_gtk.c 2018-04-26 20:30:33.000000000 +0000 @@ -1895,8 +1895,8 @@ trigger.window = gtk_widget_get_window(gui.drawarea); trigger.send_event = FALSE; trigger.time = gui.event_time; - trigger.x = 0.0; - trigger.y = 0.0; + trigger.x = 0.0; + trigger.y = 0.0; trigger.axes = NULL; trigger.state = 0; trigger.button = 3; @@ -1983,8 +1983,8 @@ trigger.window = win; trigger.send_event = FALSE; trigger.time = GDK_CURRENT_TIME; - trigger.x = 0.0; - trigger.y = 0.0; + trigger.x = 0.0; + trigger.y = 0.0; trigger.axes = NULL; trigger.state = 0; trigger.button = 0; @@ -2144,6 +2144,37 @@ return (const char *)*buffer; } +/* + * Returns the number of characters in GtkEntry. + */ + static unsigned long +entry_get_text_length(GtkEntry *entry) +{ + g_return_val_if_fail(entry != NULL, 0); + g_return_val_if_fail(GTK_IS_ENTRY(entry) == TRUE, 0); + +#if GTK_CHECK_VERSION(2,18,0) + /* 2.18 introduced a new object GtkEntryBuffer to handle text data for + * GtkEntry instead of letting each instance of the latter have its own + * storage for that. The code below is almost identical to the + * implementation of gtk_entry_get_text_length() for the versions >= 2.18. + */ + return gtk_entry_buffer_get_length(gtk_entry_get_buffer(entry)); +#elif GTK_CHECK_VERSION(2,14,0) + /* 2.14 introduced a new function to avoid memory management bugs which can + * happen when gtk_entry_get_text() is used without due care and attention. + */ + return gtk_entry_get_text_length(entry); +#else + /* gtk_entry_get_text() returns the pointer to the storage allocated + * internally by the widget. Accordingly, use the one with great care: + * Don't free it nor modify the contents it points to; call the function + * every time you need the pointer since its value may have been changed + * by the widget. */ + return g_utf8_strlen(gtk_entry_get_text(entry), -1); +#endif +} + static void find_replace_dialog_create(char_u *arg, int do_replace) { @@ -2198,10 +2229,9 @@ * For :promptrepl dialog, give it to 'with' entry if 'what' has an * non-empty entry; otherwise, to 'what' entry. */ gtk_widget_grab_focus(frdp->what); - if (do_replace && gtk_entry_get_text_length(GTK_ENTRY(frdp->what))) + if (do_replace && entry_get_text_length(GTK_ENTRY(frdp->what)) > 0) gtk_widget_grab_focus(frdp->with); - vim_free(entry_text); return; } diff -Nru vim-8.0.1453/src/gui_gtk_x11.c vim-8.0.1766/src/gui_gtk_x11.c --- vim-8.0.1453/src/gui_gtk_x11.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/gui_gtk_x11.c 2018-04-26 20:30:33.000000000 +0000 @@ -1366,15 +1366,21 @@ * Selection handlers: */ +/* Remember when clip_lose_selection was called from here, we must not call + * gtk_selection_owner_set() then. */ +static int in_selection_clear_event = FALSE; + static gint selection_clear_event(GtkWidget *widget UNUSED, GdkEventSelection *event, gpointer user_data UNUSED) { + in_selection_clear_event = TRUE; if (event->selection == clip_plus.gtk_sel_atom) clip_lose_selection(&clip_plus); else clip_lose_selection(&clip_star); + in_selection_clear_event = FALSE; return TRUE; } @@ -3838,8 +3844,7 @@ # endif } #endif - vim_free(gui_argv); - gui_argv = NULL; + VIM_CLEAR(gui_argv); #if GLIB_CHECK_VERSION(2,1,3) /* Set the human-readable application name */ @@ -4668,8 +4673,7 @@ y += hh - pixel_height; gtk_window_move(GTK_WINDOW(gui.mainwin), x, y); } - vim_free(gui.geom); - gui.geom = NULL; + VIM_CLEAR(gui.geom); /* From now until everyone's stopped trying to set the window hints * to their correct minimum values, stop them being set as we need @@ -5603,15 +5607,17 @@ guicolor_T gui_mch_get_color(char_u *name) { + guicolor_T color = INVALCOLOR; + if (!gui.in_use) /* can't do this when GUI not running */ - return INVALCOLOR; + return color; + + if (name != NULL) + color = gui_get_color_cmn(name); #if GTK_CHECK_VERSION(3,0,0) - return name != NULL ? gui_get_color_cmn(name) : INVALCOLOR; + return color; #else - guicolor_T color; - - color = (name != NULL) ? gui_get_color_cmn(name) : INVALCOLOR; if (color == INVALCOLOR) return INVALCOLOR; @@ -7050,8 +7056,11 @@ void clip_mch_lose_selection(VimClipboard *cbd UNUSED) { - gtk_selection_owner_set(NULL, cbd->gtk_sel_atom, gui.event_time); - gui_mch_update(); + if (!in_selection_clear_event) + { + gtk_selection_owner_set(NULL, cbd->gtk_sel_atom, gui.event_time); + gui_mch_update(); + } } /* diff -Nru vim-8.0.1453/src/gui.h vim-8.0.1766/src/gui.h --- vim-8.0.1453/src/gui.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/gui.h 2018-04-26 20:30:33.000000000 +0000 @@ -207,6 +207,8 @@ #define INVALCOLOR (guicolor_T)-11111 /* number for invalid color; on 32 bit displays there is a tiny chance this is an actual color */ +#define CTERMCOLOR (guicolor_T)-11110 /* only used for cterm.bg_rgb and + cterm.fg_rgb: use cterm color */ #ifdef FEAT_GUI_GTK typedef PangoFontDescription *GuiFont; /* handle for a GUI font */ diff -Nru vim-8.0.1453/src/gui_mac.c vim-8.0.1766/src/gui_mac.c --- vim-8.0.1453/src/gui_mac.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/gui_mac.c 2018-04-26 20:30:33.000000000 +0000 @@ -1105,7 +1105,8 @@ } /* Change directory to the location of the first file. */ - if (GARGCOUNT > 0 && vim_chdirfile(alist_name(&GARGLIST[0])) == OK) + if (GARGCOUNT > 0 + && vim_chdirfile(alist_name(&GARGLIST[0]), "drop") == OK) shorten_fnames(TRUE); goto finished; @@ -6231,7 +6232,7 @@ #endif } -#if (defined(FEAT_MBYTE) || defined(PROTO)) && defined(USE_CARBONKEYHANDLER) +#if (defined(FEAT_MBYTE) && defined(USE_CARBONKEYHANDLER)) || defined(PROTO) /* * Input Method Control functions. */ diff -Nru vim-8.0.1453/src/gui_photon.c vim-8.0.1766/src/gui_photon.c --- vim-8.0.1453/src/gui_photon.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/gui_photon.c 2018-04-26 20:30:33.000000000 +0000 @@ -1040,8 +1040,7 @@ PtSetResource(gui.vimPanelGroup, Pt_ARG_PG_PANEL_TITLES, &empty_title, 1); - vim_free(panel_titles); - panel_titles = NULL; + VIM_CLEAR(panel_titles); } } diff -Nru vim-8.0.1453/src/gui_w32.c vim-8.0.1766/src/gui_w32.c --- vim-8.0.1453/src/gui_w32.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/gui_w32.c 2018-04-26 20:30:33.000000000 +0000 @@ -494,9 +494,11 @@ static int s_x_pending; static int s_y_pending; static UINT s_kFlags_pending; -static UINT s_wait_timer = 0; /* Timer for get char from user */ +static UINT s_wait_timer = 0; // Timer for get char from user static int s_timed_out = FALSE; -static int dead_key = 0; /* 0: no dead key, 1: dead key pressed */ +static int dead_key = 0; // 0: no dead key, 1: dead key pressed +static UINT surrogate_pending_ch = 0; // 0: no surrogate pending, + // else a high surrogate #ifdef FEAT_BEVAL_GUI /* balloon-eval WM_NOTIFY_HANDLER */ @@ -708,6 +710,12 @@ * Convert Unicode character "ch" to bytes in "string[slen]". * When "had_alt" is TRUE the ALT key was included in "ch". * Return the length. + * Because the Windows API uses UTF-16, we have to deal with surrogate + * pairs; this is where we choose to deal with them: if "ch" is a high + * surrogate, it will be stored, and the length returned will be zero; the next + * char_to_string call will then include the high surrogate, decoding the pair + * of UTF-16 code units to a single Unicode code point, presuming it is the + * matching low surrogate. */ static int char_to_string(int ch, char_u *string, int slen, int had_alt) @@ -718,8 +726,27 @@ WCHAR wstring[2]; char_u *ws = NULL; - wstring[0] = ch; - len = 1; + if (surrogate_pending_ch != 0) + { + /* We don't guarantee ch is a low surrogate to match the high surrogate + * we already have; it should be, but if it isn't, tough luck. */ + wstring[0] = surrogate_pending_ch; + wstring[1] = ch; + surrogate_pending_ch = 0; + len = 2; + } + else if (ch >= 0xD800 && ch <= 0xDBFF) /* high surrogate */ + { + /* We don't have the entire code point yet, only the first UTF-16 code + * unit; so just remember it and use it in the next call. */ + surrogate_pending_ch = ch; + return 0; + } + else + { + wstring[0] = ch; + len = 1; + } /* "ch" is a UTF-16 character. Convert it to a string of bytes. When * "enc_codepage" is non-zero use the standard Win32 function, @@ -743,7 +770,6 @@ } else { - len = 1; ws = utf16_to_enc(wstring, &len); if (ws == NULL) len = 0; @@ -4941,8 +4967,7 @@ char_u *str = NULL; static void *tt_text = NULL; - vim_free(tt_text); - tt_text = NULL; + VIM_CLEAR(tt_text); # ifdef FEAT_GUI_TABLINE if (gui_mch_showing_tabline() diff -Nru vim-8.0.1453/src/gui_x11.c vim-8.0.1766/src/gui_x11.c --- vim-8.0.1453/src/gui_x11.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/gui_x11.c 2018-04-26 20:30:33.000000000 +0000 @@ -826,7 +826,7 @@ # endif ) { - int maxlen = len * 4 + 40; /* guessed */ + int maxlen = len * 4 + 40; /* guessed */ char_u *p = (char_u *)XtMalloc(maxlen); mch_memmove(p, string, len); @@ -1567,8 +1567,7 @@ XtCloseDisplay(gui.dpy); gui.dpy = NULL; vimShell = (Widget)0; - vim_free(gui_argv); - gui_argv = NULL; + VIM_CLEAR(gui_argv); } /* @@ -1741,8 +1740,7 @@ * says that this isn't needed when exiting, so just skip it. */ XtCloseDisplay(gui.dpy); #endif - vim_free(gui_argv); - gui_argv = NULL; + VIM_CLEAR(gui_argv); } /* @@ -1956,7 +1954,7 @@ { XFontStruct *font; - if (!gui.in_use || name == NULL) /* can't do this when GUI not running */ + if (!gui.in_use || name == NULL) /* can't do this when GUI not running */ return NOFONT; font = XLoadQueryFont(gui.dpy, (char *)name); @@ -2275,7 +2273,7 @@ guicolor_T gui_mch_get_color(char_u *name) { - guicolor_T requested; + guicolor_T requested; /* can't do this when GUI not running */ if (!gui.in_use || name == NULL || *name == NUL) @@ -2298,8 +2296,8 @@ guicolor_T gui_mch_get_rgb_color(int r, int g, int b) { - char spec[8]; /* space enough to hold "#RRGGBB" */ - XColor available; + char spec[8]; /* space enough to hold "#RRGGBB" */ + XColor available; Colormap colormap; vim_snprintf(spec, sizeof(spec), "#%.2x%.2x%.2x", r, g, b); diff -Nru vim-8.0.1453/src/hardcopy.c vim-8.0.1766/src/hardcopy.c --- vim-8.0.1453/src/hardcopy.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/hardcopy.c 2018-04-26 20:30:33.000000000 +0000 @@ -2210,8 +2210,7 @@ for (i = PRT_PS_FONT_ROMAN; i <= PRT_PS_FONT_BOLDOBLIQUE; i++) { if (prt_ps_mb_font.ps_fontname[i] != NULL) - vim_free(prt_ps_mb_font.ps_fontname[i]); - prt_ps_mb_font.ps_fontname[i] = NULL; + VIM_CLEAR(prt_ps_mb_font.ps_fontname[i]); } } @@ -2228,10 +2227,7 @@ prt_file_error = FALSE; } if (prt_ps_file_name != NULL) - { - vim_free(prt_ps_file_name); - prt_ps_file_name = NULL; - } + VIM_CLEAR(prt_ps_file_name); } static float @@ -3386,6 +3382,7 @@ #ifdef FEAT_MBYTE int in_ascii; int half_width; + char_u *tofree = NULL; #endif char_width = prt_char_width; @@ -3511,19 +3508,15 @@ #ifdef FEAT_MBYTE if (prt_do_conv) - { /* Convert from multi-byte to 8-bit encoding */ - p = string_convert(&prt_conv, p, &len); - if (p == NULL) - p = (char_u *)""; - } + tofree = p = string_convert(&prt_conv, p, &len); if (prt_out_mbyte) { /* Multi-byte character strings are represented more efficiently as hex * strings when outputting clean 8 bit PS. */ - do + while (len-- > 0) { ch = prt_hexchar[(unsigned)(*p) >> 4]; ga_append(&prt_ps_buffer, ch); @@ -3531,7 +3524,6 @@ ga_append(&prt_ps_buffer, ch); p++; } - while (--len); } else #endif @@ -3578,8 +3570,7 @@ #ifdef FEAT_MBYTE /* Need to free any translated characters */ - if (prt_do_conv && (*p != NUL)) - vim_free(p); + vim_free(tofree); #endif prt_text_run += char_width; diff -Nru vim-8.0.1453/src/if_cscope.c vim-8.0.1766/src/if_cscope.c --- vim-8.0.1453/src/if_cscope.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/if_cscope.c 2018-04-26 20:30:33.000000000 +0000 @@ -1147,17 +1147,15 @@ return FALSE; } -# ifdef FEAT_AUTOCMD if (*qfpos != '0' && apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope", curbuf->b_fname, TRUE, curbuf)) { -# ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (aborting()) return FALSE; -# endif - } # endif + } } #endif @@ -1251,10 +1249,8 @@ postponed_split = 0; } -# ifdef FEAT_AUTOCMD apply_autocmds(EVENT_QUICKFIXCMDPOST, (char_u *)"cscope", curbuf->b_fname, TRUE, curbuf); -# endif if (use_ll) /* * In the location list window, use the displayed location @@ -1479,8 +1475,7 @@ { if ((csinfo[i].ppath = (char *)alloc((unsigned)strlen(ppath) + 1)) == NULL) { - vim_free(csinfo[i].fname); - csinfo[i].fname = NULL; + VIM_CLEAR(csinfo[i].fname); return -1; } (void)strcpy(csinfo[i].ppath, (const char *)ppath); @@ -1491,10 +1486,8 @@ { if ((csinfo[i].flags = (char *)alloc((unsigned)strlen(flags) + 1)) == NULL) { - vim_free(csinfo[i].fname); - vim_free(csinfo[i].ppath); - csinfo[i].fname = NULL; - csinfo[i].ppath = NULL; + VIM_CLEAR(csinfo[i].fname); + VIM_CLEAR(csinfo[i].ppath); return -1; } (void)strcpy(csinfo[i].flags, (const char *)flags); @@ -1939,10 +1932,8 @@ if (totsofar == 0) { /* No matches, free the arrays and return NULL in "*matches_p". */ - vim_free(matches); - matches = NULL; - vim_free(cntxts); - cntxts = NULL; + VIM_CLEAR(matches); + VIM_CLEAR(cntxts); } *matched = totsofar; *matches_p = matches; @@ -2445,7 +2436,7 @@ if (csdir != NULL) { vim_strncpy(csdir, (char_u *)csinfo[i].fname, - gettail((char_u *)csinfo[i].fname) + gettail((char_u *)csinfo[i].fname) - (char_u *)csinfo[i].fname); len += (int)STRLEN(csdir); } diff -Nru vim-8.0.1453/src/if_perl.xs vim-8.0.1766/src/if_perl.xs --- vim-8.0.1453/src/if_perl.xs 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/if_perl.xs 2018-04-26 20:30:33.000000000 +0000 @@ -1558,7 +1558,7 @@ pat = (char_u *)SvPV(sv, len); ++emsg_off; - b = buflist_findpat(pat, pat+len, FALSE, FALSE, FALSE); + b = buflist_findpat(pat, pat + len, TRUE, FALSE, FALSE); --emsg_off; } diff -Nru vim-8.0.1453/src/if_py_both.h vim-8.0.1766/src/if_py_both.h --- vim-8.0.1453/src/if_py_both.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/if_py_both.h 2018-04-26 20:30:33.000000000 +0000 @@ -5996,7 +5996,7 @@ PyObject *capsule; char hexBuf[sizeof(void *) * 2 + 3]; - sprintf(hexBuf, "%p", obj); + sprintf(hexBuf, "%p", (void *)obj); # ifdef PY_USE_CAPSULE capsule = PyDict_GetItemString(lookup_dict, hexBuf); diff -Nru vim-8.0.1453/src/if_python3.c vim-8.0.1766/src/if_python3.c --- vim-8.0.1453/src/if_python3.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/if_python3.c 2018-04-26 20:30:33.000000000 +0000 @@ -34,11 +34,6 @@ #include -/* Python.h defines _POSIX_THREADS itself (if needed) */ -#ifdef _POSIX_THREADS -# undef _POSIX_THREADS -#endif - #if defined(_WIN32) && defined(HAVE_FCNTL_H) # undef HAVE_FCNTL_H #endif @@ -605,7 +600,10 @@ py3_runtime_link_init(char *libname, int verbose) { int i; - void *ucs_from_string, *ucs_decode, *ucs_as_encoded_string; + PYTHON_PROC *ucs_from_string = (PYTHON_PROC *)&py3_PyUnicode_FromString; + PYTHON_PROC *ucs_decode = (PYTHON_PROC *)&py3_PyUnicode_Decode; + PYTHON_PROC *ucs_as_encoded_string = + (PYTHON_PROC *)&py3_PyUnicode_AsEncodedString; # if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON) /* Can't have Python and Python3 loaded at the same time. @@ -646,33 +644,29 @@ /* Load unicode functions separately as only the ucs2 or the ucs4 functions * will be present in the library. */ # if PY_VERSION_HEX >= 0x030300f0 - ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicode_FromString"); - ucs_decode = symbol_from_dll(hinstPy3, "PyUnicode_Decode"); - ucs_as_encoded_string = symbol_from_dll(hinstPy3, + *ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicode_FromString"); + *ucs_decode = symbol_from_dll(hinstPy3, "PyUnicode_Decode"); + *ucs_as_encoded_string = symbol_from_dll(hinstPy3, "PyUnicode_AsEncodedString"); # else - ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_FromString"); - ucs_decode = symbol_from_dll(hinstPy3, + *ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_FromString"); + *ucs_decode = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_Decode"); - ucs_as_encoded_string = symbol_from_dll(hinstPy3, + *ucs_as_encoded_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_AsEncodedString"); - if (!ucs_from_string || !ucs_decode || !ucs_as_encoded_string) + if (*ucs_from_string == NULL || *ucs_decode == NULL + || *ucs_as_encoded_string == NULL) { - ucs_from_string = symbol_from_dll(hinstPy3, + *ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS4_FromString"); - ucs_decode = symbol_from_dll(hinstPy3, + *ucs_decode = symbol_from_dll(hinstPy3, "PyUnicodeUCS4_Decode"); - ucs_as_encoded_string = symbol_from_dll(hinstPy3, + *ucs_as_encoded_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS4_AsEncodedString"); } # endif - if (ucs_from_string && ucs_decode && ucs_as_encoded_string) - { - py3_PyUnicode_FromString = ucs_from_string; - py3_PyUnicode_Decode = ucs_decode; - py3_PyUnicode_AsEncodedString = ucs_as_encoded_string; - } - else + if (*ucs_from_string == NULL || *ucs_decode == NULL + || *ucs_as_encoded_string == NULL) { close_dll(hinstPy3); hinstPy3 = 0; @@ -821,7 +815,7 @@ #endif if (Py_IsInitialized()) { - // acquire lock before finalizing + /* acquire lock before finalizing */ PyGILState_Ensure(); Py_Finalize(); diff -Nru vim-8.0.1453/src/if_python.c vim-8.0.1766/src/if_python.c --- vim-8.0.1453/src/if_python.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/if_python.c 2018-04-26 20:30:33.000000000 +0000 @@ -74,7 +74,7 @@ #undef HAVE_FCNTL_H /* Clash with os_win32.h */ #define PyBytes_FromString PyString_FromString -#define PyBytes_Check PyString_Check +#define PyBytes_Check PyString_Check #define PyBytes_AsStringAndSize PyString_AsStringAndSize #if !defined(FEAT_PYTHON) && defined(PROTO) @@ -672,7 +672,8 @@ python_runtime_link_init(char *libname, int verbose) { int i; - void *ucs_as_encoded_string; + PYTHON_PROC *ucs_as_encoded_string = + (PYTHON_PROC*)&py_PyUnicode_AsEncodedString; #if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3) /* Can't have Python and Python3 loaded at the same time. @@ -711,14 +712,12 @@ /* Load unicode functions separately as only the ucs2 or the ucs4 functions * will be present in the library. */ - ucs_as_encoded_string = symbol_from_dll(hinstPython, + *ucs_as_encoded_string = symbol_from_dll(hinstPython, "PyUnicodeUCS2_AsEncodedString"); - if (ucs_as_encoded_string == NULL) - ucs_as_encoded_string = symbol_from_dll(hinstPython, + if (*ucs_as_encoded_string == NULL) + *ucs_as_encoded_string = symbol_from_dll(hinstPython, "PyUnicodeUCS4_AsEncodedString"); - if (ucs_as_encoded_string != NULL) - py_PyUnicode_AsEncodedString = ucs_as_encoded_string; - else + if (*ucs_as_encoded_string == NULL) { close_dll(hinstPython); hinstPython = 0; diff -Nru vim-8.0.1453/src/if_xcmdsrv.c vim-8.0.1766/src/if_xcmdsrv.c --- vim-8.0.1453/src/if_xcmdsrv.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/if_xcmdsrv.c 2018-04-26 20:30:33.000000000 +0000 @@ -1123,7 +1123,7 @@ * This procedure is invoked by the various X event loops throughout Vims when * a property changes on the communication window. This procedure reads the * property and enqueues command requests and responses. If immediate is true, - * it runs the event immediatly instead of enqueuing it. Immediate can cause + * it runs the event immediately instead of enqueuing it. Immediate can cause * unintended behavior and should only be used for code that blocks for a * response. */ @@ -1480,14 +1480,12 @@ ga_concat(&(r->strings), str); ga_append(&(r->strings), NUL); } -#ifdef FEAT_AUTOCMD { char_u winstr[30]; sprintf((char *)winstr, "0x%x", (unsigned int)win); apply_autocmds(EVENT_REMOTEREPLY, winstr, str, TRUE, curbuf); } -#endif vim_free(tofree); } else diff -Nru vim-8.0.1453/src/iscygpty.c vim-8.0.1766/src/iscygpty.c --- vim-8.0.1453/src/iscygpty.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/iscygpty.c 2018-04-26 20:30:33.000000000 +0000 @@ -62,20 +62,18 @@ //#define USE_DYNFILEID #ifdef USE_DYNFILEID typedef BOOL (WINAPI *pfnGetFileInformationByHandleEx)( - HANDLE hFile, - FILE_INFO_BY_HANDLE_CLASS FileInformationClass, - LPVOID lpFileInformation, - DWORD dwBufferSize -); + HANDLE hFile, + FILE_INFO_BY_HANDLE_CLASS FileInformationClass, + LPVOID lpFileInformation, + DWORD dwBufferSize); static pfnGetFileInformationByHandleEx pGetFileInformationByHandleEx = NULL; # ifndef USE_FILEEXTD static BOOL WINAPI stub_GetFileInformationByHandleEx( - HANDLE hFile, - FILE_INFO_BY_HANDLE_CLASS FileInformationClass, - LPVOID lpFileInformation, - DWORD dwBufferSize - ) + HANDLE hFile, + FILE_INFO_BY_HANDLE_CLASS FileInformationClass, + LPVOID lpFileInformation, + DWORD dwBufferSize) { return FALSE; } diff -Nru vim-8.0.1453/src/json.c vim-8.0.1766/src/json.c --- vim-8.0.1453/src/json.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/json.c 2018-04-26 20:30:33.000000000 +0000 @@ -217,7 +217,7 @@ case VAR_NUMBER: vim_snprintf((char *)numbuf, NUMBUFLEN, "%lld", - val->vval.v_number); + (long long)val->vval.v_number); ga_concat(gap, numbuf); break; @@ -621,7 +621,9 @@ if (top_item != NULL && top_item->jd_type == JSON_OBJECT_KEY && (options & JSON_JS) && reader->js_buf[reader->js_used] != '"' - && reader->js_buf[reader->js_used] != '\'') + && reader->js_buf[reader->js_used] != '\'' + && reader->js_buf[reader->js_used] != '[' + && reader->js_buf[reader->js_used] != '{') { char_u *key; @@ -642,6 +644,11 @@ switch (*p) { case '[': /* start of array */ + if (top_item && top_item->jd_type == JSON_OBJECT_KEY) + { + retval = FAIL; + break; + } if (ga_grow(&stack, 1) == FAIL) { retval = FAIL; @@ -668,6 +675,11 @@ continue; case '{': /* start of object */ + if (top_item && top_item->jd_type == JSON_OBJECT_KEY) + { + retval = FAIL; + break; + } if (ga_grow(&stack, 1) == FAIL) { retval = FAIL; diff -Nru vim-8.0.1453/src/json_test.c vim-8.0.1766/src/json_test.c --- vim-8.0.1453/src/json_test.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/json_test.c 2018-04-26 20:30:33.000000000 +0000 @@ -162,7 +162,7 @@ reader.js_fill = fill_from_cookie; reader.js_used = 0; reader.js_buf = (char_u *)" [ \"a\" , 123 "; - reader.js_cookie = " [ \"a\" , 123 ] "; + reader.js_cookie = " [ \"a\" , 123 ] "; assert(json_find_end(&reader, 0) == OK); reader.js_buf = (char_u *)" [ \"a\" , "; assert(json_find_end(&reader, 0) == OK); @@ -186,7 +186,7 @@ reader.js_used = 0; reader.js_buf = (char_u *)" \"foo"; reader.js_end = reader.js_buf + STRLEN(reader.js_buf); - reader.js_cookie = " \"foobar\" "; + reader.js_cookie = " \"foobar\" "; assert(json_decode_string(&reader, NULL, '"') == OK); } #endif diff -Nru vim-8.0.1453/src/libvterm/bin/unterm.c vim-8.0.1766/src/libvterm/bin/unterm.c --- vim-8.0.1453/src/libvterm/bin/unterm.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/bin/unterm.c 2018-04-26 20:30:33.000000000 +0000 @@ -9,7 +9,7 @@ #include "vterm.h" #define DEFINE_INLINES -#include "../src/utf8.h" /* fill_utf8 */ +#include "../src/utf8.h" // fill_utf8 #define streq(a,b) (!strcmp(a,b)) @@ -21,7 +21,7 @@ static enum { FORMAT_PLAIN, - FORMAT_SGR + FORMAT_SGR, } format = FORMAT_PLAIN; static int col2index(VTermColor target) @@ -44,8 +44,8 @@ break; case FORMAT_SGR: { - /* If all 7 attributes change, that means 7 SGRs max */ - /* Each colour could consume up to 3 */ + // If all 7 attributes change, that means 7 SGRs max + // Each colour could consume up to 3 int sgr[7 + 2*3]; int sgri = 0; if(!prevcell->attrs.bold && cell->attrs.bold) @@ -95,8 +95,8 @@ sgr[sgri++] = 90 + (index - 8); else { sgr[sgri++] = 38; - sgr[sgri++] = 5 | (1<<31); - sgr[sgri++] = index | (1<<31); + sgr[sgri++] = 5 | CSI_ARG_FLAG_MORE; + sgr[sgri++] = index | CSI_ARG_FLAG_MORE; } } @@ -112,8 +112,8 @@ sgr[sgri++] = 100 + (index - 8); else { sgr[sgri++] = 48; - sgr[sgri++] = 5 | (1<<31); - sgr[sgri++] = index | (1<<31); + sgr[sgri++] = 5 | CSI_ARG_FLAG_MORE; + sgr[sgri++] = index | CSI_ARG_FLAG_MORE; } } @@ -125,9 +125,9 @@ int i; for(i = 0; i < sgri; i++) printf(!i ? "%d" : - sgr[i] & (1<<31) ? ":%d" : + CSI_ARG_HAS_MORE(sgr[i]) ? ":%d" : ";%d", - sgr[i] & ~(1<<31)); + CSI_ARG(sgr[i])); } printf("m"); } @@ -283,5 +283,6 @@ close(fd); vterm_free(vt); + return 0; } diff -Nru vim-8.0.1453/src/libvterm/bin/vterm-ctrl.c vim-8.0.1766/src/libvterm/bin/vterm-ctrl.c --- vim-8.0.1453/src/libvterm/bin/vterm-ctrl.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/bin/vterm-ctrl.c 2018-04-26 20:30:33.000000000 +0000 @@ -35,7 +35,7 @@ typedef enum { OFF, ON, - QUERY + QUERY, } BoolQuery; static BoolQuery getboolq(int *argip, int argc, char *argv[]) @@ -53,6 +53,7 @@ "curblink [off|on|query]", "curshape [block|under|bar|query]", "mouse [off|click|clickdrag|motion]", + "reportfocus [off|on|query]", "altscreen [off|on|query]", "bracketpaste [off|on|query]", "icontitle [STR]", @@ -81,9 +82,9 @@ return ret; } -static void await_c1(int c1) +static void await_c1(unsigned char c1) { - int c; + unsigned char c; /* await CSI - 8bit or 2byte 7bit form */ int in_esc = FALSE; @@ -104,7 +105,7 @@ unsigned char csi[32]; int i = 0; - await_c1(0x9B); /* CSI */ + await_c1(0x9B); // CSI /* TODO: This really should be a more robust CSI parser */ @@ -115,7 +116,7 @@ } csi[++i] = 0; - /* TODO: returns longer than 32? */ + // TODO: returns longer than 32? return strdup((char *)csi); } @@ -130,7 +131,7 @@ for(i = 0; i < sizeof(dcs)-1; ) { char c = getchar(); - if(c == 0x9c) /* ST */ + if(c == 0x9c) // ST break; if(in_esc && c == 0x5c) break; @@ -300,12 +301,12 @@ do_dec_mode(12, getboolq(&argi, argc, argv), "curblink"); } else if(streq(arg, "curshape")) { - /* TODO: This ought to query the current value of DECSCUSR because it */ - /* may need blinking on or off */ + // TODO: This ought to query the current value of DECSCUSR because it + // may need blinking on or off const char *choices[] = {"block", "under", "bar", "query", NULL}; int shape = getchoice(&argi, argc, argv, choices); switch(shape) { - case 3: /* query */ + case 3: // query shape = query_rqss_numeric(" q"); switch(shape) { case 1: case 2: @@ -340,6 +341,9 @@ printf("\x1b[?1003h"); break; } } + else if(streq(arg, "reportfocus")) { + do_dec_mode(1004, getboolq(&argi, argc, argv), "reportfocus"); + } else if(streq(arg, "altscreen")) { do_dec_mode(1049, getboolq(&argi, argc, argv), "altscreen"); } diff -Nru vim-8.0.1453/src/libvterm/bin/vterm-dump.c vim-8.0.1766/src/libvterm/bin/vterm-dump.c --- vim-8.0.1453/src/libvterm/bin/vterm-dump.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/bin/vterm-dump.c 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -/* Require getopt(3) */ +// Require getopt(3) #define _XOPEN_SOURCE #include @@ -22,28 +22,28 @@ int i; for(i = 0; i < len; /* none */) { - if(b[i] < 0x20) /* C0 */ + if(b[i] < 0x20) // C0 break; - else if(b[i] < 0x80) /* ASCII */ + else if(b[i] < 0x80) // ASCII i++; - else if(b[i] < 0xa0) /* C1 */ + else if(b[i] < 0xa0) // C1 break; - else if(b[i] < 0xc0) /* UTF-8 continuation */ + else if(b[i] < 0xc0) // UTF-8 continuation break; - else if(b[i] < 0xe0) { /* UTF-8 2-byte */ - /* 2-byte UTF-8 */ + else if(b[i] < 0xe0) { // UTF-8 2-byte + // 2-byte UTF-8 if(len < i+2) break; i += 2; } - else if(b[i] < 0xf0) { /* UTF-8 3-byte */ + else if(b[i] < 0xf0) { // UTF-8 3-byte if(len < i+3) break; i += 3; } - else if(b[i] < 0xf8) { /* UTF-8 4-byte */ + else if(b[i] < 0xf8) { // UTF-8 4-byte if(len < i+4) break; i += 4; } - else /* otherwise invalid */ + else // otherwise invalid break; } @@ -200,7 +200,7 @@ file = argv[optind++]; if(!file || streq(file, "-")) - fd = 0; /* stdin */ + fd = 0; // stdin else { fd = open(file, O_RDONLY); if(fd == -1) { @@ -227,5 +227,6 @@ close(fd); vterm_free(vt); + return 0; } diff -Nru vim-8.0.1453/src/libvterm/doc/seqs.txt vim-8.0.1766/src/libvterm/doc/seqs.txt --- vim-8.0.1453/src/libvterm/doc/seqs.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/doc/seqs.txt 2018-04-26 20:30:33.000000000 +0000 @@ -151,6 +151,7 @@ DECSM 1000 = Mouse click/release tracking DECSM 1002 = Mouse click/release/drag tracking DECSM 1003 = Mouse all movements tracking + DECSM 1004 = Focus in/out reporting DECSM 1005 = Mouse protocol extended (UTF-8) - not recommended DECSM 1006 = Mouse protocol SGR DECSM 1015 = Mouse protocol rxvt diff -Nru vim-8.0.1453/src/libvterm/doc/URLs vim-8.0.1766/src/libvterm/doc/URLs --- vim-8.0.1453/src/libvterm/doc/URLs 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/doc/URLs 2018-04-26 20:30:33.000000000 +0000 @@ -9,3 +9,6 @@ Digital VT220 Programmer Reference Manual http://vt100.net/docs/vt220-rm/ + +Summary of ANSI standards for ASCII terminals + http://www.inwap.com/pdp10/ansicode.txt diff -Nru vim-8.0.1453/src/libvterm/include/vterm.h vim-8.0.1766/src/libvterm/include/vterm.h --- vim-8.0.1453/src/libvterm/include/vterm.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/include/vterm.h 2018-04-26 20:30:33.000000000 +0000 @@ -96,7 +96,9 @@ VTERM_VALUETYPE_BOOL = 1, VTERM_VALUETYPE_INT, VTERM_VALUETYPE_STRING, - VTERM_VALUETYPE_COLOR + VTERM_VALUETYPE_COLOR, + + VTERM_N_VALUETYPES } VTermValueType; typedef union { @@ -108,41 +110,49 @@ typedef enum { /* VTERM_ATTR_NONE = 0 */ - VTERM_ATTR_BOLD = 1, /* bool: 1, 22 */ - VTERM_ATTR_UNDERLINE, /* number: 4, 21, 24 */ - VTERM_ATTR_ITALIC, /* bool: 3, 23 */ - VTERM_ATTR_BLINK, /* bool: 5, 25 */ - VTERM_ATTR_REVERSE, /* bool: 7, 27 */ - VTERM_ATTR_STRIKE, /* bool: 9, 29 */ - VTERM_ATTR_FONT, /* number: 10-19 */ - VTERM_ATTR_FOREGROUND, /* color: 30-39 90-97 */ - VTERM_ATTR_BACKGROUND /* color: 40-49 100-107 */ + VTERM_ATTR_BOLD = 1, // bool: 1, 22 + VTERM_ATTR_UNDERLINE, // number: 4, 21, 24 + VTERM_ATTR_ITALIC, // bool: 3, 23 + VTERM_ATTR_BLINK, // bool: 5, 25 + VTERM_ATTR_REVERSE, // bool: 7, 27 + VTERM_ATTR_STRIKE, // bool: 9, 29 + VTERM_ATTR_FONT, // number: 10-19 + VTERM_ATTR_FOREGROUND, // color: 30-39 90-97 + VTERM_ATTR_BACKGROUND, // color: 40-49 100-107 + + VTERM_N_ATTRS } VTermAttr; typedef enum { /* VTERM_PROP_NONE = 0 */ - VTERM_PROP_CURSORVISIBLE = 1, /* bool */ - VTERM_PROP_CURSORBLINK, /* bool */ - VTERM_PROP_ALTSCREEN, /* bool */ - VTERM_PROP_TITLE, /* string */ - VTERM_PROP_ICONNAME, /* string */ - VTERM_PROP_REVERSE, /* bool */ - VTERM_PROP_CURSORSHAPE, /* number */ - VTERM_PROP_MOUSE, /* number */ - VTERM_PROP_CURSORCOLOR /* string */ + VTERM_PROP_CURSORVISIBLE = 1, // bool + VTERM_PROP_CURSORBLINK, // bool + VTERM_PROP_ALTSCREEN, // bool + VTERM_PROP_TITLE, // string + VTERM_PROP_ICONNAME, // string + VTERM_PROP_REVERSE, // bool + VTERM_PROP_CURSORSHAPE, // number + VTERM_PROP_MOUSE, // number + VTERM_PROP_CURSORCOLOR, // string + + VTERM_N_PROPS } VTermProp; enum { VTERM_PROP_CURSORSHAPE_BLOCK = 1, VTERM_PROP_CURSORSHAPE_UNDERLINE, - VTERM_PROP_CURSORSHAPE_BAR_LEFT + VTERM_PROP_CURSORSHAPE_BAR_LEFT, + + VTERM_N_PROP_CURSORSHAPES }; enum { VTERM_PROP_MOUSE_NONE = 0, VTERM_PROP_MOUSE_CLICK, VTERM_PROP_MOUSE_DRAG, - VTERM_PROP_MOUSE_MOVE + VTERM_PROP_MOUSE_MOVE, + + VTERM_N_PROP_MOUSES }; typedef struct { @@ -201,9 +211,9 @@ * Button 4 is scroll wheel down, button 5 is scroll wheel up. */ void vterm_mouse_button(VTerm *vt, int button, int pressed, VTermModifier mod); -/* ------------ - * Parser layer - * ------------ */ +// ------------ +// Parser layer +// ------------ /* Flag to indicate non-final subparameters in a single CSI parameter. * Consider @@ -213,8 +223,8 @@ * * Don't confuse this with the final byte of the CSI escape; 'a' in this case. */ -#define CSI_ARG_FLAG_MORE (1<<30) -#define CSI_ARG_MASK (~(1<<30)) +#define CSI_ARG_FLAG_MORE (1U<<31) +#define CSI_ARG_MASK (~(1U<<31)) #define CSI_ARG_HAS_MORE(a) ((a) & CSI_ARG_FLAG_MORE) #define CSI_ARG(a) ((a) & CSI_ARG_MASK) @@ -239,9 +249,9 @@ void vterm_parser_set_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user); void *vterm_parser_get_cbdata(VTerm *vt); -/* ----------- - * State layer - * ----------- */ +// ----------- +// State layer +// ----------- typedef struct { int (*putglyph)(VTermGlyphInfo *info, VTermPos pos, void *user); @@ -259,12 +269,25 @@ int (*setlineinfo)(int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user); } VTermStateCallbacks; +typedef struct { + VTermPos pos; + int buttons; +#define MOUSE_BUTTON_LEFT 0x01 +#define MOUSE_BUTTON_MIDDLE 0x02 +#define MOUSE_BUTTON_RIGHT 0x04 + int flags; +#define MOUSE_WANT_CLICK 0x01 +#define MOUSE_WANT_DRAG 0x02 +#define MOUSE_WANT_MOVE 0x04 + /* useful to add protocol? */ +} VTermMouseState; + VTermState *vterm_obtain_state(VTerm *vt); void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user); void *vterm_state_get_cbdata(VTermState *state); -/* Only invokes control, csi, osc, dcs */ +// Only invokes control, csi, osc, dcs void vterm_state_set_unrecognised_fallbacks(VTermState *state, const VTermParserCallbacks *fallbacks, void *user); void *vterm_state_get_unrecognised_fbdata(VTermState *state); @@ -272,6 +295,7 @@ void vterm_state_reset(VTermState *state, int hard); void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos); +void vterm_state_get_mousestate(const VTermState *state, VTermMouseState *mousestate); void vterm_state_get_default_colors(const VTermState *state, VTermColor *default_fg, VTermColor *default_bg); void vterm_state_get_palette_color(const VTermState *state, int index, VTermColor *col); void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermColor *default_bg); @@ -279,11 +303,13 @@ void vterm_state_set_bold_highbright(VTermState *state, int bold_is_highbright); int vterm_state_get_penattr(const VTermState *state, VTermAttr attr, VTermValue *val); int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val); +void vterm_state_focus_in(VTermState *state); +void vterm_state_focus_out(VTermState *state); const VTermLineInfo *vterm_state_get_lineinfo(const VTermState *state, int row); -/* ------------ - * Screen layer - * ------------ */ +// ------------ +// Screen layer +// ------------ typedef struct { unsigned int bold : 1; @@ -330,7 +356,7 @@ void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user); void *vterm_screen_get_cbdata(VTermScreen *screen); -/* Only invokes control, csi, osc, dcs */ +// Only invokes control, csi, osc, dcs void vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermParserCallbacks *fallbacks, void *user); void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen); @@ -343,7 +369,9 @@ VTERM_DAMAGE_CELL, /* every cell */ VTERM_DAMAGE_ROW, /* entire rows */ VTERM_DAMAGE_SCREEN, /* entire screen */ - VTERM_DAMAGE_SCROLL /* entire screen + scrollrect */ + VTERM_DAMAGE_SCROLL, /* entire screen + scrollrect */ + + VTERM_N_DAMAGES } VTermDamageSize; /* Invoke the relevant callbacks to update the screen. */ @@ -370,7 +398,9 @@ VTERM_ATTR_STRIKE_MASK = 1 << 5, VTERM_ATTR_FONT_MASK = 1 << 6, VTERM_ATTR_FOREGROUND_MASK = 1 << 7, - VTERM_ATTR_BACKGROUND_MASK = 1 << 8 + VTERM_ATTR_BACKGROUND_MASK = 1 << 8, + + VTERM_ALL_ATTRS_MASK = (1 << 9) - 1 } VTermAttrMask; int vterm_screen_get_attrs_extent(const VTermScreen *screen, VTermRect *extent, VTermPos pos, VTermAttrMask attrs); @@ -379,9 +409,9 @@ int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos); -/* --------- - * Utilities - * --------- */ +// --------- +// Utilities +// --------- VTermValueType vterm_get_attr_type(VTermAttr attr); VTermValueType vterm_get_prop_type(VTermProp prop); diff -Nru vim-8.0.1453/src/libvterm/include/vterm_keycodes.h vim-8.0.1766/src/libvterm/include/vterm_keycodes.h --- vim-8.0.1453/src/libvterm/include/vterm_keycodes.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/include/vterm_keycodes.h 2018-04-26 20:30:33.000000000 +0000 @@ -5,9 +5,12 @@ VTERM_MOD_NONE = 0x00, VTERM_MOD_SHIFT = 0x01, VTERM_MOD_ALT = 0x02, - VTERM_MOD_CTRL = 0x04 + VTERM_MOD_CTRL = 0x04, + + VTERM_ALL_MODS_MASK = 0x07 } VTermModifier; +/* The order here must match keycodes[] in src/keyboard.c! */ typedef enum { VTERM_KEY_NONE, @@ -52,7 +55,8 @@ VTERM_KEY_KP_ENTER, VTERM_KEY_KP_EQUAL, - VTERM_KEY_MAX /* Must be last */ + VTERM_KEY_MAX, // Must be last + VTERM_N_KEYS = VTERM_KEY_MAX } VTermKey; #define VTERM_KEY_FUNCTION(n) (VTERM_KEY_FUNCTION_0+(n)) diff -Nru vim-8.0.1453/src/libvterm/README vim-8.0.1766/src/libvterm/README --- vim-8.0.1453/src/libvterm/README 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/README 2018-04-26 20:30:33.000000000 +0000 @@ -10,3 +10,21 @@ - Add a .gitignore file. - Convert from C99 to C90. - Other changes to support embedding in Vim. + + +To merge in changes from Github, do this: +- Commit any pending changes. +- Setup the merge tool: + git config merge.tool vimdiff + git config merge.conflictstyle diff3 + git config mergetool.prompt false +- Run the merge tool: + git mergetool + This will open a four-way diff between: + LOCAL - your current version + BASE - version as it was at your last sync + REMOTE - version at head on Github + MERGED - best-effort merge of LOCAL and REMOTE + Now find places where automatic merge didn't work, they are marked with + <<<<<<<<, ======= and >>>>>>> + Fix those places in MERGED, remove the markers, and save the file :wqall. diff -Nru vim-8.0.1453/src/libvterm/src/encoding.c vim-8.0.1766/src/libvterm/src/encoding.c --- vim-8.0.1453/src/libvterm/src/encoding.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/src/encoding.c 2018-04-26 20:30:33.000000000 +0000 @@ -7,11 +7,11 @@ #endif struct UTF8DecoderData { - /* number of bytes remaining in this codepoint */ + // number of bytes remaining in this codepoint int bytes_remaining; - /* number of bytes total in this codepoint once it's finished - (for detecting overlongs) */ + // number of bytes total in this codepoint once it's finished + // (for detecting overlongs) int bytes_total; int this_cp; @@ -42,21 +42,23 @@ printf(" pos=%zd c=%02x rem=%d\n", *pos, c, data->bytes_remaining); #endif - if(c < 0x20) /* C0 */ + if(c < 0x20) // C0 return; else if(c >= 0x20 && c < 0x7f) { - if(data->bytes_remaining) + if(data->bytes_remaining) { + data->bytes_remaining = 0; cp[(*cpi)++] = UNICODE_INVALID; - + if (*cpi >= cplen) + break; + } cp[(*cpi)++] = c; #ifdef DEBUG_PRINT_UTF8 printf(" UTF-8 char: U+%04x\n", c); #endif - data->bytes_remaining = 0; } - else if(c == 0x7f) /* DEL */ + else if(c == 0x7f) // DEL return; else if(c >= 0x80 && c < 0xc0) { @@ -73,7 +75,7 @@ #ifdef DEBUG_PRINT_UTF8 printf(" UTF-8 raw char U+%04x bytelen=%d ", data->this_cp, data->bytes_total); #endif - /* Check for overlong sequences */ + // Check for overlong sequences switch(data->bytes_total) { case 2: if(data->this_cp < 0x0080) data->this_cp = UNICODE_INVALID; @@ -91,7 +93,7 @@ if(data->this_cp < 0x4000000) data->this_cp = UNICODE_INVALID; break; } - /* Now look for plain invalid ones */ + // Now look for plain invalid ones if((data->this_cp >= 0xD800 && data->this_cp <= 0xDFFF) || data->this_cp == 0xFFFE || data->this_cp == 0xFFFF) diff -Nru vim-8.0.1453/src/libvterm/src/keyboard.c vim-8.0.1766/src/libvterm/src/keyboard.c --- vim-8.0.1453/src/libvterm/src/keyboard.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/src/keyboard.c 2018-04-26 20:30:33.000000000 +0000 @@ -15,7 +15,7 @@ mod &= ~VTERM_MOD_SHIFT; if(mod == 0) { - /* Normal text - ignore just shift */ + // Normal text - ignore just shift char str[6]; int seqlen = fill_utf8(c, str); vterm_push_output_bytes(vt, str, seqlen); @@ -62,7 +62,7 @@ KEYCODE_CSI, KEYCODE_CSI_CURSOR, KEYCODE_CSINUM, - KEYCODE_KEYPAD + KEYCODE_KEYPAD, } type; char literal; int csinum; @@ -70,61 +70,61 @@ /* Order here must be exactly the same as VTermKey enum! */ static keycodes_s keycodes[] = { - { KEYCODE_NONE, 0, 0 }, /* NONE */ + { KEYCODE_NONE, 0, 0 }, // NONE - { KEYCODE_ENTER, '\r', 0 }, /* ENTER */ - { KEYCODE_TAB, '\t', 0 }, /* TAB */ - { KEYCODE_LITERAL, '\x7f', 0 }, /* BACKSPACE == ASCII DEL */ - { KEYCODE_LITERAL, '\x1b', 0 }, /* ESCAPE */ - - { KEYCODE_CSI_CURSOR, 'A', 0 }, /* UP */ - { KEYCODE_CSI_CURSOR, 'B', 0 }, /* DOWN */ - { KEYCODE_CSI_CURSOR, 'D', 0 }, /* LEFT */ - { KEYCODE_CSI_CURSOR, 'C', 0 }, /* RIGHT */ - - { KEYCODE_CSINUM, '~', 2 }, /* INS */ - { KEYCODE_CSINUM, '~', 3 }, /* DEL */ - { KEYCODE_CSI_CURSOR, 'H', 0 }, /* HOME */ - { KEYCODE_CSI_CURSOR, 'F', 0 }, /* END */ - { KEYCODE_CSINUM, '~', 5 }, /* PAGEUP */ - { KEYCODE_CSINUM, '~', 6 }, /* PAGEDOWN */ + { KEYCODE_ENTER, '\r', 0 }, // ENTER + { KEYCODE_TAB, '\t', 0 }, // TAB + { KEYCODE_LITERAL, '\x7f', 0 }, // BACKSPACE == ASCII DEL + { KEYCODE_LITERAL, '\x1b', 0 }, // ESCAPE + + { KEYCODE_CSI_CURSOR, 'A', 0 }, // UP + { KEYCODE_CSI_CURSOR, 'B', 0 }, // DOWN + { KEYCODE_CSI_CURSOR, 'D', 0 }, // LEFT + { KEYCODE_CSI_CURSOR, 'C', 0 }, // RIGHT + + { KEYCODE_CSINUM, '~', 2 }, // INS + { KEYCODE_CSINUM, '~', 3 }, // DEL + { KEYCODE_CSI_CURSOR, 'H', 0 }, // HOME + { KEYCODE_CSI_CURSOR, 'F', 0 }, // END + { KEYCODE_CSINUM, '~', 5 }, // PAGEUP + { KEYCODE_CSINUM, '~', 6 }, // PAGEDOWN }; static keycodes_s keycodes_fn[] = { - { KEYCODE_NONE, 0, 0 }, /* F0 - shouldn't happen */ - { KEYCODE_CSI_CURSOR, 'P', 0 }, /* F1 */ - { KEYCODE_CSI_CURSOR, 'Q', 0 }, /* F2 */ - { KEYCODE_CSI_CURSOR, 'R', 0 }, /* F3 */ - { KEYCODE_CSI_CURSOR, 'S', 0 }, /* F4 */ - { KEYCODE_CSINUM, '~', 15 }, /* F5 */ - { KEYCODE_CSINUM, '~', 17 }, /* F6 */ - { KEYCODE_CSINUM, '~', 18 }, /* F7 */ - { KEYCODE_CSINUM, '~', 19 }, /* F8 */ - { KEYCODE_CSINUM, '~', 20 }, /* F9 */ - { KEYCODE_CSINUM, '~', 21 }, /* F10 */ - { KEYCODE_CSINUM, '~', 23 }, /* F11 */ - { KEYCODE_CSINUM, '~', 24 }, /* F12 */ + { KEYCODE_NONE, 0, 0 }, // F0 - shouldn't happen + { KEYCODE_CSI_CURSOR, 'P', 0 }, // F1 + { KEYCODE_CSI_CURSOR, 'Q', 0 }, // F2 + { KEYCODE_CSI_CURSOR, 'R', 0 }, // F3 + { KEYCODE_CSI_CURSOR, 'S', 0 }, // F4 + { KEYCODE_CSINUM, '~', 15 }, // F5 + { KEYCODE_CSINUM, '~', 17 }, // F6 + { KEYCODE_CSINUM, '~', 18 }, // F7 + { KEYCODE_CSINUM, '~', 19 }, // F8 + { KEYCODE_CSINUM, '~', 20 }, // F9 + { KEYCODE_CSINUM, '~', 21 }, // F10 + { KEYCODE_CSINUM, '~', 23 }, // F11 + { KEYCODE_CSINUM, '~', 24 }, // F12 }; static keycodes_s keycodes_kp[] = { - { KEYCODE_KEYPAD, '0', 'p' }, /* KP_0 */ - { KEYCODE_KEYPAD, '1', 'q' }, /* KP_1 */ - { KEYCODE_KEYPAD, '2', 'r' }, /* KP_2 */ - { KEYCODE_KEYPAD, '3', 's' }, /* KP_3 */ - { KEYCODE_KEYPAD, '4', 't' }, /* KP_4 */ - { KEYCODE_KEYPAD, '5', 'u' }, /* KP_5 */ - { KEYCODE_KEYPAD, '6', 'v' }, /* KP_6 */ - { KEYCODE_KEYPAD, '7', 'w' }, /* KP_7 */ - { KEYCODE_KEYPAD, '8', 'x' }, /* KP_8 */ - { KEYCODE_KEYPAD, '9', 'y' }, /* KP_9 */ - { KEYCODE_KEYPAD, '*', 'j' }, /* KP_MULT */ - { KEYCODE_KEYPAD, '+', 'k' }, /* KP_PLUS */ - { KEYCODE_KEYPAD, ',', 'l' }, /* KP_COMMA */ - { KEYCODE_KEYPAD, '-', 'm' }, /* KP_MINUS */ - { KEYCODE_KEYPAD, '.', 'n' }, /* KP_PERIOD */ - { KEYCODE_KEYPAD, '/', 'o' }, /* KP_DIVIDE */ - { KEYCODE_KEYPAD, '\n', 'M' }, /* KP_ENTER */ - { KEYCODE_KEYPAD, '=', 'X' }, /* KP_EQUAL */ + { KEYCODE_KEYPAD, '0', 'p' }, // KP_0 + { KEYCODE_KEYPAD, '1', 'q' }, // KP_1 + { KEYCODE_KEYPAD, '2', 'r' }, // KP_2 + { KEYCODE_KEYPAD, '3', 's' }, // KP_3 + { KEYCODE_KEYPAD, '4', 't' }, // KP_4 + { KEYCODE_KEYPAD, '5', 'u' }, // KP_5 + { KEYCODE_KEYPAD, '6', 'v' }, // KP_6 + { KEYCODE_KEYPAD, '7', 'w' }, // KP_7 + { KEYCODE_KEYPAD, '8', 'x' }, // KP_8 + { KEYCODE_KEYPAD, '9', 'y' }, // KP_9 + { KEYCODE_KEYPAD, '*', 'j' }, // KP_MULT + { KEYCODE_KEYPAD, '+', 'k' }, // KP_PLUS + { KEYCODE_KEYPAD, ',', 'l' }, // KP_COMMA + { KEYCODE_KEYPAD, '-', 'm' }, // KP_MINUS + { KEYCODE_KEYPAD, '.', 'n' }, // KP_PERIOD + { KEYCODE_KEYPAD, '/', 'o' }, // KP_DIVIDE + { KEYCODE_KEYPAD, '\n', 'M' }, // KP_ENTER + { KEYCODE_KEYPAD, '=', 'X' }, // KP_EQUAL }; void vterm_keyboard_key(VTerm *vt, VTermKey key, VTermModifier mod) diff -Nru vim-8.0.1453/src/libvterm/src/mouse.c vim-8.0.1766/src/libvterm/src/mouse.c --- vim-8.0.1453/src/libvterm/src/mouse.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/src/mouse.c 2018-04-26 20:30:33.000000000 +0000 @@ -63,9 +63,9 @@ if((state->mouse_flags & MOUSE_WANT_DRAG && state->mouse_buttons) || (state->mouse_flags & MOUSE_WANT_MOVE)) { - int button = state->mouse_buttons & 0x01 ? 1 : - state->mouse_buttons & 0x02 ? 2 : - state->mouse_buttons & 0x04 ? 3 : 4; + int button = state->mouse_buttons & MOUSE_BUTTON_LEFT ? 1 : + state->mouse_buttons & MOUSE_BUTTON_MIDDLE ? 2 : + state->mouse_buttons & MOUSE_BUTTON_RIGHT ? 3 : 4; output_mouse(state, button-1 + 0x20, 1, mod, col, row); } } diff -Nru vim-8.0.1453/src/libvterm/src/parser.c vim-8.0.1766/src/libvterm/src/parser.c --- vim-8.0.1453/src/libvterm/src/parser.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/src/parser.c 2018-04-26 20:30:33.000000000 +0000 @@ -3,188 +3,123 @@ #include #include -#define CSI_ARGS_MAX 16 -#define CSI_LEADER_MAX 16 -#define CSI_INTERMED_MAX 16 +#undef DEBUG_PARSER + +static int is_intermed(unsigned char c) +{ + return c >= 0x20 && c <= 0x2f; +} static void do_control(VTerm *vt, unsigned char control) { - if(vt->parser_callbacks && vt->parser_callbacks->control) - if((*vt->parser_callbacks->control)(control, vt->cbdata)) + if(vt->parser.callbacks && vt->parser.callbacks->control) + if((*vt->parser.callbacks->control)(control, vt->parser.cbdata)) return; DEBUG_LOG1("libvterm: Unhandled control 0x%02x\n", control); } -static void do_string_csi(VTerm *vt, const char *args, size_t arglen, char command) +static void do_csi(VTerm *vt, char command) { - int i = 0; - - int leaderlen = 0; - char leader[CSI_LEADER_MAX]; - int argcount = 1; /* Always at least 1 arg */ - long csi_args[CSI_ARGS_MAX]; - int argi; - int intermedlen = 0; - char intermed[CSI_INTERMED_MAX]; - - /* Extract leader bytes 0x3c to 0x3f */ - for( ; i < (int)arglen; i++) { - if(args[i] < 0x3c || args[i] > 0x3f) - break; - if(leaderlen < CSI_LEADER_MAX-1) - leader[leaderlen++] = args[i]; - } - - leader[leaderlen] = 0; - - for( ; i < (int)arglen; i++) - if(args[i] == 0x3b || args[i] == 0x3a) /* ; or : */ - argcount++; - - /* TODO: Consider if these buffers should live in the VTerm struct itself */ - if(argcount > CSI_ARGS_MAX) - argcount = CSI_ARGS_MAX; - - for(argi = 0; argi < argcount; argi++) - csi_args[argi] = CSI_ARG_MISSING; - - argi = 0; - for(i = leaderlen; i < (int)arglen && argi < argcount; i++) { - switch(args[i]) { - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: - case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: - if(csi_args[argi] == CSI_ARG_MISSING) - csi_args[argi] = 0; - csi_args[argi] *= 10; - csi_args[argi] += args[i] - '0'; - break; - case 0x3a: - csi_args[argi] |= CSI_ARG_FLAG_MORE; - /* FALLTHROUGH */ - case 0x3b: - argi++; - break; - default: - goto done_leader; - } +#ifdef DEBUG_PARSER + printf("Parsed CSI args as:\n", arglen, args); + printf(" leader: %s\n", vt->parser.csi_leader); + for(int argi = 0; argi < vt->parser.csi_argi; argi++) { + printf(" %lu", CSI_ARG(vt->parser.csi_args[argi])); + if(!CSI_ARG_HAS_MORE(vt->parser.csi_args[argi])) + printf("\n"); + printf(" intermed: %s\n", vt->parser.intermed); } -done_leader: ; - - for( ; i < (int)arglen; i++) { - if((args[i] & 0xf0) != 0x20) - break; +#endif - if(intermedlen < CSI_INTERMED_MAX-1) - intermed[intermedlen++] = args[i]; - } + if(vt->parser.callbacks && vt->parser.callbacks->csi) + if((*vt->parser.callbacks->csi)( + vt->parser.csi_leaderlen ? vt->parser.csi_leader : NULL, + vt->parser.csi_args, + vt->parser.csi_argi, + vt->parser.intermedlen ? vt->parser.intermed : NULL, + command, + vt->parser.cbdata)) + return; - intermed[intermedlen] = 0; + DEBUG_LOG1("libvterm: Unhandled CSI %c\n", command); +} - if(i < (int)arglen) { - DEBUG_LOG2("libvterm: TODO unhandled CSI bytes \"%.*s\"\n", (int)(arglen - i), args + i); - } +static void do_escape(VTerm *vt, char command) +{ + char seq[INTERMED_MAX+1]; -#if 0 - printf("Parsed CSI args %.*s as:\n", arglen, args); - printf(" leader: %s\n", leader); - for(argi = 0; argi < argcount; argi++) { - printf(" %lu", CSI_ARG(csi_args[argi])); - if(!CSI_ARG_HAS_MORE(csi_args[argi])) - printf("\n"); - printf(" intermed: %s\n", intermed); - } -#endif + size_t len = vt->parser.intermedlen; + strncpy(seq, vt->parser.intermed, len); + seq[len++] = command; + seq[len] = 0; - if(vt->parser_callbacks && vt->parser_callbacks->csi) - if((*vt->parser_callbacks->csi)(leaderlen ? leader : NULL, csi_args, argcount, intermedlen ? intermed : NULL, command, vt->cbdata)) + if(vt->parser.callbacks && vt->parser.callbacks->escape) + if((*vt->parser.callbacks->escape)(seq, len, vt->parser.cbdata)) return; - DEBUG_LOG3("libvterm: Unhandled CSI %.*s %c\n", (int)arglen, args, command); + DEBUG_LOG1("libvterm: Unhandled escape ESC 0x%02x\n", command); } static void append_strbuffer(VTerm *vt, const char *str, size_t len) { - if(len > vt->strbuffer_len - vt->strbuffer_cur) { - len = vt->strbuffer_len - vt->strbuffer_cur; + if(len > vt->parser.strbuffer_len - vt->parser.strbuffer_cur) { + len = vt->parser.strbuffer_len - vt->parser.strbuffer_cur; DEBUG_LOG1("Truncating strbuffer preserve to %zd bytes\n", len); } if(len > 0) { - strncpy(vt->strbuffer + vt->strbuffer_cur, str, len); - vt->strbuffer_cur += len; + strncpy(vt->parser.strbuffer + vt->parser.strbuffer_cur, str, len); + vt->parser.strbuffer_cur += len; } } -static size_t do_string(VTerm *vt, const char *str_frag, size_t len) +static void start_string(VTerm *vt, VTermParserStringType type) { - size_t eaten; + vt->parser.stringtype = type; + + vt->parser.strbuffer_cur = 0; +} + +static void more_string(VTerm *vt, const char *str, size_t len) +{ + append_strbuffer(vt, str, len); +} - if(vt->strbuffer_cur) { - if(str_frag) - append_strbuffer(vt, str_frag, len); +static void done_string(VTerm *vt, const char *str, size_t len) +{ + if(vt->parser.strbuffer_cur) { + if(str) + append_strbuffer(vt, str, len); - str_frag = vt->strbuffer; - len = vt->strbuffer_cur; + str = vt->parser.strbuffer; + len = vt->parser.strbuffer_cur; } - else if(!str_frag) { + else if(!str) { DEBUG_LOG("parser.c: TODO: No strbuffer _and_ no final fragment???\n"); len = 0; } - vt->strbuffer_cur = 0; - - switch(vt->parser_state) { - case NORMAL: - if(vt->parser_callbacks && vt->parser_callbacks->text) - if((eaten = (*vt->parser_callbacks->text)(str_frag, len, vt->cbdata))) - return eaten; + switch(vt->parser.stringtype) { + case VTERM_PARSER_OSC: + if(vt->parser.callbacks && vt->parser.callbacks->osc) + if((*vt->parser.callbacks->osc)(str, len, vt->parser.cbdata)) + return; + + DEBUG_LOG2("libvterm: Unhandled OSC %.*s\n", (int)len, str); + return; + + case VTERM_PARSER_DCS: + if(vt->parser.callbacks && vt->parser.callbacks->dcs) + if((*vt->parser.callbacks->dcs)(str, len, vt->parser.cbdata)) + return; - DEBUG_LOG1("libvterm: Unhandled text (%zu chars)\n", len); - return 0; + DEBUG_LOG2("libvterm: Unhandled DCS %.*s\n", (int)len, str); + return; - case ESC: - if(len == 1 && str_frag[0] >= 0x40 && str_frag[0] < 0x60) { - /* C1 emulations using 7bit clean */ - /* ESC 0x40 == 0x80 */ - do_control(vt, str_frag[0] + 0x40); - return 0; - } - - if(vt->parser_callbacks && vt->parser_callbacks->escape) - if((*vt->parser_callbacks->escape)(str_frag, len, vt->cbdata)) - return 0; - - DEBUG_LOG1("libvterm: Unhandled escape ESC 0x%02x\n", str_frag[len-1]); - return 0; - - case CSI: - do_string_csi(vt, str_frag, len - 1, str_frag[len - 1]); - return 0; - - case OSC: - if(vt->parser_callbacks && vt->parser_callbacks->osc) - if((*vt->parser_callbacks->osc)(str_frag, len, vt->cbdata)) - return 0; - - DEBUG_LOG2("libvterm: Unhandled OSC %.*s\n", (int)len, str_frag); - return 0; - - case DCS: - if(vt->parser_callbacks && vt->parser_callbacks->dcs) - if((*vt->parser_callbacks->dcs)(str_frag, len, vt->cbdata)) - return 0; - - DEBUG_LOG2("libvterm: Unhandled DCS %.*s\n", (int)len, str_frag); - return 0; - - case ESC_IN_OSC: - case ESC_IN_DCS: - DEBUG_LOG("libvterm: ARGH! Should never do_string() in ESC_IN_{OSC,DCS}\n"); - return 0; + case VTERM_N_PARSER_TYPES: + return; } - - return 0; } size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len) @@ -192,96 +127,97 @@ size_t pos = 0; const char *string_start = NULL; /* init to avoid gcc warning */ - switch(vt->parser_state) { + switch(vt->parser.state) { case NORMAL: + case CSI_LEADER: + case CSI_ARGS: + case CSI_INTERMED: + case ESC: string_start = NULL; break; - case ESC: - case ESC_IN_OSC: - case ESC_IN_DCS: - case CSI: - case OSC: - case DCS: + case STRING: + case ESC_IN_STRING: string_start = bytes; break; } -#define ENTER_STRING_STATE(st) do { vt->parser_state = st; string_start = bytes + pos + 1; } while(0) -#define ENTER_NORMAL_STATE() do { vt->parser_state = NORMAL; string_start = NULL; } while(0) +#define ENTER_STRING_STATE() do { vt->parser.state = STRING; string_start = bytes + pos + 1; } while(0) +#define ENTER_STATE(st) do { vt->parser.state = st; string_start = NULL; } while(0) +#define ENTER_NORMAL_STATE() ENTER_STATE(NORMAL) for( ; pos < len; pos++) { unsigned char c = bytes[pos]; - if(c == 0x00 || c == 0x7f) { /* NUL, DEL */ - if(vt->parser_state != NORMAL) { - append_strbuffer(vt, string_start, bytes + pos - string_start); + if(c == 0x00 || c == 0x7f) { // NUL, DEL + if(vt->parser.state >= STRING) { + more_string(vt, string_start, bytes + pos - string_start); string_start = bytes + pos + 1; } continue; } - if(c == 0x18 || c == 0x1a) { /* CAN, SUB */ + if(c == 0x18 || c == 0x1a) { // CAN, SUB ENTER_NORMAL_STATE(); continue; } - else if(c == 0x1b) { /* ESC */ - if(vt->parser_state == OSC) - vt->parser_state = ESC_IN_OSC; - else if(vt->parser_state == DCS) - vt->parser_state = ESC_IN_DCS; + else if(c == 0x1b) { // ESC + vt->parser.intermedlen = 0; + if(vt->parser.state == STRING) + vt->parser.state = ESC_IN_STRING; else - ENTER_STRING_STATE(ESC); + ENTER_STATE(ESC); continue; } - else if(c == 0x07 && /* BEL, can stand for ST in OSC or DCS state */ - (vt->parser_state == OSC || vt->parser_state == DCS)) { - /* fallthrough */ + else if(c == 0x07 && // BEL, can stand for ST in OSC or DCS state + vt->parser.state == STRING) { + // fallthrough } - else if(c < 0x20) { /* other C0 */ - if(vt->parser_state != NORMAL) - append_strbuffer(vt, string_start, bytes + pos - string_start); + else if(c < 0x20) { // other C0 + if(vt->parser.state >= STRING) + more_string(vt, string_start, bytes + pos - string_start); do_control(vt, c); - if(vt->parser_state != NORMAL) + if(vt->parser.state >= STRING) string_start = bytes + pos + 1; continue; } - /* else fallthrough */ + // else fallthrough - switch(vt->parser_state) { - case ESC_IN_OSC: - case ESC_IN_DCS: - if(c == 0x5c) { /* ST */ - switch(vt->parser_state) { - case ESC_IN_OSC: vt->parser_state = OSC; break; - case ESC_IN_DCS: vt->parser_state = DCS; break; - default: break; - } - do_string(vt, string_start, bytes + pos - string_start - 1); + switch(vt->parser.state) { + case ESC_IN_STRING: + if(c == 0x5c) { // ST + vt->parser.state = STRING; + done_string(vt, string_start, bytes + pos - string_start - 1); ENTER_NORMAL_STATE(); break; } - vt->parser_state = ESC; - string_start = bytes + pos; - /* else fallthrough */ + vt->parser.state = ESC; + // else fallthrough case ESC: switch(c) { - case 0x50: /* DCS */ - ENTER_STRING_STATE(DCS); + case 0x50: // DCS + start_string(vt, VTERM_PARSER_DCS); + ENTER_STRING_STATE(); break; - case 0x5b: /* CSI */ - ENTER_STRING_STATE(CSI); + case 0x5b: // CSI + vt->parser.csi_leaderlen = 0; + ENTER_STATE(CSI_LEADER); break; - case 0x5d: /* OSC */ - ENTER_STRING_STATE(OSC); + case 0x5d: // OSC + start_string(vt, VTERM_PARSER_OSC); + ENTER_STRING_STATE(); break; default: - if(c >= 0x30 && c < 0x7f) { - /* +1 to pos because we want to include this command byte as well */ - do_string(vt, string_start, bytes + pos - string_start + 1); + if(is_intermed(c)) { + if(vt->parser.intermedlen < INTERMED_MAX-1) + vt->parser.intermed[vt->parser.intermedlen++] = c; + } + else if(!vt->parser.intermedlen && c >= 0x40 && c < 0x60) { + do_control(vt, c + 0x40); ENTER_NORMAL_STATE(); } - else if(c >= 0x20 && c < 0x30) { - /* intermediate byte */ + else if(c >= 0x30 && c < 0x7f) { + do_escape(vt, c); + ENTER_NORMAL_STATE(); } else { DEBUG_LOG1("TODO: Unhandled byte %02x in Escape\n", c); @@ -289,33 +225,89 @@ } break; - case CSI: - if(c >= 0x40 && c <= 0x7f) { - /* +1 to pos because we want to include this command byte as well */ - do_string(vt, string_start, bytes + pos - string_start + 1); - ENTER_NORMAL_STATE(); + case CSI_LEADER: + /* Extract leader bytes 0x3c to 0x3f */ + if(c >= 0x3c && c <= 0x3f) { + if(vt->parser.csi_leaderlen < CSI_LEADER_MAX-1) + vt->parser.csi_leader[vt->parser.csi_leaderlen++] = c; + break; + } + + /* else fallthrough */ + vt->parser.csi_leader[vt->parser.csi_leaderlen] = 0; + + vt->parser.csi_argi = 0; + vt->parser.csi_args[0] = CSI_ARG_MISSING; + vt->parser.state = CSI_ARGS; + + /* fallthrough */ + case CSI_ARGS: + /* Numerical value of argument */ + if(c >= '0' && c <= '9') { + if(vt->parser.csi_args[vt->parser.csi_argi] == CSI_ARG_MISSING) + vt->parser.csi_args[vt->parser.csi_argi] = 0; + vt->parser.csi_args[vt->parser.csi_argi] *= 10; + vt->parser.csi_args[vt->parser.csi_argi] += c - '0'; + break; + } + if(c == ':') { + vt->parser.csi_args[vt->parser.csi_argi] |= CSI_ARG_FLAG_MORE; + c = ';'; + } + if(c == ';') { + vt->parser.csi_argi++; + vt->parser.csi_args[vt->parser.csi_argi] = CSI_ARG_MISSING; + break; + } + + /* else fallthrough */ + vt->parser.csi_argi++; + vt->parser.intermedlen = 0; + vt->parser.state = CSI_INTERMED; + /* fallthrough */ + case CSI_INTERMED: + if(is_intermed(c)) { + if(vt->parser.intermedlen < INTERMED_MAX-1) + vt->parser.intermed[vt->parser.intermedlen++] = c; + break; + } + else if(c == 0x1b) { + /* ESC in CSI cancels */ } + else if(c >= 0x40 && c <= 0x7e) { + vt->parser.intermed[vt->parser.intermedlen] = 0; + do_csi(vt, c); + } + /* else was invalid CSI */ + + ENTER_NORMAL_STATE(); break; - case OSC: - case DCS: + case STRING: if(c == 0x07 || (c == 0x9c && !vt->mode.utf8)) { - do_string(vt, string_start, bytes + pos - string_start); + done_string(vt, string_start, bytes + pos - string_start); ENTER_NORMAL_STATE(); } + else if (pos + 1 == len) { + /* end of input but OSC string isn't finished yet, copy it to + * vt->parser.strbuffer to continue it later */ + more_string(vt, string_start, bytes + pos + 1 - string_start); + } break; case NORMAL: if(c >= 0x80 && c < 0xa0 && !vt->mode.utf8) { switch(c) { - case 0x90: /* DCS */ - ENTER_STRING_STATE(DCS); + case 0x90: // DCS + start_string(vt, VTERM_PARSER_DCS); + ENTER_STRING_STATE(); break; - case 0x9b: /* CSI */ - ENTER_STRING_STATE(CSI); + case 0x9b: // CSI + ENTER_STATE(CSI_LEADER); break; - case 0x9d: /* OSC */ - ENTER_STRING_STATE(OSC); + case 0x9d: // OSC + start_string(vt, VTERM_PARSER_OSC); + ENTER_STRING_STATE(); break; default: do_control(vt, c); @@ -323,24 +315,32 @@ } } else { - size_t text_eaten = do_string(vt, bytes + pos, len - pos); - - if(text_eaten == 0) { - string_start = bytes + pos; - goto pause; + size_t eaten = 0; + if(vt->parser.callbacks && vt->parser.callbacks->text) + eaten = (*vt->parser.callbacks->text)(bytes + pos, len - pos, vt->parser.cbdata); + + if(!eaten) { + DEBUG_LOG("libvterm: Text callback did not consume any input\n"); + /* force it to make progress */ + eaten = 1; } - pos += (text_eaten - 1); /* we'll ++ it again in a moment */ + pos += (eaten - 1); // we'll ++ it again in a moment } break; } } -pause: - if(string_start && string_start < len + bytes) { - size_t remaining = len - (string_start - bytes); - append_strbuffer(vt, string_start, remaining); - } - return len; } + +void vterm_parser_set_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user) +{ + vt->parser.callbacks = callbacks; + vt->parser.cbdata = user; +} + +void *vterm_parser_get_cbdata(VTerm *vt) +{ + return vt->parser.cbdata; +} diff -Nru vim-8.0.1453/src/libvterm/src/pen.c vim-8.0.1766/src/libvterm/src/pen.c --- vim-8.0.1453/src/libvterm/src/pen.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/src/pen.c 2018-04-26 20:30:33.000000000 +0000 @@ -4,24 +4,24 @@ static const VTermColor ansi_colors[] = { /* R G B index */ - { 0, 0, 0, 1 }, /* black */ - { 224, 0, 0, 2 }, /* red */ - { 0, 224, 0, 3 }, /* green */ - { 224, 224, 0, 4 }, /* yellow */ - { 0, 0, 224, 5 }, /* blue */ - { 224, 0, 224, 6 }, /* magenta */ - { 0, 224, 224, 7 }, /* cyan */ - { 224, 224, 224, 8 }, /* white == light grey */ - - /* high intensity */ - { 128, 128, 128, 9 }, /* black */ - { 255, 64, 64, 10 }, /* red */ - { 64, 255, 64, 11 }, /* green */ - { 255, 255, 64, 12 }, /* yellow */ - { 64, 64, 255, 13 }, /* blue */ - { 255, 64, 255, 14 }, /* magenta */ - { 64, 255, 255, 15 }, /* cyan */ - { 255, 255, 255, 16 }, /* white for real */ + { 0, 0, 0, 1 }, // black + { 224, 0, 0, 2 }, // red + { 0, 224, 0, 3 }, // green + { 224, 224, 0, 4 }, // yellow + { 0, 0, 224, 5 }, // blue + { 224, 0, 224, 6 }, // magenta + { 0, 224, 224, 7 }, // cyan + { 224, 224, 224, 8 }, // white == light grey + + // high intensity + { 128, 128, 128, 9 }, // black + { 255, 64, 64, 10 }, // red + { 64, 255, 64, 11 }, // green + { 255, 255, 64, 12 }, // yellow + { 64, 64, 255, 13 }, // blue + { 255, 64, 255, 14 }, // magenta + { 64, 255, 255, 15 }, // cyan + { 255, 255, 255, 16 }, // white for real }; static int ramp6[] = { @@ -47,11 +47,11 @@ static int lookup_colour_palette(const VTermState *state, long index, VTermColor *col) { if(index >= 0 && index < 16) { - /* Normal 8 colours or high intensity - parse as palette 0 */ + // Normal 8 colours or high intensity - parse as palette 0 return lookup_colour_ansi(state, index, col); } else if(index >= 16 && index < 232) { - /* 216-colour cube */ + // 216-colour cube index -= 16; col->blue = ramp6[index % 6]; @@ -62,7 +62,7 @@ return TRUE; } else if(index >= 232 && index < 256) { - /* 24 greyscales */ + // 24 greyscales index -= 232; col->blue = ramp24[index]; @@ -79,7 +79,7 @@ static int lookup_colour(const VTermState *state, int palette, const long args[], int argcount, VTermColor *col, int *index) { switch(palette) { - case 2: /* RGB mode - 3 args contain colour values directly */ + case 2: // RGB mode - 3 args contain colour values directly if(argcount < 3) return argcount; @@ -90,7 +90,7 @@ return 3; - case 5: /* XTerm 256-colour mode */ + case 5: // XTerm 256-colour mode if(index) *index = CSI_ARG_OR(args[0], -1); @@ -104,7 +104,7 @@ } } -/* Some conveniences */ +// Some conveniences static void setpenattr(VTermState *state, VTermAttr attr, VTermValueType type UNUSED, VTermValue *val) { @@ -153,7 +153,7 @@ { int col; - /* 90% grey so that pure white is brighter */ + // 90% grey so that pure white is brighter state->default_fg.red = state->default_fg.green = state->default_fg.blue = 240; state->default_fg.ansi_index = VTERM_ANSI_INDEX_DEFAULT; state->default_bg.red = state->default_bg.green = state->default_bg.blue = 0; @@ -232,98 +232,98 @@ INTERNAL void vterm_state_setpen(VTermState *state, const long args[], int argcount) { - /* SGR - ECMA-48 8.3.117 */ + // SGR - ECMA-48 8.3.117 int argi = 0; int value; while(argi < argcount) { - /* This logic is easier to do 'done' backwards; set it true, and make it - false again in the 'default' case */ + // This logic is easier to do 'done' backwards; set it true, and make it + // false again in the 'default' case int done = 1; long arg; switch(arg = CSI_ARG(args[argi])) { case CSI_ARG_MISSING: - case 0: /* Reset */ + case 0: // Reset vterm_state_resetpen(state); break; - case 1: /* Bold on */ + case 1: // Bold on state->pen.bold = 1; setpenattr_bool(state, VTERM_ATTR_BOLD, 1); if(state->fg_index > -1 && state->fg_index < 8 && state->bold_is_highbright) set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, state->fg_index + (state->pen.bold ? 8 : 0)); break; - case 3: /* Italic on */ + case 3: // Italic on state->pen.italic = 1; setpenattr_bool(state, VTERM_ATTR_ITALIC, 1); break; - case 4: /* Underline single */ + case 4: // Underline single state->pen.underline = 1; setpenattr_int(state, VTERM_ATTR_UNDERLINE, 1); break; - case 5: /* Blink */ + case 5: // Blink state->pen.blink = 1; setpenattr_bool(state, VTERM_ATTR_BLINK, 1); break; - case 7: /* Reverse on */ + case 7: // Reverse on state->pen.reverse = 1; setpenattr_bool(state, VTERM_ATTR_REVERSE, 1); break; - case 9: /* Strikethrough on */ + case 9: // Strikethrough on state->pen.strike = 1; setpenattr_bool(state, VTERM_ATTR_STRIKE, 1); break; case 10: case 11: case 12: case 13: case 14: - case 15: case 16: case 17: case 18: case 19: /* Select font */ + case 15: case 16: case 17: case 18: case 19: // Select font state->pen.font = CSI_ARG(args[argi]) - 10; setpenattr_int(state, VTERM_ATTR_FONT, state->pen.font); break; - case 21: /* Underline double */ + case 21: // Underline double state->pen.underline = 2; setpenattr_int(state, VTERM_ATTR_UNDERLINE, 2); break; - case 22: /* Bold off */ + case 22: // Bold off state->pen.bold = 0; setpenattr_bool(state, VTERM_ATTR_BOLD, 0); break; - case 23: /* Italic and Gothic (currently unsupported) off */ + case 23: // Italic and Gothic (currently unsupported) off state->pen.italic = 0; setpenattr_bool(state, VTERM_ATTR_ITALIC, 0); break; - case 24: /* Underline off */ + case 24: // Underline off state->pen.underline = 0; setpenattr_int(state, VTERM_ATTR_UNDERLINE, 0); break; - case 25: /* Blink off */ + case 25: // Blink off state->pen.blink = 0; setpenattr_bool(state, VTERM_ATTR_BLINK, 0); break; - case 27: /* Reverse off */ + case 27: // Reverse off state->pen.reverse = 0; setpenattr_bool(state, VTERM_ATTR_REVERSE, 0); break; - case 29: /* Strikethrough off */ + case 29: // Strikethrough off state->pen.strike = 0; setpenattr_bool(state, VTERM_ATTR_STRIKE, 0); break; case 30: case 31: case 32: case 33: - case 34: case 35: case 36: case 37: /* Foreground colour palette */ + case 34: case 35: case 36: case 37: // Foreground colour palette value = CSI_ARG(args[argi]) - 30; state->fg_index = value; if(state->pen.bold && state->bold_is_highbright) @@ -331,7 +331,7 @@ set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, value); break; - case 38: /* Foreground colour alternative palette */ + case 38: // Foreground colour alternative palette state->fg_index = -1; if(argcount - argi < 1) return; @@ -339,20 +339,20 @@ setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->pen.fg); break; - case 39: /* Foreground colour default */ + case 39: // Foreground colour default state->fg_index = -1; state->pen.fg = state->default_fg; setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->pen.fg); break; case 40: case 41: case 42: case 43: - case 44: case 45: case 46: case 47: /* Background colour palette */ + case 44: case 45: case 46: case 47: // Background colour palette value = CSI_ARG(args[argi]) - 40; state->bg_index = value; set_pen_col_ansi(state, VTERM_ATTR_BACKGROUND, value); break; - case 48: /* Background colour alternative palette */ + case 48: // Background colour alternative palette state->bg_index = -1; if(argcount - argi < 1) return; @@ -360,21 +360,21 @@ setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->pen.bg); break; - case 49: /* Default background */ + case 49: // Default background state->bg_index = -1; state->pen.bg = state->default_bg; setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->pen.bg); break; case 90: case 91: case 92: case 93: - case 94: case 95: case 96: case 97: /* Foreground colour high-intensity palette */ + case 94: case 95: case 96: case 97: // Foreground colour high-intensity palette value = CSI_ARG(args[argi]) - 90 + 8; state->fg_index = value; set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, value); break; case 100: case 101: case 102: case 103: - case 104: case 105: case 106: case 107: /* Background colour high-intensity palette */ + case 104: case 105: case 106: case 107: // Background colour high-intensity palette value = CSI_ARG(args[argi]) - 100 + 8; state->bg_index = value; set_pen_col_ansi(state, VTERM_ATTR_BACKGROUND, value); @@ -432,7 +432,7 @@ args[argi++] = state->fg_index; } else if(state->fg_index == -1) { - /* Send palette 2 if the actual FG colour is not default */ + // Send palette 2 if the actual FG colour is not default if(state->pen.fg.red != state->default_fg.red || state->pen.fg.green != state->default_fg.green || state->pen.fg.blue != state->default_fg.blue ) { @@ -454,7 +454,7 @@ args[argi++] = state->bg_index; } else if(state->bg_index == -1) { - /* Send palette 2 if the actual BG colour is not default */ + // Send palette 2 if the actual BG colour is not default if(state->pen.bg.red != state->default_bg.red || state->pen.bg.green != state->default_bg.green || state->pen.bg.blue != state->default_bg.blue ) { @@ -507,6 +507,9 @@ case VTERM_ATTR_BACKGROUND: val->color = state->pen.bg; return 1; + + case VTERM_N_ATTRS: + return 0; } return 0; diff -Nru vim-8.0.1453/src/libvterm/src/screen.c vim-8.0.1766/src/libvterm/src/screen.c --- vim-8.0.1453/src/libvterm/src/screen.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/src/screen.c 2018-04-26 20:30:33.000000000 +0000 @@ -115,17 +115,17 @@ /* Emit damage longer than one row. Try to merge with existing damage in * the same row */ if(rect.end_row > rect.start_row + 1) { - /* Bigger than 1 line - flush existing, emit this */ + // Bigger than 1 line - flush existing, emit this vterm_screen_flush_damage(screen); emit = rect; } else if(screen->damaged.start_row == -1) { - /* None stored yet */ + // None stored yet screen->damaged = rect; return; } else if(rect.start_row == screen->damaged.start_row) { - /* Merge with the stored line */ + // Merge with the stored line if(screen->damaged.start_col > rect.start_col) screen->damaged.start_col = rect.start_col; if(screen->damaged.end_col < rect.end_col) @@ -133,7 +133,7 @@ return; } else { - /* Emit the currently stored line, store a new one */ + // Emit the currently stored line, store a new one emit = screen->damaged; screen->damaged = rect; } @@ -208,9 +208,9 @@ VTermScreen *screen = user; if(screen->callbacks && screen->callbacks->sb_pushline && - dest.start_row == 0 && dest.start_col == 0 && /* starts top-left corner */ - dest.end_col == screen->cols && /* full width */ - screen->buffer == screen->buffers[0]) { /* not altscreen */ + dest.start_row == 0 && dest.start_col == 0 && // starts top-left corner + dest.end_col == screen->cols && // full width + screen->buffer == screen->buffers[0]) { // not altscreen VTermPos pos; for(pos.row = 0; pos.row < src.start_row; pos.row++) { for(pos.col = 0; pos.col < screen->cols; pos.col++) @@ -252,7 +252,7 @@ if(screen->callbacks && screen->callbacks->moverect) { if(screen->damage_merge != VTERM_DAMAGE_SCROLL) - /* Avoid an infinite loop */ + // Avoid an infinite loop vterm_screen_flush_damage(screen); if((*screen->callbacks->moverect)(dest, src, screen->cbdata)) @@ -429,6 +429,9 @@ case VTERM_ATTR_BACKGROUND: screen->pen.bg = val->color; return 1; + + case VTERM_N_ATTRS: + return 0; } return 0; @@ -485,11 +488,11 @@ int first_blank_row; if(!is_altscreen && new_rows < old_rows) { - /* Fewer rows - determine if we're going to scroll at all, and if so, push - those lines to scrollback */ + // Fewer rows - determine if we're going to scroll at all, and if so, push + // those lines to scrollback VTermPos pos = { 0, 0 }; VTermPos cursor = screen->state->pos; - /* Find the first blank row after the cursor. */ + // Find the first blank row after the cursor. for(pos.row = old_rows - 1; pos.row >= new_rows; pos.row--) if(!vterm_screen_is_eol(screen, pos) || cursor.row == pos.row) break; @@ -699,10 +702,10 @@ int i; if(cell->chars[0] == 0) - /* Erased cell, might need a space */ + // Erased cell, might need a space padding++; else if(cell->chars[0] == (uint32_t)-1) - /* Gap behind a double-width char, do nothing */ + // Gap behind a double-width char, do nothing ; else { while(padding) { @@ -909,7 +912,7 @@ ScreenCell *target = getcell(screen, pos.row, pos.col); - /* TODO: bounds check */ + // TODO: bounds check extent->start_row = pos.row; extent->end_row = pos.row + 1; diff -Nru vim-8.0.1453/src/libvterm/src/state.c vim-8.0.1766/src/libvterm/src/state.c --- vim-8.0.1453/src/libvterm/src/state.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/src/state.c 2018-04-26 20:30:33.000000000 +0000 @@ -101,7 +101,7 @@ else if(rightward < -cols) rightward = -cols; - /* Update lineinfo if full line */ + // Update lineinfo if full line if(rect.start_col == 0 && rect.end_col == state->cols && rightward == 0) { int height = rect.end_row - rect.start_row - abs(downward); @@ -221,7 +221,7 @@ info.doublewidth = DWL_OFF; else if(dwl == DWL_ON) info.doublewidth = DWL_ON; - /* else -1 to ignore */ + // else -1 to ignore if(dhl == DHL_OFF) info.doubleheight = DHL_OFF; @@ -248,8 +248,9 @@ VTermPos oldpos = state->pos; - /* We'll have at most len codepoints */ - codepoints = vterm_allocator_malloc(state->vt, len * sizeof(uint32_t)); + // We'll have at most len codepoints, plus one from a previous incomplete + // sequence. + codepoints = vterm_allocator_malloc(state->vt, (len + 1) * sizeof(uint32_t)); encoding = state->gsingle_set ? &state->encoding[state->gsingle_set] : @@ -267,7 +268,7 @@ if(!npoints) { vterm_allocator_free(state->vt, codepoints); - return 0; + return eaten; } if(state->gsingle_set && npoints) @@ -316,7 +317,7 @@ } for(; i < npoints; i++) { - /* Try to find combining characters following this */ + // Try to find combining characters following this int glyph_starts = i; int glyph_ends; int width = 0; @@ -421,54 +422,54 @@ VTermPos oldpos = state->pos; switch(control) { - case 0x07: /* BEL - ECMA-48 8.3.3 */ + case 0x07: // BEL - ECMA-48 8.3.3 if(state->callbacks && state->callbacks->bell) (*state->callbacks->bell)(state->cbdata); break; - case 0x08: /* BS - ECMA-48 8.3.5 */ + case 0x08: // BS - ECMA-48 8.3.5 if(state->pos.col > 0) state->pos.col--; break; - case 0x09: /* HT - ECMA-48 8.3.60 */ + case 0x09: // HT - ECMA-48 8.3.60 tab(state, 1, +1); break; - case 0x0a: /* LF - ECMA-48 8.3.74 */ - case 0x0b: /* VT */ - case 0x0c: /* FF */ + case 0x0a: // LF - ECMA-48 8.3.74 + case 0x0b: // VT + case 0x0c: // FF linefeed(state); if(state->mode.newline) state->pos.col = 0; break; - case 0x0d: /* CR - ECMA-48 8.3.15 */ + case 0x0d: // CR - ECMA-48 8.3.15 state->pos.col = 0; break; - case 0x0e: /* LS1 - ECMA-48 8.3.76 */ + case 0x0e: // LS1 - ECMA-48 8.3.76 state->gl_set = 1; break; - case 0x0f: /* LS0 - ECMA-48 8.3.75 */ + case 0x0f: // LS0 - ECMA-48 8.3.75 state->gl_set = 0; break; - case 0x84: /* IND - DEPRECATED but implemented for completeness */ + case 0x84: // IND - DEPRECATED but implemented for completeness linefeed(state); break; - case 0x85: /* NEL - ECMA-48 8.3.86 */ + case 0x85: // NEL - ECMA-48 8.3.86 linefeed(state); state->pos.col = 0; break; - case 0x88: /* HTS - ECMA-48 8.3.62 */ + case 0x88: // HTS - ECMA-48 8.3.62 set_col_tabstop(state, state->pos.col); break; - case 0x8d: /* RI - ECMA-48 8.3.104 */ + case 0x8d: // RI - ECMA-48 8.3.104 if(state->pos.row == state->scrollregion_top) { VTermRect rect; rect.start_row = state->scrollregion_top; @@ -482,11 +483,11 @@ state->pos.row--; break; - case 0x8e: /* SS2 - ECMA-48 8.3.141 */ + case 0x8e: // SS2 - ECMA-48 8.3.141 state->gsingle_set = 2; break; - case 0x8f: /* SS3 - ECMA-48 8.3.142 */ + case 0x8f: // SS3 - ECMA-48 8.3.142 state->gsingle_set = 3; break; @@ -579,11 +580,11 @@ return 0; switch(bytes[1]) { - case 'F': /* S7C1T */ + case 'F': // S7C1T state->vt->mode.ctrl8bit = 0; break; - case 'G': /* S8C1T */ + case 'G': // S8C1T state->vt->mode.ctrl8bit = 1; break; @@ -597,31 +598,31 @@ return 0; switch(bytes[1]) { - case '3': /* DECDHL top */ + case '3': // DECDHL top if(state->mode.leftrightmargin) break; set_lineinfo(state, state->pos.row, NO_FORCE, DWL_ON, DHL_TOP); break; - case '4': /* DECDHL bottom */ + case '4': // DECDHL bottom if(state->mode.leftrightmargin) break; set_lineinfo(state, state->pos.row, NO_FORCE, DWL_ON, DHL_BOTTOM); break; - case '5': /* DECSWL */ + case '5': // DECSWL if(state->mode.leftrightmargin) break; set_lineinfo(state, state->pos.row, NO_FORCE, DWL_OFF, DHL_OFF); break; - case '6': /* DECDWL */ + case '6': // DECDWL if(state->mode.leftrightmargin) break; set_lineinfo(state, state->pos.row, NO_FORCE, DWL_ON, DHL_OFF); break; - case '8': /* DECALN */ + case '8': // DECALN { VTermPos pos; uint32_t E[] = { 'E', 0 }; @@ -636,7 +637,7 @@ } return 2; - case '(': case ')': case '*': case '+': /* SCS */ + case '(': case ')': case '*': case '+': // SCS if(len != 2) return 0; @@ -654,26 +655,26 @@ return 2; - case '7': /* DECSC */ + case '7': // DECSC savecursor(state, 1); return 1; - case '8': /* DECRC */ + case '8': // DECRC savecursor(state, 0); return 1; - case '<': /* Ignored by VT100. Used in VT52 mode to switch up to VT100 */ + case '<': // Ignored by VT100. Used in VT52 mode to switch up to VT100 return 1; - case '=': /* DECKPAM */ + case '=': // DECKPAM state->mode.keypad = 1; return 1; - case '>': /* DECKPNM */ + case '>': // DECKPNM state->mode.keypad = 0; return 1; - case 'c': /* RIS - ECMA-48 8.3.105 */ + case 'c': // RIS - ECMA-48 8.3.105 { VTermPos oldpos = state->pos; vterm_state_reset(state, 1); @@ -682,23 +683,23 @@ return 1; } - case 'n': /* LS2 - ECMA-48 8.3.78 */ + case 'n': // LS2 - ECMA-48 8.3.78 state->gl_set = 2; return 1; - case 'o': /* LS3 - ECMA-48 8.3.80 */ + case 'o': // LS3 - ECMA-48 8.3.80 state->gl_set = 3; return 1; - case '~': /* LS1R - ECMA-48 8.3.77 */ + case '~': // LS1R - ECMA-48 8.3.77 state->gr_set = 1; return 1; - case '}': /* LS2R - ECMA-48 8.3.79 */ + case '}': // LS2R - ECMA-48 8.3.79 state->gr_set = 2; return 1; - case '|': /* LS3R - ECMA-48 8.3.81 */ + case '|': // LS3R - ECMA-48 8.3.81 state->gr_set = 3; return 1; @@ -710,11 +711,11 @@ static void set_mode(VTermState *state, int num, int val) { switch(num) { - case 4: /* IRM - ECMA-48 7.2.10 */ + case 4: // IRM - ECMA-48 7.2.10 state->mode.insert = val; break; - case 20: /* LNM - ANSI X3.4-1977 */ + case 20: // LNM - ANSI X3.4-1977 state->mode.newline = val; break; @@ -731,11 +732,11 @@ state->mode.cursor = val; break; - case 5: /* DECSCNM - screen mode */ + case 5: // DECSCNM - screen mode settermprop_bool(state, VTERM_PROP_REVERSE, val); break; - case 6: /* DECOM - origin mode */ + case 6: // DECOM - origin mode { VTermPos oldpos = state->pos; state->mode.origin = val; @@ -757,13 +758,13 @@ settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, val); break; - case 69: /* DECVSSM - vertical split screen mode */ - /* DECLRMM - left/right margin mode */ + case 69: // DECVSSM - vertical split screen mode + // DECLRMM - left/right margin mode state->mode.leftrightmargin = val; if(val) { int row; - /* Setting DECVSSM must clear doublewidth/doubleheight state of every line */ + // Setting DECVSSM must clear doublewidth/doubleheight state of every line for(row = 0; row < state->rows; row++) set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); } @@ -780,6 +781,10 @@ VTERM_PROP_MOUSE_MOVE); break; + case 1004: + state->mode.report_focus = val; + break; + case 1005: state->mouse_protocol = val ? MOUSE_UTF8 : MOUSE_X10; break; @@ -860,6 +865,10 @@ reply = state->mouse_flags == (MOUSE_WANT_CLICK|MOUSE_WANT_MOVE); break; + case 1004: + reply = state->mode.report_focus; + break; + case 1005: reply = state->mouse_protocol == MOUSE_UTF8; break; @@ -902,7 +911,7 @@ int selective; if(leader && leader[0]) { - if(leader[1]) /* longer than 1 char */ + if(leader[1]) // longer than 1 char return 0; switch(leader[0]) { @@ -916,7 +925,7 @@ } if(intermed && intermed[0]) { - if(intermed[1]) /* longer than 1 char */ + if(intermed[1]) // longer than 1 char return 0; switch(intermed[0]) { @@ -940,7 +949,7 @@ #define INTERMED(i,b) ((i << 16) | b) switch(intermed_byte << 16 | leader_byte << 8 | command) { - case 0x40: /* ICH - ECMA-48 8.3.64 */ + case 0x40: // ICH - ECMA-48 8.3.64 count = CSI_ARG_COUNT(args[0]); if(!is_cursor_in_scrollregion(state)) @@ -958,54 +967,54 @@ break; - case 0x41: /* CUU - ECMA-48 8.3.22 */ + case 0x41: // CUU - ECMA-48 8.3.22 count = CSI_ARG_COUNT(args[0]); state->pos.row -= count; state->at_phantom = 0; break; - case 0x42: /* CUD - ECMA-48 8.3.19 */ + case 0x42: // CUD - ECMA-48 8.3.19 count = CSI_ARG_COUNT(args[0]); state->pos.row += count; state->at_phantom = 0; break; - case 0x43: /* CUF - ECMA-48 8.3.20 */ + case 0x43: // CUF - ECMA-48 8.3.20 count = CSI_ARG_COUNT(args[0]); state->pos.col += count; state->at_phantom = 0; break; - case 0x44: /* CUB - ECMA-48 8.3.18 */ + case 0x44: // CUB - ECMA-48 8.3.18 count = CSI_ARG_COUNT(args[0]); state->pos.col -= count; state->at_phantom = 0; break; - case 0x45: /* CNL - ECMA-48 8.3.12 */ + case 0x45: // CNL - ECMA-48 8.3.12 count = CSI_ARG_COUNT(args[0]); state->pos.col = 0; state->pos.row += count; state->at_phantom = 0; break; - case 0x46: /* CPL - ECMA-48 8.3.13 */ + case 0x46: // CPL - ECMA-48 8.3.13 count = CSI_ARG_COUNT(args[0]); state->pos.col = 0; state->pos.row -= count; state->at_phantom = 0; break; - case 0x47: /* CHA - ECMA-48 8.3.9 */ + case 0x47: // CHA - ECMA-48 8.3.9 val = CSI_ARG_OR(args[0], 1); state->pos.col = val-1; state->at_phantom = 0; break; - case 0x48: /* CUP - ECMA-48 8.3.21 */ + case 0x48: // CUP - ECMA-48 8.3.21 row = CSI_ARG_OR(args[0], 1); col = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? 1 : CSI_ARG(args[1]); - /* zero-based */ + // zero-based state->pos.row = row-1; state->pos.col = col-1; if(state->mode.origin) { @@ -1015,13 +1024,13 @@ state->at_phantom = 0; break; - case 0x49: /* CHT - ECMA-48 8.3.10 */ + case 0x49: // CHT - ECMA-48 8.3.10 count = CSI_ARG_COUNT(args[0]); tab(state, count, +1); break; - case 0x4a: /* ED - ECMA-48 8.3.39 */ - case LEADER('?', 0x4a): /* DECSED - Selective Erase in Display */ + case 0x4a: // ED - ECMA-48 8.3.39 + case LEADER('?', 0x4a): // DECSED - Selective Erase in Display selective = (leader_byte == '?'); switch(CSI_ARG(args[0])) { case CSI_ARG_MISSING: @@ -1063,8 +1072,8 @@ } break; - case 0x4b: /* EL - ECMA-48 8.3.41 */ - case LEADER('?', 0x4b): /* DECSEL - Selective Erase in Line */ + case 0x4b: // EL - ECMA-48 8.3.41 + case LEADER('?', 0x4b): // DECSEL - Selective Erase in Line selective = (leader_byte == '?'); rect.start_row = state->pos.row; rect.end_row = state->pos.row + 1; @@ -1086,7 +1095,7 @@ break; - case 0x4c: /* IL - ECMA-48 8.3.67 */ + case 0x4c: // IL - ECMA-48 8.3.67 count = CSI_ARG_COUNT(args[0]); if(!is_cursor_in_scrollregion(state)) @@ -1101,7 +1110,7 @@ break; - case 0x4d: /* DL - ECMA-48 8.3.32 */ + case 0x4d: // DL - ECMA-48 8.3.32 count = CSI_ARG_COUNT(args[0]); if(!is_cursor_in_scrollregion(state)) @@ -1116,7 +1125,7 @@ break; - case 0x50: /* DCH - ECMA-48 8.3.26 */ + case 0x50: // DCH - ECMA-48 8.3.26 count = CSI_ARG_COUNT(args[0]); if(!is_cursor_in_scrollregion(state)) @@ -1134,7 +1143,7 @@ break; - case 0x53: /* SU - ECMA-48 8.3.147 */ + case 0x53: // SU - ECMA-48 8.3.147 count = CSI_ARG_COUNT(args[0]); rect.start_row = state->scrollregion_top; @@ -1146,7 +1155,7 @@ break; - case 0x54: /* SD - ECMA-48 8.3.113 */ + case 0x54: // SD - ECMA-48 8.3.113 count = CSI_ARG_COUNT(args[0]); rect.start_row = state->scrollregion_top; @@ -1158,7 +1167,7 @@ break; - case 0x58: /* ECH - ECMA-48 8.3.38 */ + case 0x58: // ECH - ECMA-48 8.3.38 count = CSI_ARG_COUNT(args[0]); rect.start_row = state->pos.row; @@ -1170,36 +1179,36 @@ erase(state, rect, 0); break; - case 0x5a: /* CBT - ECMA-48 8.3.7 */ + case 0x5a: // CBT - ECMA-48 8.3.7 count = CSI_ARG_COUNT(args[0]); tab(state, count, -1); break; - case 0x60: /* HPA - ECMA-48 8.3.57 */ + case 0x60: // HPA - ECMA-48 8.3.57 col = CSI_ARG_OR(args[0], 1); state->pos.col = col-1; state->at_phantom = 0; break; - case 0x61: /* HPR - ECMA-48 8.3.59 */ + case 0x61: // HPR - ECMA-48 8.3.59 count = CSI_ARG_COUNT(args[0]); state->pos.col += count; state->at_phantom = 0; break; - case 0x63: /* DA - ECMA-48 8.3.24 */ + case 0x63: // DA - ECMA-48 8.3.24 val = CSI_ARG_OR(args[0], 0); if(val == 0) - /* DEC VT100 response */ + // DEC VT100 response vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "?1;2c"); break; - case LEADER('>', 0x63): /* DEC secondary Device Attributes */ - /* This returns xterm version number 100. */ + case LEADER('>', 0x63): // DEC secondary Device Attributes + // This returns xterm version number 100. vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, ">%d;%d;%dc", 0, 100, 0); break; - case 0x64: /* VPA - ECMA-48 8.3.158 */ + case 0x64: // VPA - ECMA-48 8.3.158 row = CSI_ARG_OR(args[0], 1); state->pos.row = row-1; if(state->mode.origin) @@ -1207,16 +1216,16 @@ state->at_phantom = 0; break; - case 0x65: /* VPR - ECMA-48 8.3.160 */ + case 0x65: // VPR - ECMA-48 8.3.160 count = CSI_ARG_COUNT(args[0]); state->pos.row += count; state->at_phantom = 0; break; - case 0x66: /* HVP - ECMA-48 8.3.63 */ + case 0x66: // HVP - ECMA-48 8.3.63 row = CSI_ARG_OR(args[0], 1); col = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? 1 : CSI_ARG(args[1]); - /* zero-based */ + // zero-based state->pos.row = row-1; state->pos.col = col-1; if(state->mode.origin) { @@ -1226,7 +1235,7 @@ state->at_phantom = 0; break; - case 0x67: /* TBC - ECMA-48 8.3.154 */ + case 0x67: // TBC - ECMA-48 8.3.154 val = CSI_ARG_OR(args[0], 0); switch(val) { @@ -1248,44 +1257,44 @@ } break; - case 0x68: /* SM - ECMA-48 8.3.125 */ + case 0x68: // SM - ECMA-48 8.3.125 if(!CSI_ARG_IS_MISSING(args[0])) set_mode(state, CSI_ARG(args[0]), 1); break; - case LEADER('?', 0x68): /* DEC private mode set */ + case LEADER('?', 0x68): // DEC private mode set if(!CSI_ARG_IS_MISSING(args[0])) set_dec_mode(state, CSI_ARG(args[0]), 1); break; - case 0x6a: /* HPB - ECMA-48 8.3.58 */ + case 0x6a: // HPB - ECMA-48 8.3.58 count = CSI_ARG_COUNT(args[0]); state->pos.col -= count; state->at_phantom = 0; break; - case 0x6b: /* VPB - ECMA-48 8.3.159 */ + case 0x6b: // VPB - ECMA-48 8.3.159 count = CSI_ARG_COUNT(args[0]); state->pos.row -= count; state->at_phantom = 0; break; - case 0x6c: /* RM - ECMA-48 8.3.106 */ + case 0x6c: // RM - ECMA-48 8.3.106 if(!CSI_ARG_IS_MISSING(args[0])) set_mode(state, CSI_ARG(args[0]), 0); break; - case LEADER('?', 0x6c): /* DEC private mode reset */ + case LEADER('?', 0x6c): // DEC private mode reset if(!CSI_ARG_IS_MISSING(args[0])) set_dec_mode(state, CSI_ARG(args[0]), 0); break; - case 0x6d: /* SGR - ECMA-48 8.3.117 */ + case 0x6d: // SGR - ECMA-48 8.3.117 vterm_state_setpen(state, args, argcount); break; - case 0x6e: /* DSR - ECMA-48 8.3.35 */ - case LEADER('?', 0x6e): /* DECDSR */ + case 0x6e: // DSR - ECMA-48 8.3.35 + case LEADER('?', 0x6e): // DECDSR val = CSI_ARG_OR(args[0], 0); { @@ -1293,12 +1302,12 @@ switch(val) { case 0: case 1: case 2: case 3: case 4: - /* ignore - these are replies */ + // ignore - these are replies break; case 5: vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "%s0n", qmark); break; - case 6: /* CPR - cursor position report */ + case 6: // CPR - cursor position report vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "%s%d;%dR", qmark, state->pos.row + 1, state->pos.col + 1); break; } @@ -1306,7 +1315,7 @@ break; - case LEADER('!', 0x70): /* DECSTR - DEC soft terminal reset */ + case LEADER('!', 0x70): // DECSTR - DEC soft terminal reset vterm_state_reset(state, 0); break; @@ -1314,7 +1323,7 @@ request_dec_mode(state, CSI_ARG(args[0])); break; - case INTERMED(' ', 0x71): /* DECSCUSR - DEC set cursor shape */ + case INTERMED(' ', 0x71): // DECSCUSR - DEC set cursor shape val = CSI_ARG_OR(args[0], 1); switch(val) { @@ -1346,7 +1355,7 @@ break; - case INTERMED('"', 0x71): /* DECSCA - DEC select character protection attribute */ + case INTERMED('"', 0x71): // DECSCA - DEC select character protection attribute val = CSI_ARG_OR(args[0], 0); switch(val) { @@ -1360,7 +1369,7 @@ break; - case 0x72: /* DECSTBM - DEC custom */ + case 0x72: // DECSTBM - DEC custom state->scrollregion_top = CSI_ARG_OR(args[0], 1) - 1; state->scrollregion_bottom = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? -1 : CSI_ARG(args[1]); LBOUND(state->scrollregion_top, 0); @@ -1372,15 +1381,15 @@ UBOUND(state->scrollregion_bottom, state->rows); if(SCROLLREGION_BOTTOM(state) <= state->scrollregion_top) { - /* Invalid */ + // Invalid state->scrollregion_top = 0; state->scrollregion_bottom = -1; } break; - case 0x73: /* DECSLRM - DEC custom */ - /* Always allow setting these margins, just they won't take effect without DECVSSM */ + case 0x73: // DECSLRM - DEC custom + // Always allow setting these margins, just they won't take effect without DECVSSM state->scrollregion_left = CSI_ARG_OR(args[0], 1) - 1; state->scrollregion_right = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? -1 : CSI_ARG(args[1]); LBOUND(state->scrollregion_left, 0); @@ -1393,7 +1402,7 @@ if(state->scrollregion_right > -1 && state->scrollregion_right <= state->scrollregion_left) { - /* Invalid */ + // Invalid state->scrollregion_left = 0; state->scrollregion_right = -1; } @@ -1408,7 +1417,7 @@ } break; - case INTERMED('\'', 0x7D): /* DECIC */ + case INTERMED('\'', 0x7D): // DECIC count = CSI_ARG_COUNT(args[0]); if(!is_cursor_in_scrollregion(state)) @@ -1423,7 +1432,7 @@ break; - case INTERMED('\'', 0x7E): /* DECDC */ + case INTERMED('\'', 0x7E): // DECDC count = CSI_ARG_COUNT(args[0]); if(!is_cursor_in_scrollregion(state)) @@ -1505,6 +1514,22 @@ settermprop_string(state, VTERM_PROP_TITLE, command + 2, cmdlen - 2); return 1; } + else if(strneq(command, "10;", 3)) { + /* request foreground color: ]10;?<0x07> */ + int red = state->default_fg.red; + int blue = state->default_fg.blue; + int green = state->default_fg.green; + vterm_push_output_sprintf_ctrl(state->vt, C1_OSC, "10;rgb:%02x%02x/%02x%02x/%02x%02x\x07", red, red, green, green, blue, blue); + return 1; + } + else if(strneq(command, "11;", 3)) { + /* request background color: ]11;?<0x07> */ + int red = state->default_bg.red; + int blue = state->default_bg.blue; + int green = state->default_bg.green; + vterm_push_output_sprintf_ctrl(state->vt, C1_OSC, "11;rgb:%02x%02x/%02x%02x/%02x%02x\x07", red, red, green, green, blue, blue); + return 1; + } else if(strneq(command, "12;", 3)) { settermprop_string(state, VTERM_PROP_CURSORCOLOR, command + 3, cmdlen - 3); return 1; @@ -1520,7 +1545,7 @@ { if(cmdlen == 1) switch(command[0]) { - case 'm': /* Query SGR */ + case 'm': // Query SGR { long args[20]; int argc = vterm_state_getpen(state, args, sizeof(args)/sizeof(args[0])); @@ -1536,10 +1561,10 @@ vterm_push_output_sprintf_ctrl(state->vt, C1_ST, ""); } return; - case 'r': /* Query DECSTBM */ + case 'r': // Query DECSTBM vterm_push_output_sprintf_dcs(state->vt, "1$r%d;%dr", state->scrollregion_top+1, SCROLLREGION_BOTTOM(state)); return; - case 's': /* Query DECSLRM */ + case 's': // Query DECSLRM vterm_push_output_sprintf_dcs(state->vt, "1$r%d;%ds", SCROLLREGION_LEFT(state)+1, SCROLLREGION_RIGHT(state)); return; } @@ -1711,6 +1736,7 @@ state->mode.origin = 0; state->mode.leftrightmargin = 0; state->mode.bracketpaste = 0; + state->mode.report_focus = 0; state->vt->mode.ctrl8bit = 0; @@ -1753,7 +1779,7 @@ state->protected_cell = 0; - /* Initialise the props */ + // Initialise the props settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, 1); settermprop_bool(state, VTERM_PROP_CURSORBLINK, 1); settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BLOCK); @@ -1776,6 +1802,14 @@ *cursorpos = state->pos; } +void vterm_state_get_mousestate(const VTermState *state, VTermMouseState *mousestate) +{ + mousestate->pos.col = state->mouse_col; + mousestate->pos.row = state->mouse_row; + mousestate->buttons = state->mouse_buttons; + mousestate->flags = state->mouse_flags; +} + void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user) { if(callbacks) { @@ -1825,7 +1859,7 @@ case VTERM_PROP_TITLE: case VTERM_PROP_ICONNAME: case VTERM_PROP_CURSORCOLOR: - /* we don't store these, just transparently pass through */ + // we don't store these, just transparently pass through return 1; case VTERM_PROP_CURSORVISIBLE: state->mode.cursor_visible = val->boolean; @@ -1857,11 +1891,26 @@ if(val->number == VTERM_PROP_MOUSE_MOVE) state->mouse_flags |= MOUSE_WANT_MOVE; return 1; + + case VTERM_N_PROPS: + return 0; } return 0; } +void vterm_state_focus_in(VTermState *state) +{ + if(state->mode.report_focus) + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "I"); +} + +void vterm_state_focus_out(VTermState *state) +{ + if(state->mode.report_focus) + vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "O"); +} + const VTermLineInfo *vterm_state_get_lineinfo(const VTermState *state, int row) { return state->lineinfo + row; diff -Nru vim-8.0.1453/src/libvterm/src/unicode.c vim-8.0.1766/src/libvterm/src/unicode.c --- vim-8.0.1453/src/libvterm/src/unicode.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/src/unicode.c 2018-04-26 20:30:33.000000000 +0000 @@ -1,11 +1,10 @@ #include "vterm_internal.h" -/* ### The following from http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c - * With modifications: - * made functions static - * moved 'combining' table to file scope, so other functions can see it - * ################################################################### - */ +// ### The following from http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c +// With modifications: +// made functions static +// moved 'combining' table to file scope, so other functions can see it +// ################################################################### /* * This is an implementation of wcwidth() and wcswidth() (defined in @@ -336,9 +335,8 @@ } #endif - -/* ################################ - * ### The rest added by Paul Evans */ +// ################################ +// ### The rest added by Paul Evans INTERNAL int vterm_unicode_width(uint32_t codepoint) { diff -Nru vim-8.0.1453/src/libvterm/src/utf8.h vim-8.0.1766/src/libvterm/src/utf8.h --- vim-8.0.1453/src/libvterm/src/utf8.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/src/utf8.h 2018-04-26 20:30:33.000000000 +0000 @@ -24,7 +24,7 @@ { int nbytes = utf8_seqlen(codepoint); - /* This is easier done backwards */ + // This is easier done backwards int b = nbytes; while(b > 1) { b--; diff -Nru vim-8.0.1453/src/libvterm/src/vterm.c vim-8.0.1766/src/libvterm/src/vterm.c --- vim-8.0.1453/src/libvterm/src/vterm.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/src/vterm.c 2018-04-26 20:30:33.000000000 +0000 @@ -27,8 +27,8 @@ } static VTermAllocatorFunctions default_allocator = { - &default_malloc, /* malloc */ - &default_free /* free */ + &default_malloc, // malloc + &default_free // free }; VTerm *vterm_new(int rows, int cols) @@ -47,16 +47,16 @@ vt->rows = rows; vt->cols = cols; - vt->parser_state = NORMAL; + vt->parser.state = NORMAL; - vt->parser_callbacks = NULL; - vt->cbdata = NULL; + vt->parser.callbacks = NULL; + vt->parser.cbdata = NULL; - vt->strbuffer_len = 64; - vt->strbuffer_cur = 0; - vt->strbuffer = vterm_allocator_malloc(vt, vt->strbuffer_len); + vt->parser.strbuffer_len = 500; /* should be able to hold an OSC string */ + vt->parser.strbuffer_cur = 0; + vt->parser.strbuffer = vterm_allocator_malloc(vt, vt->parser.strbuffer_len); - vt->outbuffer_len = 64; + vt->outbuffer_len = 200; vt->outbuffer_cur = 0; vt->outbuffer = vterm_allocator_malloc(vt, vt->outbuffer_len); @@ -71,7 +71,7 @@ if(vt->state) vterm_state_free(vt->state); - vterm_allocator_free(vt, vt->strbuffer); + vterm_allocator_free(vt, vt->parser.strbuffer); vterm_allocator_free(vt, vt->outbuffer); vterm_allocator_free(vt, vt); @@ -100,8 +100,8 @@ vt->rows = rows; vt->cols = cols; - if(vt->parser_callbacks && vt->parser_callbacks->resize) - (*vt->parser_callbacks->resize)(rows, cols, vt->cbdata); + if(vt->parser.callbacks && vt->parser.callbacks->resize) + (*vt->parser.callbacks->resize)(rows, cols, vt->parser.cbdata); } int vterm_get_utf8(const VTerm *vt) @@ -257,17 +257,6 @@ return len; } -void vterm_parser_set_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user) -{ - vt->parser_callbacks = callbacks; - vt->cbdata = user; -} - -void *vterm_parser_get_cbdata(VTerm *vt) -{ - return vt->cbdata; -} - VTermValueType vterm_get_attr_type(VTermAttr attr) { switch(attr) { @@ -280,6 +269,8 @@ case VTERM_ATTR_FONT: return VTERM_VALUETYPE_INT; case VTERM_ATTR_FOREGROUND: return VTERM_VALUETYPE_COLOR; case VTERM_ATTR_BACKGROUND: return VTERM_VALUETYPE_COLOR; + + case VTERM_N_ATTRS: return 0; } return 0; /* UNREACHABLE */ } @@ -296,6 +287,8 @@ case VTERM_PROP_CURSORSHAPE: return VTERM_VALUETYPE_INT; case VTERM_PROP_MOUSE: return VTERM_VALUETYPE_INT; case VTERM_PROP_CURSORCOLOR: return VTERM_VALUETYPE_STRING; + + case VTERM_N_PROPS: return 0; } return 0; /* UNREACHABLE */ } diff -Nru vim-8.0.1453/src/libvterm/src/vterm_internal.h vim-8.0.1766/src/libvterm/src/vterm_internal.h --- vim-8.0.1453/src/libvterm/src/vterm_internal.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/src/vterm_internal.h 2018-04-26 20:30:33.000000000 +0000 @@ -5,7 +5,7 @@ #include -#if defined(__GNUC__) +#if defined(__GNUC__) && !defined(__MINGW32__) # define INTERNAL __attribute__((visibility("internal"))) # define UNUSED __attribute__((unused)) #else @@ -27,12 +27,17 @@ #define ESC_S "\x1b" +#define INTERMED_MAX 16 + +#define CSI_ARGS_MAX 16 +#define CSI_LEADER_MAX 16 + typedef struct VTermEncoding VTermEncoding; typedef struct { VTermEncoding *enc; - /* This size should be increased if required by other stateful encodings */ + // This size should be increased if required by other stateful encodings char data[4*sizeof(uint32_t)]; } VTermEncodingInstance; @@ -95,17 +100,14 @@ int mouse_col, mouse_row; int mouse_buttons; int mouse_flags; -#define MOUSE_WANT_CLICK 0x01 -#define MOUSE_WANT_DRAG 0x02 -#define MOUSE_WANT_MOVE 0x04 enum { MOUSE_X10, MOUSE_UTF8, MOUSE_SGR, MOUSE_RXVT } mouse_protocol; /* Last glyph output, for Unicode recombining purposes */ uint32_t *combine_chars; - size_t combine_chars_size; /* Number of ELEMENTS in the above */ - int combine_width; /* The width of the glyph above */ - VTermPos combine_pos; /* Position before movement */ + size_t combine_chars_size; // Number of ELEMENTS in the above + int combine_width; // The width of the glyph above + VTermPos combine_pos; // Position before movement struct { unsigned int keypad:1; @@ -121,6 +123,7 @@ unsigned int screen:1; unsigned int leftrightmargin:1; unsigned int bracketpaste:1; + unsigned int report_focus:1; } mode; VTermEncodingInstance encoding[4], encoding_utf8; @@ -130,7 +133,7 @@ VTermColor default_fg; VTermColor default_bg; - VTermColor colors[16]; /* Store the 8 ANSI and the 8 ANSI high-brights only */ + VTermColor colors[16]; // Store the 8 ANSI and the 8 ANSI high-brights only int fg_index; int bg_index; @@ -151,6 +154,13 @@ } saved; }; +typedef enum { + VTERM_PARSER_OSC, + VTERM_PARSER_DCS, + + VTERM_N_PARSER_TYPES +} VTermParserStringType; + struct VTerm { VTermAllocatorFunctions *allocator; @@ -164,22 +174,37 @@ unsigned int ctrl8bit:1; } mode; - enum VTermParserState { - NORMAL, - CSI, - OSC, - DCS, - ESC, - ESC_IN_OSC, - ESC_IN_DCS - } parser_state; - const VTermParserCallbacks *parser_callbacks; - void *cbdata; + struct { + enum VTermParserState { + NORMAL, + CSI_LEADER, + CSI_ARGS, + CSI_INTERMED, + ESC, + /* below here are the "string states" */ + STRING, + ESC_IN_STRING, + } state; + + int intermedlen; + char intermed[INTERMED_MAX]; + + int csi_leaderlen; + char csi_leader[CSI_LEADER_MAX]; + + int csi_argi; + long csi_args[CSI_ARGS_MAX]; + + const VTermParserCallbacks *callbacks; + void *cbdata; + + VTermParserStringType stringtype; + char *strbuffer; + size_t strbuffer_len; + size_t strbuffer_cur; + } parser; /* len == malloc()ed size; cur == number of valid bytes */ - char *strbuffer; - size_t strbuffer_len; - size_t strbuffer_cur; char *outbuffer; size_t outbuffer_len; @@ -222,7 +247,8 @@ C1_SS3 = 0x8f, C1_DCS = 0x90, C1_CSI = 0x9b, - C1_ST = 0x9c + C1_ST = 0x9c, + C1_OSC = 0x9d, }; void vterm_state_push_output_sprintf_CSI(VTermState *vts, const char *format, ...); diff -Nru vim-8.0.1453/src/libvterm/t/10state_putglyph.test vim-8.0.1766/src/libvterm/t/10state_putglyph.test --- vim-8.0.1453/src/libvterm/t/10state_putglyph.test 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/t/10state_putglyph.test 2018-04-26 20:30:33.000000000 +0000 @@ -17,6 +17,12 @@ putglyph 0xc1 1 0,0 putglyph 0xe9 1 0,1 +!UTF-8 split writes +RESET +PUSH "\xC3" +PUSH "\x81" + putglyph 0xc1 1 0,0 + !UTF-8 wide char # U+FF10 = 0xEF 0xBC 0x90 name: FULLWIDTH DIGIT ZERO RESET diff -Nru vim-8.0.1453/src/libvterm/t/25state_input.test vim-8.0.1766/src/libvterm/t/25state_input.test --- vim-8.0.1453/src/libvterm/t/25state_input.test 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/t/25state_input.test 2018-04-26 20:30:33.000000000 +0000 @@ -130,3 +130,14 @@ output "\e[200~" PASTE END output "\e[201~" + +!Focus reporting disabled +FOCUS IN +FOCUS OUT + +!Focus reporting enabled +PUSH "\e[?1004h" +FOCUS IN + output "\e[I" +FOCUS OUT + output "\e[O" diff -Nru vim-8.0.1453/src/libvterm/t/26state_query.test vim-8.0.1766/src/libvterm/t/26state_query.test --- vim-8.0.1453/src/libvterm/t/26state_query.test 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/t/26state_query.test 2018-04-26 20:30:33.000000000 +0000 @@ -58,5 +58,5 @@ PUSH "\e F" !Truncation on attempted buffer overflow -PUSH "\e[6n" x 20 - output "\e[10;10R" x 7 +PUSH "\e[6n" x 30 + output "\e[10;10R" x 24 diff -Nru vim-8.0.1453/src/libvterm/t/harness.c vim-8.0.1766/src/libvterm/t/harness.c --- vim-8.0.1453/src/libvterm/t/harness.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/libvterm/t/harness.c 2018-04-26 20:30:33.000000000 +0000 @@ -233,6 +233,9 @@ case VTERM_VALUETYPE_COLOR: printf("settermprop %d rgb(%d,%d,%d)\n", prop, val->color.red, val->color.green, val->color.blue); return 1; + + case VTERM_N_VALUETYPES: + return 0; } return 0; @@ -316,6 +319,9 @@ case VTERM_ATTR_BACKGROUND: state_pen.background = val->color; break; + + case VTERM_N_ATTRS: + return 0; } return 1; @@ -650,6 +656,16 @@ else goto abort_line; } + + else if(strstartswith(line, "FOCUS ")) { + char *linep = line + 6; + if(streq(linep, "IN")) + vterm_state_focus_in(state); + else if(streq(linep, "OUT")) + vterm_state_focus_out(state); + else + goto abort_line; + } else if(strstartswith(line, "MOUSEMOVE ")) { char *linep = line + 10; diff -Nru vim-8.0.1453/src/list.c vim-8.0.1766/src/list.c --- vim-8.0.1453/src/list.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/list.c 2018-04-26 20:30:33.000000000 +0000 @@ -475,6 +475,27 @@ } /* + * Append list2 to list1. + * Return FAIL when out of memory. + */ + int +list_append_list(list1, list2) + list_T *list1; + list_T *list2; +{ + listitem_T *li = listitem_alloc(); + + if (li == NULL) + return FAIL; + li->li_tv.v_type = VAR_LIST; + li->li_tv.v_lock = 0; + li->li_tv.vval.v_list = list2; + list_append(list1, li); + ++list2->lv_refcount; + return OK; +} + +/* * Make a copy of "str" and append it as an item to list "l". * When "len" >= 0 use "str[len]". * Returns FAIL when out of memory. diff -Nru vim-8.0.1453/src/macros.h vim-8.0.1766/src/macros.h --- vim-8.0.1453/src/macros.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/macros.h 2018-04-26 20:30:33.000000000 +0000 @@ -230,9 +230,9 @@ #endif #ifdef STARTUPTIME -# define TIME_MSG(s) { if (time_fd != NULL) time_msg(s, NULL); } +# define TIME_MSG(s) do { if (time_fd != NULL) time_msg(s, NULL); } while (0) #else -# define TIME_MSG(s) +# define TIME_MSG(s) do { /**/ } while (0) #endif #ifdef FEAT_VREPLACE @@ -289,24 +289,12 @@ #endif #ifdef FEAT_AUTOCHDIR -# define DO_AUTOCHDIR if (p_acd) do_autochdir(); +# define DO_AUTOCHDIR do { if (p_acd) do_autochdir(); } while (0) #else -# define DO_AUTOCHDIR +# define DO_AUTOCHDIR do { /**/ } while (0) #endif -#if defined(FEAT_SCROLLBIND) && defined(FEAT_CURSORBIND) -# define RESET_BINDING(wp) (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE -#else -# if defined(FEAT_SCROLLBIND) -# define RESET_BINDING(wp) (wp)->w_p_scb = FALSE -# else -# if defined(FEAT_CURSORBIND) -# define RESET_BINDING(wp) (wp)->w_p_crb = FALSE -# else -# define RESET_BINDING(wp) -# endif -# endif -#endif +#define RESET_BINDING(wp) (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE #ifdef FEAT_DIFF # define PLINES_NOFILL(x) plines_nofill(x) @@ -379,3 +367,14 @@ # define mch_enable_flush() # define mch_disable_flush() #endif + +/* + * Like vim_free(), and also set the pointer to NULL. + */ +#define VIM_CLEAR(p) \ + do { \ + if ((p) != NULL) { \ + vim_free(p); \ + (p) = NULL; \ + } \ + } while (0) diff -Nru vim-8.0.1453/src/main.c vim-8.0.1766/src/main.c --- vim-8.0.1453/src/main.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/main.c 2018-04-26 20:30:33.000000000 +0000 @@ -111,7 +111,7 @@ # endif (int argc, char **argv) { -#ifdef STARTUPTIME +#if defined(STARTUPTIME) || defined(CLEAN_RUNTIMEPATH) int i; #endif @@ -158,18 +158,25 @@ #ifdef STARTUPTIME /* Need to find "--startuptime" before actually parsing arguments. */ - for (i = 1; i < argc; ++i) - { - if (STRICMP(argv[i], "--startuptime") == 0 && i + 1 < argc) + for (i = 1; i < argc - 1; ++i) + if (STRICMP(argv[i], "--startuptime") == 0) { time_fd = mch_fopen(argv[i + 1], "a"); TIME_MSG("--- VIM STARTING ---"); break; } - } #endif starttime = time(NULL); +#ifdef CLEAN_RUNTIMEPATH + /* Need to find "--clean" before actually parsing arguments. */ + for (i = 1; i < argc; ++i) + if (STRICMP(argv[i], "--clean") == 0) + { + params.clean = TRUE; + break; + } +#endif common_init(¶ms); #ifdef FEAT_CLIENTSERVER @@ -264,7 +271,7 @@ * Hint: to avoid this when typing a command use a forward slash. * If the cd fails, it doesn't matter. */ - (void)vim_chdirfile(params.fname); + (void)vim_chdirfile(params.fname, "drop"); if (start_dir != NULL) mch_dirname(start_dir, MAXPATHL); } @@ -314,7 +321,7 @@ && STRCMP(NameBuff, "/") == 0) { if (params.fname != NULL) - (void)vim_chdirfile(params.fname); + (void)vim_chdirfile(params.fname, "drop"); else { expand_env((char_u *)"$HOME", NameBuff, MAXPATHL); @@ -359,6 +366,13 @@ */ check_tty(¶ms); +#ifdef _IOLBF + /* Ensure output works usefully without a tty: buffer lines instead of + * fully buffered. */ + if (silent_mode) + setvbuf(stdout, NULL, _IOLBF, 0); +#endif + /* This message comes before term inits, but after setting "silent_mode" * when the input is not a tty. */ if (GARGCOUNT > 1 && !silent_mode) @@ -734,10 +748,8 @@ if (exmode_active) curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); TIME_MSG("BufEnter autocommands"); -#endif setpcmark(); #ifdef FEAT_QUICKFIX @@ -812,7 +824,7 @@ no_wait_return = FALSE; /* 'autochdir' has been postponed */ - DO_AUTOCHDIR + DO_AUTOCHDIR; #ifdef FEAT_TERMRESPONSE /* Requesting the termresponse is postponed until here, so that a "-c q" @@ -829,10 +841,8 @@ #ifdef FEAT_EVAL set_vim_var_nr(VV_VIM_DID_ENTER, 1L); #endif -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf); TIME_MSG("VimEnter autocommands"); -#endif #if defined(FEAT_EVAL) && defined(FEAT_CLIPBOARD) /* Adjust default register name for "unnamed" in 'clipboard'. Can only be @@ -847,7 +857,7 @@ } #endif -#if defined(FEAT_DIFF) && defined(FEAT_SCROLLBIND) +#if defined(FEAT_DIFF) /* When a startup script or session file setup for diff'ing and * scrollbind, sync the scrollbind now. */ if (curwin->w_p_diff && curwin->w_p_scb) @@ -1017,7 +1027,7 @@ * First find out the home directory, needed to expand "~" in options. */ init_homedir(); /* find real value of $HOME */ - set_init_1(); + set_init_1(paramp->clean); TIME_MSG("inits 1"); #ifdef FEAT_EVAL @@ -1046,7 +1056,7 @@ int cmdwin, /* TRUE when working in the command-line window */ int noexmode) /* TRUE when return on entering Ex mode */ { - oparg_T oa; /* operator arguments */ + oparg_T oa; /* operator arguments */ volatile int previous_got_int = FALSE; /* "got_int" was TRUE */ #ifdef FEAT_CONCEAL /* these are static to avoid a compiler warning */ @@ -1148,63 +1158,42 @@ skip_redraw = FALSE; else if (do_redraw || stuff_empty()) { -# ifdef FEAT_GUI +#ifdef FEAT_GUI /* If ui_breakcheck() was used a resize may have been postponed. */ gui_may_resize_shell(); -# endif -#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL) +#endif /* Trigger CursorMoved if the cursor moved. */ if (!finish_op && ( -# ifdef FEAT_AUTOCMD has_cursormoved() -# endif -# if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL) - || -# endif -# ifdef FEAT_CONCEAL - curwin->w_p_cole > 0 -# endif +#ifdef FEAT_CONCEAL + || curwin->w_p_cole > 0 +#endif ) -# ifdef FEAT_AUTOCMD - && !EQUAL_POS(last_cursormoved, curwin->w_cursor) -# endif - ) + && !EQUAL_POS(last_cursormoved, curwin->w_cursor)) { -# ifdef FEAT_AUTOCMD if (has_cursormoved()) apply_autocmds(EVENT_CURSORMOVED, NULL, NULL, FALSE, curbuf); -# endif # ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0) { -# ifdef FEAT_AUTOCMD conceal_old_cursor_line = last_cursormoved.lnum; -# endif conceal_new_cursor_line = curwin->w_cursor.lnum; conceal_update_lines = TRUE; } # endif -# ifdef FEAT_AUTOCMD last_cursormoved = curwin->w_cursor; -# endif } -#endif -#ifdef FEAT_AUTOCMD /* Trigger TextChanged if b:changedtick differs. */ if (!finish_op && has_textchanged() - && last_changedtick != CHANGEDTICK(curbuf)) + && curbuf->b_last_changedtick != CHANGEDTICK(curbuf)) { - if (last_changedtick_buf == curbuf) - apply_autocmds(EVENT_TEXTCHANGED, NULL, NULL, - FALSE, curbuf); - last_changedtick_buf = curbuf; - last_changedtick = CHANGEDTICK(curbuf); + apply_autocmds(EVENT_TEXTCHANGED, NULL, NULL, FALSE, curbuf); + curbuf->b_last_changedtick = CHANGEDTICK(curbuf); } -#endif -#if defined(FEAT_DIFF) && defined(FEAT_SCROLLBIND) +#if defined(FEAT_DIFF) /* Scroll-binding for diff mode may have been postponed until * here. Avoids doing it for every change. */ if (diff_need_scrollbind) @@ -1281,7 +1270,7 @@ may_clear_sb_text(); /* clear scroll-back text on next msg */ showruler(FALSE); -# if defined(FEAT_CONCEAL) +#if defined(FEAT_CONCEAL) if (conceal_update_lines && (conceal_old_cursor_line != conceal_new_cursor_line || conceal_cursor_line(curwin) @@ -1296,7 +1285,7 @@ mch_enable_flush(); curwin->w_valid &= ~VALID_CROW; } -# endif +#endif setcursor(); cursor_on(); @@ -1394,13 +1383,10 @@ void getout(int exitval) { -#ifdef FEAT_AUTOCMD - buf_T *buf; - win_T *wp; - tabpage_T *tp, *next_tp; -#endif - exiting = TRUE; +#if defined(FEAT_JOB_CHANNEL) + ch_log(NULL, "Exiting..."); +#endif /* When running in Ex mode an error causes us to exit with a non-zero exit * code. POSIX requires this, although it's not 100% clear from the @@ -1423,9 +1409,13 @@ msg_didany = FALSE; #endif -#ifdef FEAT_AUTOCMD - if (get_vim_var_nr(VV_DYING) <= 1) + if (v_dying <= 1) { + tabpage_T *tp; + tabpage_T *next_tp; + buf_T *buf; + win_T *wp; + /* Trigger BufWinLeave for all windows, but only once per buffer. */ for (tp = first_tabpage; tp != NULL; tp = next_tp) { @@ -1468,7 +1458,6 @@ } apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf); } -#endif #ifdef FEAT_VIMINFO if (*p_viminfo != NUL) @@ -1476,10 +1465,8 @@ write_viminfo(NULL, FALSE); #endif -#ifdef FEAT_AUTOCMD - if (get_vim_var_nr(VV_DYING) <= 1) + if (v_dying <= 1) apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, FALSE, curbuf); -#endif #ifdef FEAT_PROFILE profile_dump(); @@ -1496,13 +1483,11 @@ wait_return(FALSE); } -#ifdef FEAT_AUTOCMD /* Position the cursor again, the autocommands may have moved it */ -# ifdef FEAT_GUI +#ifdef FEAT_GUI if (!gui.in_use) -# endif - windgoto((int)Rows - 1, 0); #endif + windgoto((int)Rows - 1, 0); #ifdef FEAT_JOB_CHANNEL job_stop_on_exit(); @@ -1899,6 +1884,10 @@ else if (STRNICMP(argv[0] + argv_idx, "clean", 5) == 0) { parmp->use_vimrc = (char_u *)"DEFAULTS"; +#ifdef FEAT_GUI + use_gvimrc = (char_u *)"NONE"; +#endif + parmp->clean = TRUE; set_option_value((char_u *)"vif", 0L, (char_u *)"NONE", 0); } else if (STRNICMP(argv[0] + argv_idx, "literal", 7) == 0) @@ -2532,7 +2521,7 @@ /* * Print a warning if stdout is not a terminal. - * When starting in Ex mode and commands come from a file, set Silent mode. + * When starting in Ex mode and commands come from a file, set silent_mode. */ static void check_tty(mparm_T *parmp) @@ -2689,13 +2678,11 @@ * Commands in the .vimrc might have loaded a file or split the window. * Watch out for autocommands that delete a window. */ -#ifdef FEAT_AUTOCMD /* * Don't execute Win/Buf Enter/Leave autocommands here */ ++autocmd_no_enter; ++autocmd_no_leave; -#endif dorewind = TRUE; while (done++ < 1000) { @@ -2755,9 +2742,7 @@ else handle_swap_exists(NULL); #endif -#ifdef FEAT_AUTOCMD dorewind = TRUE; /* start again */ -#endif } ui_breakcheck(); if (got_int) @@ -2771,10 +2756,8 @@ else curwin = firstwin; curbuf = curwin->w_buffer; -#ifdef FEAT_AUTOCMD --autocmd_no_enter; --autocmd_no_leave; -#endif } } @@ -2792,13 +2775,11 @@ int advance = TRUE; win_T *win; -# ifdef FEAT_AUTOCMD /* * Don't execute Win/Buf Enter/Leave autocommands here */ ++autocmd_no_enter; ++autocmd_no_leave; -# endif /* When w_arg_idx is -1 remove the window (see create_windows()). */ if (curwin->w_arg_idx == -1) @@ -2879,9 +2860,7 @@ if (parmp->window_layout == WIN_TABS) goto_tabpage(1); -# ifdef FEAT_AUTOCMD --autocmd_no_enter; -# endif /* make the first window the current window */ win = firstwin; @@ -2899,9 +2878,7 @@ #endif win_enter(win, FALSE); -#ifdef FEAT_AUTOCMD --autocmd_no_leave; -#endif TIME_MSG("editing files in windows"); if (parmp->window_count > 1 && parmp->window_layout != WIN_TABS) win_equal(curwin, FALSE, 'b'); /* adjust heights */ @@ -3947,8 +3924,7 @@ { /* Output error from remote */ mch_errmsg((char *)res); - vim_free(res); - res = NULL; + VIM_CLEAR(res); } mch_errmsg(_(": Send expression failed.\n")); } diff -Nru vim-8.0.1453/src/Make_cyg_ming.mak vim-8.0.1766/src/Make_cyg_ming.mak --- vim-8.0.1453/src/Make_cyg_ming.mak 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/Make_cyg_ming.mak 2018-04-26 20:30:33.000000000 +0000 @@ -20,7 +20,7 @@ # # "make upx" makes *compressed* versions of the 32 bit GUI and console EXEs, # using the excellent UPX compressor: -# http://upx.sourceforge.net/ +# https://upx.github.io/ # "make mpress" uses the MPRESS compressor for 32- and 64-bit EXEs: # http://www.matcode.com/mpress.htm # @@ -28,52 +28,71 @@ # Updated 2014 Oct 13. #>>>>> choose options: +# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE] +# Set to TINY to make minimal version (few features). +FEATURES=HUGE + # set to yes for a debug build DEBUG=no + # set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization OPTIMIZE=MAXSPEED + # set to yes to make gvim, no for vim GUI=yes -# set to yes if you want to use DirectWrite (DirectX) + +# set to no if you do not want to use DirectWrite (DirectX) # MinGW-w64 is needed, and ARCH should be set to i686 or x86-64. -DIRECTX=no -# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE] -# Set to TINY to make minimal version (few features). -FEATURES=HUGE +DIRECTX=yes + +# Disable Color emoji support +# (default is yes if DIRECTX=yes, requires WinSDK 8.1 or later.) +#COLOR_EMOJI=no + # Set to one of i386, i486, i586, i686 as the minimum target processor. # For amd64/x64 architecture set ARCH=x86-64 . # If not set, it will be automatically detected. (Normally i686 or x86-64.) #ARCH=i686 # Set to yes to cross-compile from unix; no=native Windows (and Cygwin). CROSS=no + # Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'. # Use "yes" when the path does not need to be define. #ICONV="." ICONV=yes GETTEXT=yes + # Set to yes to include multibyte support. MBYTE=yes + # Set to yes to include IME support. IME=yes DYNAMIC_IME=yes + # Set to yes to enable writing a postscript file with :hardcopy. POSTSCRIPT=no + # Set to yes to enable OLE support. OLE=no + # Set the default $(WINVER) to make it work with WinXP. ifndef WINVER WINVER = 0x0501 endif + # Set to yes to enable Cscope support. CSCOPE=yes + # Set to yes to enable Netbeans support (requires CHANNEL). NETBEANS=$(GUI) + # Set to yes to enable inter process communication. ifeq (HUGE, $(FEATURES)) CHANNEL=yes else CHANNEL=$(GUI) endif + # Set to yes to enable terminal support. ifeq (HUGE, $(FEATURES)) TERMINAL=yes @@ -371,7 +390,7 @@ # Ruby interface: # RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak) -# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically) +# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically, "no" for static) # RUBY_VER=[Ruby version, eg 19, 22] (default is 22) # RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0] # (default is 2.2.0) @@ -518,6 +537,9 @@ CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER) endif +ifeq (no, $(DYNAMIC_RUBY)) +CFLAGS += -DRUBY_VERSION=$(RUBY_VER) +endif ifneq ($(findstring w64-mingw32,$(CC)),) # A workaround for MinGW-w64 CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE @@ -588,7 +610,10 @@ ifeq ($(DIRECTX),yes) # Only allow DirectWrite for a GUI build. ifeq (yes, $(GUI)) -DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI +DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX +ifneq ($(COLOR_EMOJI),no) +DEFINES += -DFEAT_DIRECTX_COLOR_EMOJI +endif endif endif diff -Nru vim-8.0.1453/src/Makefile vim-8.0.1766/src/Makefile --- vim-8.0.1453/src/Makefile 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/Makefile 2018-04-26 20:30:33.000000000 +0000 @@ -651,12 +651,16 @@ # PROFILING - Uncomment the next two lines to do profiling with gcc and gprof. # Might not work with GUI or Perl. -# For unknown reasons adding "-lc" fixes a linking problem with some versions -# of GCC. That's probably a bug in the "-pg" implementation. # After running Vim see the profile result with: gprof vim gmon.out | vim - # Need to recompile everything after changing this: "make clean" "make". #PROFILE_CFLAGS = -pg -g -DWE_ARE_PROFILING #PROFILE_LIBS = -pg + +# GCC 5 and later need the -no-pie argument. +#PROFILE_LIBS = -pg -no-pie + +# For unknown reasons adding "-lc" fixes a linking problem with some versions +# of GCC. That's probably a bug in the "-pg" implementation. #PROFILE_LIBS = -pg -lc @@ -1392,6 +1396,8 @@ libvterm/src/utf8.h \ libvterm/src/vterm_internal.h +TERM_SRC = libvterm/src/*.c + ### Command to create dependencies based on #include "..." ### prototype headers are ignored due to -DPROTO, system ### headers #include <...> are ignored if we use the -MM option, as @@ -2036,7 +2042,7 @@ # Motif and Athena GUI # You can ignore error messages for missing files. tags TAGS: notags - $(TAGPRG) $(TAGS_SRC) $(TAGS_INCL) + $(TAGPRG) $(TAGS_SRC) $(TAGS_INCL) $(TERM_SRC) $(TERM_DEPS) # Make a highlight file for types. Requires Exuberant ctags and awk types: types.vim @@ -2082,6 +2088,10 @@ unittesttargets: $(MAKE) -f Makefile $(UNITTEST_TARGETS) +# Swap these lines to run individual tests with gvim instead of vim. +VIMTESTTARGET = $(VIMTARGET) +# VIMTESTTARGET = $(GVIMTARGET) + # Execute the unittests one by one. unittest unittests: $(RUN_UNITTESTS) @@ -2109,7 +2119,7 @@ test70 test72 \ test85 test86 test87 test88 \ test94 test95 test99 test108: - cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) + cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) # Run individual NEW style test. # These do not depend on the executable, compile it when needed. @@ -2121,12 +2131,14 @@ test_autocmd \ test_autoload \ test_backspace_opt \ + test_blockedit \ test_breakindent \ test_bufline \ test_bufwintabinfo \ test_cd \ test_cdo \ test_changedtick \ + test_changelist \ test_channel \ test_charsearch \ test_charsearch_utf8 \ @@ -2150,6 +2162,7 @@ test_eval_stuff \ test_ex_undo \ test_ex_z \ + test_exit \ test_exec_while_if \ test_execute_func \ test_exists \ @@ -2198,6 +2211,7 @@ test_job_fails \ test_join \ test_json \ + test_jumplist \ test_jumps \ test_lambda \ test_langmap \ @@ -2298,17 +2312,18 @@ test_windows_home \ test_wordcount \ test_writefile \ + test_xxd \ test_alot_latin \ test_alot_utf8 \ test_alot: - cd testdir; rm -f $@.res test.log messages; $(MAKE) -f Makefile $@.res VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) + cd testdir; rm -f $@.res test.log messages; $(MAKE) -f Makefile $@.res VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) @if test -f testdir/test.log; then \ cat testdir/test.log; \ fi cat testdir/messages newtests: - cd testdir; rm -f $@.res test.log messages; $(MAKE) -f Makefile newtestssilent VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) + cd testdir; rm -f $@.res test.log messages; $(MAKE) -f Makefile newtestssilent VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) @if test -f testdir/test.log; then \ cat testdir/test.log; \ fi @@ -2879,6 +2894,7 @@ ../../testdir/pyxfile \ ../../testdir/sautest \ ../../testdir/samples \ + ../../testdir/dumps \ ../../testdir/test83-tags? \ ../../testdir/*.ok . @@ -3154,12 +3170,6 @@ objects/if_perlsfio.o: if_perlsfio.c $(CCC_NF) $(PERL_CFLAGS) $(ALL_CFLAGS) -o $@ if_perlsfio.c -objects/py_getpath.o: $(PYTHON_CONFDIR)/getpath.c - $(CCC_NF) $(PYTHON_CFLAGS) $(ALL_CFLAGS) -o $@ \ - $(PYTHON_CONFDIR)/getpath.c \ - -I$(PYTHON_CONFDIR) -DHAVE_CONFIG_H -DNO_MAIN \ - $(PYTHON_GETPATH_CFLAGS) - objects/if_python.o: if_python.c if_py_both.h $(CCC_NF) $(PYTHON_CFLAGS) $(PYTHON_CFLAGS_EXTRA) $(ALL_CFLAGS) -o $@ if_python.c diff -Nru vim-8.0.1453/src/Make_mvc.mak vim-8.0.1766/src/Make_mvc.mak --- vim-8.0.1453/src/Make_mvc.mak 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/Make_mvc.mak 2018-04-26 20:30:33.000000000 +0000 @@ -26,7 +26,7 @@ # GUI interface: GUI=yes (default is no) # # GUI with DirectWrite (DirectX): DIRECTX=yes -# (default is no, requires GUI=yes and MBYTE=yes) +# (default is yes if GUI=yes, requires GUI=yes and MBYTE=yes) # # Color emoji support: COLOR_EMOJI=yes # (default is yes if DIRECTX=yes, requires WinSDK 8.1 or later.) @@ -180,6 +180,10 @@ TARGETOS = WINNT +!ifndef DIRECTX +DIRECTX = $(GUI) +!endif + # Select one of eight object code directories, depends on GUI, OLE, DEBUG and # interfaces. # If you change something else, do "make clean" first! @@ -289,7 +293,8 @@ MSVCRT_VER = ($(MSVCVER) / 10 - 60) # Visual C++ 2017 needs special handling # it has an _MSC_VER of 1910->14.1, but is actually v15 with runtime v140 -!elseif $(MSVCVER) == 1910 +# TODO: what's the maximum value? +!elseif $(MSVCVER) >= 1910 MSVC_MAJOR = 15 MSVCRT_VER = 140 !else @@ -1153,7 +1158,9 @@ # CFLAGS with /Fo$(OUTDIR)/ CFLAGS_OUTDIR=$(CFLAGS) /Fo$(OUTDIR)/ -conflags = /nologo /subsystem:$(SUBSYSTEM) +# Add /opt:ref to remove unreferenced functions and data even when /DEBUG is +# added. +conflags = /nologo /subsystem:$(SUBSYSTEM) /opt:ref PATHDEF_SRC = $(OUTDIR)\pathdef.c @@ -1179,6 +1186,13 @@ !endif !endif +!if $(MSVC_MAJOR) >= 11 && "$(CPU)" == "AMD64" && "$(GUI)" == "yes" +# This option is required for VC2012 or later so that 64-bit gvim can +# accept D&D from 32-bit applications. NOTE: This disables 64-bit ASLR, +# therefore the security level becomes as same as VC2010. +LINKARGS1 = $(LINKARGS1) /HIGHENTROPYVA:NO +!endif + all: $(VIM).exe \ vimrun.exe \ install.exe \ diff -Nru vim-8.0.1453/src/mark.c vim-8.0.1766/src/mark.c --- vim-8.0.1453/src/mark.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/mark.c 2018-04-26 20:30:33.000000000 +0000 @@ -27,13 +27,9 @@ #define EXTRA_MARKS 10 /* marks 0-9 */ static xfmark_T namedfm[NMARKS + EXTRA_MARKS]; /* marks with file nr */ -static void fname2fnum(xfmark_T *fm); static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf); static char_u *mark_line(pos_T *mp, int lead_len); static void show_one_mark(int, char_u *, pos_T *, char_u *, int current); -#ifdef FEAT_JUMPLIST -static void cleanup_jumplist(void); -#endif #ifdef FEAT_VIMINFO static void write_one_filemark(FILE *fp, xfmark_T *fm, int c1, int c2); #endif @@ -127,8 +123,7 @@ i = c - 'A'; namedfm[i].fmark.mark = *pos; namedfm[i].fmark.fnum = fnum; - vim_free(namedfm[i].fname); - namedfm[i].fname = NULL; + VIM_CLEAR(namedfm[i].fname); #ifdef FEAT_VIMINFO namedfm[i].time_set = vim_time(); #endif @@ -226,7 +221,7 @@ pos_T *pos; xfmark_T *jmp; - cleanup_jumplist(); + cleanup_jumplist(curwin, TRUE); if (curwin->w_jumplistlen == 0) /* nothing to jump to */ return (pos_T *)NULL; @@ -520,7 +515,7 @@ * This is used for marks obtained from the .viminfo file. It's postponed * until the mark is used to avoid a long startup delay. */ - static void + void fname2fnum(xfmark_T *fm) { char_u *p; @@ -598,8 +593,7 @@ && fnamecmp(name, fm->fname) == 0) { fm->fmark.fnum = buf->b_fnum; - vim_free(fm->fname); - fm->fname = NULL; + VIM_CLEAR(fm->fname); } } @@ -862,8 +856,7 @@ else n = i - 'A'; namedfm[n].fmark.mark.lnum = 0; - vim_free(namedfm[n].fname); - namedfm[n].fname = NULL; + VIM_CLEAR(namedfm[n].fname); #ifdef FEAT_VIMINFO namedfm[n].time_set = 0; #endif @@ -898,15 +891,14 @@ int i; char_u *name; - cleanup_jumplist(); + cleanup_jumplist(curwin, TRUE); + /* Highlight title */ MSG_PUTS_TITLE(_("\n jump line col file/text")); for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i) { if (curwin->w_jumplist[i].fmark.mark.lnum != 0) { - if (curwin->w_jumplist[i].fmark.fnum == 0) - fname2fnum(&curwin->w_jumplist[i]); name = fm_getname(&curwin->w_jumplist[i].fmark, 16); if (name == NULL) /* file name not available */ continue; @@ -1308,34 +1300,49 @@ #ifdef FEAT_JUMPLIST /* * When deleting lines, this may create duplicate marks in the - * jumplist. They will be removed here for the current window. + * jumplist. They will be removed here for the specified window. + * When "loadfiles" is TRUE first ensure entries have the "fnum" field set + * (this may be a bit slow). */ - static void -cleanup_jumplist(void) + void +cleanup_jumplist(win_T *wp, int loadfiles) { int i; int from, to; + if (loadfiles) + { + /* If specified, load all the files from the jump list. This is + * needed to properly clean up duplicate entries, but will take some + * time. */ + for (i = 0; i < wp->w_jumplistlen; ++i) + { + if ((wp->w_jumplist[i].fmark.fnum == 0) && + (wp->w_jumplist[i].fmark.mark.lnum != 0)) + fname2fnum(&wp->w_jumplist[i]); + } + } + to = 0; - for (from = 0; from < curwin->w_jumplistlen; ++from) + for (from = 0; from < wp->w_jumplistlen; ++from) { - if (curwin->w_jumplistidx == from) - curwin->w_jumplistidx = to; - for (i = from + 1; i < curwin->w_jumplistlen; ++i) - if (curwin->w_jumplist[i].fmark.fnum - == curwin->w_jumplist[from].fmark.fnum - && curwin->w_jumplist[from].fmark.fnum != 0 - && curwin->w_jumplist[i].fmark.mark.lnum - == curwin->w_jumplist[from].fmark.mark.lnum) + if (wp->w_jumplistidx == from) + wp->w_jumplistidx = to; + for (i = from + 1; i < wp->w_jumplistlen; ++i) + if (wp->w_jumplist[i].fmark.fnum + == wp->w_jumplist[from].fmark.fnum + && wp->w_jumplist[from].fmark.fnum != 0 + && wp->w_jumplist[i].fmark.mark.lnum + == wp->w_jumplist[from].fmark.mark.lnum) break; - if (i >= curwin->w_jumplistlen) /* no duplicate */ - curwin->w_jumplist[to++] = curwin->w_jumplist[from]; + if (i >= wp->w_jumplistlen) /* no duplicate */ + wp->w_jumplist[to++] = wp->w_jumplist[from]; else - vim_free(curwin->w_jumplist[from].fname); + vim_free(wp->w_jumplist[from].fname); } - if (curwin->w_jumplistidx == curwin->w_jumplistlen) - curwin->w_jumplistidx = to; - curwin->w_jumplistlen = to; + if (wp->w_jumplistidx == wp->w_jumplistlen) + wp->w_jumplistidx = to; + wp->w_jumplistlen = to; } /* @@ -1480,16 +1487,14 @@ { for (i = 0; i < NMARKS + EXTRA_MARKS; ++i) vim_free(vi_namedfm[i].fname); - vim_free(vi_namedfm); - vi_namedfm = NULL; + VIM_CLEAR(vi_namedfm); } #ifdef FEAT_JUMPLIST if (vi_jumplist != NULL) { for (i = 0; i < vi_jumplist_len; ++i) vim_free(vi_jumplist[i].fname); - vim_free(vi_jumplist); - vi_jumplist = NULL; + VIM_CLEAR(vi_jumplist); } #endif } @@ -1746,7 +1751,7 @@ /* Write the jumplist with -' */ fputs(_("\n# Jumplist (newest first):\n"), fp); setpcmark(); /* add current cursor position */ - cleanup_jumplist(); + cleanup_jumplist(curwin, FALSE); vi_idx = 0; idx = curwin->w_jumplistlen - 1; for (i = 0; i < JUMPLISTSIZE; ++i) diff -Nru vim-8.0.1453/src/mbyte.c vim-8.0.1766/src/mbyte.c --- vim-8.0.1453/src/mbyte.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/mbyte.c 2018-04-26 20:30:33.000000000 +0000 @@ -799,11 +799,9 @@ fix_arg_enc(); #endif -#ifdef FEAT_AUTOCMD /* Fire an autocommand to let people do custom font setup. This must be * after Vim has been setup for the new encoding. */ apply_autocmds(EVENT_ENCODINGCHANGED, NULL, (char_u *)"", FALSE, curbuf); -#endif #ifdef FEAT_SPELL /* Need to reload spell dictionaries */ @@ -2260,7 +2258,6 @@ /* * Convert Unicode character "c" to UTF-8 string in "buf[]". * Returns the number of bytes. - * This does not include composing characters. */ int utf_char2bytes(int c, char_u *buf) @@ -4666,8 +4663,7 @@ else if (ICONV_ERRNO != ICONV_E2BIG) { /* conversion failed */ - vim_free(result); - result = NULL; + VIM_CLEAR(result); break; } /* Not enough room or skipping illegal sequence. */ @@ -4794,7 +4790,8 @@ # define USE_IMSTATUSFUNC (*p_imsf != NUL) #endif -#if defined(FEAT_EVAL) && defined(FEAT_MBYTE) +#if defined(FEAT_EVAL) && defined(FEAT_MBYTE) \ + && (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM)) static void call_imactivatefunc(int active) { @@ -4813,11 +4810,7 @@ int is_active; /* FIXME: Don't execute user function in unsafe situation. */ - if (exiting -# ifdef FEAT_AUTOCMD - || is_autocmd_blocked() -# endif - ) + if (exiting || is_autocmd_blocked()) return FALSE; /* FIXME: :py print 'xxx' is shown duplicate result. * Use silent to avoid it. */ @@ -5047,11 +5040,11 @@ #else gtk_widget_modify_font(preedit_label, gui.norm_font); - vim_snprintf(buf, sizeof(buf), "#%06X", gui.norm_pixel); + vim_snprintf(buf, sizeof(buf), "#%06X", (unsigned)gui.norm_pixel); gdk_color_parse(buf, &color); gtk_widget_modify_fg(preedit_label, GTK_STATE_NORMAL, &color); - vim_snprintf(buf, sizeof(buf), "#%06X", gui.back_pixel); + vim_snprintf(buf, sizeof(buf), "#%06X", (unsigned)gui.back_pixel); gdk_color_parse(buf, &color); gtk_widget_modify_bg(preedit_window, GTK_STATE_NORMAL, &color); #endif @@ -5700,11 +5693,11 @@ void xim_reset(void) { -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (USE_IMACTIVATEFUNC) call_imactivatefunc(im_is_active); else -#endif +# endif if (xic != NULL) { gtk_im_context_reset(xic); @@ -6484,11 +6477,11 @@ #else /* !defined(FEAT_XIM) */ -# if !defined(FEAT_GUI_W32) || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)) +# ifdef IME_WITHOUT_XIM static int im_was_set_active = FALSE; int -im_get_status() +im_get_status(void) { # if defined(FEAT_MBYTE) && defined(FEAT_EVAL) if (USE_IMSTATUSFUNC) diff -Nru vim-8.0.1453/src/memfile.c vim-8.0.1766/src/memfile.c --- vim-8.0.1453/src/memfile.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/memfile.c 2018-04-26 20:30:33.000000000 +0000 @@ -297,10 +297,8 @@ if (mfp->mf_fname != NULL) { mch_remove(mfp->mf_fname); /* delete the swap file */ - vim_free(mfp->mf_fname); - vim_free(mfp->mf_ffname); - mfp->mf_fname = NULL; - mfp->mf_ffname = NULL; + VIM_CLEAR(mfp->mf_fname); + VIM_CLEAR(mfp->mf_ffname); } } @@ -1288,10 +1286,8 @@ */ if (mfp->mf_fd < 0) { - vim_free(mfp->mf_fname); - vim_free(mfp->mf_ffname); - mfp->mf_fname = NULL; - mfp->mf_ffname = NULL; + VIM_CLEAR(mfp->mf_fname); + VIM_CLEAR(mfp->mf_ffname); } else { diff -Nru vim-8.0.1453/src/memline.c vim-8.0.1766/src/memline.c --- vim-8.0.1453/src/memline.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/memline.c 2018-04-26 20:30:33.000000000 +0000 @@ -8,8 +8,8 @@ */ /* for debugging */ -/* #define CHECK(c, s) if (c) EMSG(s) */ -#define CHECK(c, s) +/* #define CHECK(c, s) do { if (c) EMSG(s); } while (0) */ +#define CHECK(c, s) do { /**/ } while (0) /* * memline.c: Contains the functions for appending, deleting and changing the @@ -535,8 +535,7 @@ idx = 0; /* start with first index in block 1 */ error = 0; buf->b_ml.ml_stack_top = 0; - vim_free(buf->b_ml.ml_stack); - buf->b_ml.ml_stack = NULL; + VIM_CLEAR(buf->b_ml.ml_stack); buf->b_ml.ml_stack_size = 0; /* no stack yet */ for ( ; !got_int; line_breakcheck()) @@ -852,8 +851,7 @@ vim_free(buf->b_ml.ml_line_ptr); vim_free(buf->b_ml.ml_stack); #ifdef FEAT_BYTEOFF - vim_free(buf->b_ml.ml_chunksize); - buf->b_ml.ml_chunksize = NULL; + VIM_CLEAR(buf->b_ml.ml_chunksize); #endif buf->b_ml.ml_mfp = NULL; @@ -1734,13 +1732,11 @@ } if (serious_error && called_from_main) ml_close(curbuf, TRUE); -#ifdef FEAT_AUTOCMD else { apply_autocmds(EVENT_BUFREADPOST, NULL, curbuf->b_fname, FALSE, curbuf); apply_autocmds(EVENT_BUFWINENTER, NULL, curbuf->b_fname, FALSE, curbuf); } -#endif return; } @@ -4073,7 +4069,7 @@ --no_wait_return; } -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) static int do_swapexists(buf_T *buf, char_u *fname); /* @@ -4197,8 +4193,7 @@ break; if ((n = (int)STRLEN(fname)) == 0) /* safety check */ { - vim_free(fname); - fname = NULL; + VIM_CLEAR(fname); break; } #if defined(UNIX) @@ -4453,7 +4448,7 @@ #if (defined(UNIX) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)) process_still_running = FALSE; #endif -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) /* * If there is an SwapExists autocommand and we can handle * the response, trigger it. It may return 0 to ask the @@ -4578,8 +4573,7 @@ if (fname[n - 2] == 'a') /* ".saa": tried enough, give up */ { EMSG(_("E326: Too many swap files found")); - vim_free(fname); - fname = NULL; + VIM_CLEAR(fname); break; } --fname[n - 2]; /* ".svz", ".suz", etc. */ diff -Nru vim-8.0.1453/src/menu.c vim-8.0.1766/src/menu.c --- vim-8.0.1453/src/menu.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/menu.c 2018-04-26 20:30:33.000000000 +0000 @@ -34,10 +34,6 @@ static int get_menu_cmd_modes(char_u *, int, int *, int *); static char_u *popup_mode_name(char_u *name, int idx); static char_u *menu_text(char_u *text, int *mnemonic, char_u **actext); -#ifdef FEAT_GUI -static int get_menu_mode(void); -static void gui_update_menus_recurse(vimmenu_T *, int); -#endif #if defined(FEAT_GUI_W32) && defined(FEAT_TEAROFF) static void gui_create_tearoffs_recurse(vimmenu_T *menu, const char_u *pname, int *pri_tab, int pri_idx); @@ -727,8 +723,7 @@ menup = &menu->children; parent = menu; name = next_name; - vim_free(dname); - dname = NULL; + VIM_CLEAR(dname); if (pri_tab[pri_idx + 1] != -1) ++pri_idx; } @@ -1872,7 +1867,7 @@ } #endif -#ifdef FEAT_GUI +#if defined(FEAT_GUI) || defined(FEAT_TERM_POPUP_MENU) || defined(PROTO) static int get_menu_mode(void) @@ -1896,6 +1891,68 @@ return MENU_INDEX_INVALID; } + int +get_menu_mode_flag(void) +{ + int mode = get_menu_mode(); + + if (mode == MENU_INDEX_INVALID) + return 0; + return 1 << mode; +} + +/* + * Display the Special "PopUp" menu as a pop-up at the current mouse + * position. The "PopUpn" menu is for Normal mode, "PopUpi" for Insert mode, + * etc. + */ + void +show_popupmenu(void) +{ + vimmenu_T *menu; + int mode; + + mode = get_menu_mode(); + if (mode == MENU_INDEX_INVALID) + return; + mode = menu_mode_chars[mode]; + + { + char_u ename[2]; + + ename[0] = mode; + ename[1] = NUL; + apply_autocmds(EVENT_MENUPOPUP, ename, NULL, FALSE, curbuf); + } + + for (menu = root_menu; menu != NULL; menu = menu->next) + if (STRNCMP("PopUp", menu->name, 5) == 0 && menu->name[5] == mode) + break; + + /* Only show a popup when it is defined and has entries */ + if (menu != NULL && menu->children != NULL) + { +# if defined(FEAT_GUI) + if (gui.in_use) + { + /* Update the menus now, in case the MenuPopup autocommand did + * anything. */ + gui_update_menus(0); + gui_mch_show_popupmenu(menu); + } +# endif +# if defined(FEAT_GUI) && defined(FEAT_TERM_POPUP_MENU) + else +# endif +# if defined(FEAT_TERM_POPUP_MENU) + pum_show_popupmenu(menu); +# endif + } +} +#endif + +#if defined(FEAT_GUI) || defined(PROTO) + /* * Check that a pointer appears in the menu tree. Used to protect from using * a menu that was deleted after it was selected but before the event was @@ -1956,28 +2013,28 @@ while (menu) { if ((menu->modes & menu->enabled & mode) -#if defined(FEAT_GUI_W32) && defined(FEAT_TEAROFF) +# if defined(FEAT_GUI_W32) && defined(FEAT_TEAROFF) || menu_is_tearoff(menu->dname) -#endif +# endif ) grey = FALSE; else grey = TRUE; -#ifdef FEAT_GUI_ATHENA +# ifdef FEAT_GUI_ATHENA /* Hiding menus doesn't work for Athena, it can cause a crash. */ gui_mch_menu_grey(menu, grey); -#else +# else /* Never hide a toplevel menu, it may make the menubar resize or * disappear. Same problem for ToolBar items. */ if (vim_strchr(p_go, GO_GREY) != NULL || menu->parent == NULL -# ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR || menu_is_toolbar(menu->parent->name) -# endif +# endif ) gui_mch_menu_grey(menu, grey); else gui_mch_menu_hidden(menu, grey); -#endif +# endif gui_update_menus_recurse(menu->children, mode); menu = menu->next; } @@ -1997,13 +2054,7 @@ if (modes != 0x0) mode = modes; else - { - mode = get_menu_mode(); - if (mode == MENU_INDEX_INVALID) - mode = 0; - else - mode = (1 << mode); - } + mode = get_menu_mode_flag(); if (force_menu_update || mode != prev_mode) { @@ -2011,15 +2062,15 @@ gui_mch_draw_menubar(); prev_mode = mode; force_menu_update = FALSE; -#ifdef FEAT_GUI_W32 +# ifdef FEAT_GUI_W32 /* This can leave a tearoff as active window - make sure we * have the focus */ gui_mch_activate_window(); -#endif +# endif } } -#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) \ +# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) \ || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(PROTO) /* * Check if a key is used as a mnemonic for a toplevel menu. @@ -2038,47 +2089,7 @@ return TRUE; return FALSE; } -#endif - -/* - * Display the Special "PopUp" menu as a pop-up at the current mouse - * position. The "PopUpn" menu is for Normal mode, "PopUpi" for Insert mode, - * etc. - */ - void -gui_show_popupmenu(void) -{ - vimmenu_T *menu; - int mode; - - mode = get_menu_mode(); - if (mode == MENU_INDEX_INVALID) - return; - mode = menu_mode_chars[mode]; - -#ifdef FEAT_AUTOCMD - { - char_u ename[2]; - - ename[0] = mode; - ename[1] = NUL; - apply_autocmds(EVENT_MENUPOPUP, ename, NULL, FALSE, curbuf); - } -#endif - - for (menu = root_menu; menu != NULL; menu = menu->next) - if (STRNCMP("PopUp", menu->name, 5) == 0 && menu->name[5] == mode) - break; - - /* Only show a popup when it is defined and has entries */ - if (menu != NULL && menu->children != NULL) - { - /* Update the menus now, in case the MenuPopup autocommand did - * anything. */ - gui_update_menus(0); - gui_mch_show_popupmenu(menu); - } -} +# endif #endif /* FEAT_GUI */ #if (defined(FEAT_GUI_W32) && defined(FEAT_TEAROFF)) || defined(PROTO) @@ -2239,7 +2250,7 @@ * Execute "menu". Use by ":emenu" and the window toolbar. * "eap" is NULL for the window toolbar. */ - static void + void execute_menu(exarg_T *eap, vimmenu_T *menu) { char_u *mode; @@ -2451,6 +2462,7 @@ } #if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) \ + || defined(FEAT_TERM_POPUP_MENU) \ || defined(FEAT_BEVAL_TIP) || defined(PROTO) /* * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy. diff -Nru vim-8.0.1453/src/message.c vim-8.0.1766/src/message.c --- vim-8.0.1453/src/message.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/message.c 2018-04-26 20:30:33.000000000 +0000 @@ -415,8 +415,7 @@ void reset_last_sourcing(void) { - vim_free(last_sourcing_name); - last_sourcing_name = NULL; + VIM_CLEAR(last_sourcing_name); last_sourcing_lnum = 0; } @@ -761,7 +760,7 @@ void iemsg(char_u *s) { - msg(s); + emsg(s); #ifdef ABORT_ON_INTERNAL_ERROR abort(); #endif @@ -1249,10 +1248,7 @@ reset_last_sourcing(); if (keep_msg != NULL && vim_strsize(keep_msg) >= (Rows - cmdline_row - 1) * Columns + sc_col) - { - vim_free(keep_msg); - keep_msg = NULL; /* don't redisplay message, it's too long */ - } + VIM_CLEAR(keep_msg); /* don't redisplay message, it's too long */ if (tmpState == SETWSIZE) /* got resize event while in vgetc() */ { @@ -1325,10 +1321,7 @@ int did_return = FALSE; if (!msg_silent) - { - vim_free(keep_msg); - keep_msg = NULL; /* don't display old message now */ - } + VIM_CLEAR(keep_msg); #ifdef FEAT_EVAL if (need_clr_eos) @@ -1710,8 +1703,6 @@ { c = TO_SPECIAL(str[1], str[2]); str += 2; - if (c == KS_ZERO) /* display as ^@ or */ - c = NUL; } if (IS_SPECIAL(c) || modifiers) /* special key */ special = TRUE; @@ -3481,8 +3472,7 @@ #ifdef FEAT_EVAL set_vim_var_string(VV_WARNINGMSG, message, -1); #endif - vim_free(keep_msg); - keep_msg = NULL; + VIM_CLEAR(keep_msg); if (hl) keep_msg_attr = HL_ATTR(HLF_W); else @@ -4993,7 +4983,7 @@ zero_padding = 0; } else - { + { /* Regular float number */ format[0] = '%'; l = 1; @@ -5016,7 +5006,7 @@ format[l + 1] = NUL; str_arg_l = sprintf(tmp, format, f); - } + } if (remove_trailing_zeroes) { diff -Nru vim-8.0.1453/src/misc1.c vim-8.0.1766/src/misc1.c --- vim-8.0.1453/src/misc1.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/misc1.c 2018-04-26 20:30:33.000000000 +0000 @@ -588,7 +588,7 @@ * "second_line_indent": indent for after ^^D in Insert mode or if flag * OPENLINE_COM_LIST * - * Return TRUE for success, FALSE for failure + * Return OK for success, FAIL for failure */ int open_line( @@ -606,7 +606,7 @@ int newindent = 0; /* auto-indent of the new line */ int n; int trunc_line = FALSE; /* truncate current line afterwards */ - int retval = FALSE; /* return value, default is FAIL */ + int retval = FAIL; /* return value */ #ifdef FEAT_COMMENTS int extra_len = 0; /* length of p_extra string */ int lead_len; /* length of comment leader */ @@ -1642,7 +1642,7 @@ } #endif - retval = TRUE; /* success! */ + retval = OK; /* success! */ theend: curbuf->b_p_pi = saved_pi; vim_free(saved_line); @@ -2457,7 +2457,7 @@ * If "fixpos" is TRUE, don't leave the cursor on the NUL after the line. * Caller must have prepared for undo. * - * return FAIL for failure, OK otherwise + * Return FAIL for failure, OK otherwise. */ int del_bytes( @@ -2476,12 +2476,21 @@ oldp = ml_get(lnum); oldlen = (int)STRLEN(oldp); - /* - * Can't do anything when the cursor is on the NUL after the line. - */ + /* Can't do anything when the cursor is on the NUL after the line. */ if (col >= oldlen) return FAIL; + /* If "count" is zero there is nothing to do. */ + if (count == 0) + return OK; + + /* If "count" is negative the caller must be doing something wrong. */ + if (count < 1) + { + IEMSGN("E950: Invalid count for del_bytes(): %ld", count); + return FAIL; + } + #ifdef FEAT_MBYTE /* If 'delcombine' is set and deleting (less than) one character, only * delete the last combining character. */ @@ -3174,12 +3183,10 @@ if (must_redraw < VALID) must_redraw = VALID; -#ifdef FEAT_AUTOCMD /* when the cursor line is changed always trigger CursorMoved */ if (lnum <= curwin->w_cursor.lnum && lnume + (xtra < 0 ? -xtra : xtra) > curwin->w_cursor.lnum) last_cursormoved.lnum = 0; -#endif } /* @@ -3243,18 +3250,14 @@ if (curbuf->b_did_warn == FALSE && curbufIsChanged() == 0 -#ifdef FEAT_AUTOCMD && !autocmd_busy -#endif && curbuf->b_p_ro) { -#ifdef FEAT_AUTOCMD ++curbuf_lock; apply_autocmds(EVENT_FILECHANGEDRO, NULL, NULL, FALSE, curbuf); --curbuf_lock; if (!curbuf->b_p_ro) return; -#endif /* * Do what msg() does, but with a column offset if the warning should * be after the mode message. @@ -3591,6 +3594,11 @@ cmdline_row = 0; save_State = State; State = ASKMORE; /* prevents a screen update when using a timer */ +#ifdef FEAT_MOUSE + /* May show different mouse shape. */ + setmouse(); +#endif + i = get_number(TRUE, mouse_used); if (KeyTyped) @@ -3605,6 +3613,10 @@ else cmdline_row = save_cmdline_row; State = save_State; +#ifdef FEAT_MOUSE + /* May need to restore mouse shape. */ + setmouse(); +#endif return i; } @@ -3679,6 +3691,10 @@ vim_beep( unsigned val) /* one of the BO_ values, e.g., BO_OPER */ { +#ifdef FEAT_EVAL + called_vim_beep = TRUE; +#endif + if (emsg_silent == 0) { if (!((bo_flags & val) || (bo_flags & BO_ALL))) @@ -3701,7 +3717,22 @@ && !(gui.in_use && gui.starting) #endif ) + { out_str_cf(T_VB); +#ifdef FEAT_VTP + /* No restore color information, refresh the screen. */ + if (has_vtp_working() != 0 +# ifdef FEAT_TERMGUICOLORS + && p_tgc +# endif + ) + { + redraw_later(CLEAR); + update_screen(0); + redrawcmd(); + } +#endif + } else out_char(BELL); #ifdef ELAPSED_FUNC @@ -3709,8 +3740,9 @@ #endif } - /* When 'verbose' is set and we are sourcing a script or executing a - * function give the user a hint where the beep comes from. */ + /* When 'debug' contains "beep" produce a message. If we are sourcing + * a script or executing a function give the user a hint where the beep + * comes from. */ if (vim_strchr(p_debug, 'e') != NULL) { msg_source(HL_ATTR(HLF_W)); @@ -3736,8 +3768,7 @@ char_u *var; /* In case we are called a second time (when 'encoding' changes). */ - vim_free(homedir); - homedir = NULL; + VIM_CLEAR(homedir); #ifdef VMS var = mch_getenv((char_u *)"SYS$LOGIN"); @@ -4349,10 +4380,7 @@ p = vim_strnsave(p, (int)(pend - p)); if (p != NULL && !mch_isdir(p)) - { - vim_free(p); - p = NULL; - } + VIM_CLEAR(p); else { #ifdef USE_EXE_NAME @@ -9766,8 +9794,7 @@ /* If the number of matches is now zero, we fail. */ if (*num_files == 0) { - vim_free(*files); - *files = NULL; + VIM_CLEAR(*files); return FAIL; } } @@ -10022,10 +10049,7 @@ hFind = FindFirstFileW(wn, &wfb); if (hFind == INVALID_HANDLE_VALUE && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - vim_free(wn); - wn = NULL; - } + VIM_CLEAR(wn); } } @@ -10113,8 +10137,7 @@ # endif hFind = FindFirstFile((LPCSTR)buf, &fb); ok = (hFind != INVALID_HANDLE_VALUE); - vim_free(matchname); - matchname = NULL; + VIM_CLEAR(matchname); } } @@ -10761,6 +10784,7 @@ char_u *curdir; garray_T path_ga; char_u *paths = NULL; + int glob_flags = 0; if ((curdir = alloc((unsigned)MAXPATHL)) == NULL) return 0; @@ -10777,7 +10801,11 @@ if (paths == NULL) return 0; - globpath(paths, pattern, gap, (flags & EW_ICASE) ? WILD_ICASE : 0); + if (flags & EW_ICASE) + glob_flags |= WILD_ICASE; + if (flags & EW_ADDSLASH) + glob_flags |= WILD_ADD_SLASH; + globpath(paths, pattern, gap, glob_flags); vim_free(paths); return gap->ga_len; @@ -11242,8 +11270,7 @@ if (i != len) { EMSG2(_(e_notread), tempname); - vim_free(buffer); - buffer = NULL; + VIM_CLEAR(buffer); } else if (ret_len == NULL) { diff -Nru vim-8.0.1453/src/misc2.c vim-8.0.1766/src/misc2.c --- vim-8.0.1453/src/misc2.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/misc2.c 2018-04-26 20:30:33.000000000 +0000 @@ -1099,10 +1099,8 @@ return; entered_free_all_mem = TRUE; -# ifdef FEAT_AUTOCMD /* Don't want to trigger autocommands from here on. */ block_autocmds(); -# endif /* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */ p_ea = FALSE; @@ -1116,6 +1114,10 @@ spell_free_all(); # endif +#if defined(FEAT_INS_EXPAND) && defined(FEAT_BEVAL_TERM) + ui_remove_balloon(); +# endif + # if defined(FEAT_USR_CMDS) /* Clear user commands (before deleting buffers). */ ex_comclear(NULL); @@ -1153,9 +1155,7 @@ # endif /* Obviously named calls. */ -# if defined(FEAT_AUTOCMD) free_all_autocmds(); -# endif clear_termcodes(); free_all_marks(); alist_clear(&global_alist); @@ -1823,6 +1823,8 @@ * Replacement for free() that ignores NULL pointers. * Also skip free() when exiting for sure, this helps when we caught a deadly * signal that was caused by a crash in free(). + * If you want to set NULL after calling this function, you should use + * VIM_CLEAR() instead. */ void vim_free(void *x) @@ -3159,7 +3161,7 @@ int c; if (eap != NULL && eap->force_ff != 0) - c = eap->cmd[eap->force_ff]; + c = eap->force_ff; else { if ((eap != NULL && eap->force_bin != 0) @@ -3389,13 +3391,18 @@ * Return OK or FAIL. */ int -vim_chdirfile(char_u *fname) +vim_chdirfile(char_u *fname, char *trigger_autocmd UNUSED) { char_u dir[MAXPATHL]; + int res; vim_strncpy(dir, fname, MAXPATHL - 1); *gettail_sep(dir) = NUL; - return mch_chdir((char *)dir) == 0 ? OK : FAIL; + res = mch_chdir((char *)dir) == 0 ? OK : FAIL; + if (res == OK && trigger_autocmd != NULL) + apply_autocmds(EVENT_DIRCHANGED, (char_u *)trigger_autocmd, + dir, FALSE, curbuf); + return res; } #endif @@ -5166,8 +5173,8 @@ prev2 = prev1; prev1 = c1; - i += MB_PTR2LEN(s1 + i); - j += MB_PTR2LEN(s2 + j); + i += MB_PTR2LEN(s1 + i); + j += MB_PTR2LEN(s2 + j); } return s1[i] == s2[j]; } @@ -5885,7 +5892,7 @@ if (c2 == NUL) /* full match */ return 0; s = q; - i = j; + i = j; break; } @@ -6141,59 +6148,83 @@ #if defined(FEAT_SPELL) || defined(FEAT_PERSISTENT_UNDO) || defined(PROTO) /* * Read 2 bytes from "fd" and turn them into an int, MSB first. + * Returns -1 when encountering EOF. */ int get2c(FILE *fd) { - int n; + int c, n; n = getc(fd); - n = (n << 8) + getc(fd); - return n; + if (n == EOF) return -1; + c = getc(fd); + if (c == EOF) return -1; + return (n << 8) + c; } /* * Read 3 bytes from "fd" and turn them into an int, MSB first. + * Returns -1 when encountering EOF. */ int get3c(FILE *fd) { - int n; + int c, n; n = getc(fd); - n = (n << 8) + getc(fd); - n = (n << 8) + getc(fd); - return n; + if (n == EOF) return -1; + c = getc(fd); + if (c == EOF) return -1; + n = (n << 8) + c; + c = getc(fd); + if (c == EOF) return -1; + return (n << 8) + c; } /* * Read 4 bytes from "fd" and turn them into an int, MSB first. + * Returns -1 when encountering EOF. */ int get4c(FILE *fd) { + int c; /* Use unsigned rather than int otherwise result is undefined * when left-shift sets the MSB. */ unsigned n; - n = (unsigned)getc(fd); - n = (n << 8) + (unsigned)getc(fd); - n = (n << 8) + (unsigned)getc(fd); - n = (n << 8) + (unsigned)getc(fd); + c = getc(fd); + if (c == EOF) return -1; + n = (unsigned)c; + c = getc(fd); + if (c == EOF) return -1; + n = (n << 8) + (unsigned)c; + c = getc(fd); + if (c == EOF) return -1; + n = (n << 8) + (unsigned)c; + c = getc(fd); + if (c == EOF) return -1; + n = (n << 8) + (unsigned)c; return (int)n; } /* * Read 8 bytes from "fd" and turn them into a time_T, MSB first. + * Returns -1 when encountering EOF. */ time_T get8ctime(FILE *fd) { + int c; time_T n = 0; int i; for (i = 0; i < 8; ++i) - n = (n << 8) + getc(fd); + { + c = getc(fd); + if (c == EOF) return -1; + n = (n << 8) + c; + } return n; } @@ -6398,3 +6429,150 @@ } # endif #endif + +#if defined(FEAT_JOB_CHANNEL) \ + || (defined(UNIX) && (!defined(USE_SYSTEM) \ + || (defined(FEAT_GUI) && defined(FEAT_TERMINAL)))) \ + || defined(PROTO) +/* + * Parse "cmd" and put the white-separated parts in "argv". + * "argv" is an allocated array with "argc" entries and room for 4 more. + * Returns FAIL when out of memory. + */ + int +mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc) +{ + int i; + char_u *p, *d; + int inquote; + + /* + * Do this loop twice: + * 1: find number of arguments + * 2: separate them and build argv[] + */ + for (i = 0; i < 2; ++i) + { + p = skipwhite(cmd); + inquote = FALSE; + *argc = 0; + for (;;) + { + if (i == 1) + (*argv)[*argc] = (char *)p; + ++*argc; + d = p; + while (*p != NUL && (inquote || (*p != ' ' && *p != TAB))) + { + if (p[0] == '"') + /* quotes surrounding an argument and are dropped */ + inquote = !inquote; + else + { + if (p[0] == '\\' && p[1] != NUL) + { + /* First pass: skip over "\ " and "\"". + * Second pass: Remove the backslash. */ + ++p; + } + if (i == 1) + *d++ = *p; + } + ++p; + } + if (*p == NUL) + { + if (i == 1) + *d++ = NUL; + break; + } + if (i == 1) + *d++ = NUL; + p = skipwhite(p + 1); + } + if (*argv == NULL) + { + if (use_shcf) + { + /* Account for possible multiple args in p_shcf. */ + p = p_shcf; + for (;;) + { + p = skiptowhite(p); + if (*p == NUL) + break; + ++*argc; + p = skipwhite(p); + } + } + + *argv = (char **)alloc((unsigned)((*argc + 4) * sizeof(char *))); + if (*argv == NULL) /* out of memory */ + return FAIL; + } + } + return OK; +} + +# if defined(FEAT_JOB_CHANNEL) || defined(PROTO) +/* + * Build "argv[argc]" from the string "cmd". + * "argv[argc]" is set to NULL; + * Return FAIL when out of memory. + */ + int +build_argv_from_string(char_u *cmd, char ***argv, int *argc) +{ + char_u *cmd_copy; + int i; + + /* Make a copy, parsing will modify "cmd". */ + cmd_copy = vim_strsave(cmd); + if (cmd_copy == NULL + || mch_parse_cmd(cmd_copy, FALSE, argv, argc) == FAIL) + { + vim_free(cmd_copy); + return FAIL; + } + for (i = 0; i < *argc; i++) + (*argv)[i] = (char *)vim_strsave((char_u *)(*argv)[i]); + (*argv)[*argc] = NULL; + vim_free(cmd_copy); + return OK; +} + +/* + * Build "argv[argc]" from the list "l". + * "argv[argc]" is set to NULL; + * Return FAIL when out of memory. + */ + int +build_argv_from_list(list_T *l, char ***argv, int *argc) +{ + listitem_T *li; + char_u *s; + + /* Pass argv[] to mch_call_shell(). */ + *argv = (char **)alloc(sizeof(char *) * (l->lv_len + 1)); + if (*argv == NULL) + return FAIL; + *argc = 0; + for (li = l->lv_first; li != NULL; li = li->li_next) + { + s = get_tv_string_chk(&li->li_tv); + if (s == NULL) + { + int i; + + for (i = 0; i < *argc; ++i) + vim_free((*argv)[i]); + return FAIL; + } + (*argv)[*argc] = (char *)vim_strsave(s); + *argc += 1; + } + (*argv)[*argc] = NULL; + return OK; +} +# endif +#endif diff -Nru vim-8.0.1453/src/move.c vim-8.0.1766/src/move.c --- vim-8.0.1453/src/move.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/move.c 2018-04-26 20:30:33.000000000 +0000 @@ -184,9 +184,7 @@ curwin->w_topline = curwin->w_cursor.lnum; curwin->w_botline = curwin->w_topline; curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP; -#ifdef FEAT_SCROLLBIND curwin->w_scbind_pos = 1; -#endif return; } @@ -215,9 +213,7 @@ curwin->w_topline = 1; curwin->w_botline = 2; curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP; -#ifdef FEAT_SCROLLBIND curwin->w_scbind_pos = 1; -#endif } /* @@ -538,9 +534,7 @@ /* Approximate the value of w_botline */ wp->w_botline += lnum - wp->w_topline; wp->w_topline = lnum; -#ifdef FEAT_AUTOCMD wp->w_topline_was_set = TRUE; -#endif #ifdef FEAT_DIFF wp->w_topfill = 0; #endif @@ -2775,7 +2769,6 @@ redraw_later(VALID); } -#if defined(FEAT_CURSORBIND) || defined(PROTO) void do_check_cursorbind(void) { @@ -2848,4 +2841,3 @@ curwin = old_curwin; curbuf = old_curbuf; } -#endif /* FEAT_CURSORBIND */ diff -Nru vim-8.0.1453/src/netbeans.c vim-8.0.1766/src/netbeans.c --- vim-8.0.1453/src/netbeans.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/netbeans.c 2018-04-26 20:30:33.000000000 +0000 @@ -580,8 +580,7 @@ buf.bufp->b_was_netbeans_file = FALSE; } } - vim_free(buf_list); - buf_list = NULL; + VIM_CLEAR(buf_list); buf_list_size = 0; buf_list_used = 0; @@ -1477,8 +1476,7 @@ EMSG("E636: invalid buffer identifier in create"); return FAIL; } - vim_free(buf->displayname); - buf->displayname = NULL; + VIM_CLEAR(buf->displayname); netbeansReadFile = 0; /* don't try to open disk file */ do_ecmd(0, NULL, 0, 0, ECMD_ONE, ECMD_HIDE + ECMD_OLDBUF, curwin); @@ -1583,9 +1581,7 @@ do_update = 1; buf->initDone = TRUE; nb_set_curbuf(buf->bufp); -#if defined(FEAT_AUTOCMD) apply_autocmds(EVENT_BUFREADPOST, 0, 0, FALSE, buf->bufp); -#endif /* handle any postponed key commands */ handle_key_queue(); @@ -2162,17 +2158,13 @@ #endif ) { -#ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, buf->bufp); -#endif buf_write_all(buf->bufp, FALSE); -#ifdef FEAT_AUTOCMD /* an autocommand may have deleted the buffer */ if (!bufref_valid(&bufref)) buf->bufp = NULL; -#endif } } else @@ -2663,7 +2655,7 @@ nbdebug(("EVT: %s", buffer)); nb_send(buffer, "netbeans_file_opened"); - if (p_acd && vim_chdirfile(bufp->b_ffname) == OK) + if (p_acd && vim_chdirfile(bufp->b_ffname, "auto") == OK) shorten_fnames(TRUE); } @@ -3447,8 +3439,7 @@ msg_add_lines(c, (long)lnum, nchars); /* Now display it */ - vim_free(keep_msg); - keep_msg = NULL; + VIM_CLEAR(keep_msg); msg_scrolled_ign = TRUE; msg_trunc_attr(IObuff, FALSE, 0); msg_scrolled_ign = FALSE; @@ -3475,8 +3466,7 @@ msg_add_lines(c, buf->bufp->b_ml.ml_line_count, buf->bufp->b_orig_size); - vim_free(keep_msg); - keep_msg = NULL; + VIM_CLEAR(keep_msg); msg_scrolled_ign = TRUE; p = msg_trunc_attr(IObuff, FALSE, 0); if ((msg_scrolled && !need_wait_return) || !buf->initDone) diff -Nru vim-8.0.1453/src/normal.c vim-8.0.1766/src/normal.c --- vim-8.0.1453/src/normal.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/normal.c 2018-04-26 20:30:33.000000000 +0000 @@ -169,9 +169,7 @@ #ifdef FEAT_DND static void nv_drop(cmdarg_T *cap); #endif -#ifdef FEAT_AUTOCMD static void nv_cursorhold(cmdarg_T *cap); -#endif static void get_op_vcol(oparg_T *oap, colnr_T col, int initial); static char *e_noident = N_("E349: No identifier under cursor"); @@ -424,9 +422,7 @@ #ifdef FEAT_DND {K_DROP, nv_drop, NV_STS, 0}, #endif -#ifdef FEAT_AUTOCMD {K_CURSORHOLD, nv_cursorhold, NV_KEEPREG, 0}, -#endif {K_PS, nv_edit, 0, 0}, }; @@ -595,7 +591,6 @@ #endif } -#ifdef FEAT_AUTOCMD /* Restore counts from before receiving K_CURSORHOLD. This means after * typing "3", handling K_CURSORHOLD and then typing "2" we get "32", not * "3 * 2". */ @@ -606,7 +601,6 @@ oap->prev_opcount = 0; oap->prev_count0 = 0; } -#endif mapped_len = typebuf_maplen(); @@ -737,7 +731,6 @@ } } -#ifdef FEAT_AUTOCMD if (c == K_CURSORHOLD) { /* Save the count values so that ca.opcount and ca.count0 are exactly @@ -745,9 +738,7 @@ oap->prev_opcount = ca.opcount; oap->prev_count0 = ca.count0; } - else -#endif - if (ca.opcount != 0) + else if (ca.opcount != 0) { /* * If we're in the middle of an operator (including after entering a @@ -808,10 +799,8 @@ text_locked_msg(); goto normal_end; } -#ifdef FEAT_AUTOCMD if ((nv_cmds[idx].cmd_flags & NV_NCW) && curbuf_locked()) goto normal_end; -#endif /* * In Visual/Select mode, a few keys are handled in a special way. @@ -892,17 +881,15 @@ int lit = FALSE; /* get extra character literally */ int langmap_active = FALSE; /* using :lmap mappings */ int lang; /* getting a text character */ -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD int save_smd; /* saved value of p_smd */ #endif ++no_mapping; ++allow_keys; /* no mapping for nchar, but allow key codes */ -#ifdef FEAT_AUTOCMD /* Don't generate a CursorHold event here, most commands can't handle * it, e.g., nv_replace(), nv_csearch(). */ did_cursorhold = TRUE; -#endif if (ca.cmdchar == 'g') { /* @@ -957,7 +944,7 @@ State = LANGMAP; langmap_active = TRUE; } -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD save_smd = p_smd; p_smd = FALSE; /* Don't let the IM code show the mode here */ if (lang && curbuf->b_p_iminsert == B_IMODE_IM) @@ -973,7 +960,7 @@ ++allow_keys; State = NORMAL_BUSY; } -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD if (lang) { if (curbuf->b_p_iminsert != B_IMODE_LMAP) @@ -1102,10 +1089,8 @@ if (need_flushbuf) out_flush(); #endif -#ifdef FEAT_AUTOCMD if (ca.cmdchar != K_IGNORE) did_cursorhold = FALSE; -#endif State = NORMAL; @@ -1278,10 +1263,7 @@ #ifdef FEAT_CMDL_INFO if (oap->op_type == OP_NOP && oap->regname == 0 -# ifdef FEAT_AUTOCMD - && ca.cmdchar != K_CURSORHOLD -# endif - ) + && ca.cmdchar != K_CURSORHOLD) clear_showcmd(); #endif @@ -1293,21 +1275,17 @@ mb_adjust_cursor(); #endif -#ifdef FEAT_SCROLLBIND if (curwin->w_p_scb && toplevel) { validate_cursor(); /* may need to update w_leftcol */ do_check_scrollbind(TRUE); } -#endif -#ifdef FEAT_CURSORBIND if (curwin->w_p_crb && toplevel) { validate_cursor(); /* may need to update w_leftcol */ do_check_cursorbind(); } -#endif #ifdef FEAT_TERMINAL /* don't go to Insert mode if a terminal has a running job */ @@ -1482,8 +1460,7 @@ { AppendToRedobuffLit(repeat_cmdline, -1); AppendToRedobuff(NL_STR); - vim_free(repeat_cmdline); - repeat_cmdline = NULL; + VIM_CLEAR(repeat_cmdline); } } } @@ -1685,11 +1662,19 @@ get_op_char(oap->op_type), get_extra_op_char(oap->op_type), oap->motion_force, cap->cmdchar, cap->nchar); else if (cap->cmdchar != ':') + { + int nchar = oap->op_type == OP_REPLACE ? cap->nchar : NUL; + + /* reverse what nv_replace() did */ + if (nchar == REPLACE_CR_NCHAR) + nchar = CAR; + else if (nchar == REPLACE_NL_NCHAR) + nchar = NL; prep_redo(oap->regname, 0L, NUL, 'v', get_op_char(oap->op_type), get_extra_op_char(oap->op_type), - oap->op_type == OP_REPLACE - ? cap->nchar : NUL); + nchar); + } if (!redo_VIsual_busy) { redo_VIsual_mode = resel_VIsual_mode; @@ -2279,12 +2264,12 @@ * Do the appropriate action for the current mouse click in the current mode. * Not used for Command-line mode. * - * Normal Mode: + * Normal and Visual Mode: * event modi- position visual change action * fier cursor window * left press - yes end yes * left press C yes end yes "^]" (2) - * left press S yes end yes "*" (2) + * left press S yes end (popup: extend) yes "*" (2) * left drag - yes start if moved no * left relse - yes start if moved no * middle press - yes if not active no put register @@ -2625,7 +2610,7 @@ end_visual_mode(); } } - else if (c1 < 0) + else { tabpage_T *tp; @@ -2663,82 +2648,94 @@ if (which_button == MOUSE_RIGHT && !(mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))) { - /* - * NOTE: Ignore right button down and drag mouse events. - * Windows only shows the popup menu on the button up event. - */ #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \ + || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \ + || defined(FEAT_GUI_MAC) || defined(FEAT_GUI_PHOTON) \ + || defined(FEAT_TERM_POPUP_MENU) +# ifdef FEAT_GUI + if (gui.in_use) + { +# if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \ || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC) + if (!is_click) + /* Ignore right button release events, only shows the popup + * menu on the button down event. */ + return FALSE; +# endif +# if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) + if (is_click || is_drag) + /* Ignore right button down and drag mouse events. Windows + * only shows the popup menu on the button up event. */ + return FALSE; +# endif + } +# endif +# if defined(FEAT_GUI) && defined(FEAT_TERM_POPUP_MENU) + else +# endif +# if defined(FEAT_TERM_POPUP_MENU) if (!is_click) + /* Ignore right button release events, only shows the popup + * menu on the button down event. */ return FALSE; #endif -#if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) - if (is_click || is_drag) - return FALSE; -#endif -#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \ - || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \ - || defined(FEAT_GUI_MAC) || defined(FEAT_GUI_PHOTON) - if (gui.in_use) + + jump_flags = 0; + if (STRCMP(p_mousem, "popup_setpos") == 0) { - jump_flags = 0; - if (STRCMP(p_mousem, "popup_setpos") == 0) + /* First set the cursor position before showing the popup + * menu. */ + if (VIsual_active) { - /* First set the cursor position before showing the popup - * menu. */ - if (VIsual_active) - { - pos_T m_pos; + pos_T m_pos; - /* - * set MOUSE_MAY_STOP_VIS if we are outside the - * selection or the current window (might have false - * negative here) - */ - if (mouse_row < curwin->w_winrow - || mouse_row - > (curwin->w_winrow + curwin->w_height)) - jump_flags = MOUSE_MAY_STOP_VIS; - else if (get_fpos_of_mouse(&m_pos) != IN_BUFFER) + /* + * set MOUSE_MAY_STOP_VIS if we are outside the + * selection or the current window (might have false + * negative here) + */ + if (mouse_row < curwin->w_winrow + || mouse_row + > (curwin->w_winrow + curwin->w_height)) + jump_flags = MOUSE_MAY_STOP_VIS; + else if (get_fpos_of_mouse(&m_pos) != IN_BUFFER) + jump_flags = MOUSE_MAY_STOP_VIS; + else + { + if ((LT_POS(curwin->w_cursor, VIsual) + && (LT_POS(m_pos, curwin->w_cursor) + || LT_POS(VIsual, m_pos))) + || (LT_POS(VIsual, curwin->w_cursor) + && (LT_POS(m_pos, VIsual) + || LT_POS(curwin->w_cursor, m_pos)))) + { jump_flags = MOUSE_MAY_STOP_VIS; - else + } + else if (VIsual_mode == Ctrl_V) { - if ((LT_POS(curwin->w_cursor, VIsual) - && (LT_POS(m_pos, curwin->w_cursor) - || LT_POS(VIsual, m_pos))) - || (LT_POS(VIsual, curwin->w_cursor) - && (LT_POS(m_pos, VIsual) - || LT_POS(curwin->w_cursor, m_pos)))) - { + getvcols(curwin, &curwin->w_cursor, &VIsual, + &leftcol, &rightcol); + getvcol(curwin, &m_pos, NULL, &m_pos.col, NULL); + if (m_pos.col < leftcol || m_pos.col > rightcol) jump_flags = MOUSE_MAY_STOP_VIS; - } - else if (VIsual_mode == Ctrl_V) - { - getvcols(curwin, &curwin->w_cursor, &VIsual, - &leftcol, &rightcol); - getvcol(curwin, &m_pos, NULL, &m_pos.col, NULL); - if (m_pos.col < leftcol || m_pos.col > rightcol) - jump_flags = MOUSE_MAY_STOP_VIS; - } } } - else - jump_flags = MOUSE_MAY_STOP_VIS; - } - if (jump_flags) - { - jump_flags = jump_to_mouse(jump_flags, NULL, which_button); - update_curbuf(VIsual_active ? INVERTED : VALID); - setcursor(); - out_flush(); /* Update before showing popup menu */ } + else + jump_flags = MOUSE_MAY_STOP_VIS; + } + if (jump_flags) + { + jump_flags = jump_to_mouse(jump_flags, NULL, which_button); + update_curbuf(VIsual_active ? INVERTED : VALID); + setcursor(); + out_flush(); /* Update before showing popup menu */ + } # ifdef FEAT_MENU - gui_show_popupmenu(); + show_popupmenu(); + got_click = FALSE; /* ignore release events */ # endif - return (jump_flags & CURSOR_MOVED) != 0; - } - else - return FALSE; + return (jump_flags & CURSOR_MOVED) != 0; #else return FALSE; #endif @@ -3979,7 +3976,6 @@ } #endif -#ifdef FEAT_SCROLLBIND /* * When "check" is FALSE, prepare for commands that scroll the window. * When "check" is TRUE, take care of scroll-binding after the window has @@ -4138,7 +4134,6 @@ curwin = old_curwin; curbuf = old_curbuf; } -#endif /* #ifdef FEAT_SCROLLBIND */ /* * Command character that's ignored. @@ -6245,13 +6240,11 @@ text_locked_msg(); return; } -#ifdef FEAT_AUTOCMD if (curbuf_locked()) { clearop(cap->oap); return; } -#endif ptr = grab_file_name(cap->count1, &lnum); @@ -7023,10 +7016,12 @@ reset_VIsual(); if (had_ctrl_v) { - if (cap->nchar == '\r') - cap->nchar = -1; - else if (cap->nchar == '\n') - cap->nchar = -2; + /* Use a special (negative) number to make a difference between a + * literal CR or NL and a line break. */ + if (cap->nchar == CAR) + cap->nchar = REPLACE_CR_NCHAR; + else if (cap->nchar == NL) + cap->nchar = REPLACE_NL_NCHAR; } nv_operator(cap); return; @@ -7465,6 +7460,11 @@ static void nv_subst(cmdarg_T *cap) { +#ifdef FEAT_TERMINAL + /* When showing output of term_dumpdiff() swap the top and botom. */ + if (term_swap_diff() == OK) + return; +#endif if (VIsual_active) /* "vs" and "vS" are the same as "vc" */ { if (cap->cmdchar == 'S') @@ -8491,7 +8491,7 @@ #ifdef FEAT_COMMENTS has_format_option(FO_OPEN_COMS) ? OPENLINE_DO_COM : #endif - 0, 0)) + 0, 0) == OK) { #ifdef FEAT_CONCEAL if (curwin->w_p_cole > 0 && oldline != curwin->w_cursor.lnum) @@ -9571,7 +9571,6 @@ } #endif -#ifdef FEAT_AUTOCMD /* * Trigger CursorHold event. * When waiting for a character for 'updatetime' K_CURSORHOLD is put in the @@ -9584,7 +9583,6 @@ did_cursorhold = TRUE; cap->retval |= CA_COMMAND_BUSY; /* don't call edit() now */ } -#endif /* * Calculate start/end virtual columns for operating in block mode. diff -Nru vim-8.0.1453/src/ops.c vim-8.0.1766/src/ops.c --- vim-8.0.1453/src/ops.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/ops.c 2018-04-26 20:30:33.000000000 +0000 @@ -899,17 +899,21 @@ * * If regname is 0 and writing, use register 0 * If regname is 0 and reading, use previous register + * + * Return TRUE when the register should be inserted literally (selection or + * clipboard). */ - void + int get_yank_register(int regname, int writing) { int i; + int ret = FALSE; y_append = FALSE; if ((regname == 0 || regname == '"') && !writing && y_previous != NULL) { y_current = y_previous; - return; + return ret; } i = regname; if (VIM_ISDIGIT(i)) @@ -926,10 +930,16 @@ #ifdef FEAT_CLIPBOARD /* When selection is not available, use register 0 instead of '*' */ else if (clip_star.available && regname == '*') + { i = STAR_REGISTER; + ret = TRUE; + } /* When clipboard is not available, use register 0 instead of '+' */ else if (clip_plus.available && regname == '+') + { i = PLUS_REGISTER; + ret = TRUE; + } #endif #ifdef FEAT_DND else if (!writing && regname == '~') @@ -940,6 +950,7 @@ y_current = &(y_regs[i]); if (writing) /* remember the register we write into for do_put() */ y_previous = y_current; + return ret; } #if defined(FEAT_CLIPBOARD) || defined(PROTO) @@ -1082,7 +1093,7 @@ if (Recording == FALSE) /* start recording */ { - /* registers 0-9, a-z and " are allowed */ + /* registers 0-9, a-z and " are allowed */ if (c < 0 || (!ASCII_ISALNUM(c) && c != '"')) retval = FAIL; else @@ -1235,8 +1246,7 @@ EMSG(_(e_nolastcmd)); return FAIL; } - vim_free(new_last_cmdline); /* don't keep the cmdline containing @: */ - new_last_cmdline = NULL; + VIM_CLEAR(new_last_cmdline); /* don't keep the cmdline containing @: */ /* Escape all control characters with a CTRL-V */ p = vim_strsave_escaped_ext(last_cmdline, (char_u *)"\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", Ctrl_V, FALSE); @@ -1388,12 +1398,13 @@ int insert_reg( int regname, - int literally) /* insert literally, not as if typed */ + int literally_arg) /* insert literally, not as if typed */ { long i; int retval = OK; char_u *arg; int allocated; + int literally = literally_arg; /* * It is possible to get into an endless loop by having CTRL-R a in @@ -1424,7 +1435,8 @@ } else /* name or number register */ { - get_yank_register(regname, FALSE); + if (get_yank_register(regname, FALSE)) + literally = TRUE; if (y_current->y_array == NULL) retval = FAIL; else @@ -1581,12 +1593,14 @@ int cmdline_paste_reg( int regname, - int literally, /* Insert text literally instead of "as typed" */ + int literally_arg, /* Insert text literally instead of "as typed" */ int remcr) /* don't add CR characters */ { long i; + int literally = literally_arg; - get_yank_register(regname, FALSE); + if (get_yank_register(regname, FALSE)) + literally = TRUE; if (y_current->y_array == NULL) return FAIL; @@ -1652,7 +1666,7 @@ y_regs[1].y_array = NULL; /* set register one to empty */ } -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) static void yank_do_autocmd(oparg_T *oap, yankreg_T *reg) { @@ -1669,6 +1683,8 @@ v_event = get_vim_var_dict(VV_EVENT); list = list_alloc(); + if (list == NULL) + return; for (n = 0; n < reg->y_size; n++) list_append_string(list, reg->y_array[n], -1); list->lv_lock = VAR_FIXED; @@ -1865,7 +1881,7 @@ } } -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) if (did_yank && has_textyankpost()) yank_do_autocmd(oap, y_current); #endif @@ -2113,13 +2129,21 @@ size_t oldlen; struct block_def bd; char_u *after_p = NULL; - int had_ctrl_v_cr = (c == -1 || c == -2); + int had_ctrl_v_cr = FALSE; if ((curbuf->b_ml.ml_flags & ML_EMPTY ) || oap->empty) return OK; /* nothing to do */ - if (had_ctrl_v_cr) - c = (c == -1 ? '\r' : '\n'); + if (c == REPLACE_CR_NCHAR) + { + had_ctrl_v_cr = TRUE; + c = CAR; + } + else if (c == REPLACE_NL_NCHAR) + { + had_ctrl_v_cr = TRUE; + c = NL; + } #ifdef FEAT_MBYTE if (has_mbyte) @@ -2207,7 +2231,8 @@ /* insert pre-spaces */ vim_memset(newp + bd.textcol, ' ', (size_t)bd.startspaces); /* insert replacement chars CHECK FOR ALLOCATED SPACE */ - /* -1/-2 is used for entering CR literally. */ + /* REPLACE_CR_NCHAR/REPLACE_NL_NCHAR is used for entering CR + * literally. */ if (had_ctrl_v_cr || (c != '\r' && c != '\n')) { #ifdef FEAT_MBYTE @@ -2677,6 +2702,7 @@ if (oap->block_mode) { struct block_def bd2; + int did_indent = FALSE; /* If indent kicked in, the firstline might have changed * but only do that, if the indent actually increased. */ @@ -2685,11 +2711,14 @@ { bd.textcol += ind_post - ind_pre; bd.start_vcol += ind_post - ind_pre; + did_indent = TRUE; } /* The user may have moved the cursor before inserting something, try - * to adjust the block for that. */ - if (oap->start.lnum == curbuf->b_op_start_orig.lnum && !bd.is_MAX) + * to adjust the block for that. But only do it, if the difference + * does not come from indent kicking in. */ + if (oap->start.lnum == curbuf->b_op_start_orig.lnum + && !bd.is_MAX && !did_indent) { if (oap->op_type == OP_INSERT && oap->start.col @@ -2986,8 +3015,7 @@ #endif vim_free(y_current->y_array[i]); } - vim_free(y_current->y_array); - y_current->y_array = NULL; + VIM_CLEAR(y_current->y_array); #ifdef AMIGA if (n >= 1000) MSG(""); @@ -3341,7 +3369,7 @@ # endif #endif -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) if (!deleting && has_textyankpost()) yank_do_autocmd(oap, y_current); #endif @@ -3484,11 +3512,9 @@ return; } -#ifdef FEAT_AUTOCMD /* Autocommands may be executed when saving lines for undo, which may make * y_array invalid. Start undo now to avoid that. */ u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1); -#endif if (insert_string != NULL) { @@ -5954,13 +5980,17 @@ buf2[i] = '\0'; } else if (pre == 0) - vim_snprintf((char *)buf2, NUMBUFLEN, "%llu", n); + vim_snprintf((char *)buf2, NUMBUFLEN, "%llu", + (long long unsigned)n); else if (pre == '0') - vim_snprintf((char *)buf2, NUMBUFLEN, "%llo", n); + vim_snprintf((char *)buf2, NUMBUFLEN, "%llo", + (long long unsigned)n); else if (pre && hexupper) - vim_snprintf((char *)buf2, NUMBUFLEN, "%llX", n); + vim_snprintf((char *)buf2, NUMBUFLEN, "%llX", + (long long unsigned)n); else - vim_snprintf((char *)buf2, NUMBUFLEN, "%llx", n); + vim_snprintf((char *)buf2, NUMBUFLEN, "%llx", + (long long unsigned)n); length -= (int)STRLEN(buf2); /* @@ -6031,8 +6061,7 @@ vim_free(y_read_regs[i].y_array[j]); vim_free(y_read_regs[i].y_array); } - vim_free(y_read_regs); - y_read_regs = NULL; + VIM_CLEAR(y_read_regs); } } @@ -6370,7 +6399,7 @@ * |{bartype},{flags},{name},{type}, * {linecount},{width},{timestamp},"line1","line2" * flags: REG_PREVIOUS - register is y_previous - * REG_EXEC - used for @@ + * REG_EXEC - used for @@ */ if (y_previous == &y_regs[i]) flags |= REG_PREVIOUS; @@ -7137,8 +7166,7 @@ /* Without any lines make the register empty. */ if (y_ptr->y_size + newlines == 0) { - vim_free(y_ptr->y_array); - y_ptr->y_array = NULL; + VIM_CLEAR(y_ptr->y_array); return; } @@ -7481,16 +7509,21 @@ _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes"), buf1, line_count_selected, (long)curbuf->b_ml.ml_line_count, - word_count_cursor, word_count, - byte_count_cursor, byte_count); + (long long)word_count_cursor, + (long long)word_count, + (long long)byte_count_cursor, + (long long)byte_count); else vim_snprintf((char *)IObuff, IOSIZE, _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of %lld Bytes"), buf1, line_count_selected, (long)curbuf->b_ml.ml_line_count, - word_count_cursor, word_count, - char_count_cursor, char_count, - byte_count_cursor, byte_count); + (long long)word_count_cursor, + (long long)word_count, + (long long)char_count_cursor, + (long long)char_count, + (long long)byte_count_cursor, + (long long)byte_count); } else { @@ -7508,17 +7541,17 @@ (char *)buf1, (char *)buf2, (long)curwin->w_cursor.lnum, (long)curbuf->b_ml.ml_line_count, - word_count_cursor, word_count, - byte_count_cursor, byte_count); + (long long)word_count_cursor, (long long)word_count, + (long long)byte_count_cursor, (long long)byte_count); else vim_snprintf((char *)IObuff, IOSIZE, _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte %lld of %lld"), (char *)buf1, (char *)buf2, (long)curwin->w_cursor.lnum, (long)curbuf->b_ml.ml_line_count, - word_count_cursor, word_count, - char_count_cursor, char_count, - byte_count_cursor, byte_count); + (long long)word_count_cursor, (long long)word_count, + (long long)char_count_cursor, (long long)char_count, + (long long)byte_count_cursor, (long long)byte_count); } } @@ -7526,7 +7559,7 @@ bom_count = bomb_size(); if (bom_count > 0) vim_snprintf((char *)IObuff + STRLEN(IObuff), IOSIZE, - _("(+%ld for BOM)"), bom_count); + _("(+%lld for BOM)"), (long long)bom_count); #endif if (dict == NULL) { diff -Nru vim-8.0.1453/src/option.c vim-8.0.1766/src/option.c --- vim-8.0.1453/src/option.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/option.c 2018-04-26 20:30:33.000000000 +0000 @@ -114,9 +114,7 @@ #define PV_FF OPT_BUF(BV_FF) #define PV_FLP OPT_BUF(BV_FLP) #define PV_FO OPT_BUF(BV_FO) -#ifdef FEAT_AUTOCMD -# define PV_FT OPT_BUF(BV_FT) -#endif +#define PV_FT OPT_BUF(BV_FT) #define PV_IMI OPT_BUF(BV_IMI) #define PV_IMS OPT_BUF(BV_IMS) #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) @@ -229,9 +227,7 @@ # define PV_RL OPT_WIN(WV_RL) # define PV_RLC OPT_WIN(WV_RLC) #endif -#ifdef FEAT_SCROLLBIND -# define PV_SCBIND OPT_WIN(WV_SCBIND) -#endif +#define PV_SCBIND OPT_WIN(WV_SCBIND) #define PV_SCROLL OPT_WIN(WV_SCROLL) #ifdef FEAT_SPELL # define PV_SPELL OPT_WIN(WV_SPELL) @@ -248,16 +244,15 @@ # define PV_WFH OPT_WIN(WV_WFH) # define PV_WFW OPT_WIN(WV_WFW) #define PV_WRAP OPT_WIN(WV_WRAP) -#ifdef FEAT_CURSORBIND -# define PV_CRBIND OPT_WIN(WV_CRBIND) -#endif +#define PV_CRBIND OPT_WIN(WV_CRBIND) #ifdef FEAT_CONCEAL # define PV_COCU OPT_WIN(WV_COCU) # define PV_COLE OPT_WIN(WV_COLE) #endif #ifdef FEAT_TERMINAL -# define PV_TK OPT_WIN(WV_TK) -# define PV_TMS OPT_WIN(WV_TMS) +# define PV_TWK OPT_WIN(WV_TWK) +# define PV_TWS OPT_WIN(WV_TWS) +# define PV_TWSL OPT_BUF(BV_TWSL) #endif #ifdef FEAT_SIGNS # define PV_SCL OPT_WIN(WV_SCL) @@ -319,9 +314,7 @@ static char_u *p_ff; static char_u *p_fo; static char_u *p_flp; -#ifdef FEAT_AUTOCMD static char_u *p_ft; -#endif static long p_iminsert; static long p_imsearch; #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) @@ -381,6 +374,9 @@ #ifdef FEAT_KEYMAP static char_u *p_keymap; #endif +#ifdef FEAT_TERMINAL +static long p_twsl; +#endif /* Saved values for when 'bin' is set. */ static int p_et_nobin; @@ -980,11 +976,7 @@ #endif {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, {"cursorbind", "crb", P_BOOL|P_VI_DEF, -#ifdef FEAT_CURSORBIND (char_u *)VAR_WIN, PV_CRBIND, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"cursorcolumn", "cuc", P_BOOL|P_VI_DEF|P_RWIN, #ifdef FEAT_SYN_HL @@ -1125,11 +1117,7 @@ (char_u *)&p_ek, PV_NONE, {(char_u *)FALSE, (char_u *)TRUE} SCRIPTID_INIT}, {"eventignore", "ei", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, -#ifdef FEAT_AUTOCMD (char_u *)&p_ei, PV_NONE, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"expandtab", "et", P_BOOL|P_VI_DEF|P_VIM, (char_u *)&p_et, PV_ET, @@ -1174,13 +1162,8 @@ #endif (char_u *)0L} SCRIPTID_INIT}, {"filetype", "ft", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME, -#ifdef FEAT_AUTOCMD (char_u *)&p_ft, PV_FT, {(char_u *)"", (char_u *)0L} -#else - (char_u *)NULL, PV_NONE, - {(char_u *)0L, (char_u *)0L} -#endif SCRIPTID_INIT}, {"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_ONECOMMA|P_NODUP, (char_u *)&p_fcs, PV_NONE, @@ -2239,6 +2222,13 @@ (char_u *)NULL, PV_NONE, #endif {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, + {"pumwidth", "pw", P_NUM|P_VI_DEF, +#ifdef FEAT_INS_EXPAND + (char_u *)&p_pw, PV_NONE, +#else + (char_u *)NULL, PV_NONE, +#endif + {(char_u *)15L, (char_u *)15L} SCRIPTID_INIT}, {"pythonthreedll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, #if defined(DYNAMIC_PYTHON3) (char_u *)&p_py3dll, PV_NONE, @@ -2388,11 +2378,7 @@ (char_u *)VAR_WIN, PV_SCROLL, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, {"scrollbind", "scb", P_BOOL|P_VI_DEF, -#ifdef FEAT_SCROLLBIND (char_u *)VAR_WIN, PV_SCBIND, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"scrolljump", "sj", P_NUM|P_VI_DEF|P_VIM, (char_u *)&p_sj, PV_NONE, @@ -2401,13 +2387,8 @@ (char_u *)&p_so, PV_NONE, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, {"scrollopt", "sbo", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, -#ifdef FEAT_SCROLLBIND (char_u *)&p_sbo, PV_NONE, {(char_u *)"ver,jump", (char_u *)0L} -#else - (char_u *)NULL, PV_NONE, - {(char_u *)0L, (char_u *)0L} -#endif SCRIPTID_INIT}, {"sections", "sect", P_STRING|P_VI_DEF, (char_u *)&p_sections, PV_NONE, @@ -2426,7 +2407,7 @@ {"sessionoptions", "ssop", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef FEAT_SESSION (char_u *)&p_ssop, PV_NONE, - {(char_u *)"blank,buffers,curdir,folds,help,options,tabpages,winsize", + {(char_u *)"blank,buffers,curdir,folds,help,options,tabpages,winsize,terminal", (char_u *)0L} #else (char_u *)NULL, PV_NONE, @@ -2773,18 +2754,57 @@ {(char_u *)FALSE, (char_u *)FALSE} #endif SCRIPTID_INIT}, - {"termkey", "tk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, + /* TODO: remove this deprecated entry */ + {"terminalscroll", "tlsl", P_NUM|P_VI_DEF|P_VIM|P_RBUF, +#ifdef FEAT_TERMINAL + (char_u *)&p_twsl, PV_TWSL, + {(char_u *)10000L, (char_u *)10000L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + /* TODO: remove this deprecated entry */ + {"termkey", "tk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, #ifdef FEAT_TERMINAL - (char_u *)VAR_WIN, PV_TK, + (char_u *)VAR_WIN, PV_TWK, {(char_u *)"", (char_u *)NULL} #else (char_u *)NULL, PV_NONE, {(char_u *)NULL, (char_u *)0L} #endif SCRIPTID_INIT}, + /* TODO: remove this deprecated entry */ {"termsize", "tms", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, #ifdef FEAT_TERMINAL - (char_u *)VAR_WIN, PV_TMS, + (char_u *)VAR_WIN, PV_TWS, + {(char_u *)"", (char_u *)NULL} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"termwinkey", "twk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, +#ifdef FEAT_TERMINAL + (char_u *)VAR_WIN, PV_TWK, + {(char_u *)"", (char_u *)NULL} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"termwinscroll", "twsl", P_NUM|P_VI_DEF|P_VIM|P_RBUF, +#ifdef FEAT_TERMINAL + (char_u *)&p_twsl, PV_TWSL, + {(char_u *)10000L, (char_u *)10000L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, + {"termwinsize", "tws", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, +#ifdef FEAT_TERMINAL + (char_u *)VAR_WIN, PV_TWS, {(char_u *)"", (char_u *)NULL} #else (char_u *)NULL, PV_NONE, @@ -3236,16 +3256,10 @@ #ifdef FEAT_BROWSE static char *(p_bsdir_values[]) = {"current", "last", "buffer", NULL}; #endif -#ifdef FEAT_SCROLLBIND static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL}; -#endif static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL}; static char *(p_ead_values[]) = {"both", "ver", "hor", NULL}; -#ifdef FEAT_AUTOCMD static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", "acwrite", NULL}; -#else -static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", NULL}; -#endif static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL}; static char *(p_bs_values[]) = {"indent", "eol", "start", NULL}; #ifdef FEAT_FOLDING @@ -3265,6 +3279,7 @@ static void set_option_default(int, int opt_flags, int compatible); static void set_options_default(int opt_flags); +static void set_string_default_esc(char *name, char_u *val, int escape); static char_u *term_bg_default(void); static void did_set_option(int opt_idx, int opt_flags, int new_value); static char_u *illegal_char(char_u *, int); @@ -3337,9 +3352,10 @@ * Initialize the options, first part. * * Called only once from main(), just after creating the first buffer. + * If "clean_arg" is TRUE Vim was started with --clean. */ void -set_init_1(void) +set_init_1(int clean_arg) { char_u *p; int opt_idx; @@ -3371,7 +3387,7 @@ # endif #endif ) - set_string_default("sh", p); + set_string_default_esc("sh", p, TRUE); #ifdef FEAT_WILDIGN /* @@ -3394,7 +3410,11 @@ mustfree = FALSE; # ifdef UNIX if (*names[n] == NUL) +# ifdef MACOS_X + p = (char_u *)"/private/tmp"; +# else p = (char_u *)"/tmp"; +# endif else # endif p = vim_getenv((char_u *)names[n], &mustfree); @@ -3546,6 +3566,24 @@ */ set_options_default(0); +#ifdef CLEAN_RUNTIMEPATH + if (clean_arg) + { + opt_idx = findoption((char_u *)"runtimepath"); + if (opt_idx >= 0) + { + options[opt_idx].def_val[VI_DEFAULT] = (char_u *)CLEAN_RUNTIMEPATH; + p_rtp = (char_u *)CLEAN_RUNTIMEPATH; + } + opt_idx = findoption((char_u *)"packpath"); + if (opt_idx >= 0) + { + options[opt_idx].def_val[VI_DEFAULT] = (char_u *)CLEAN_RUNTIMEPATH; + p_pp = (char_u *)CLEAN_RUNTIMEPATH; + } + } +#endif + #ifdef FEAT_GUI if (found_reverse_arg) set_option_value((char_u *)"bg", 0L, (char_u *)"dark", 0); @@ -3767,17 +3805,23 @@ dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT; if (flags & P_STRING) { - /* Use set_string_option_direct() for local options to handle - * freeing and allocating the value. */ - if (options[opt_idx].indir != PV_NONE) - set_string_option_direct(NULL, opt_idx, - options[opt_idx].def_val[dvi], opt_flags, 0); - else - { - if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED)) - free_string_option(*(char_u **)(varp)); - *(char_u **)varp = options[opt_idx].def_val[dvi]; - options[opt_idx].flags &= ~P_ALLOCED; + /* skip 'termkey' and 'termsize, they are duplicates of + * 'termwinkey' and 'termwinsize' */ + if (STRCMP(options[opt_idx].fullname, "termkey") != 0 + && STRCMP(options[opt_idx].fullname, "termsize") != 0) + { + /* Use set_string_option_direct() for local options to handle + * freeing and allocating the value. */ + if (options[opt_idx].indir != PV_NONE) + set_string_option_direct(NULL, opt_idx, + options[opt_idx].def_val[dvi], opt_flags, 0); + else + { + if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED)) + free_string_option(*(char_u **)(varp)); + *(char_u **)varp = options[opt_idx].def_val[dvi]; + options[opt_idx].flags &= ~P_ALLOCED; + } } } else if (flags & P_NUM) @@ -3859,14 +3903,18 @@ /* * Set the Vi-default value of a string option. * Used for 'sh', 'backupskip' and 'term'. + * When "escape" is TRUE escape spaces with a backslash. */ - void -set_string_default(char *name, char_u *val) + static void +set_string_default_esc(char *name, char_u *val, int escape) { char_u *p; int opt_idx; - p = vim_strsave(val); + if (escape && vim_strchr(val, ' ') != NULL) + p = vim_strsave_escaped(val, (char_u *)" "); + else + p = vim_strsave(val); if (p != NULL) /* we don't want a NULL */ { opt_idx = findoption((char_u *)name); @@ -3880,6 +3928,12 @@ } } + void +set_string_default(char *name, char_u *val) +{ + set_string_default_esc(name, val, FALSE); +} + /* * Set the Vi-default value of a number option. * Used for 'lines' and 'columns'. @@ -4302,7 +4356,7 @@ } #endif -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) static void trigger_optionsset_string( int opt_idx, @@ -4793,7 +4847,7 @@ char_u *oldval = NULL; /* previous value if *varp */ char_u *newval; char_u *origval = NULL; -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) char_u *saved_origval = NULL; char_u *saved_newval = NULL; #endif @@ -5147,7 +5201,7 @@ */ *(char_u **)(varp) = newval; -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (!starting # ifdef FEAT_CRYPT && options[opt_idx].indir != PV_KEY @@ -5170,7 +5224,7 @@ errmsg = did_set_string_option(opt_idx, (char_u **)varp, new_value_alloced, oldval, errbuf, opt_flags); -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (errmsg == NULL) trigger_optionsset_string(opt_idx, opt_flags, saved_origval, saved_newval); @@ -5689,9 +5743,7 @@ check_string_option(&buf->b_p_cino); parse_cino(buf); #endif -#ifdef FEAT_AUTOCMD check_string_option(&buf->b_p_ft); -#endif #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) check_string_option(&buf->b_p_cinw); #endif @@ -5945,7 +5997,7 @@ char_u *s; char_u **varp; char_u *oldval; -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) char_u *saved_oldval = NULL; char_u *saved_newval = NULL; #endif @@ -5965,7 +6017,7 @@ oldval = *varp; *varp = s; -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (!starting # ifdef FEAT_CRYPT && options[opt_idx].indir != PV_KEY @@ -5980,7 +6032,7 @@ opt_flags)) == NULL) did_set_option(opt_idx, opt_flags, TRUE); -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) /* call autocommand after handling side effects */ if (r == NULL) trigger_optionsset_string(opt_idx, opt_flags, @@ -5992,7 +6044,6 @@ return r; } -#if defined(FEAT_KEYMAP) || defined(FEAT_AUTOCMD) || defined(FEAT_SYN_HL) /* * Return TRUE if "val" is a valid 'filetype' name. * Also used for 'syntax' and 'keymap'. @@ -6007,7 +6058,6 @@ return FALSE; return TRUE; } -#endif /* * Handle string options that need some action to perform when changed. @@ -6031,9 +6081,7 @@ /* set when changing an option that only requires a redraw in the GUI */ int redraw_gui_only = FALSE; #endif -#ifdef FEAT_AUTOCMD int ft_changed = FALSE; -#endif /* Get the global option to compare with, otherwise we would have to check * two values for all local options. */ @@ -6226,13 +6274,11 @@ #endif /* 'scrollopt' */ -#ifdef FEAT_SCROLLBIND else if (varp == &p_sbo) { if (check_opt_strings(p_sbo, p_scbopt_values, TRUE) != OK) errmsg = e_invarg; } -#endif /* 'ambiwidth' */ #ifdef FEAT_MBYTE @@ -6314,14 +6360,12 @@ } #endif -#ifdef FEAT_AUTOCMD /* 'eventignore' */ else if (varp == &p_ei) { if (check_ei() == FAIL) errmsg = e_invarg; } -#endif #ifdef FEAT_MBYTE /* 'encoding', 'fileencoding', 'termencoding' and 'makeencoding' */ @@ -7431,7 +7475,6 @@ } #endif -#ifdef FEAT_AUTOCMD else if (gvarp == &p_ft) { if (!valid_filetype(*varp)) @@ -7439,7 +7482,6 @@ else ft_changed = STRCMP(oldval, *varp) != 0; } -#endif #ifdef FEAT_SYN_HL else if (gvarp == &p_syn) @@ -7450,19 +7492,22 @@ #endif #ifdef FEAT_TERMINAL - /* 'termkey' */ - else if (varp == &curwin->w_p_tk) + /* 'termwinkey' */ + else if (varp == &curwin->w_p_twk) { - if (*curwin->w_p_tk != NUL && string_to_key(curwin->w_p_tk, TRUE) == 0) + if (*curwin->w_p_twk != NUL + && string_to_key(curwin->w_p_twk, TRUE) == 0) errmsg = e_invarg; } - /* 'termsize' */ - else if (varp == &curwin->w_p_tms) + /* 'termwinsize' */ + else if (varp == &curwin->w_p_tws) { - if (*curwin->w_p_tms != NUL) + if (*curwin->w_p_tws != NUL) { - p = skipdigits(curwin->w_p_tms); - if (p == curwin->w_p_tms || *p != 'x' || *skipdigits(p + 1) != NUL) + p = skipdigits(curwin->w_p_tws); + if (p == curwin->w_p_tws + || (*p != 'x' && *p != '*') + || *skipdigits(p + 1) != NUL) errmsg = e_invarg; } } @@ -7556,18 +7601,17 @@ else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL) set_string_option_global(opt_idx, varp); -#ifdef FEAT_AUTOCMD /* * Trigger the autocommand only after setting the flags. */ -# ifdef FEAT_SYN_HL +#ifdef FEAT_SYN_HL /* When 'syntax' is set, load the syntax of that name */ if (varp == &(curbuf->b_p_syn)) { apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, curbuf->b_fname, TRUE, curbuf); } -# endif +#endif else if (varp == &(curbuf->b_p_ft)) { /* 'filetype' is set, trigger the FileType autocommand. @@ -7583,7 +7627,6 @@ varp = NULL; } } -#endif #ifdef FEAT_SPELL if (varp == &(curwin->w_s->b_p_spl)) { @@ -8203,8 +8246,8 @@ { # ifdef FEAT_TERMINAL /* Cannot set 'modifiable' when in Terminal mode. */ - if (term_in_normal_mode() - || (bt_terminal(curbuf) && !term_is_finished(curbuf))) + if (curbuf->b_p_ma && (term_in_normal_mode() || (bt_terminal(curbuf) + && curbuf->b_term != NULL && !term_is_finished(curbuf)))) { curbuf->b_p_ma = FALSE; return (char_u *)N_("E946: Cannot make a terminal with running job modifiable"); @@ -8243,14 +8286,12 @@ #endif } -#ifdef FEAT_AUTOCMD /* when 'buflisted' changes, trigger autocommands */ else if ((int *)varp == &curbuf->b_p_bl && old_value != curbuf->b_p_bl) { apply_autocmds(curbuf->b_p_bl ? EVENT_BUFADD : EVENT_BUFDELETE, NULL, NULL, TRUE, curbuf); } -#endif /* when 'swf' is set, create swapfile, when reset remove swapfile */ else if ((int *)varp == &curbuf->b_p_swf) @@ -8322,7 +8363,6 @@ } #endif -#ifdef FEAT_SCROLLBIND /* when 'scrollbind' is set: snapshot the current position to avoid a jump * at the end of normal_cmd() */ else if ((int *)varp == &curwin->w_p_scb) @@ -8333,7 +8373,6 @@ curwin->w_scbind_pos = curwin->w_topline; } } -#endif #if defined(FEAT_QUICKFIX) /* There can be only one window with 'previewwindow' set. */ @@ -8396,9 +8435,7 @@ #ifdef FEAT_TITLE redraw_titles(); #endif -#ifdef FEAT_AUTOCMD modified_was_set = value; -#endif } #ifdef BACKSLASH_IN_FILENAME @@ -8475,7 +8512,7 @@ else if ((int *)varp == &p_acd) { /* Change directories when the 'acd' option is set now. */ - DO_AUTOCHDIR + DO_AUTOCHDIR; } #endif @@ -8492,7 +8529,7 @@ } #endif -#ifdef FEAT_MBYTE +#ifdef HAVE_INPUT_METHOD /* 'imdisable' */ else if ((int *)varp == &p_imdisable) { @@ -8672,10 +8709,25 @@ /* 'termguicolors' */ else if ((int *)varp == &p_tgc) { +# ifdef FEAT_VTP + /* Do not turn on 'tgc' when 24-bit colors are not supported. */ + if (!has_vtp_working()) + { + p_tgc = 0; + return (char_u*)N_("E954: 24-bit colors are not supported on this environment"); + } + swap_tcap(); +# endif # ifdef FEAT_GUI if (!gui.in_use && !gui.starting) # endif highlight_gui_started(); +# ifdef FEAT_VTP + control_console_color_rgb(); + /* reset t_Co */ + if (STRCMP(T_NAME, "win32") == 0) + set_termname(T_NAME); +# endif } #endif @@ -8687,7 +8739,7 @@ options[opt_idx].flags |= P_WAS_SET; -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (!starting) { char_u buf_old[2], buf_new[2], buf_type[7]; @@ -9237,7 +9289,7 @@ options[opt_idx].flags |= P_WAS_SET; -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) if (!starting && errmsg == NULL) { char_u buf_old[11], buf_new[11], buf_type[7]; @@ -10087,22 +10139,15 @@ } else /* P_STRING */ { -#if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD) int do_endif = FALSE; /* Don't set 'syntax' and 'filetype' again if the value is * already right, avoids reloading the syntax file. */ if ( -# if defined(FEAT_SYN_HL) - p->indir == PV_SYN -# if defined(FEAT_AUTOCMD) - || -# endif -# endif -# if defined(FEAT_AUTOCMD) - p->indir == PV_FT -# endif - ) +#if defined(FEAT_SYN_HL) + p->indir == PV_SYN || +#endif + p->indir == PV_FT) { if (fprintf(fd, "if &%s != '%s'", p->fullname, *(char_u **)(varp)) < 0 @@ -10110,17 +10155,14 @@ return FAIL; do_endif = TRUE; } -#endif if (put_setstring(fd, cmd, p->fullname, (char_u **)varp, (p->flags & P_EXPAND) != 0) == FAIL) return FAIL; -#if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD) if (do_endif) { if (put_line(fd, "endif") == FAIL) return FAIL; } -#endif } } } @@ -10679,19 +10721,16 @@ case PV_BRI: return (char_u *)&(curwin->w_p_bri); case PV_BRIOPT: return (char_u *)&(curwin->w_p_briopt); #endif -#ifdef FEAT_SCROLLBIND case PV_SCBIND: return (char_u *)&(curwin->w_p_scb); -#endif -#ifdef FEAT_CURSORBIND case PV_CRBIND: return (char_u *)&(curwin->w_p_crb); -#endif #ifdef FEAT_CONCEAL case PV_COCU: return (char_u *)&(curwin->w_p_cocu); case PV_COLE: return (char_u *)&(curwin->w_p_cole); #endif #ifdef FEAT_TERMINAL - case PV_TK: return (char_u *)&(curwin->w_p_tk); - case PV_TMS: return (char_u *)&(curwin->w_p_tms); + case PV_TWK: return (char_u *)&(curwin->w_p_twk); + case PV_TWS: return (char_u *)&(curwin->w_p_tws); + case PV_TWSL: return (char_u *)&(curbuf->b_p_twsl); #endif case PV_AI: return (char_u *)&(curbuf->b_p_ai); @@ -10731,9 +10770,7 @@ case PV_FENC: return (char_u *)&(curbuf->b_p_fenc); #endif case PV_FF: return (char_u *)&(curbuf->b_p_ff); -#ifdef FEAT_AUTOCMD case PV_FT: return (char_u *)&(curbuf->b_p_ft); -#endif case PV_FO: return (char_u *)&(curbuf->b_p_fo); case PV_FLP: return (char_u *)&(curbuf->b_p_flp); case PV_IMI: return (char_u *)&(curbuf->b_p_iminsert); @@ -10871,14 +10908,10 @@ to->wo_bri = from->wo_bri; to->wo_briopt = vim_strsave(from->wo_briopt); #endif -#ifdef FEAT_SCROLLBIND to->wo_scb = from->wo_scb; to->wo_scb_save = from->wo_scb_save; -#endif -#ifdef FEAT_CURSORBIND to->wo_crb = from->wo_crb; to->wo_crb_save = from->wo_crb_save; -#endif #ifdef FEAT_SPELL to->wo_spell = from->wo_spell; #endif @@ -10896,8 +10929,8 @@ to->wo_cole = from->wo_cole; #endif #ifdef FEAT_TERMINAL - to->wo_tk = vim_strsave(from->wo_tk); - to->wo_tms = vim_strsave(from->wo_tms); + to->wo_twk = vim_strsave(from->wo_twk); + to->wo_tws = vim_strsave(from->wo_tws); #endif #ifdef FEAT_FOLDING to->wo_fdc = from->wo_fdc; @@ -10966,8 +10999,8 @@ check_string_option(&wop->wo_cocu); #endif #ifdef FEAT_TERMINAL - check_string_option(&wop->wo_tk); - check_string_option(&wop->wo_tms); + check_string_option(&wop->wo_twk); + check_string_option(&wop->wo_tws); #endif #ifdef FEAT_LINEBREAK check_string_option(&wop->wo_briopt); @@ -11009,8 +11042,8 @@ clear_string_option(&wop->wo_cocu); #endif #ifdef FEAT_TERMINAL - clear_string_option(&wop->wo_tk); - clear_string_option(&wop->wo_tms); + clear_string_option(&wop->wo_twk); + clear_string_option(&wop->wo_tws); #endif } @@ -11148,10 +11181,8 @@ buf->b_p_cink = vim_strsave(p_cink); buf->b_p_cino = vim_strsave(p_cino); #endif -#ifdef FEAT_AUTOCMD /* Don't copy 'filetype', it must be detected */ buf->b_p_ft = empty_option; -#endif buf->b_p_pi = p_pi; #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) buf->b_p_cinw = vim_strsave(p_cinw); @@ -11189,6 +11220,9 @@ buf->b_p_keymap = vim_strsave(p_keymap); buf->b_kmap_state |= KEYMAP_INIT; #endif +#ifdef FEAT_TERMINAL + buf->b_p_twsl = p_twsl; +#endif /* This isn't really an option, but copying the langmap and IME * state from the current buffer is better than resetting it. */ buf->b_p_iminsert = p_iminsert; @@ -11717,8 +11751,7 @@ if (buf == NULL) { - vim_free(*file); - *file = NULL; + VIM_CLEAR(*file); return FAIL; } diff -Nru vim-8.0.1453/src/option.h vim-8.0.1766/src/option.h --- vim-8.0.1453/src/option.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/option.h 2018-04-26 20:30:33.000000000 +0000 @@ -214,6 +214,7 @@ #define SHM_ALL "rmfixlnwaWtToOsAIcqF" /* all possible flags for 'shm' */ /* characters for p_go: */ +#define GO_TERMINAL '!' /* use terminal for system commands */ #define GO_ASEL 'a' /* autoselect */ #define GO_ASELML 'A' /* autoselect modeless selection */ #define GO_BOT 'b' /* use bottom scrollbar */ @@ -236,7 +237,7 @@ #define GO_FOOTER 'F' /* add footer */ #define GO_VERTICAL 'v' /* arrange dialog buttons vertically */ #define GO_KEEPWINSIZE 'k' /* keep GUI window size */ -#define GO_ALL "aAbcefFghilmMprtTvk" /* all possible flags for 'go' */ +#define GO_ALL "!aAbcefFghilmMprtTvk" /* all possible flags for 'go' */ /* flags for 'comments' option */ #define COM_NEST 'n' /* comments strings nest */ @@ -424,6 +425,7 @@ #ifdef FEAT_INS_EXPAND EXTERN char_u *p_cot; /* 'completeopt' */ EXTERN long p_ph; /* 'pumheight' */ +EXTERN long p_pw; /* 'pumwidth' */ #endif EXTERN char_u *p_cpo; /* 'cpoptions' */ #ifdef FEAT_CSCOPE @@ -476,9 +478,7 @@ EXTERN char_u *p_gefm; /* 'grepformat' */ EXTERN char_u *p_gp; /* 'grepprg' */ #endif -#ifdef FEAT_AUTOCMD EXTERN char_u *p_ei; /* 'eventignore' */ -#endif EXTERN int p_ek; /* 'esckeys' */ EXTERN int p_exrc; /* 'exrc' */ #ifdef FEAT_MBYTE @@ -740,9 +740,7 @@ EXTERN char_u *p_rtp; /* 'runtimepath' */ EXTERN long p_sj; /* 'scrolljump' */ EXTERN long p_so; /* 'scrolloff' */ -#ifdef FEAT_SCROLLBIND EXTERN char_u *p_sbo; /* 'scrollopt' */ -#endif EXTERN char_u *p_sections; /* 'sections' */ EXTERN int p_secure; /* 'secure' */ EXTERN char_u *p_sel; /* 'selection' */ @@ -754,7 +752,7 @@ /* Also used for 'viewoptions'! */ static char *(p_ssop_values[]) = {"buffers", "winpos", "resize", "winsize", "localoptions", "options", "help", "blank", "globals", "slash", "unix", - "sesdir", "curdir", "folds", "cursor", "tabpages", NULL}; + "sesdir", "curdir", "folds", "cursor", "tabpages", "terminal", NULL}; # endif # define SSOP_BUFFERS 0x001 # define SSOP_WINPOS 0x002 @@ -772,6 +770,7 @@ # define SSOP_FOLDS 0x2000 # define SSOP_CURSOR 0x4000 # define SSOP_TABPAGES 0x8000 +# define SSOP_TERMINAL 0x10000 #endif EXTERN char_u *p_sh; /* 'shell' */ EXTERN char_u *p_shcf; /* 'shellcmdflag' */ @@ -850,6 +849,9 @@ #ifdef FEAT_ARABIC EXTERN int p_tbidi; /* 'termbidi' */ #endif +#ifdef FEAT_TERMINAL +EXTERN long p_tlsl; /* 'terminalscroll' */ +#endif #ifdef FEAT_MBYTE EXTERN char_u *p_tenc; /* 'termencoding' */ #endif @@ -1045,9 +1047,7 @@ , BV_FF , BV_FLP , BV_FO -#ifdef FEAT_AUTOCMD , BV_FT -#endif , BV_IMI , BV_IMS #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) @@ -1114,6 +1114,9 @@ , BV_UDF , BV_UL , BV_WM +#ifdef FEAT_TERMINAL + , BV_TWSL +#endif , BV_COUNT /* must be the last one */ }; @@ -1133,12 +1136,10 @@ , WV_COLE #endif #ifdef FEAT_TERMINAL - , WV_TK - , WV_TMS + , WV_TWK + , WV_TWS #endif -#ifdef FEAT_CURSORBIND , WV_CRBIND -#endif #ifdef FEAT_LINEBREAK , WV_BRI , WV_BRIOPT @@ -1175,9 +1176,7 @@ , WV_RL , WV_RLC #endif -#ifdef FEAT_SCROLLBIND , WV_SCBIND -#endif , WV_SCROLL #ifdef FEAT_SPELL , WV_SPELL diff -Nru vim-8.0.1453/src/os_amiga.c vim-8.0.1766/src/os_amiga.c --- vim-8.0.1453/src/os_amiga.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/os_amiga.c 2018-04-26 20:30:33.000000000 +0000 @@ -152,7 +152,6 @@ */ if (WaitForChar(raw_in, p_ut * 1000L) == 0) { -#ifdef FEAT_AUTOCMD if (trigger_cursorhold() && maxlen >= 3) { buf[0] = K_SPECIAL; @@ -160,7 +159,6 @@ buf[2] = (int)KE_CURSORHOLD; return 3; } -#endif before_blocking(); } } @@ -1619,8 +1617,7 @@ else #endif { - vim_free(alloced); - alloced = NULL; + VIM_CLEAR(alloced); retval = NULL; buf = alloc(IOSIZE); diff -Nru vim-8.0.1453/src/os_amiga.h vim-8.0.1766/src/os_amiga.h --- vim-8.0.1453/src/os_amiga.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/os_amiga.h 2018-04-26 20:30:33.000000000 +0000 @@ -43,6 +43,9 @@ #ifndef DFLT_RUNTIMEPATH # define DFLT_RUNTIMEPATH "home:vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,home:vimfiles/after" #endif +#ifndef CLEAN_RUNTIMEPATH +# define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" +#endif #ifndef BASENAMELEN # define BASENAMELEN 26 /* Amiga */ diff -Nru vim-8.0.1453/src/osdef2.h.in vim-8.0.1766/src/osdef2.h.in --- vim-8.0.1453/src/osdef2.h.in 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/osdef2.h.in 2018-04-26 20:30:33.000000000 +0000 @@ -8,7 +8,11 @@ extern char *malloc(unsigned int); extern char *realloc(char *, int); extern char *getenv(char *); +#ifndef __TANDEM extern int setenv(char *, char *, int); +#else +extern int setenv(const char *, const char *, int); +#endif extern int putenv(const char *); #ifndef __TANDEM diff -Nru vim-8.0.1453/src/os_dos.h vim-8.0.1766/src/os_dos.h --- vim-8.0.1453/src/os_dos.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/os_dos.h 2018-04-26 20:30:33.000000000 +0000 @@ -125,6 +125,7 @@ #define DFLT_ERRORFILE "errors.err" #define DFLT_RUNTIMEPATH "$HOME/vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/vimfiles/after" +#define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" #define CASE_INSENSITIVE_FILENAME /* ignore case when comparing file names */ #define SPACE_IN_FILENAME diff -Nru vim-8.0.1453/src/os_mac_conv.c vim-8.0.1766/src/os_mac_conv.c --- vim-8.0.1453/src/os_mac_conv.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/os_mac_conv.c 2018-04-26 20:30:33.000000000 +0000 @@ -480,10 +480,7 @@ if (TECConvertText(gPathConverter, decompPath, decompLen, &decompLen, result, decompLen, &actualLen) != noErr) - { - vim_free(result); - result = NULL; - } + VIM_CLEAR(result); } } @@ -517,10 +514,7 @@ utf8_len += inputRead; } else - { - vim_free(result); - result = NULL; - } + VIM_CLEAR(result); } else { diff -Nru vim-8.0.1453/src/os_mac.h vim-8.0.1766/src/os_mac.h --- vim-8.0.1453/src/os_mac.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/os_mac.h 2018-04-26 20:30:33.000000000 +0000 @@ -215,6 +215,9 @@ #ifndef DFLT_RUNTIMEPATH # define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" #endif +#ifndef CLEAN_RUNTIMEPATH +# define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" +#endif /* * Macintosh has plenty of memory, use large buffers diff -Nru vim-8.0.1453/src/os_macosx.m vim-8.0.1766/src/os_macosx.m --- vim-8.0.1453/src/os_macosx.m 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/os_macosx.m 2018-04-26 20:30:33.000000000 +0000 @@ -11,6 +11,14 @@ * os_macosx.m -- Mac specific things for Mac OS X. */ +/* Suppress compiler warnings to non-C89 code. */ +#if defined(__clang__) && defined(__STRICT_ANSI__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wc99-extensions" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeclaration-after-statement" +#endif + /* Avoid a conflict for the definition of Boolean between Mac header files and * X11 header files. */ #define NO_X11_INCLUDES @@ -189,3 +197,9 @@ } #endif /* FEAT_CLIPBOARD */ + +/* Lift the compiler warning suppression. */ +#if defined(__clang__) && defined(__STRICT_ANSI__) +# pragma clang diagnostic pop +# pragma clang diagnostic pop +#endif diff -Nru vim-8.0.1453/src/os_mswin.c vim-8.0.1766/src/os_mswin.c --- vim-8.0.1453/src/os_mswin.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/os_mswin.c 2018-04-26 20:30:33.000000000 +0000 @@ -1233,8 +1233,7 @@ if (prt_name != NULL) { vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (char_u *)prt_name); - vim_free(prt_name); - prt_name = NULL; + VIM_CLEAR(prt_name); } EnableMenuItem(GetSystemMenu(hDlg, FALSE), SC_CLOSE, MF_GRAYED); #ifndef FEAT_GUI @@ -2164,7 +2163,6 @@ (data->dwData == COPYDATA_RESULT ? 1 : 2))) == FAIL) vim_free(str); -#ifdef FEAT_AUTOCMD else if (data->dwData == COPYDATA_REPLY) { char_u winstr[30]; @@ -2173,7 +2171,6 @@ apply_autocmds(EVENT_REMOTEREPLY, winstr, str, TRUE, curbuf); } -#endif } return 1; } @@ -2608,6 +2605,7 @@ while (reply_received == 0) { #ifdef FEAT_TIMERS + /* TODO: use the return value to decide how long to wait. */ check_due_timer(); #endif time(&now); diff -Nru vim-8.0.1453/src/os_unix.c vim-8.0.1766/src/os_unix.c --- vim-8.0.1453/src/os_unix.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/os_unix.c 2018-04-26 20:30:33.000000000 +0000 @@ -371,7 +371,7 @@ #endif /* - * Write s[len] to the screen. + * Write s[len] to the screen (stdout). */ void mch_write(char_u *s, int len) @@ -441,11 +441,10 @@ /* no character available within "wtime" */ return 0; - if (wtime < 0) + else { /* no character available within 'updatetime' */ did_start_blocking = TRUE; -#ifdef FEAT_AUTOCMD if (trigger_cursorhold() && maxlen >= 3 && !typebuf_changed(tb_change_cnt)) { @@ -454,7 +453,6 @@ buf[2] = (int)KE_CURSORHOLD; return 3; } -#endif /* * If there is no character available within 'updatetime' * seconds flush all the swap files to disk. @@ -565,6 +563,10 @@ # if defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO) # include # endif +# ifdef MACOS_X +# include +# include +# endif /* * Return total amount of memory available in Kbyte. @@ -576,16 +578,70 @@ long_u mem = 0; long_u shiftright = 10; /* how much to shift "mem" right for Kbyte */ +# ifdef MACOS_X + { + /* Mac (Darwin) way of getting the amount of RAM available */ + mach_port_t host = mach_host_self(); + kern_return_t kret; +# ifdef HOST_VM_INFO64 + struct vm_statistics64 vm_stat; + natural_t count = HOST_VM_INFO64_COUNT; + + kret = host_statistics64(host, HOST_VM_INFO64, + (host_info64_t)&vm_stat, &count); +# else + struct vm_statistics vm_stat; + natural_t count = HOST_VM_INFO_COUNT; + + kret = host_statistics(host, HOST_VM_INFO, + (host_info_t)&vm_stat, &count); +# endif + if (kret == KERN_SUCCESS) + /* get the amount of user memory by summing each usage */ + mem = (long_u)(vm_stat.free_count + vm_stat.active_count + + vm_stat.inactive_count +# ifdef MAC_OS_X_VERSION_10_9 + + vm_stat.compressor_page_count +# endif + ) * sysconf(_SC_PAGESIZE); + mach_port_deallocate(mach_task_self(), host); + } +# endif + # ifdef HAVE_SYSCTL - int mib[2], physmem; - size_t len; + if (mem == 0) + { + /* BSD way of getting the amount of RAM available. */ + int mib[2]; + size_t len = sizeof(long_u); +# ifdef HW_USERMEM64 + long_u physmem; +# else + /* sysctl() may return 32 bit or 64 bit, accept both */ + union { + int_u u32; + long_u u64; + } physmem; +# endif - /* BSD way of getting the amount of RAM available. */ - mib[0] = CTL_HW; - mib[1] = HW_USERMEM; - len = sizeof(physmem); - if (sysctl(mib, 2, &physmem, &len, NULL, 0) == 0) - mem = (long_u)physmem; + mib[0] = CTL_HW; +# ifdef HW_USERMEM64 + mib[1] = HW_USERMEM64; +# else + mib[1] = HW_USERMEM; +# endif + if (sysctl(mib, 2, &physmem, &len, NULL, 0) == 0) + { +# ifdef HW_USERMEM64 + mem = (long_u)physmem; +# else + if (len == sizeof(physmem.u64)) + mem = (long_u)physmem.u64; + else + mem = (long_u)physmem.u32; +# endif + } + } # endif # if defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO) @@ -1074,16 +1130,15 @@ /* Remember how often we have been called. */ ++entered; -#ifdef FEAT_AUTOCMD /* Executing autocommands is likely to use more stack space than we have * available in the signal stack. */ block_autocmds(); -#endif #ifdef FEAT_EVAL /* Set the v:dying variable. */ set_vim_var_nr(VV_DYING, (long)entered); #endif + v_dying = entered; #ifdef HAVE_STACK_LIMIT /* Since we are now using the signal stack, need to reset the stack @@ -1311,8 +1366,7 @@ /* * Set oldtitle to NULL, so the current title is obtained again. */ - vim_free(oldtitle); - oldtitle = NULL; + VIM_CLEAR(oldtitle); # endif settmode(TMODE_RAW); need_check_timestamps = TRUE; @@ -3261,8 +3315,7 @@ XCloseDisplay(x11_display); # endif # if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK) - vim_free(signal_stack); - signal_stack = NULL; + VIM_CLEAR(signal_stack); # endif # ifdef FEAT_TITLE vim_free(oldtitle); @@ -4101,88 +4154,6 @@ return wait_pid; } -#if defined(FEAT_JOB_CHANNEL) || !defined(USE_SYSTEM) || defined(PROTO) -/* - * Parse "cmd" and put the white-separated parts in "argv". - * "argv" is an allocated array with "argc" entries. - * Returns FAIL when out of memory. - */ - int -mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc) -{ - int i; - char_u *p, *d; - int inquote; - - /* - * Do this loop twice: - * 1: find number of arguments - * 2: separate them and build argv[] - */ - for (i = 0; i < 2; ++i) - { - p = skipwhite(cmd); - inquote = FALSE; - *argc = 0; - for (;;) - { - if (i == 1) - (*argv)[*argc] = (char *)p; - ++*argc; - d = p; - while (*p != NUL && (inquote || (*p != ' ' && *p != TAB))) - { - if (p[0] == '"') - /* quotes surrounding an argument and are dropped */ - inquote = !inquote; - else - { - if (p[0] == '\\' && p[1] != NUL) - { - /* First pass: skip over "\ " and "\"". - * Second pass: Remove the backslash. */ - ++p; - } - if (i == 1) - *d++ = *p; - } - ++p; - } - if (*p == NUL) - { - if (i == 1) - *d++ = NUL; - break; - } - if (i == 1) - *d++ = NUL; - p = skipwhite(p + 1); - } - if (*argv == NULL) - { - if (use_shcf) - { - /* Account for possible multiple args in p_shcf. */ - p = p_shcf; - for (;;) - { - p = skiptowhite(p); - if (*p == NUL) - break; - ++*argc; - p = skipwhite(p); - } - } - - *argv = (char **)alloc((unsigned)((*argc + 4) * sizeof(char *))); - if (*argv == NULL) /* out of memory */ - return FAIL; - } - } - return OK; -} -#endif - #if !defined(USE_SYSTEM) || defined(FEAT_JOB_CHANNEL) /* * Set the environment for a child process. @@ -4306,8 +4277,121 @@ # endif } - int -mch_call_shell( +#if !defined(USE_SYSTEM) || (defined(FEAT_GUI) && defined(FEAT_TERMINAL)) + + static int +build_argv( + char_u *cmd, + char ***argvp, + char_u **sh_tofree, + char_u **shcf_tofree) +{ + char **argv = NULL; + int argc; + + *sh_tofree = vim_strsave(p_sh); + if (*sh_tofree == NULL) /* out of memory */ + return FAIL; + + if (mch_parse_cmd(*sh_tofree, TRUE, &argv, &argc) == FAIL) + return FAIL; + *argvp = argv; + + if (cmd != NULL) + { + char_u *s; + char_u *p; + + if (extra_shell_arg != NULL) + argv[argc++] = (char *)extra_shell_arg; + + /* Break 'shellcmdflag' into white separated parts. This doesn't + * handle quoted strings, they are very unlikely to appear. */ + *shcf_tofree = alloc((unsigned)STRLEN(p_shcf) + 1); + if (*shcf_tofree == NULL) /* out of memory */ + return FAIL; + s = *shcf_tofree; + p = p_shcf; + while (*p != NUL) + { + argv[argc++] = (char *)s; + while (*p && *p != ' ' && *p != TAB) + *s++ = *p++; + *s++ = NUL; + p = skipwhite(p); + } + + argv[argc++] = (char *)cmd; + } + argv[argc] = NULL; + return OK; +} +#endif + +#if defined(FEAT_GUI) && defined(FEAT_TERMINAL) +/* + * Use a terminal window to run a shell command in. + */ + static int +mch_call_shell_terminal( + char_u *cmd, + int options UNUSED) /* SHELL_*, see vim.h */ +{ + jobopt_T opt; + char **argv = NULL; + char_u *tofree1 = NULL; + char_u *tofree2 = NULL; + int retval = -1; + buf_T *buf; + aco_save_T aco; + oparg_T oa; /* operator arguments */ + + if (build_argv(cmd, &argv, &tofree1, &tofree2) == FAIL) + goto theend; + + init_job_options(&opt); + ch_log(NULL, "starting terminal for system command '%s'", cmd); + buf = term_start(NULL, argv, &opt, TERM_START_SYSTEM); + + /* Find a window to make "buf" curbuf. */ + aucmd_prepbuf(&aco, buf); + + clear_oparg(&oa); + while (term_use_loop()) + { + if (oa.op_type == OP_NOP && oa.regname == NUL && !VIsual_active) + { + /* If terminal_loop() returns OK we got a key that is handled + * in Normal model. We don't do redrawing anyway. */ + if (terminal_loop(TRUE) == OK) + normal_cmd(&oa, TRUE); + } + else + normal_cmd(&oa, TRUE); + } + retval = 0; + ch_log(NULL, "system command finished"); + + /* restore curwin/curbuf and a few other things */ + aucmd_restbuf(&aco); + + wait_return(TRUE); + do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD, buf->b_fnum, TRUE); + +theend: + vim_free(argv); + vim_free(tofree1); + vim_free(tofree2); + return retval; +} +#endif + +#ifdef USE_SYSTEM +/* + * Use system() to start the shell: simple but slow. + */ + static int +mch_call_shell_system( char_u *cmd, int options) /* SHELL_*, see vim.h */ { @@ -4316,7 +4400,6 @@ char *ofn = NULL; #endif int tmode = cur_tmode; -#ifdef USE_SYSTEM /* use system() to start the shell: simple but slow */ char_u *newcmd; /* only needed for unix */ int x; @@ -4390,14 +4473,23 @@ restore_clipboard(); # endif return x; +} -#else /* USE_SYSTEM */ /* don't use system(), use fork()/exec() */ +#else /* USE_SYSTEM */ # define EXEC_FAILED 122 /* Exit code when shell didn't execute. Don't use 127, some shells use that already */ # define OPEN_NULL_FAILED 123 /* Exit code if /dev/null can't be opened */ - char_u *newcmd; +/* + * Don't use system(), use fork()/exec(). + */ + static int +mch_call_shell_fork( + char_u *cmd, + int options) /* SHELL_*, see vim.h */ +{ + int tmode = cur_tmode; pid_t pid; pid_t wpid = 0; pid_t wait_pid = 0; @@ -4408,10 +4500,9 @@ # endif int retval = -1; char **argv = NULL; - int argc; - char_u *p_shcf_copy = NULL; + char_u *tofree1 = NULL; + char_u *tofree2 = NULL; int i; - char_u *p; int pty_master_fd = -1; /* for pty's */ # ifdef FEAT_GUI int pty_slave_fd = -1; @@ -4421,44 +4512,13 @@ int pipe_error = FALSE; int did_settmode = FALSE; /* settmode(TMODE_RAW) called */ - newcmd = vim_strsave(p_sh); - if (newcmd == NULL) /* out of memory */ - goto error; - out_flush(); if (options & SHELL_COOKED) settmode(TMODE_COOK); /* set to normal mode */ - if (mch_parse_cmd(newcmd, TRUE, &argv, &argc) == FAIL) + if (build_argv(cmd, &argv, &tofree1, &tofree2) == FAIL) goto error; - if (cmd != NULL) - { - char_u *s; - - if (extra_shell_arg != NULL) - argv[argc++] = (char *)extra_shell_arg; - - /* Break 'shellcmdflag' into white separated parts. This doesn't - * handle quoted strings, they are very unlikely to appear. */ - p_shcf_copy = alloc((unsigned)STRLEN(p_shcf) + 1); - if (p_shcf_copy == NULL) /* out of memory */ - goto error; - s = p_shcf_copy; - p = p_shcf; - while (*p != NUL) - { - argv[argc++] = (char *)s; - while (*p && *p != ' ' && *p != TAB) - *s++ = *p++; - *s++ = NUL; - p = skipwhite(p); - } - - argv[argc++] = (char *)cmd; - } - argv[argc] = NULL; - /* * For the GUI, when writing the output into the buffer and when reading * input from the buffer: Try using a pseudo-tty to get the stdin/stdout @@ -4544,6 +4604,12 @@ reset_signals(); /* handle signals normally */ UNBLOCK_SIGNALS(&curset); +# ifdef FEAT_JOB_CHANNEL + if (ch_log_active()) + /* close the log file in the child */ + ch_logfile((char_u *)"", (char_u *)""); +# endif + if (!show_shell_mess || (options & SHELL_EXPAND)) { int fd; @@ -5022,6 +5088,7 @@ else if (has_mbyte) { int l; + char_u *p; len += buffer_off; buffer[len] = NUL; @@ -5260,8 +5327,6 @@ MSG_PUTS(_("\nCommand terminated\n")); } } - vim_free(argv); - vim_free(p_shcf_copy); error: if (!did_settmode) @@ -5270,11 +5335,28 @@ # ifdef FEAT_TITLE resettitle(); # endif - vim_free(newcmd); + vim_free(argv); + vim_free(tofree1); + vim_free(tofree2); return retval; - +} #endif /* USE_SYSTEM */ + + int +mch_call_shell( + char_u *cmd, + int options) /* SHELL_*, see vim.h */ +{ +#if defined(FEAT_GUI) && defined(FEAT_TERMINAL) + if (gui.in_use && vim_strchr(p_go, GO_TERMINAL) != NULL) + return mch_call_shell_terminal(cmd, options); +#endif +#ifdef USE_SYSTEM + return mch_call_shell_system(cmd, options); +#else + return mch_call_shell_fork(cmd, options); +#endif } #if defined(FEAT_JOB_CHANNEL) || defined(PROTO) @@ -5397,6 +5479,12 @@ reset_signals(); /* handle signals normally */ UNBLOCK_SIGNALS(&curset); +# ifdef FEAT_JOB_CHANNEL + if (ch_log_active()) + /* close the log file in the child */ + ch_logfile((char_u *)"", (char_u *)""); +# endif + # ifdef HAVE_SETSID /* Create our own process group, so that the child and all its * children can be kill()ed. Don't do this when using pipes, @@ -5406,11 +5494,23 @@ # ifdef FEAT_TERMINAL if (options->jo_term_rows > 0) + { + char *term = (char *)T_NAME; + +#ifdef FEAT_GUI + if (term_is_gui(T_NAME)) + /* In the GUI 'term' is not what we want, use $TERM. */ + term = getenv("TERM"); +#endif + /* Use 'term' or $TERM if it starts with "xterm", otherwise fall + * back to "xterm". */ + if (term == NULL || *term == NUL || STRNCMP(term, "xterm", 5) != 0) + term = "xterm"; set_child_environment( (long)options->jo_term_rows, (long)options->jo_term_cols, - STRNCMP(T_NAME, "xterm", 5) == 0 - ? (char *)T_NAME : "xterm"); + term); + } else # endif set_default_child_environment(); @@ -5530,21 +5630,22 @@ if (pty_master_fd >= 0) close(pty_slave_fd); /* not used in the parent */ /* close child stdin, stdout and stderr */ - if (!use_file_for_in && fd_in[0] >= 0) + if (fd_in[0] >= 0) close(fd_in[0]); - if (!use_file_for_out && fd_out[1] >= 0) + if (fd_out[1] >= 0) close(fd_out[1]); - if (!use_out_for_err && !use_file_for_err && fd_err[1] >= 0) + if (fd_err[1] >= 0) close(fd_err[1]); if (channel != NULL) { - channel_set_pipes(channel, - use_file_for_in || use_null_for_in - ? INVALID_FD : fd_in[1] < 0 ? pty_master_fd : fd_in[1], - use_file_for_out || use_null_for_out - ? INVALID_FD : fd_out[0] < 0 ? pty_master_fd : fd_out[0], - use_out_for_err || use_file_for_err || use_null_for_err - ? INVALID_FD : fd_err[0] < 0 ? pty_master_fd : fd_err[0]); + int in_fd = use_file_for_in || use_null_for_in + ? INVALID_FD : fd_in[1] < 0 ? pty_master_fd : fd_in[1]; + int out_fd = use_file_for_out || use_null_for_out + ? INVALID_FD : fd_out[0] < 0 ? pty_master_fd : fd_out[0]; + int err_fd = use_out_for_err || use_file_for_err || use_null_for_err + ? INVALID_FD : fd_err[0] < 0 ? pty_master_fd : fd_err[0]; + + channel_set_pipes(channel, in_fd, out_fd, err_fd); channel_set_job(channel, job, options); } else @@ -6765,8 +6866,7 @@ if (*num_file == 0) /* rejected all entries */ { - vim_free(*file); - *file = NULL; + VIM_CLEAR(*file); goto notfound; } diff -Nru vim-8.0.1453/src/os_unix.h vim-8.0.1766/src/os_unix.h --- vim-8.0.1453/src/os_unix.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/os_unix.h 2018-04-26 20:30:33.000000000 +0000 @@ -366,11 +366,14 @@ #ifdef VMS # define DFLT_RUNTIMEPATH "sys$login:vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,sys$login:vimfiles/after" +# define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" #else # ifdef RUNTIME_GLOBAL # define DFLT_RUNTIMEPATH "~/.vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after,~/.vim/after" +# define CLEAN_RUNTIMEPATH RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after" # else # define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" +# define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" # endif #endif diff -Nru vim-8.0.1453/src/os_vms.c vim-8.0.1766/src/os_vms.c --- vim-8.0.1453/src/os_vms.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/os_vms.c 2018-04-26 20:30:33.000000000 +0000 @@ -18,7 +18,7 @@ /* based on Alpha's gen64def.h; the file is absent on VAX */ typedef struct _generic_64 { # pragma __nomember_alignment - __union { /* You can treat me as... */ + __union { /* You can treat me as... */ /* long long is not available on VAXen */ /* unsigned __int64 gen64$q_quadword; ...a single 64-bit value, or */ @@ -83,7 +83,7 @@ #define EXPL_ALLOC_INC 64 #define EQN(S1,S2,LN) (strncmp(S1,S2,LN) == 0) -#define SKIP_FOLLOWING_SLASHES(Str) while (Str[1] == '/') ++Str +#define SKIP_FOLLOWING_SLASHES(Str) do { while (Str[1] == '/') ++Str; } while (0) /* @@ -461,8 +461,7 @@ result = decc$translate_vms(vms_fixfilename(buf)); if ( (int) result == 0 || (int) result == -1 ) { cnt = 0; - } - else { + } else { cnt = decc$to_vms(result, vms_wproc, 1 /*allow wild*/ , (flags & EW_DIR ? 0:1 ) /*allow directory*/) ; } if (cnt > 0) @@ -519,10 +518,9 @@ /* otherwise it might create ACCVIO error in decc$to_vms */ result = decc$translate_vms(vms_fixfilename(path)); if ( (int) result == 0 || (int) result == -1 ) { - cnt = 0; - } - else { - cnt = decc$to_vms(result, vms_wproc, 1 /*allow_wild*/, (flags & EW_DIR ? 0:1 ) /*allow directory*/); + cnt = 0; + } else { + cnt = decc$to_vms(result, vms_wproc, 1 /*allow_wild*/, (flags & EW_DIR ? 0:1 ) /*allow directory*/); } if (cnt > 0) cnt = vms_match_num; @@ -741,68 +739,66 @@ get_tty(); if (sec > 0) { - /* time-out specified; convert it to absolute time */ + /* time-out specified; convert it to absolute time */ /* sec>0 requirement of lib$cvtf_to_internal_time()*/ - /* get current time (number of 100ns ticks since the VMS Epoch) */ - status = sys$gettim(&time_curr); - if (status != SS$_NORMAL) - return 0; /* error */ - /* construct the delta time */ + /* get current time (number of 100ns ticks since the VMS Epoch) */ + status = sys$gettim(&time_curr); + if (status != SS$_NORMAL) + return 0; /* error */ + /* construct the delta time */ #if __G_FLOAT==0 # ifndef VAX /* IEEE is default on IA64, but can be used on Alpha too - but not on VAX */ - status = lib$cvts_to_internal_time( - &convert_operation, &sec, &time_diff); + status = lib$cvts_to_internal_time( + &convert_operation, &sec, &time_diff); # endif #else /* default on Alpha and VAX */ - status = lib$cvtf_to_internal_time( + status = lib$cvtf_to_internal_time( &convert_operation, &sec, &time_diff); #endif - if (status != LIB$_NORMAL) - return 0; /* error */ - /* add them up */ - status = lib$add_times( - &time_curr, - &time_diff, - &time_out); - if (status != LIB$_NORMAL) - return 0; /* error */ + if (status != LIB$_NORMAL) + return 0; /* error */ + /* add them up */ + status = lib$add_times( + &time_curr, + &time_diff, + &time_out); + if (status != LIB$_NORMAL) + return 0; /* error */ } while (TRUE) { - /* select() */ - status = sys$qiow(0, iochan, IO$_SENSEMODE | IO$M_TYPEAHDCNT, iosb, - 0, 0, &typeahead, 8, 0, 0, 0, 0); + /* select() */ + status = sys$qiow(0, iochan, IO$_SENSEMODE | IO$M_TYPEAHDCNT, iosb, + 0, 0, &typeahead, 8, 0, 0, 0, 0); if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL) - return 0; /* error */ + return 0; /* error */ - if (typeahead.numchars) - return 1; /* ready to read */ + if (typeahead.numchars) + return 1; /* ready to read */ - /* there's nothing to read; what now? */ - if (msec == 0) { - /* immediate time-out; return impatiently */ - return 0; - } - else if (msec < 0) { - /* no time-out; wait on indefinitely */ - continue; - } - else { - /* time-out needs to be checked */ - status = sys$gettim(&time_curr); - if (status != SS$_NORMAL) - return 0; /* error */ - - status = lib$sub_times( - &time_out, - &time_curr, - &time_diff); - if (status != LIB$_NORMAL) - return 0; /* error, incl. time_diff < 0 (i.e. time-out) */ + /* there's nothing to read; what now? */ + if (msec == 0) { + /* immediate time-out; return impatiently */ + return 0; + } else if (msec < 0) { + /* no time-out; wait on indefinitely */ + return 1; /* fakeout to force a wait in vms_read() */ + } else { + /* time-out needs to be checked */ + status = sys$gettim(&time_curr); + if (status != SS$_NORMAL) + return 0; /* error */ + + status = lib$sub_times( + &time_out, + &time_curr, + &time_diff); + if (status != LIB$_NORMAL) + return 0; /* error, incl. time_diff < 0 (i.e. time-out) */ - /* otherwise wait some more */ - } + /* otherwise wait some more */ + } } } diff -Nru vim-8.0.1453/src/os_win32.c vim-8.0.1766/src/os_win32.c --- vim-8.0.1453/src/os_win32.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/os_win32.c 2018-04-26 20:30:33.000000000 +0000 @@ -203,6 +203,32 @@ static int win32_set_archive(char_u *name); #ifndef FEAT_GUI_W32 +static int vtp_working = 0; +static void vtp_init(); +static void vtp_exit(); +static int vtp_printf(char *format, ...); +static void vtp_sgr_bulk(int arg); +static void vtp_sgr_bulks(int argc, int *argv); + +static guicolor_T save_console_bg_rgb; +static guicolor_T save_console_fg_rgb; + +# ifdef FEAT_TERMGUICOLORS +# define USE_VTP (vtp_working && p_tgc) +# else +# define USE_VTP 0 +# endif + +static void set_console_color_rgb(void); +static void reset_console_color_rgb(void); +#endif + +/* This flag is newly created from Windows 10 */ +#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING +# define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 +#endif + +#ifndef FEAT_GUI_W32 static int suppress_winsize = 1; /* don't fiddle with console */ #endif @@ -211,6 +237,54 @@ static BOOL win8_or_later = FALSE; #ifndef FEAT_GUI_W32 +/* Dynamic loading for portability */ +typedef struct _DYN_CONSOLE_SCREEN_BUFFER_INFOEX +{ + ULONG cbSize; + COORD dwSize; + COORD dwCursorPosition; + WORD wAttributes; + SMALL_RECT srWindow; + COORD dwMaximumWindowSize; + WORD wPopupAttributes; + BOOL bFullscreenSupported; + COLORREF ColorTable[16]; +} DYN_CONSOLE_SCREEN_BUFFER_INFOEX, *PDYN_CONSOLE_SCREEN_BUFFER_INFOEX; +typedef BOOL (WINAPI *PfnGetConsoleScreenBufferInfoEx)(HANDLE, PDYN_CONSOLE_SCREEN_BUFFER_INFOEX); +static PfnGetConsoleScreenBufferInfoEx pGetConsoleScreenBufferInfoEx; +typedef BOOL (WINAPI *PfnSetConsoleScreenBufferInfoEx)(HANDLE, PDYN_CONSOLE_SCREEN_BUFFER_INFOEX); +static PfnSetConsoleScreenBufferInfoEx pSetConsoleScreenBufferInfoEx; +static BOOL has_csbiex = FALSE; + +/* + * Get version number including build number + */ +typedef BOOL (WINAPI *PfnRtlGetVersion)(LPOSVERSIONINFOW); +# define MAKE_VER(major, minor, build) \ + (((major) << 24) | ((minor) << 16) | (build)) + + static DWORD +get_build_number(void) +{ + OSVERSIONINFOW osver = {sizeof(OSVERSIONINFOW)}; + HMODULE hNtdll; + PfnRtlGetVersion pRtlGetVersion; + DWORD ver = MAKE_VER(0, 0, 0); + + hNtdll = GetModuleHandle("ntdll.dll"); + if (hNtdll != NULL) + { + pRtlGetVersion = + (PfnRtlGetVersion)GetProcAddress(hNtdll, "RtlGetVersion"); + pRtlGetVersion(&osver); + ver = MAKE_VER(min(osver.dwMajorVersion, 255), + min(osver.dwMinorVersion, 255), + min(osver.dwBuildNumber, 32767)); + } + return ver; +} + + /* * Version of ReadConsoleInput() that works with IME. * Works around problems on Windows 8. @@ -1090,6 +1164,18 @@ SetConsoleMode(g_hConIn, cmodein); } + +#if defined(FEAT_BEVAL_TERM) || defined(PROTO) +/* + * Called when 'balloonevalterm' changed. + */ + void +mch_bevalterm_changed(void) +{ + mch_setmouse(g_fMouseActive); +} +#endif + /* * Decode a MOUSE_EVENT. If it's a valid event, return MOUSE_LEFT, * MOUSE_MIDDLE, or MOUSE_RIGHT for a click; MOUSE_DRAG for a mouse @@ -1169,7 +1255,7 @@ if (pmer->dwEventFlags == MOUSE_MOVED) { - /* ignore MOUSE_MOVED events if (x, y) hasn't changed. (We get these + /* Ignore MOUSE_MOVED events if (x, y) hasn't changed. (We get these * events even when the mouse moves only within a char cell.) */ if (s_xOldMouse == g_xMouse && s_yOldMouse == g_yMouse) return FALSE; @@ -1178,11 +1264,20 @@ /* If no buttons are pressed... */ if ((pmer->dwButtonState & ((1 << cButtons) - 1)) == 0) { + nButton = MOUSE_RELEASE; + /* If the last thing returned was MOUSE_RELEASE, ignore this */ if (s_fReleased) - return FALSE; + { +#ifdef FEAT_BEVAL_TERM + /* do return mouse move events when we want them */ + if (p_bevalterm) + nButton = MOUSE_DRAG; + else +#endif + return FALSE; + } - nButton = MOUSE_RELEASE; s_fReleased = TRUE; } else /* one or more buttons pressed */ @@ -1557,7 +1652,13 @@ if (ir.EventType == FOCUS_EVENT) handle_focus_event(ir); else if (ir.EventType == WINDOW_BUFFER_SIZE_EVENT) - shell_resized(); + { + /* Only call shell_resized() when the size actually change to + * avoid the screen is cleard. */ + if (ir.Event.WindowBufferSizeEvent.dwSize.X != Columns + || ir.Event.WindowBufferSizeEvent.dwSize.Y != Rows) + shell_resized(); + } #ifdef FEAT_MOUSE else if (ir.EventType == MOUSE_EVENT && decode_mouse_event(&ir.Event.MouseEvent)) @@ -1707,7 +1808,6 @@ */ if (!WaitForChar(p_ut, FALSE)) { -#ifdef FEAT_AUTOCMD if (trigger_cursorhold() && maxlen >= 3) { buf[0] = K_SPECIAL; @@ -1715,7 +1815,6 @@ buf[2] = (int)KE_CURSORHOLD; return 3; } -#endif before_blocking(); } } @@ -2252,8 +2351,7 @@ cb->Regions = (PSMALL_RECT)alloc(cb->NumRegions * sizeof(SMALL_RECT)); if (cb->Regions == NULL) { - vim_free(cb->Buffer); - cb->Buffer = NULL; + VIM_CLEAR(cb->Buffer); return FALSE; } } @@ -2278,10 +2376,8 @@ BufferCoord, /* offset in our buffer */ &ReadRegion)) /* region to save */ { - vim_free(cb->Buffer); - cb->Buffer = NULL; - vim_free(cb->Regions); - cb->Regions = NULL; + VIM_CLEAR(cb->Buffer); + VIM_CLEAR(cb->Regions); return FALSE; } cb->Regions[i] = ReadRegion; @@ -2534,6 +2630,7 @@ /* set termcap codes to current text attributes */ update_tcap(g_attrCurrent); + swap_tcap(); GetConsoleCursorInfo(g_hConOut, &g_cci); GetConsoleMode(g_hConIn, &g_cmodein); @@ -2574,6 +2671,8 @@ #ifdef FEAT_CLIPBOARD win_clip_init(); #endif + + vtp_init(); } /* @@ -2586,6 +2685,8 @@ { exiting = TRUE; + vtp_exit(); + stoptermcap(); if (g_fWindInitCalled) settmode(TMODE_COOK); @@ -3798,7 +3899,15 @@ if (g_fMouseActive) cmodein |= ENABLE_MOUSE_INPUT; #endif - cmodeout &= ~(ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT); + cmodeout &= ~( +#ifdef FEAT_TERMGUICOLORS + /* Do not turn off the ENABLE_PROCESSRD_OUTPUT flag when using + * VTP. */ + ((vtp_working) ? 0 : ENABLE_PROCESSED_OUTPUT) | +#else + ENABLE_PROCESSED_OUTPUT | +#endif + ENABLE_WRAP_AT_EOL_OUTPUT); bEnableHandler = TRUE; } else /* cooked */ @@ -4379,7 +4488,7 @@ int c; int noread_cnt = 0; garray_T ga; - int delay = 1; + int delay = 1; DWORD buffer_off = 0; /* valid bytes in buffer[] */ char *p = NULL; @@ -4673,6 +4782,81 @@ #endif +#if defined(FEAT_GUI) && defined(FEAT_TERMINAL) +/* + * Use a terminal window to run a shell command in. + */ + static int +mch_call_shell_terminal( + char_u *cmd, + int options UNUSED) /* SHELL_*, see vim.h */ +{ + jobopt_T opt; + char_u *newcmd = NULL; + typval_T argvar[2]; + long_u cmdlen; + int retval = -1; + buf_T *buf; + aco_save_T aco; + oparg_T oa; /* operator arguments */ + + if (cmd == NULL) + cmdlen = STRLEN(p_sh) + 1; + else + cmdlen = STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10; + newcmd = lalloc(cmdlen, TRUE); + if (newcmd == NULL) + return 255; + if (cmd == NULL) + { + STRCPY(newcmd, p_sh); + ch_log(NULL, "starting terminal to run a shell"); + } + else + { + vim_snprintf((char *)newcmd, cmdlen, "%s %s %s", p_sh, p_shcf, cmd); + ch_log(NULL, "starting terminal for system command '%s'", cmd); + } + + init_job_options(&opt); + + argvar[0].v_type = VAR_STRING; + argvar[0].vval.v_string = newcmd; + argvar[1].v_type = VAR_UNKNOWN; + buf = term_start(argvar, NULL, &opt, TERM_START_SYSTEM); + if (buf == NULL) + return 255; + + /* Find a window to make "buf" curbuf. */ + aucmd_prepbuf(&aco, buf); + + clear_oparg(&oa); + while (term_use_loop()) + { + if (oa.op_type == OP_NOP && oa.regname == NUL && !VIsual_active) + { + /* If terminal_loop() returns OK we got a key that is handled + * in Normal model. We don't do redrawing anyway. */ + if (terminal_loop(TRUE) == OK) + normal_cmd(&oa, TRUE); + } + else + normal_cmd(&oa, TRUE); + } + retval = 0; + ch_log(NULL, "system command finished"); + + /* restore curwin/curbuf and a few other things */ + aucmd_restbuf(&aco); + + wait_return(TRUE); + do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD, buf->b_fnum, TRUE); + + vim_free(newcmd); + return retval; +} +#endif + /* * Either execute a command by calling the shell or start a new shell */ @@ -4742,6 +4926,19 @@ fflush(fdDump); } #endif +#if defined(FEAT_GUI) && defined(FEAT_TERMINAL) + /* TODO: make the terminal window work with input or output redirected. */ + if (vim_strchr(p_go, GO_TERMINAL) != NULL + && (options & (SHELL_FILTER|SHELL_DOOUT|SHELL_WRITE|SHELL_READ)) == 0) + { + /* Use a terminal window to run the command in. */ + x = mch_call_shell_terminal(cmd, options); +#ifdef FEAT_TITLE + resettitle(); +#endif + return x; + } +#endif /* * Catch all deadly signals while running the external command, because a @@ -5445,6 +5642,7 @@ * to restore the actual contents of the buffer. */ RestoreConsoleBuffer(&g_cbTermcap, FALSE); + reset_console_color_rgb(); SetConsoleWindowInfo(g_hConOut, TRUE, &g_cbTermcap.Info.srWindow); Rows = g_cbTermcap.Info.dwSize.Y; Columns = g_cbTermcap.Info.dwSize.X; @@ -5457,6 +5655,7 @@ * size. We will use this as the size of our editing environment. */ ClearConsoleBuffer(g_attrCurrent); + set_console_color_rgb(); ResizeConBufAndWindow(g_hConOut, Columns, Rows); } @@ -5505,6 +5704,7 @@ cb = &g_cbNonTermcap; #endif RestoreConsoleBuffer(cb, p_rs); + reset_console_color_rgb(); SetConsoleCursorInfo(g_hConOut, &g_cci); if (p_rs || exiting) @@ -5559,7 +5759,11 @@ DWORD dwDummy; FillConsoleOutputCharacter(g_hConOut, ' ', n, coord, &dwDummy); - FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, n, coord, &dwDummy); + + if (!USE_VTP) + FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, n, coord, &dwDummy); + else + FillConsoleOutputAttribute(g_hConOut, 0, n, coord, &dwDummy); } @@ -5570,7 +5774,15 @@ clear_screen(void) { g_coord.X = g_coord.Y = 0; - clear_chars(g_coord, Rows * Columns); + + if (!USE_VTP) + clear_chars(g_coord, Rows * Columns); + else + { + set_console_color_rgb(); + gotoxy(1, 1); + vtp_printf("\033[2J"); + } } @@ -5580,8 +5792,20 @@ static void clear_to_end_of_display(void) { - clear_chars(g_coord, (Rows - g_coord.Y - 1) + COORD save = g_coord; + + if (!USE_VTP) + clear_chars(g_coord, (Rows - g_coord.Y - 1) * Columns + (Columns - g_coord.X)); + else + { + set_console_color_rgb(); + gotoxy(g_coord.X + 1, g_coord.Y + 1); + vtp_printf("\033[0J"); + + gotoxy(save.X + 1, save.Y + 1); + g_coord = save; + } } @@ -5591,7 +5815,19 @@ static void clear_to_end_of_line(void) { - clear_chars(g_coord, Columns - g_coord.X); + COORD save = g_coord; + + if (!USE_VTP) + clear_chars(g_coord, Columns - g_coord.X); + else + { + set_console_color_rgb(); + gotoxy(g_coord.X + 1, g_coord.Y + 1); + vtp_printf("\033[0K"); + + gotoxy(save.X + 1, save.Y + 1); + g_coord = save; + } } @@ -5630,6 +5866,9 @@ g_srScrollRegion.Top = top; g_srScrollRegion.Right = right; g_srScrollRegion.Bottom = bottom; + + if (USE_VTP) + vtp_printf("\033[%d;%dr", top + 1, bottom + 1); } @@ -5651,10 +5890,20 @@ source.Right = g_srScrollRegion.Right; source.Bottom = g_srScrollRegion.Bottom - cLines; - fill.Char.AsciiChar = ' '; - fill.Attributes = g_attrCurrent; + if (!USE_VTP) + { + fill.Char.AsciiChar = ' '; + fill.Attributes = g_attrCurrent; - ScrollConsoleScreenBuffer(g_hConOut, &source, NULL, dest, &fill); + ScrollConsoleScreenBuffer(g_hConOut, &source, NULL, dest, &fill); + } + else + { + set_console_color_rgb(); + + gotoxy(1, source.Top + 1); + vtp_printf("\033[%dT", cLines); + } /* Here we have to deal with a win32 console flake: If the scroll * region looks like abc and we scroll c to a and fill with d we get @@ -5693,10 +5942,20 @@ source.Right = g_srScrollRegion.Right; source.Bottom = g_srScrollRegion.Bottom; - fill.Char.AsciiChar = ' '; - fill.Attributes = g_attrCurrent; + if (!USE_VTP) + { + fill.Char.AsciiChar = ' '; + fill.Attributes = g_attrCurrent; - ScrollConsoleScreenBuffer(g_hConOut, &source, NULL, dest, &fill); + ScrollConsoleScreenBuffer(g_hConOut, &source, NULL, dest, &fill); + } + else + { + set_console_color_rgb(); + + gotoxy(1, source.Top + 1); + vtp_printf("\033[%dS", cLines); + } /* Here we have to deal with a win32 console flake: If the scroll * region looks like abc and we scroll c to a and fill with d we get @@ -5732,7 +5991,11 @@ /* external cursor coords are 1-based; internal are 0-based */ g_coord.X = x - 1; g_coord.Y = y - 1; - SetConsoleCursorPosition(g_hConOut, g_coord); + + if (!USE_VTP) + SetConsoleCursorPosition(g_hConOut, g_coord); + else + vtp_printf("\033[%d;%dH", y, x); } @@ -5754,7 +6017,10 @@ { g_attrCurrent = (g_attrCurrent & 0xf0) + (wAttr & 0x0f); - SetConsoleTextAttribute(g_hConOut, g_attrCurrent); + if (!USE_VTP) + SetConsoleTextAttribute(g_hConOut, g_attrCurrent); + else + vtp_sgr_bulk(wAttr); } @@ -5763,7 +6029,10 @@ { g_attrCurrent = (g_attrCurrent & 0x0f) + ((wAttr & 0x0f) << 4); - SetConsoleTextAttribute(g_hConOut, g_attrCurrent); + if (!USE_VTP) + SetConsoleTextAttribute(g_hConOut, g_attrCurrent); + else + vtp_sgr_bulk(wAttr); } @@ -5773,7 +6042,10 @@ static void normvideo(void) { - textattr(g_attrDefault); + if (!USE_VTP) + textattr(g_attrDefault); + else + vtp_sgr_bulk(0); } @@ -5786,6 +6058,7 @@ standout(void) { g_attrPreStandout = g_attrCurrent; + textattr((WORD) (g_attrCurrent|FOREGROUND_INTENSITY|BACKGROUND_INTENSITY)); } @@ -5797,10 +6070,9 @@ standend(void) { if (g_attrPreStandout) - { textattr(g_attrPreStandout); - g_attrPreStandout = 0; - } + + g_attrPreStandout = 0; } @@ -5815,7 +6087,11 @@ cterm_normal_fg_color = (g_attrDefault & 0xf) + 1; cterm_normal_bg_color = ((g_attrDefault >> 4) & 0xf) + 1; - if (T_ME[0] == ESC && T_ME[1] == '|') + if ( +#ifdef FEAT_TERMGUICOLORS + !p_tgc && +#endif + T_ME[0] == ESC && T_ME[1] == '|') { p = T_ME + 2; n = getdigits(&p); @@ -5825,6 +6101,10 @@ cterm_normal_bg_color = ((n >> 4) & 0xf) + 1; } } +#ifdef FEAT_TERMGUICOLORS + cterm_normal_fg_gui_color = INVALCOLOR; + cterm_normal_bg_gui_color = INVALCOLOR; +#endif } @@ -5848,7 +6128,8 @@ coordOrigin, &dwDummy); Sleep(15); /* wait for 15 msec */ - WriteConsoleOutputAttribute(g_hConOut, oldattrs, Rows * Columns, + if (!USE_VTP) + WriteConsoleOutputAttribute(g_hConOut, oldattrs, Rows * Columns, coordOrigin, &dwDummy); vim_free(oldattrs); } @@ -5898,14 +6179,24 @@ unicodebuf, unibuflen); cells = mb_string2cells(pchBuf, cbToWrite); - FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, cells, - coord, &written); - /* When writing fails or didn't write a single character, pretend one - * character was written, otherwise we get stuck. */ - if (WriteConsoleOutputCharacterW(g_hConOut, unicodebuf, length, - coord, &cchwritten) == 0 - || cchwritten == 0) - cchwritten = 1; + + if (!USE_VTP) + { + FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, cells, + coord, &written); + /* When writing fails or didn't write a single character, pretend one + * character was written, otherwise we get stuck. */ + if (WriteConsoleOutputCharacterW(g_hConOut, unicodebuf, length, + coord, &cchwritten) == 0 + || cchwritten == 0) + cchwritten = 1; + } + else + { + if (WriteConsoleW(g_hConOut, unicodebuf, length, &cchwritten, + NULL) == 0 || cchwritten == 0) + cchwritten = 1; + } if (cchwritten == length) { @@ -5924,14 +6215,23 @@ else #endif { - FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, cbToWrite, - coord, &written); - /* When writing fails or didn't write a single character, pretend one - * character was written, otherwise we get stuck. */ - if (WriteConsoleOutputCharacter(g_hConOut, (LPCSTR)pchBuf, cbToWrite, - coord, &written) == 0 - || written == 0) - written = 1; + if (!USE_VTP) + { + FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, cbToWrite, + coord, &written); + /* When writing fails or didn't write a single character, pretend one + * character was written, otherwise we get stuck. */ + if (WriteConsoleOutputCharacter(g_hConOut, (LPCSTR)pchBuf, cbToWrite, + coord, &written) == 0 + || written == 0) + written = 1; + } + else + { + if (WriteConsole(g_hConOut, (LPCSTR)pchBuf, cbToWrite, &written, + NULL) == 0 || written == 0) + written = 1; + } g_coord.X += (SHORT) written; } @@ -6057,67 +6357,76 @@ char_u *old_s = s; #endif char_u *p; - int arg1 = 0, arg2 = 0; + int arg1 = 0, arg2 = 0, argc = 0, args[16]; switch (s[2]) { - /* one or two numeric arguments, separated by ';' */ - case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - p = s + 2; - arg1 = getdigits(&p); /* no check for length! */ - if (p > s + len) - break; - - if (*p == ';') + p = s + 1; + do { ++p; - arg2 = getdigits(&p); /* no check for length! */ + args[argc] = getdigits(&p); + argc += (argc < 15) ? 1 : 0; if (p > s + len) break; + } while (*p == ';'); - if (*p == 'H') - gotoxy(arg2, arg1); - else if (*p == 'r') - set_scroll_region(0, arg1 - 1, Columns - 1, arg2 - 1); + if (p > s + len) + break; + + arg1 = args[0]; + arg2 = args[1]; + if (*p == 'm') + { + if (argc == 1 && args[0] == 0) + normvideo(); + else if (argc == 1) + { + if (USE_VTP) + textcolor((WORD) arg1); + else + textattr((WORD) arg1); + } + else if (USE_VTP) + vtp_sgr_bulks(argc, args); } - else if (*p == 'A') + else if (argc == 2 && *p == 'H') { - /* move cursor up arg1 lines in same column */ - gotoxy(g_coord.X + 1, - max(g_srScrollRegion.Top, g_coord.Y - arg1) + 1); + gotoxy(arg2, arg1); } - else if (*p == 'C') + else if (argc == 2 && *p == 'r') { - /* move cursor right arg1 columns in same line */ - gotoxy(min(g_srScrollRegion.Right, g_coord.X + arg1) + 1, - g_coord.Y + 1); + set_scroll_region(0, arg1 - 1, Columns - 1, arg2 - 1); } - else if (*p == 'H') + else if (argc == 1 && *p == 'A') { - gotoxy(1, arg1); + gotoxy(g_coord.X + 1, + max(g_srScrollRegion.Top, g_coord.Y - arg1) + 1); } - else if (*p == 'L') + else if (argc == 1 && *p == 'b') { - insert_lines(arg1); + textbackground((WORD) arg1); } - else if (*p == 'm') + else if (argc == 1 && *p == 'C') { - if (arg1 == 0) - normvideo(); - else - textattr((WORD) arg1); + gotoxy(min(g_srScrollRegion.Right, g_coord.X + arg1) + 1, + g_coord.Y + 1); } - else if (*p == 'f') + else if (argc == 1 && *p == 'f') { textcolor((WORD) arg1); } - else if (*p == 'b') + else if (argc == 1 && *p == 'H') { - textbackground((WORD) arg1); + gotoxy(1, arg1); + } + else if (argc == 1 && *p == 'L') + { + insert_lines(arg1); } - else if (*p == 'M') + else if (argc == 1 && *p == 'M') { delete_lines(arg1); } @@ -6126,11 +6435,7 @@ s = p + 1; break; - - /* Three-character escape sequences */ - case 'A': - /* move cursor up one line in same column */ gotoxy(g_coord.X + 1, max(g_srScrollRegion.Top, g_coord.Y - 1) + 1); goto got3; @@ -6140,7 +6445,6 @@ goto got3; case 'C': - /* move cursor right one column in same line */ gotoxy(min(g_srScrollRegion.Right, g_coord.X + 1) + 1, g_coord.Y + 1); goto got3; @@ -7181,10 +7485,15 @@ /* Now expand wildcards in the arguments. */ /* Temporarily add '(' and ')' to 'isfname'. These are valid * filename characters but are excluded from 'isfname' to make - * "gf" work on a file name in parenthesis (e.g.: see vim.h). */ + * "gf" work on a file name in parenthesis (e.g.: see vim.h). + * Also, unset wildignore to not be influenced by this option. + * The arguments specified in command-line should be kept even if + * encoding options were changed. */ do_cmdline_cmd((char_u *)":let SaVe_ISF = &isf|set isf+=(,)"); + do_cmdline_cmd((char_u *)":let SaVe_WIG = &wig|set wig="); alist_expand(fnum_list, used_alist_count); do_cmdline_cmd((char_u *)":let &isf = SaVe_ISF|unlet SaVe_ISF"); + do_cmdline_cmd((char_u *)":let &wig = SaVe_WIG|unlet SaVe_WIG"); } /* If wildcard expansion failed, we are editing the first file of the @@ -7193,7 +7502,7 @@ { do_cmdline_cmd((char_u *)":rewind"); if (GARGCOUNT == 1 && used_file_full_path) - (void)vim_chdirfile(alist_name(&GARGLIST[0])); + (void)vim_chdirfile(alist_name(&GARGLIST[0]), "drop"); } set_alist_count(); @@ -7239,3 +7548,186 @@ return 0; } + +#ifndef FEAT_GUI_W32 + +/* + * Support for 256 colors and 24-bit colors was added in Windows 10 + * version 1703 (Creators update). + */ +# define VTP_FIRST_SUPPORT_BUILD MAKE_VER(10, 0, 15063) + + static void +vtp_init(void) +{ + DWORD ver, mode; + HMODULE hKerneldll; + DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi; + + ver = get_build_number(); + vtp_working = (ver >= VTP_FIRST_SUPPORT_BUILD) ? 1 : 0; + GetConsoleMode(g_hConOut, &mode); + mode |= (ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING); + if (SetConsoleMode(g_hConOut, mode) == 0) + vtp_working = 0; + + /* Use functions supported from Vista */ + hKerneldll = GetModuleHandle("kernel32.dll"); + if (hKerneldll != NULL) + { + pGetConsoleScreenBufferInfoEx = + (PfnGetConsoleScreenBufferInfoEx)GetProcAddress( + hKerneldll, "GetConsoleScreenBufferInfoEx"); + pSetConsoleScreenBufferInfoEx = + (PfnSetConsoleScreenBufferInfoEx)GetProcAddress( + hKerneldll, "SetConsoleScreenBufferInfoEx"); + if (pGetConsoleScreenBufferInfoEx != NULL + && pSetConsoleScreenBufferInfoEx != NULL) + has_csbiex = TRUE; + } + + csbi.cbSize = sizeof(csbi); + if (has_csbiex) + pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi); + save_console_bg_rgb = (guicolor_T)csbi.ColorTable[0]; + save_console_fg_rgb = (guicolor_T)csbi.ColorTable[7]; + + set_console_color_rgb(); +} + + static void +vtp_exit(void) +{ + reset_console_color_rgb(); +} + + static int +vtp_printf( + char *format, + ...) +{ + char_u buf[100]; + va_list list; + DWORD result; + + va_start(list, format); + vim_vsnprintf((char *)buf, 100, (char *)format, list); + va_end(list); + WriteConsoleA(g_hConOut, buf, (DWORD)STRLEN(buf), &result, NULL); + return (int)result; +} + + static void +vtp_sgr_bulk( + int arg) +{ + int args[1]; + + args[0] = arg; + vtp_sgr_bulks(1, args); +} + + static void +vtp_sgr_bulks( + int argc, + int *args +) +{ + /* 2('\033[') + 4('255.') * 16 + NUL */ + char_u buf[2 + (4 * 16) + 1]; + char_u *p; + int i; + + p = buf; + *p++ = '\033'; + *p++ = '['; + + for (i = 0; i < argc; ++i) + { + p += vim_snprintf((char *)p, 4, "%d", args[i] & 0xff); + *p++ = ';'; + } + p--; + *p++ = 'm'; + *p = NUL; + vtp_printf((char *)buf); +} + + static void +set_console_color_rgb(void) +{ +# ifdef FEAT_TERMGUICOLORS + DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi; + int id; + guicolor_T fg = INVALCOLOR; + guicolor_T bg = INVALCOLOR; + + if (!USE_VTP) + return; + + id = syn_name2id((char_u *)"Normal"); + if (id > 0) + syn_id2colors(id, &fg, &bg); + if (fg == INVALCOLOR) + fg = 0xc0c0c0; /* white text */ + if (bg == INVALCOLOR) + bg = 0x000000; /* black background */ + fg = (GetRValue(fg) << 16) | (GetGValue(fg) << 8) | GetBValue(fg); + bg = (GetRValue(bg) << 16) | (GetGValue(bg) << 8) | GetBValue(bg); + + csbi.cbSize = sizeof(csbi); + if (has_csbiex) + pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi); + + csbi.cbSize = sizeof(csbi); + csbi.srWindow.Right += 1; + csbi.srWindow.Bottom += 1; + csbi.ColorTable[0] = (COLORREF)bg; + csbi.ColorTable[7] = (COLORREF)fg; + if (has_csbiex) + pSetConsoleScreenBufferInfoEx(g_hConOut, &csbi); +# endif +} + + static void +reset_console_color_rgb(void) +{ +# ifdef FEAT_TERMGUICOLORS + DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi; + + csbi.cbSize = sizeof(csbi); + if (has_csbiex) + pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi); + + csbi.cbSize = sizeof(csbi); + csbi.srWindow.Right += 1; + csbi.srWindow.Bottom += 1; + csbi.ColorTable[0] = (COLORREF)save_console_bg_rgb; + csbi.ColorTable[7] = (COLORREF)save_console_fg_rgb; + if (has_csbiex) + pSetConsoleScreenBufferInfoEx(g_hConOut, &csbi); +# endif +} + + void +control_console_color_rgb(void) +{ + if (USE_VTP) + set_console_color_rgb(); + else + reset_console_color_rgb(); +} + + int +has_vtp_working(void) +{ + return vtp_working; +} + + int +use_vtp(void) +{ + return USE_VTP; +} + +#endif diff -Nru vim-8.0.1453/src/po/Make_cyg.mak vim-8.0.1766/src/po/Make_cyg.mak --- vim-8.0.1453/src/po/Make_cyg.mak 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/po/Make_cyg.mak 2018-04-26 20:30:33.000000000 +0000 @@ -41,6 +41,7 @@ ru.cp1251 \ sk \ sk.cp1250 \ + sr \ sv \ uk \ uk.cp1251 \ @@ -80,6 +81,7 @@ ru.mo \ sk.cp1250.mo \ sk.mo \ + sr.mo \ sv.mo \ uk.cp1251.mo \ uk.mo \ @@ -128,11 +130,11 @@ first_time: $(XGETTEXT) --default-domain=$(LANGUAGE) \ - --add-comments --keyword=_ --keyword=N_ $(wildcard ../*.c) ../if_perl.xs ../GvimExt/gvimext.cpp $(wildcard ../globals.h) ../if_py_both.h + --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 $(wildcard ../*.c) ../if_perl.xs ../GvimExt/gvimext.cpp $(wildcard ../globals.h) ../if_py_both.h $(LANGUAGES): $(XGETTEXT) --default-domain=$(PACKAGE) \ - --add-comments --keyword=_ --keyword=N_ $(wildcard ../*.c) ../if_perl.xs ../GvimExt/gvimext.cpp $(wildcard ../globals.h) ../if_py_both.h + --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 $(wildcard ../*.c) ../if_perl.xs ../GvimExt/gvimext.cpp $(wildcard ../globals.h) ../if_py_both.h $(MV) $(PACKAGE).po $(PACKAGE).pot $(CP) $@.po $@.po.orig $(MV) $@.po $@.po.old diff -Nru vim-8.0.1453/src/po/Makefile vim-8.0.1766/src/po/Makefile --- vim-8.0.1453/src/po/Makefile 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/po/Makefile 2018-04-26 20:30:33.000000000 +0000 @@ -30,6 +30,7 @@ pt_BR \ ru \ sk \ + sr \ sv \ uk \ vi \ @@ -72,6 +73,7 @@ pt_BR.mo \ ru.mo \ sk.mo \ + sr.mo \ sv.mo \ uk.mo \ vi.mo \ @@ -113,6 +115,7 @@ pt_BR.ck \ ru.ck \ sk.ck \ + sr.ck \ sv.ck \ uk.ck \ vi.ck \ @@ -280,7 +283,7 @@ $(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h ../if_py_both.h cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \ - --add-comments --keyword=_ --keyword=N_ \ + --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 \ *.c if_perl.xs GvimExt/gvimext.cpp globals.h if_py_both.h mv -f ../$(PACKAGE).po $(PACKAGE).pot diff -Nru vim-8.0.1453/src/po/Make_ming.mak vim-8.0.1766/src/po/Make_ming.mak --- vim-8.0.1453/src/po/Make_ming.mak 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/po/Make_ming.mak 2018-04-26 20:30:33.000000000 +0000 @@ -47,6 +47,7 @@ ru.cp1251 \ sk \ sk.cp1250 \ + sr \ sv \ uk \ uk.cp1251 \ @@ -86,6 +87,7 @@ ru.mo \ sk.cp1250.mo \ sk.mo \ + sr.mo \ sv.mo \ uk.cp1251.mo \ uk.mo \ @@ -137,11 +139,11 @@ first_time: $(XGETTEXT) --default-domain=$(LANGUAGE) \ - --add-comments --keyword=_ --keyword=N_ $(wildcard ../*.c) ../if_perl.xs ../GvimExt/gvimext.cpp $(wildcard ../globals.h) ../if_py_both.h + --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 $(wildcard ../*.c) ../if_perl.xs ../GvimExt/gvimext.cpp $(wildcard ../globals.h) ../if_py_both.h $(LANGUAGES): $(XGETTEXT) --default-domain=$(PACKAGE) \ - --add-comments --keyword=_ --keyword=N_ $(wildcard ../*.c) ../if_perl.xs ../GvimExt/gvimext.cpp $(wildcard ../globals.h) ../if_py_both.h + --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 $(wildcard ../*.c) ../if_perl.xs ../GvimExt/gvimext.cpp $(wildcard ../globals.h) ../if_py_both.h $(MV) $(PACKAGE).po $(PACKAGE).pot $(CP) $@.po $@.po.orig $(MV) $@.po $@.po.old diff -Nru vim-8.0.1453/src/po/Make_mvc.mak vim-8.0.1766/src/po/Make_mvc.mak --- vim-8.0.1453/src/po/Make_mvc.mak 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/po/Make_mvc.mak 2018-04-26 20:30:33.000000000 +0000 @@ -39,6 +39,7 @@ ru.cp1251 \ sk \ sk.cp1250 \ + sr \ sv \ uk \ uk.cp1251 \ @@ -78,6 +79,7 @@ ru.mo \ sk.cp1250.mo \ sk.mo \ + sr.mo \ sv.mo \ uk.cp1251.mo \ uk.mo \ @@ -122,12 +124,12 @@ first_time: files set OLD_PO_FILE_INPUT=yes set OLD_PO_FILE_OUTPUT=yes - $(XGETTEXT) --default-domain=$(LANGUAGE) --add-comments --keyword=_ --keyword=N_ --files-from=.\files + $(XGETTEXT) --default-domain=$(LANGUAGE) --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 --files-from=.\files $(LANGUAGES): files set OLD_PO_FILE_INPUT=yes set OLD_PO_FILE_OUTPUT=yes - $(XGETTEXT) --default-domain=$(PACKAGE) --add-comments --keyword=_ --keyword=N_ --files-from=.\files + $(XGETTEXT) --default-domain=$(PACKAGE) --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 --files-from=.\files $(MV) $(PACKAGE).po $(PACKAGE).pot $(CP) $@.po $@.po.orig $(MV) $@.po $@.po.old diff -Nru vim-8.0.1453/src/po/sr.po vim-8.0.1766/src/po/sr.po --- vim-8.0.1453/src/po/sr.po 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/po/sr.po 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,6918 @@ +# Serbian Cyrillic Translation for Vim +# +# Do ":help uganda" in Vim to read copying and usage conditions. +# Do ":help credits" in Vim to see a list of people who contributed. + +# Copyright (C) 2017 +# This file is distributed under the same license as the Vim package. +# FIRST AUTHOR Ivan PeÅ¡ić , 2017. +# +msgid "" +msgstr "" +"Project-Id-Version: Vim(Serbian)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-21 08:34+0400\n" +"PO-Revision-Date: 2017-12-27 10:29+0400\n" +"Last-Translator: Ivan PeÅ¡ić \n" +"Language-Team: Serbian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "E831: bf_key_init() called with empty password" +msgstr "E831: bf_key_init() је позвана Ñа празном лозинком" + +msgid "E820: sizeof(uint32_t) != 4" +msgstr "E820: sizeof(uint32_t) != 4" + +msgid "E817: Blowfish big/little endian use wrong" +msgstr "E817: Blowfish употреба big/little endian је погрешна" + +msgid "E818: sha256 test failed" +msgstr "E818: sha256 теÑÑ‚ није уÑпео" + +msgid "E819: Blowfish test failed" +msgstr "E819: Blowfish теÑÑ‚ није уÑпео" + +msgid "[Location List]" +msgstr "[ЛиÑта локација]" + +msgid "[Quickfix List]" +msgstr "[Quickfix лиÑта]" + +msgid "E855: Autocommands caused command to abort" +msgstr "E855: Ðутокоманде Ñу изазвале прекид команде" + +msgid "E82: Cannot allocate any buffer, exiting..." +msgstr "E82: Ðе може да Ñе резервише меморија ни за један бафер, излазак..." + +msgid "E83: Cannot allocate buffer, using other one..." +msgstr "E83: Ðе може да Ñе резервише меморија за бафер, кориÑти Ñе други..." + +msgid "E931: Buffer cannot be registered" +msgstr "E931: Бафер не може да Ñе региÑтрује" + +msgid "E937: Attempt to delete a buffer that is in use" +msgstr "E937: Покушај бриÑања бафера који је у употреби" + +msgid "E515: No buffers were unloaded" +msgstr "E515: Ðиједан бафер није уклоњен из меморије" + +msgid "E516: No buffers were deleted" +msgstr "E516: Ðиједан бафер није обриÑан" + +msgid "E517: No buffers were wiped out" +msgstr "E517: Ðиједан бафер није очишћен" + +msgid "1 buffer unloaded" +msgstr "1 бафер је уклоњен из меморије" + +#, c-format +msgid "%d buffers unloaded" +msgstr "%d бафера је уклоњено из меморије" + +msgid "1 buffer deleted" +msgstr "1 бафер је обриÑан" + +#, c-format +msgid "%d buffers deleted" +msgstr "%d бафера је обриÑано" + +msgid "1 buffer wiped out" +msgstr "1 бафер је очишћен" + +#, c-format +msgid "%d buffers wiped out" +msgstr "%d бафера је очишћено" + +msgid "E90: Cannot unload last buffer" +msgstr "E90: ПоÑледњи бафер не може да Ñе уклони из меморије" + +msgid "E84: No modified buffer found" +msgstr "E84: Ðије пронађен измењени бафер" + +msgid "E85: There is no listed buffer" +msgstr "E85: Ðема бафера на лиÑти" + +msgid "E87: Cannot go beyond last buffer" +msgstr "E87: Ðе може да Ñе иде иза поÑледњег бафера" + +msgid "E88: Cannot go before first buffer" +msgstr "E88: Ðе може да Ñе иде иÑпред првог бафера" + +#, c-format +msgid "E89: No write since last change for buffer %ld (add ! to override)" +msgstr "E89: Од поÑледње измене није било упиÑа за бафер %ld (додајте ! да премоÑтите)" + +msgid "E948: Job still running (add ! to end the job)" +msgstr "E948: Задатак Ñе још извршава (додајте ! да зауÑтавите задатак)" + +msgid "E37: No write since last change (add ! to override)" +msgstr "E37: Ðије било упиÑа од поÑледње промене (додајте ! да премоÑтите)" + +msgid "E948: Job still running" +msgstr "E948: Задатак Ñе и даље извршава" + +msgid "E37: No write since last change" +msgstr "E37: Ðије било упиÑа од поÑледње промене" + +msgid "W14: Warning: List of file names overflow" +msgstr "W14: Упозорење: Прекорачена је макÑимална величина лиÑте имена датотека" + +#, c-format +msgid "E92: Buffer %ld not found" +msgstr "E92: Бафер %ld није пронађен" + +#, c-format +msgid "E93: More than one match for %s" +msgstr "E93: Више од једног подударања Ñа %s" + +#, c-format +msgid "E94: No matching buffer for %s" +msgstr "E94: Ðиједан бафер Ñе не подудара Ñа %s" + +#, c-format +msgid "line %ld" +msgstr "линија %ld" + +msgid "E95: Buffer with this name already exists" +msgstr "E95: Бафер Ñа овим именом већ поÑтоји" + +msgid " [Modified]" +msgstr "[Измењено]" + +msgid "[Not edited]" +msgstr "[Ðије уређивано]" + +msgid "[New file]" +msgstr "[Ðова датотека]" + +msgid "[Read errors]" +msgstr "[Грешке при читању]" + +msgid "[RO]" +msgstr "[СЧ]" + +msgid "[readonly]" +msgstr "[Ñамо за читање]" + +#, c-format +msgid "1 line --%d%%--" +msgstr "1 линија --%d%%--" + +#, c-format +msgid "%ld lines --%d%%--" +msgstr "%ld линија --%d%%--" + +#, c-format +msgid "line %ld of %ld --%d%%-- col " +msgstr "линија %ld од %ld --%d%%-- кол " + +msgid "[No Name]" +msgstr "[Без имена]" + +msgid "help" +msgstr "помоћ" + +msgid "[Help]" +msgstr "[Помоћ]" + +msgid "[Preview]" +msgstr "[Преглед]" + +msgid "All" +msgstr "Све" + +msgid "Bot" +msgstr "Дно" + +msgid "Top" +msgstr "Врх" + +msgid "" +"\n" +"# Buffer list:\n" +msgstr "" +"\n" +"# ЛиÑта бафера:\n" + +msgid "E382: Cannot write, 'buftype' option is set" +msgstr "E382: Ð£Ð¿Ð¸Ñ Ð½Ð¸Ñ˜Ðµ могућ, поÑтављена је 'buftype' опција" + +msgid "[Scratch]" +msgstr "[Празно]" + +msgid "" +"\n" +"--- Signs ---" +msgstr "" +"\n" +"--- Знаци ---" + +#, c-format +msgid "Signs for %s:" +msgstr "Знаци за %s:" + +#, c-format +msgid " line=%ld id=%d name=%s" +msgstr " линија=%ld ид=%d име=%s" + +msgid "E902: Cannot connect to port" +msgstr "E902: Повезивање на порт није могуће" + +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() у channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() у channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: примњена команда Ñа аргуменом који није Ñтринг" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: поÑледњи аргумент за expr/call мора бити број" + +msgid "E904: third argument for call must be a list" +msgstr "E904: трећи аргумент за call мора бити лиÑта" + +#, c-format +msgid "E905: received unknown command: %s" +msgstr "E905: примљена непозната команда: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): ÑƒÐ¿Ð¸Ñ Ð´Ð¾Ðº није уÑпоÑтављена веза" + +#, c-format +msgid "E631: %s(): write failed" +msgstr "E631: %s(): ÑƒÐ¿Ð¸Ñ Ð½Ð¸Ñ˜Ðµ уÑпео" + +#, c-format +msgid "E917: Cannot use a callback with %s()" +msgstr "E917: Callback не може да Ñе кориÑти Ñа %s()" + +msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +msgstr "E912: ch_evalexpr()/ch_sendexpr() не може да Ñе кориÑти Ñа raw или nl каналом" + +msgid "E906: not an open channel" +msgstr "E906: није отворен канал" + +msgid "E920: _io file requires _name to be set" +msgstr "E920: _io датотека захтева да _name буде поÑтављено" + +msgid "E915: in_io buffer requires in_buf or in_name to be set" +msgstr "E915: in_io бафер захтева да in_buf или in_name буде поÑтављено" + +#, c-format +msgid "E918: buffer must be loaded: %s" +msgstr "E918: бафер мора бити учитан: %s" + +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Датотека је шифрована непознатом методом" + +msgid "Warning: Using a weak encryption method; see :help 'cm'" +msgstr "Упозорење: КориÑти Ñе Ñлаба метода шифрирања; погледајте :help 'cm'" + +msgid "Enter encryption key: " +msgstr "УнеÑите кључ за шифрирање: " + +msgid "Enter same key again: " +msgstr "УнеÑите иÑти кључ поново: " + +msgid "Keys don't match!" +msgstr "Кључеви ниÑу иÑти!" + +msgid "[crypted]" +msgstr "[шифровано]" + +#, c-format +msgid "E720: Missing colon in Dictionary: %s" +msgstr "E720: ÐедоÑтаје тачка-зарез у Речнику: %s" + +#, c-format +msgid "E721: Duplicate key in Dictionary: \"%s\"" +msgstr "E721: Дупликат кључа у Речнику: \"%s\"" + +#, c-format +msgid "E722: Missing comma in Dictionary: %s" +msgstr "E722: ÐедоÑтаје зарез у Речнику: %s" + +#, c-format +msgid "E723: Missing end of Dictionary '}': %s" +msgstr "E723: ÐедоÑтаје крај Речника '}': %s" + +msgid "extend() argument" +msgstr "extend() аргумент" + +#, c-format +msgid "E737: Key already exists: %s" +msgstr "E737: Кључ већ поÑтоји: %s" + +#, c-format +msgid "E96: Cannot diff more than %ld buffers" +msgstr "E96: Ðе може да Ñе упоређује више од %ld бафера" + +msgid "E810: Cannot read or write temp files" +msgstr "E810: Ðије могуће читање или ÑƒÐ¿Ð¸Ñ Ñƒ привремене датотеке" + +msgid "E97: Cannot create diffs" +msgstr "E97: Ðије могуће креирање diff-ова" + +msgid "Patch file" +msgstr "Patch датотека" + +msgid "E816: Cannot read patch output" +msgstr "E816: Ðије могуће читање patch излаза" + +msgid "E98: Cannot read diff output" +msgstr "E98: Ðије могуће читање diff излаза" + +msgid "E99: Current buffer is not in diff mode" +msgstr "E99: Текући бафер није у diff режиму" + +msgid "E793: No other buffer in diff mode is modifiable" +msgstr "E793: Ðиједан други бафер у diff режиму није измењив" + +msgid "E100: No other buffer in diff mode" +msgstr "E100: ниједан други бафер није у diff режиму" + +msgid "E101: More than two buffers in diff mode, don't know which one to use" +msgstr "E101: Више од два бафера Ñу у diff режиму, не знам који да кориÑтим" + +#, c-format +msgid "E102: Can't find buffer \"%s\"" +msgstr "E102: Бафер \"%s\" не може да Ñе пронађе" + +#, c-format +msgid "E103: Buffer \"%s\" is not in diff mode" +msgstr "E103: Бафер \"%s\" није у diff режиму" + +msgid "E787: Buffer changed unexpectedly" +msgstr "E787: Бафер је неочекивано измењен" + +msgid "E104: Escape not allowed in digraph" +msgstr "E104: Escape није дозвољен у digraph" + +msgid "E544: Keymap file not found" +msgstr "E544: Keymap датотека није пронађена" + +msgid "E105: Using :loadkeymap not in a sourced file" +msgstr "E105: Коришћење :loadkeymap ван датотеке која Ñе учитава као Ñкрипта" + +msgid "E791: Empty keymap entry" +msgstr "E791: Празна keymap Ñтавка" + +msgid " Keyword completion (^N^P)" +msgstr " Довршавање кључне речи (^N^P)" + +msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" +msgstr " ^X режим (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" + +msgid " Whole line completion (^L^N^P)" +msgstr " Довршавање целе линије (^L^N^P)" + +msgid " File name completion (^F^N^P)" +msgstr " Довршавање имена датотеке (^F^N^P)" + +msgid " Tag completion (^]^N^P)" +msgstr " Довршавање ознаке (^]^N^P)" + +msgid " Path pattern completion (^N^P)" +msgstr " Довршавање шаблона путање (^N^P)" + +msgid " Definition completion (^D^N^P)" +msgstr " Довршавање дефиниције (^D^N^P)" + +msgid " Dictionary completion (^K^N^P)" +msgstr " Довршавање речника (^K^N^P)" + +msgid " Thesaurus completion (^T^N^P)" +msgstr " Довршавање речника Ñинонима (^T^N^P)" + +msgid " Command-line completion (^V^N^P)" +msgstr " Довршавање командне линије (^V^N^P)" + +msgid " User defined completion (^U^N^P)" +msgstr " КориÑнички дефиниÑано довршавање (^U^N^P)" + +msgid " Omni completion (^O^N^P)" +msgstr " Omni довршавање (^O^N^P)" + +msgid " Spelling suggestion (s^N^P)" +msgstr " ПравопиÑни предлог (s^N^P)" + +msgid " Keyword Local completion (^N^P)" +msgstr " Довршавање локалне кључне речи (^N^P)" + +msgid "Hit end of paragraph" +msgstr "ДоÑтигнут крај паÑуÑа" + +msgid "E839: Completion function changed window" +msgstr "E839: Функција довршавања је променила прозор" + +msgid "E840: Completion function deleted text" +msgstr "E840: Функција довршавања је обриÑала текÑÑ‚" + +msgid "'dictionary' option is empty" +msgstr "Опција 'dictionary' је празна" + +msgid "'thesaurus' option is empty" +msgstr "Опција 'thesaurus' је празна" + +#, c-format +msgid "Scanning dictionary %s" +msgstr "Скенирање речника: %s" + +msgid " (insert) Scroll (^E/^Y)" +msgstr " (уметање) Скроловање (^E/^Y)" + +msgid " (replace) Scroll (^E/^Y)" +msgstr " (замена) Скроловање (^E/^Y)" + +#, c-format +msgid "Scanning: %s" +msgstr "Скенирање: %s" + +msgid "Scanning tags." +msgstr "Скенирање ознака." + +msgid "match in file" +msgstr "подударање у датотеци" + +msgid " Adding" +msgstr " Додавање" + +msgid "-- Searching..." +msgstr "-- Претрага..." + +msgid "Back at original" +msgstr "Ðазад на оригинал" + +msgid "Word from other line" +msgstr "Реч из друге линије" + +msgid "The only match" +msgstr "Једино подударање" + +#, c-format +msgid "match %d of %d" +msgstr "подударање %d од %d" + +#, c-format +msgid "match %d" +msgstr "подударање %d" + +msgid "E18: Unexpected characters in :let" +msgstr "E18: Ðеочекивани карактери у :let" + +#, c-format +msgid "E121: Undefined variable: %s" +msgstr "E121: ÐедефиниÑана променљива: %s" + +msgid "E111: Missing ']'" +msgstr "E111: ÐедоÑтаје ']'" + +msgid "E719: Cannot use [:] with a Dictionary" +msgstr "E719: Ðе може да Ñе кориÑти [:] Ñа Речником" + +#, c-format +msgid "E734: Wrong variable type for %s=" +msgstr "E734: Погрешан тип променљиве за %s=" + +#, c-format +msgid "E461: Illegal variable name: %s" +msgstr "E461: Ðедозвољено име променљиве: %s" + +msgid "E806: using Float as a String" +msgstr "E806: коришћење Float као String" + +msgid "E687: Less targets than List items" +msgstr "E687: Мање одредишта него Ñтавки ЛиÑте" + +msgid "E688: More targets than List items" +msgstr "E688: Више одредишта него Ñтавки ЛиÑте" + +msgid "Double ; in list of variables" +msgstr "Дупле ; у лиÑти променљивих" + +#, c-format +msgid "E738: Can't list variables for %s" +msgstr "E738: Ðе може да Ñе прикаже лиÑта променљивих за %s" + +msgid "E689: Can only index a List or Dictionary" +msgstr "E689: Само ЛиÑта или Речник могу да Ñе индекÑирају" + +msgid "E708: [:] must come last" +msgstr "E708: [:] мора да буде поÑледња" + +msgid "E709: [:] requires a List value" +msgstr "E709: [:] захтева вредноÑÑ‚ типа List" + +msgid "E710: List value has more items than target" +msgstr "E710: ВредноÑÑ‚ типа List има више Ñтавки него одредиште" + +msgid "E711: List value has not enough items" +msgstr "E711: ВредноÑÑ‚ типа List нема довољно Ñтавки" + +msgid "E690: Missing \"in\" after :for" +msgstr "E690: ÐедоÑтаје \"in\" након :for" + +#, c-format +msgid "E108: No such variable: \"%s\"" +msgstr "E108: Ðе поÑтоји таква променљива: \"%s\"" + +#, c-format +msgid "E940: Cannot lock or unlock variable %s" +msgstr "E940: Ðе може да Ñе откључа или закључа променљива %s" + +msgid "E743: variable nested too deep for (un)lock" +msgstr "E743: променљива је угњеждена Ñувише дубоко да би Ñе за(от)кључала" + +msgid "E109: Missing ':' after '?'" +msgstr "E109: ÐедоÑтаје ':' након '?'" + +msgid "E691: Can only compare List with List" +msgstr "E691: List може да Ñе пореди Ñамо Ñа List" + +msgid "E692: Invalid operation for List" +msgstr "E692: ÐеиÑправна операција за List" + +msgid "E735: Can only compare Dictionary with Dictionary" +msgstr "E735: Dictionary може да Ñе пореди Ñамо Ñа Dictionary" + +msgid "E736: Invalid operation for Dictionary" +msgstr "E736: ÐеиÑправна операција за Dictionary" + +msgid "E694: Invalid operation for Funcrefs" +msgstr "E694: ÐеиÑправна операција за Funcrefs" + +msgid "E804: Cannot use '%' with Float" +msgstr "E804: '%' не може да Ñе кориÑти Ñа Float" + +msgid "E110: Missing ')'" +msgstr "E110: ÐедоÑтаје ')'" + +msgid "E695: Cannot index a Funcref" +msgstr "E695: Funcref не може да Ñе индекÑира" + +msgid "E909: Cannot index a special variable" +msgstr "E909: Специјална променљива не може да Ñе индекÑира" + +#, c-format +msgid "E112: Option name missing: %s" +msgstr "E112: ÐедоÑтаје име опције: %s" + +#, c-format +msgid "E113: Unknown option: %s" +msgstr "E113: Ðепозната опција: %s" + +#, c-format +msgid "E114: Missing quote: %s" +msgstr "E114: ÐедоÑтаје наводник: %s" + +#, c-format +msgid "E115: Missing quote: %s" +msgstr "E115: ÐедоÑтаје наводник: %s" + +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "Ðема довољно меморије за поÑтављање референци, прекинуто је Ñкупљање отпада" + +msgid "E724: variable nested too deep for displaying" +msgstr "E724: променљива је угњеждена предубоко да би Ñе приказала" + +msgid "E805: Using a Float as a Number" +msgstr "E805: КориÑти Ñе Float као Number" + +msgid "E703: Using a Funcref as a Number" +msgstr "E703: КориÑти Ñе Funcref као Number" + +msgid "E745: Using a List as a Number" +msgstr "E745: КориÑти Ñе List као Number" + +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: КориÑти Ñе Dictionary као Number" + +msgid "E910: Using a Job as a Number" +msgstr "E910: КориÑти Ñе Job као Number" + +msgid "E913: Using a Channel as a Number" +msgstr "E913: КориÑти Ñе Channel као Number" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: КориÑти Ñе Funcref као Float" + +msgid "E892: Using a String as a Float" +msgstr "E892: КориÑти Ñе String као Float" + +msgid "E893: Using a List as a Float" +msgstr "E893: КориÑти Ñе List као Float" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: КориÑти Ñе Dictionary као Float" + +msgid "E907: Using a special value as a Float" +msgstr "E907: КориÑти Ñе Ñпецијална вредноÑÑ‚ као Float" + +msgid "E911: Using a Job as a Float" +msgstr "E911: КориÑти Ñе Job као Float" + +msgid "E914: Using a Channel as a Float" +msgstr "E914: КориÑти Ñе Channel као Float" + +msgid "E729: using Funcref as a String" +msgstr "E729: кориÑти Ñе Funcref као String" + +msgid "E730: using List as a String" +msgstr "E730: кориÑти Ñе List као String" + +msgid "E731: using Dictionary as a String" +msgstr "E731: кориÑти Ñе Dictionary као String" + +msgid "E908: using an invalid value as a String" +msgstr "E908: кориÑти Ñе недозвољена вредноÑÑ‚ као String" + +#, c-format +msgid "E795: Cannot delete variable %s" +msgstr "E795: Променљива %s не може да Ñе обрише" + +#, c-format +msgid "E704: Funcref variable name must start with a capital: %s" +msgstr "E704: Име Funcref мора да почне великим Ñловом: %s" + +#, c-format +msgid "E705: Variable name conflicts with existing function: %s" +msgstr "E705: Име променљиве је у конфликту Ñа поÑтојећом функцијом: %s" + +#, c-format +msgid "E741: Value is locked: %s" +msgstr "E741: ВредноÑÑ‚ је закључана: %s" + +msgid "Unknown" +msgstr "Ðепознато" + +#, c-format +msgid "E742: Cannot change value of %s" +msgstr "E742: ВредноÑÑ‚ %s не може да Ñе промени" + +msgid "E698: variable nested too deep for making a copy" +msgstr "E698: променљива је предубоко угњеждена да би Ñе направила копија" + +msgid "" +"\n" +"# global variables:\n" +msgstr "" +"\n" +"# глобалне променљиве:\n" + +msgid "" +"\n" +"\tLast set from " +msgstr "" +"\n" +"\tПоÑледњи Ñет од " + +msgid "map() argument" +msgstr "map() аргумент" + +msgid "filter() argument" +msgstr "filter() аргумент" + +#, c-format +msgid "E686: Argument of %s must be a List" +msgstr "E686: Ðргумент за %s мора бити List" + +msgid "E928: String required" +msgstr "E928: Захтева Ñе String" + +msgid "E808: Number or Float required" +msgstr "E808: Захтева Ñе Number или Float" + +msgid "add() argument" +msgstr "add() аргумент" + +msgid "E785: complete() can only be used in Insert mode" +msgstr "E785: complete() може да Ñе кориÑти Ñамо у режиму Уметање" + +msgid "&Ok" +msgstr "&Ок" + +#, c-format +msgid "E700: Unknown function: %s" +msgstr "E700: Ðепозната функција: %s" + +msgid "E922: expected a dict" +msgstr "E922: очекивао Ñе dict" + +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: Други аргумент function() мора бити list или dict" + +msgid "" +"&OK\n" +"&Cancel" +msgstr "" +"&OK\n" +"О&ткажи" + +msgid "called inputrestore() more often than inputsave()" +msgstr "inputrestore() је позвана више пута него inputsave()" + +msgid "insert() argument" +msgstr "insert() аргумент" + +msgid "E786: Range not allowed" +msgstr "E786: ОпÑег није дозвољен" + +msgid "E916: not a valid job" +msgstr "E916: није валидан job" + +msgid "E701: Invalid type for len()" +msgstr "E701: ÐеиÑправан тип за len()" + +#, c-format +msgid "E798: ID is reserved for \":match\": %ld" +msgstr "E798: ИД је резервиÑан за \":match\": %ld" + +msgid "E726: Stride is zero" +msgstr "E726: Корак је нула" + +msgid "E727: Start past end" +msgstr "E727: Почетак иза краја" + +msgid "" +msgstr "<празно>" + +msgid "E240: No connection to the X server" +msgstr "E240: Ðема везе Ñа X Ñервером" + +#, c-format +msgid "E241: Unable to send to %s" +msgstr "E241: Слање ка %s није могуће" + +msgid "E277: Unable to read a server reply" +msgstr "E277: Ðе може да Ñе прочита одговор Ñервера" + +msgid "E941: already started a server" +msgstr "E941: Ñервер је већ покренут" + +msgid "E942: +clientserver feature not available" +msgstr "E942: МогућноÑÑ‚ +clientserver није доÑтупна" + +msgid "remove() argument" +msgstr "remove() аргумент" + +msgid "E655: Too many symbolic links (cycle?)" +msgstr "E655: Превише Ñимболичких веза (циклуÑ?)" + +msgid "reverse() argument" +msgstr "reverse() аргумент" + +msgid "E258: Unable to send to client" +msgstr "E258: Слање ка клијенту није могуће" + +#, c-format +msgid "E927: Invalid action: '%s'" +msgstr "E927: ÐеиÑправна акција: '%s'" + +msgid "sort() argument" +msgstr "sort() аргумент" + +msgid "uniq() argument" +msgstr "uniq() аргумент" + +msgid "E702: Sort compare function failed" +msgstr "E702: Sort функција поређења није уÑпела" + +msgid "E882: Uniq compare function failed" +msgstr "E882: Uniq функција поређења није уÑпела" + +msgid "(Invalid)" +msgstr "(ÐеиÑправно)" + +#, c-format +msgid "E935: invalid submatch number: %d" +msgstr "E935: неиÑправан број подпоклапања: %d" + +msgid "E677: Error writing temp file" +msgstr "E677: Грешка при упиÑу temp датотеке" + +msgid "E921: Invalid callback argument" +msgstr "E921: ÐеиÑправан callback аргумент" + +#, c-format +msgid "<%s>%s%s %d, Hex %02x, Octal %03o" +msgstr "<%s>%s%s %d, Ð¥ÐµÐºÑ %02x, Октално %03o" + +#, c-format +msgid "> %d, Hex %04x, Octal %o" +msgstr "> %d, Ð¥ÐµÐºÑ %04x, Октално %o" + +#, c-format +msgid "> %d, Hex %08x, Octal %o" +msgstr "> %d, Ð¥ÐµÐºÑ %08x, Октално %o" + +msgid "E134: Move lines into themselves" +msgstr "E134: Премештање линија у Ñаме Ñебе" + +msgid "1 line moved" +msgstr "1 линија премештена" + +#, c-format +msgid "%ld lines moved" +msgstr "%ld линија премештено" + +#, c-format +msgid "%ld lines filtered" +msgstr "%ld линија филтрирано" + +msgid "E135: *Filter* Autocommands must not change current buffer" +msgstr "E135: *Филтер* Ðутокоманде не Ñмеју да мењају текући бафер" + +msgid "[No write since last change]\n" +msgstr "[Ðема упиÑа од поÑледње промене]\n" + +#, c-format +msgid "%sviminfo: %s in line: " +msgstr "%sviminfo: %s у линији: " + +msgid "E136: viminfo: Too many errors, skipping rest of file" +msgstr "E136: viminfo: Превише грешака, оÑтатак датотеке Ñе преÑкаче" + +#, c-format +msgid "Reading viminfo file \"%s\"%s%s%s" +msgstr "Читање viminfo датотеке \"%s\"%s%s%s" + +msgid " info" +msgstr " инфо" + +msgid " marks" +msgstr " маркера" + +msgid " oldfiles" +msgstr " Ñтарихдатотека" + +msgid " FAILED" +msgstr " ÐЕУСПЕЛО" + +#, c-format +msgid "E137: Viminfo file is not writable: %s" +msgstr "E137: Viminfo датотека није упиÑива: %s" + +#, c-format +msgid "E929: Too many viminfo temp files, like %s!" +msgstr "E929: Превише viminfo temp датотека, као %s!" + +#, c-format +msgid "E138: Can't write viminfo file %s!" +msgstr "E138: Viminfo датотека %s не може да Ñе упише!" + +#, c-format +msgid "Writing viminfo file \"%s\"" +msgstr "УпиÑивање viminfo датотеке \"%s\"" + +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Viminfo датотека не може да Ñе преименује у %s!" + +#, c-format +msgid "# This viminfo file was generated by Vim %s.\n" +msgstr "# Ову viminfo датотеку је генериÑао Vim %s.\n" + +msgid "" +"# You may edit it if you're careful!\n" +"\n" +msgstr "" +"# Можете да је уређујете ако Ñте опрезни!\n" +"\n" + +msgid "# Value of 'encoding' when this file was written\n" +msgstr "# ВредноÑÑ‚ опције 'encoding' када је ова датотека напиÑана\n" + +msgid "Illegal starting char" +msgstr "ÐеиÑправан почетни карактер" + +msgid "" +"\n" +"# Bar lines, copied verbatim:\n" +msgstr "" +"\n" +"# Преградне линије, копиране доÑловно:\n" + +msgid "Save As" +msgstr "Сачувај као" + +msgid "Write partial file?" +msgstr "Да упишем парцијалну датотеку?" + +msgid "E140: Use ! to write partial buffer" +msgstr "E140: КориÑтите ! да биÑте упиÑали парцијални бафер" + +#, c-format +msgid "Overwrite existing file \"%s\"?" +msgstr "Да препишем поÑтојећи датотеку \"%s\"?" + +#, c-format +msgid "Swap file \"%s\" exists, overwrite anyway?" +msgstr "Swap датотека \"%s\" поÑтоји, да је препишем у Ñваком Ñлучају?" + +#, c-format +msgid "E768: Swap file exists: %s (:silent! overrides)" +msgstr "E768: Swap датотека поÑтоји: %s (:silent! премошћава)" + +#, c-format +msgid "E141: No file name for buffer %ld" +msgstr "E141: Ðема имена датотеке за бафер %ld" + +msgid "E142: File not written: Writing is disabled by 'write' option" +msgstr "E142: Датотека није упиÑана: УпиÑивање је онемогућено опцијом 'write'" + +#, c-format +msgid "" +"'readonly' option is set for \"%s\".\n" +"Do you wish to write anyway?" +msgstr "" +"'readonly' опција је поÑтављена за \"%s\".\n" +"Да ли ипак желите да упишете?" + +#, c-format +msgid "" +"File permissions of \"%s\" are read-only.\n" +"It may still be possible to write it.\n" +"Do you wish to try?" +msgstr "" +"Дозволе датотеке \"%s\" омогућавају Ñамо читање.\n" +"Можда је ипак могуће да Ñе упише.\n" +"Да ли желите да покушате?" + +#, c-format +msgid "E505: \"%s\" is read-only (add ! to override)" +msgstr "E505: \"%s\" је Ñамо за читање (додајте ! за премошћавање)" + +msgid "Edit File" +msgstr "Уреди датотеку" + +#, c-format +msgid "E143: Autocommands unexpectedly deleted new buffer %s" +msgstr "E143: Ðутокоманде Ñу неочекивано обриÑале нов бафер %s" + +msgid "E144: non-numeric argument to :z" +msgstr "E144: ненумерички аргумент за :z" + +msgid "E145: Shell commands not allowed in rvim" +msgstr "E145: Shell команде ниÑу дозвољене у rvim" + +msgid "E146: Regular expressions can't be delimited by letters" +msgstr "E146: Регуларни изрази не могу да Ñе раздвајају Ñловима" + +#, c-format +msgid "replace with %s (y/n/a/q/l/^E/^Y)?" +msgstr "заменити Ñа %s (y/n/a/q/l/^E/^Y)?" + +msgid "(Interrupted) " +msgstr "(Прекинуто)" + +msgid "1 match" +msgstr "1 подударање" + +msgid "1 substitution" +msgstr "1 замена" + +#, c-format +msgid "%ld matches" +msgstr "%ld подударања" + +#, c-format +msgid "%ld substitutions" +msgstr "%ld замена" + +msgid " on 1 line" +msgstr " у 1 линији" + +#, c-format +msgid " on %ld lines" +msgstr " у %ld линија" + +msgid "E147: Cannot do :global recursive with a range" +msgstr "E147: :global не може да Ñе изврши рекурзивно Ñа опÑегом" + +msgid "E148: Regular expression missing from global" +msgstr "E148: У global недоÑтаје регуларни израз" + +#, c-format +msgid "Pattern found in every line: %s" +msgstr "Шаблон је пронаћен у Ñвакој линији: %s" + +#, c-format +msgid "Pattern not found: %s" +msgstr "Шаблон није пронађен: %s" + +msgid "" +"\n" +"# Last Substitute String:\n" +"$" +msgstr "" +"\n" +"# ПоÑледњи Стринг за замену:\n" +"$" + +msgid "E478: Don't panic!" +msgstr "E478: Ðе паничите!" + +#, c-format +msgid "E661: Sorry, no '%s' help for %s" +msgstr "E661: Жао нам је, нема '%s' помоћи за %s" + +#, c-format +msgid "E149: Sorry, no help for %s" +msgstr "E149: Жао нам је, нема помоћи за %s" + +#, c-format +msgid "Sorry, help file \"%s\" not found" +msgstr "Жао нам је, датотека помоћи \"%s\" није пронађена" + +#, c-format +msgid "E151: No match: %s" +msgstr "E151: Ðема подударања: %s" + +#, c-format +msgid "E152: Cannot open %s for writing" +msgstr "E152: %s не може да Ñе отвори за упиÑ" + +#, c-format +msgid "E153: Unable to open %s for reading" +msgstr "E153: %s не може да Ñе отвори за читање" + +#, c-format +msgid "E670: Mix of help file encodings within a language: %s" +msgstr "E670: Помешано је више кодирања фајлова помоћи за језик: %s" + +#, c-format +msgid "E154: Duplicate tag \"%s\" in file %s/%s" +msgstr "E154: Дуплирана ознака \"%s\" у датотеци %s/%s" + +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: Ðије директоријум: %s" + +#, c-format +msgid "E160: Unknown sign command: %s" +msgstr "E160: Ðепозната знак команда: %s" + +msgid "E156: Missing sign name" +msgstr "E156: ÐедоÑтаје име знака" + +msgid "E612: Too many signs defined" +msgstr "E612: ДефиниÑано је превише знакова" + +#, c-format +msgid "E239: Invalid sign text: %s" +msgstr "E239: ÐеиÑправан текÑÑ‚ знака: %s" + +#, c-format +msgid "E155: Unknown sign: %s" +msgstr "E155: Ðепознат знак: %s" + +msgid "E159: Missing sign number" +msgstr "E159: ÐедоÑтаје број знака" + +#, c-format +msgid "E158: Invalid buffer name: %s" +msgstr "E158: ÐеиÑправно име бафера: %s" + +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: Ðе може да Ñе Ñкочи на бафер који нема име`" + +#, c-format +msgid "E157: Invalid sign ID: %ld" +msgstr "E157: ÐеиÑправан ИД знака: %ld" + +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Знак %s не може да Ñе промени" + +msgid " (NOT FOUND)" +msgstr " (ÐИЈЕ ПРОÐÐЂЕÐО)" + +msgid " (not supported)" +msgstr " (није подржано)" + +msgid "[Deleted]" +msgstr "[ОбриÑано]" + +msgid "No old files" +msgstr "Ðема Ñтарих датотека" + +msgid "Entering Debug mode. Type \"cont\" to continue." +msgstr "Улазак у Debug режим. Откуцајте \"cont\" за наÑтавак." + +#, c-format +msgid "line %ld: %s" +msgstr "линија %ld: %s" + +#, c-format +msgid "cmd: %s" +msgstr "ком: %s" + +msgid "frame is zero" +msgstr "оквир је нула" + +#, c-format +msgid "frame at highest level: %d" +msgstr "оквир је на највишем нивоу: %d" + +#, c-format +msgid "Breakpoint in \"%s%s\" line %ld" +msgstr "Прекидна тачка у \"%s%s\" линија %ld" + +#, c-format +msgid "E161: Breakpoint not found: %s" +msgstr "E161: Прекидна тачка није пронађена: %s" + +msgid "No breakpoints defined" +msgstr "Ðије дефиниÑана ниједна прекидна тачка" + +#, c-format +msgid "%3d %s %s line %ld" +msgstr "%3d %s %s линија %ld" + +msgid "E750: First use \":profile start {fname}\"" +msgstr "E750: Ðајпре кориÑтите \":profile start {fname}\"" + +#, c-format +msgid "Save changes to \"%s\"?" +msgstr "Да Ñачувам промене у \"%s\"?" + +#, c-format +msgid "E947: Job still running in buffer \"%s\"" +msgstr "E947: Задатак Ñе и даље извршава у баферу \"%s\"" + +#, c-format +msgid "E162: No write since last change for buffer \"%s\"" +msgstr "E162: Ðије било упиÑа од поÑледње промене за бафер \"%s\"" + +msgid "Warning: Entered other buffer unexpectedly (check autocommands)" +msgstr "Упозорење: Ðеочекивано Ñе прешло у други бафер (проверите аутокоманде)" + +msgid "E163: There is only one file to edit" +msgstr "E163: ПоÑтоји Ñамо једна датотека за уређивање" + +msgid "E164: Cannot go before first file" +msgstr "E164: Ðе може да Ñе иде иÑпред прве датотеке" + +msgid "E165: Cannot go beyond last file" +msgstr "E165: Ðе може да Ñе иде иÑпред прве датотеке" + +#, c-format +msgid "E666: compiler not supported: %s" +msgstr "E666: компајлер није подржан: %s" + +#, c-format +msgid "Searching for \"%s\" in \"%s\"" +msgstr "Тражи Ñе \"%s\" у \"%s\"" + +#, c-format +msgid "Searching for \"%s\"" +msgstr "Тражи Ñе\"%s\"" + +#, c-format +msgid "not found in '%s': \"%s\"" +msgstr "није пронађено у '%s': \"%s\"" + +#, c-format +msgid "W20: Required python version 2.x not supported, ignoring file: %s" +msgstr "W20: Захтевани python version 2.x није подржан, датотека: %s Ñе игнорише" + +#, c-format +msgid "W21: Required python version 3.x not supported, ignoring file: %s" +msgstr "W21: Захтевани python version 3.x није подржан, датотека: %s Ñе игнорише" + +msgid "Source Vim script" +msgstr "Изворна Vim Ñкрипта" + +#, c-format +msgid "Cannot source a directory: \"%s\"" +msgstr "Директоријум не може да буде извор: \"%s\"" + +#, c-format +msgid "could not source \"%s\"" +msgstr "не може бити извор \"%s\"" + +#, c-format +msgid "line %ld: could not source \"%s\"" +msgstr "линија %ld: не може бити извор \"%s\"" + +#, c-format +msgid "sourcing \"%s\"" +msgstr "прибављање \"%s\"" + +#, c-format +msgid "line %ld: sourcing \"%s\"" +msgstr "линија %ld: прибављање \"%s\"" + +#, c-format +msgid "finished sourcing %s" +msgstr "завршено прибављање %s" + +#, c-format +msgid "continuing in %s" +msgstr "наÑтавља Ñе у %s" + +msgid "modeline" +msgstr "режимÑка линија (modeline)" + +msgid "--cmd argument" +msgstr "--cmd аргумент" + +msgid "-c argument" +msgstr "-c аргумент" + +msgid "environment variable" +msgstr "променљива окружења" + +msgid "error handler" +msgstr "процедура за обраду грешке" + +msgid "W15: Warning: Wrong line separator, ^M may be missing" +msgstr "W15: Упозорење: Погрешан Ñепаратор линије, можда недоÑтаје ^M" + +msgid "E167: :scriptencoding used outside of a sourced file" +msgstr "E167: :scriptencoding Ñе кориÑти ван изворишне датотеке" + +msgid "E168: :finish used outside of a sourced file" +msgstr "E168: :finish Ñе кориÑти ван изворишне датотеке" + +#, c-format +msgid "Current %slanguage: \"%s\"" +msgstr "Текући %sјезик: \"%s\"" + +#, c-format +msgid "E197: Cannot set language to \"%s\"" +msgstr "E197: Језик не може да Ñе поÑтави на \"%s\"" + +msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." +msgstr "Улазак у Ex режим. Откуцајте \"visual\" да биÑте прешли у Ðормални режим." + +msgid "E501: At end-of-file" +msgstr "E501: Ðа крају-датотеке" + +msgid "E169: Command too recursive" +msgstr "E169: Команда је Ñувише рекурзивна" + +#, c-format +msgid "E605: Exception not caught: %s" +msgstr "E605: Изузетак није ухваћен: %s" + +msgid "End of sourced file" +msgstr "Крај изворишне датотеке" + +msgid "End of function" +msgstr "Крај функције" + +msgid "E464: Ambiguous use of user-defined command" +msgstr "E464: ДвоÑмиÑлена употреба кориÑнички дефиниÑане команде" + +msgid "E492: Not an editor command" +msgstr "E492: Ðије команда едитора" + +msgid "E493: Backwards range given" +msgstr "E493: Задат је опÑег уназад" + +msgid "Backwards range given, OK to swap" +msgstr "Задат је опÑег уназад, ОК да Ñе замени" + +msgid "E494: Use w or w>>" +msgstr "E494: КориÑтите w или w>>" + +msgid "E943: Command table needs to be updated, run 'make cmdidxs'" +msgstr "E943: Табела команди мора да Ñе оÑвежи, покрените 'make cmdidxs'" + +msgid "E319: Sorry, the command is not available in this version" +msgstr "E319: Жао нам је, та команда није доÑтупна у овој верзији" + +msgid "1 more file to edit. Quit anyway?" +msgstr "Још 1 датотека за уређивање. Ипак желите да напуÑтите програм?" + +#, c-format +msgid "%d more files to edit. Quit anyway?" +msgstr "Још %d датотека за уређивање. Ипак желите да напуÑтите програм?" + +msgid "E173: 1 more file to edit" +msgstr "E173: Још 1 датотека за уређивање" + +#, c-format +msgid "E173: %ld more files to edit" +msgstr "E173: Још %ld датотека за уређивање" + +msgid "E174: Command already exists: add ! to replace it" +msgstr "E174: Команда већ поÑтоји: додајте ! да је замените" + +msgid "" +"\n" +" Name Args Address Complete Definition" +msgstr "" +"\n" +" Име Ðргум ÐдреÑа Довршење Дефиниција" + +msgid "No user-defined commands found" +msgstr "ÐиÑу пронађене кориÑнички дефиниÑане команде" + +msgid "E175: No attribute specified" +msgstr "E175: Ðије наведен ни један атрибут" + +msgid "E176: Invalid number of arguments" +msgstr "E176: ÐеиÑправан број аргумената" + +msgid "E177: Count cannot be specified twice" +msgstr "E177: Бројач не може да Ñе наведе два пута" + +msgid "E178: Invalid default value for count" +msgstr "E178: ÐеÑправна подразумевана вредноÑÑ‚ за бројач" + +msgid "E179: argument required for -complete" +msgstr "E179: потребан је аргумент за -complete" + +msgid "E179: argument required for -addr" +msgstr "E179: потребан је аргумент за -addr" + +#, c-format +msgid "E181: Invalid attribute: %s" +msgstr "E181: ÐеиÑправан атрибут: %s" + +msgid "E182: Invalid command name" +msgstr "E182: ÐеиÑправно име команде" + +msgid "E183: User defined commands must start with an uppercase letter" +msgstr "E183: КориÑнички дефиниÑане команде морају да почну великим Ñловом" + +msgid "E841: Reserved name, cannot be used for user defined command" +msgstr "E841: РезервиÑано име, не може да Ñе кориÑти за кориÑнички дефиниÑану команду" + +#, c-format +msgid "E184: No such user-defined command: %s" +msgstr "E184: Ðе поÑтоји таква кориÑнички дефиниÑана команда: %s" + +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: ÐеиÑправна вредноÑÑ‚ адреÑног типа: %s" + +#, c-format +msgid "E180: Invalid complete value: %s" +msgstr "E180: ÐеиÑправна вредноÑÑ‚ довршавања: %s" + +msgid "E468: Completion argument only allowed for custom completion" +msgstr "E468: Ðргумент довршавања је дозвољен Ñамо за прилагођена довршавања" + +msgid "E467: Custom completion requires a function argument" +msgstr "E467: Прилагођено довршавање захтева аргумент функције" + +msgid "unknown" +msgstr "непознато" + +#, c-format +msgid "E185: Cannot find color scheme '%s'" +msgstr "E185: Шема боја '%s' не може да Ñе пронађе" + +msgid "Greetings, Vim user!" +msgstr "Поздрав, кориÑниче Vim-a" + +msgid "E784: Cannot close last tab page" +msgstr "E784: ПоÑледња картица не може да Ñе затвори" + +msgid "Already only one tab page" +msgstr "Већ Ñте на Ñамо једној картици" + +msgid "Edit File in new window" +msgstr "Уређивање Датотеке у новом прозору" + +#, c-format +msgid "Tab page %d" +msgstr "Картица %d" + +msgid "No swap file" +msgstr "Ðема swap датотеке" + +msgid "Append File" +msgstr "Додавање на крај Датотеке" + +msgid "E747: Cannot change directory, buffer is modified (add ! to override)" +msgstr "E747: Директоријум не може да Ñе промени, бафер је измењен (додајте ! за премошћавање)" + +msgid "E186: No previous directory" +msgstr "E186: Ðема претгодног директоријума" + +msgid "E187: Unknown" +msgstr "E187: Ðепознато" + +msgid "E465: :winsize requires two number arguments" +msgstr "E465: :winsize захтева два бројчана аргумента" + +#, c-format +msgid "Window position: X %d, Y %d" +msgstr "Позиција прозора: X %d, Y %d" + +msgid "E188: Obtaining window position not implemented for this platform" +msgstr "E188: Добављање позиције прозора није имплементирано за ову платформу" + +msgid "E466: :winpos requires two number arguments" +msgstr "E466: :winpos захтева два бројчана аргумента" + +msgid "E930: Cannot use :redir inside execute()" +msgstr "E930: :redir не може да Ñе кориÑти унутар execute()" + +msgid "Save Redirection" +msgstr "Сачувај Редирекцију" + +msgid "Save View" +msgstr "Сачувај Поглед" + +msgid "Save Session" +msgstr "Сачувај СеÑију" + +msgid "Save Setup" +msgstr "Сачувај Подешавање" + +#, c-format +msgid "E739: Cannot create directory: %s" +msgstr "E739: Директоријум не може да Ñе креира: %s" + +#, c-format +msgid "E189: \"%s\" exists (add ! to override)" +msgstr "E189: \"%s\" поÑтоји (додајте ! за премошћавање)" + +#, c-format +msgid "E190: Cannot open \"%s\" for writing" +msgstr "E190: \"%s\" не може да Ñе отвори за упиÑ" + +msgid "E191: Argument must be a letter or forward/backward quote" +msgstr "E191: Ðргумент мора бити Ñлово или апоÑтроф/обрнути апоÑтроф" + +msgid "E192: Recursive use of :normal too deep" +msgstr "E192: Рекурзивно коришћење :normal је Ñувише дубоко" + +msgid "E809: #< is not available without the +eval feature" +msgstr "E809: #< није доÑтупно без +eval могућноÑти" + +msgid "E194: No alternate file name to substitute for '#'" +msgstr "E194: Ðема алтернативног имена које би заменило '#'" + +msgid "E495: no autocommand file name to substitute for \"\"" +msgstr "E495: нема имена датотеке за аутокоманде које би заменило \"\"" + +msgid "E496: no autocommand buffer number to substitute for \"\"" +msgstr "E496: нема броја бафера за аутокоманду који би заменио \"\"" + +msgid "E497: no autocommand match name to substitute for \"\"" +msgstr "E497: нема имена подударања аутокоманде које би заменило \"\"" + +msgid "E498: no :source file name to substitute for \"\"" +msgstr "E498: нема имена :source датотеке које би заменило \"\"" + +msgid "E842: no line number to use for \"\"" +msgstr "E842: нема броја линије који би Ñе кориÑтио за \"\"" + +#, no-c-format +msgid "E499: Empty file name for '%' or '#', only works with \":p:h\"" +msgstr "E499: Празно име датотеке за'%' or '#', функционише Ñамо Ñа \":p:h\"" + +msgid "E500: Evaluates to an empty string" +msgstr "E500: Резултат израчунавања је празан Ñтринг" + +msgid "E195: Cannot open viminfo file for reading" +msgstr "E195: viminfo датотека не може да Ñе отвори за читање" + +msgid "Untitled" +msgstr "Без наÑлова" + +msgid "E196: No digraphs in this version" +msgstr "E196: У овој верзији нема диграфа" + +msgid "E608: Cannot :throw exceptions with 'Vim' prefix" +msgstr "E608: :throw изузетка Ñа 'Vim' префикÑом није дозвољен" + +#, c-format +msgid "Exception thrown: %s" +msgstr "Бачен је изузетак: %s" + +#, c-format +msgid "Exception finished: %s" +msgstr "Изузетак је завршен: %s" + +#, c-format +msgid "Exception discarded: %s" +msgstr "Изузетак је одбачен: %s" + +#, c-format +msgid "%s, line %ld" +msgstr "%s, линија %ld" + +#, c-format +msgid "Exception caught: %s" +msgstr "Изузетак је ухваћен: %s" + +#, c-format +msgid "%s made pending" +msgstr "%s је Ñтављен на чекање" + +#, c-format +msgid "%s resumed" +msgstr "%s је поново активан" + +#, c-format +msgid "%s discarded" +msgstr "%s је одбачен" + +msgid "Exception" +msgstr "Изузетак" + +msgid "Error and interrupt" +msgstr "Грешка и прекид" + +msgid "Error" +msgstr "Грешка" + +msgid "Interrupt" +msgstr "Прекид" + +msgid "E579: :if nesting too deep" +msgstr "E579: :if угњеждавање је Ñувише дубоко" + +msgid "E580: :endif without :if" +msgstr "E580: :endif без :if" + +msgid "E581: :else without :if" +msgstr "E581: :else без :if" + +msgid "E582: :elseif without :if" +msgstr "E582: :elseif без :if" + +msgid "E583: multiple :else" +msgstr "E583: вишеÑтруко :else" + +msgid "E584: :elseif after :else" +msgstr "E584: :elseif након :else" + +msgid "E585: :while/:for nesting too deep" +msgstr "E585: :while/:for угњеждавање је Ñувише дубоко" + +msgid "E586: :continue without :while or :for" +msgstr "E586: :continue без :while или :for" + +msgid "E587: :break without :while or :for" +msgstr "E587: :break без :while или :for" + +msgid "E732: Using :endfor with :while" +msgstr "E732: Коришћење :endfor Ñа :while" + +msgid "E733: Using :endwhile with :for" +msgstr "E733: Коришћење :endwhile Ñа :for" + +msgid "E601: :try nesting too deep" +msgstr "E601: :try угњеждавање је Ñувише дубоко" + +msgid "E603: :catch without :try" +msgstr "E603: :catch без :try" + +msgid "E604: :catch after :finally" +msgstr "E604: :catch након :finally" + +msgid "E606: :finally without :try" +msgstr "E606: :finally без :try" + +msgid "E607: multiple :finally" +msgstr "E607: вишеÑтруко :finally" + +msgid "E602: :endtry without :try" +msgstr "E602: :endtry без :try" + +msgid "E193: :endfunction not inside a function" +msgstr "E193: :endfunction није унутар функције" + +msgid "E788: Not allowed to edit another buffer now" +msgstr "E788: Уређивање другог бафера тренутно није дозвољено" + +msgid "E811: Not allowed to change buffer information now" +msgstr "E811: Мењање информација о баферу тренутно није дозвољено" + +msgid "tagname" +msgstr "ознака" + +msgid " kind file\n" +msgstr " врÑта датотеке\n" + +msgid "'history' option is zero" +msgstr "опција 'history' је нула" + +#, c-format +msgid "" +"\n" +"# %s History (newest to oldest):\n" +msgstr "" +"\n" +"# %s ИÑторија (од најновијег ка најÑтаријем):\n" + +msgid "Command Line" +msgstr "Командна линија" + +msgid "Search String" +msgstr "Стринг за претрагу" + +msgid "Expression" +msgstr "Израз" + +msgid "Input Line" +msgstr "Линија за уноÑ" + +msgid "Debug Line" +msgstr "Debug линија" + +msgid "E198: cmd_pchar beyond the command length" +msgstr "E198: cmd_pchar је иза дужине команде" + +msgid "E199: Active window or buffer deleted" +msgstr "E199: Active window or buffer deleted" + +msgid "E812: Autocommands changed buffer or buffer name" +msgstr "E812: Ðутокоманде Ñу промениле багер или име бафера" + +msgid "Illegal file name" +msgstr "Ðедозвољено име датотеке" + +msgid "is a directory" +msgstr "је директоријум" + +msgid "is not a file" +msgstr "није датотека" + +msgid "is a device (disabled with 'opendevice' option)" +msgstr "је уређај (онемогућен опцијом 'opendevice')" + +msgid "[New File]" +msgstr "[Ðова датотека]" + +msgid "[New DIRECTORY]" +msgstr "[Ðов ДИРЕКТОРИЈУМ]" + +msgid "[File too big]" +msgstr "[Датотека је Ñувише велика]" + +msgid "[Permission Denied]" +msgstr "[Дозвола одбијена]" + +msgid "E200: *ReadPre autocommands made the file unreadable" +msgstr "E200: *ReadPre аутокоманде Ñу учиниле датотеку нечитљивом" + +msgid "E201: *ReadPre autocommands must not change current buffer" +msgstr "E201: *ReadPre аутокоманде не Ñмеју да измене текући бафер" + +msgid "Vim: Reading from stdin...\n" +msgstr "Vim: Читање Ñа stdin...\n" + +msgid "Reading from stdin..." +msgstr "Читање Ñа stdin..." + +msgid "E202: Conversion made file unreadable!" +msgstr "E202: Конверзија је учинила датотеку нечитљивом!" + +msgid "[fifo/socket]" +msgstr "[fifo/утичница]" + +msgid "[fifo]" +msgstr "[fifo]" + +msgid "[socket]" +msgstr "[утичница]" + +msgid "[character special]" +msgstr "[Ñпецијални карактер]" + +msgid "[CR missing]" +msgstr "[недоÑтаје CR]" + +msgid "[long lines split]" +msgstr "[дуге линије преломљене]" + +msgid "[NOT converted]" +msgstr "[ÐИЈЕ конвертовано]" + +msgid "[convered]" +msgstr "[конвертовано]" + +#, c-format +msgid "[CONVERSION ERROR in line %ld]" +msgstr "[ГРЕШКРКОÐВЕРЗИЈЕ у линији %ld]" + +#, c-format +msgid "[ILLEGAL BYTE in line %ld]" +msgstr "[ÐЕДОЗВОЉЕРБÐЈТ у линији %ld]" + +msgid "[READ ERRORS]" +msgstr "[ГРЕШКЕ ПРИ ЧИТÐЊУ]" + +msgid "Can't find temp file for conversion" +msgstr "Привремена датотека за конверзију не може да Ñе пронађе" + +msgid "Conversion with 'charconvert' failed" +msgstr "Конверзија Ñа 'charconvert' није уÑпела" + +msgid "can't read output of 'charconvert'" +msgstr "излаз 'charconvert' не може да Ñе прочита" + +msgid "E676: No matching autocommands for acwrite buffer" +msgstr "E676: Ðема одговарајућих аутокоманди за acwrite бафер" + +msgid "E203: Autocommands deleted or unloaded buffer to be written" +msgstr "E203: Ðутокоманде Ñу обриÑале или уклониле из меморије бафер који требало да буде упиÑан" + +msgid "E204: Autocommand changed number of lines in unexpected way" +msgstr "E204: Ðутокоманде Ñу на неочекиван начин промениле број линија" + +msgid "NetBeans disallows writes of unmodified buffers" +msgstr "NetBeans не дозвољава ÑƒÐ¿Ð¸Ñ Ð½ÐµÐ¸Ð·Ð¼ÐµÑšÐµÐ½Ð¸Ñ… бафера" + +msgid "Partial writes disallowed for NetBeans buffers" +msgstr "Парцијални упиÑи ниÑу дозвољени за NetBeans бафере" + +msgid "is not a file or writable device" +msgstr "није датотека или уређај на који може да Ñе упиÑује" + +msgid "writing to device disabled with 'opendevice' option" +msgstr "ÑƒÐ¿Ð¸Ñ Ð½Ð° уређај је онемогућен опцијом 'opendevice'" + +msgid "is read-only (add ! to override)" +msgstr "је Ñамо за читање (додајте ! за премошћавање)" + +msgid "E506: Can't write to backup file (add ! to override)" +msgstr "E506: Ðе може да Ñе упише у резервну датотеку (додајте ! за премошћавање)" + +msgid "E507: Close error for backup file (add ! to override)" +msgstr "E507: Грешка код затварања за резервну датотеку (додајте ! за премошћавање)" + +msgid "E508: Can't read file for backup (add ! to override)" +msgstr "E508: Резервна датотека не може да Ñе прочита (додајте ! за премошћавање)" + +msgid "E509: Cannot create backup file (add ! to override)" +msgstr "E509: Резервна датотека не може да Ñе креира (додајте ! за премошћавање)" + +msgid "E510: Can't make backup file (add ! to override)" +msgstr "E510: Резервна датотека не може да Ñе направи (додајте ! за премошћавање)" + +msgid "E214: Can't find temp file for writing" +msgstr "E214: Привремена датотека за ÑƒÐ¿Ð¸Ñ Ð½Ðµ може да Ñе пронађе" + +msgid "E213: Cannot convert (add ! to write without conversion)" +msgstr "E213: Конверзија није могућа (додајте ! за ÑƒÐ¿Ð¸Ñ Ð±ÐµÐ· конверзије)" + +msgid "E166: Can't open linked file for writing" +msgstr "E166: Повезана датотека не може да Ñе отвори за упиÑ" + +msgid "E212: Can't open file for writing" +msgstr "E212: Датотека не може да Ñе отвори за упиÑ" + +msgid "E949: File changed while writing" +msgstr "E949: Датотека је промењена током упиÑа" + +msgid "E512: Close failed" +msgstr "E512: Затварање није уÑпело" + +msgid "E513: write error, conversion failed (make 'fenc' empty to override)" +msgstr "E513: грешка при упиÑу, конверзија није уÑпела (оÑтавите 'fenc' празно да премоÑтите)" + +#, c-format +msgid "" +"E513: write error, conversion failed in line %ld (make 'fenc' empty to " +"override)" +msgstr "" +"E513: грешка при упиÑу, конверзија није уÑпела у линији %ld (оÑтавите 'fenc' празно " +"да премоÑтите)" + +msgid "E514: write error (file system full?)" +msgstr "E514: грешка при упиÑу (ÑиÑтем датотека је пун?)" + +msgid " CONVERSION ERROR" +msgstr " ГРЕШКРКОÐВЕРЗИЈЕ" + +#, c-format +msgid " in line %ld;" +msgstr " у линији %ld;" + +msgid "[Device]" +msgstr "[Уређај]" + +msgid "[New]" +msgstr "[Ðово]" + +msgid " [a]" +msgstr " [н]" + +msgid " appended" +msgstr " наÑтављено" + +msgid " [w]" +msgstr " [у]" + +msgid " written" +msgstr " упиÑано" + +msgid "E205: Patchmode: can't save original file" +msgstr "E205: Patch режим: оригинална датотека не може да Ñе Ñачува" + +msgid "E206: patchmode: can't touch empty original file" +msgstr "E206: Patch режим: не може да Ñе креира празна оригинална датотека" + +msgid "E207: Can't delete backup file" +msgstr "E207: Резервна датотека не може да Ñе обрише" + +msgid "" +"\n" +"WARNING: Original file may be lost or damaged\n" +msgstr "" +"\n" +"УПОЗОРЕЊЕ: Оригинална датотека је можда изгубљена или оштећена\n" + +msgid "don't quit the editor until the file is successfully written!" +msgstr "не напуштајте едитор док Ñе датотека уÑпешно не упише!" + +msgid "[dos]" +msgstr "[dos]" + +msgid "[dos format]" +msgstr "[dos формат]" + +msgid "[mac]" +msgstr "[mac]" + +msgid "[mac format]" +msgstr "[mac формат]" + +msgid "[unix]" +msgstr "[unix]" + +msgid "[unix format]" +msgstr "[unix формат]" + +msgid "1 line, " +msgstr "1 линија, " + +#, c-format +msgid "%ld lines, " +msgstr "%ld линија, " + +msgid "1 character" +msgstr "1 карактер" + +#, c-format +msgid "%lld characters" +msgstr "%lld карактера" + +msgid "[noeol]" +msgstr "[noeol]" + +msgid "[Incomplete last line]" +msgstr "[ПоÑледња линија није комплетна]" + +msgid "WARNING: The file has been changed since reading it!!!" +msgstr "УПОЗОРЕЊЕ: Ова датотека је промењена од кад је прочитана!!!" + +msgid "Do you really want to write to it" +msgstr "Да ли заиÑта желите да пишете у њу" + +#, c-format +msgid "E208: Error writing to \"%s\"" +msgstr "E208: Грешка при упиÑу у \"%s\"" + +#, c-format +msgid "E209: Error closing \"%s\"" +msgstr "E209: Грешка при затварању \"%s\"" + +#, c-format +msgid "E210: Error reading \"%s\"" +msgstr "E210: Грешка при читању \"%s\"" + +msgid "E246: FileChangedShell autocommand deleted buffer" +msgstr "E246: FileChangedShell аутокоманда је обриÑала бафер" + +#, c-format +msgid "E211: File \"%s\" no longer available" +msgstr "E211: Датотека \"%s\" више није доÑтупна" + +#, c-format +msgid "" +"W12: Warning: File \"%s\" has changed and the buffer was changed in Vim as " +"well" +msgstr "" +"W12: Упозорење: Датотека \"%s\" је измењена и бафер у програму Vim је такође " +"измењен" + +msgid "See \":help W12\" for more info." +msgstr "Погледајте \":help W12\" за више информација." + +#, c-format +msgid "W11: Warning: File \"%s\" has changed since editing started" +msgstr "W11: Упозорење: Датотека \"%s\" је измењена откад је започето уређивање" + +msgid "See \":help W11\" for more info." +msgstr "Погледајте \":help W11\" за више информација." + +#, c-format +msgid "W16: Warning: Mode of file \"%s\" has changed since editing started" +msgstr "W16: Упозорење: Режим датотеке \"%s\" је измењен откад је започето уређивање" + +msgid "See \":help W16\" for more info." +msgstr "Погледајте \":help W16\" за више информација." + +#, c-format +msgid "W13: Warning: File \"%s\" has been created after editing started" +msgstr "W13: Упозорење: Датотека \"%s\" је креирана након почетка уређивања" + +msgid "Warning" +msgstr "Упозорење" + +msgid "" +"&OK\n" +"&Load File" +msgstr "" +"&OK\n" +"&Учитај датотеку" + +#, c-format +msgid "E462: Could not prepare for reloading \"%s\"" +msgstr "E462: Припрема за поновно учитавање \"%s\" није била могућа" + +#, c-format +msgid "E321: Could not reload \"%s\"" +msgstr "E321: \"%s\" не може поново да Ñе учита" + +msgid "--Deleted--" +msgstr "--ОбриÑано--" + +#, c-format +msgid "auto-removing autocommand: %s " +msgstr "ауто-уклањајућа аутокоманда: %s <бафер=%d>" + +#, c-format +msgid "E367: No such group: \"%s\"" +msgstr "E367: Ðема такве групе: \"%s\"" + +msgid "E936: Cannot delete the current group" +msgstr "E936: Текућа група не може да Ñе обрише" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: БриÑање augroup која је још у употреби" + +#, c-format +msgid "E215: Illegal character after *: %s" +msgstr "E215: Ðедозвољени карактер након *: %s" + +#, c-format +msgid "E216: No such event: %s" +msgstr "E216: Ðема таквог догађаја: %s" + +#, c-format +msgid "E216: No such group or event: %s" +msgstr "E216: Ðема такве групе или догађаја: %s" + +msgid "" +"\n" +"--- Auto-Commands ---" +msgstr "" +"\n" +"--- Ðуто-Команде ---" + +#, c-format +msgid "E680: : invalid buffer number " +msgstr "E680: <бафер=%d>: неиÑправан број бафера " + +msgid "E217: Can't execute autocommands for ALL events" +msgstr "E217: Ðутокоманде за СВЕ догађаје не могу да Ñе изврше" + +msgid "No matching autocommands" +msgstr "Ðема подударајућих аутокоманди" + +msgid "E218: autocommand nesting too deep" +msgstr "E218: Угњшждавање аутокоманде је Ñувише дубоко" + +#, c-format +msgid "%s Auto commands for \"%s\"" +msgstr "%s Ðуто команде за \"%s\"" + +#, c-format +msgid "Executing %s" +msgstr "Извршавање %s" + +#, c-format +msgid "autocommand %s" +msgstr "аутокоманда %s" + +msgid "E219: Missing {." +msgstr "E219: ÐедоÑтаје {." + +msgid "E220: Missing }." +msgstr "E220: ÐедоÑтаје }." + +msgid "E490: No fold found" +msgstr "E490: Ðије пронађено ниједно Ñклапање" + +msgid "E350: Cannot create fold with current 'foldmethod'" +msgstr "E350: Склапање не може да Ñе креира Ñа текућим 'foldmethod'" + +msgid "E351: Cannot delete fold with current 'foldmethod'" +msgstr "E351: Склапање не може да Ñе обрише Ñа текћим 'foldmethod'" + +msgid "E222: Add to read buffer" +msgstr "E222: Додавање у бафер читања" + +msgid "E223: recursive mapping" +msgstr "E223: рекурзивно мапирање" + +#, c-format +msgid "E224: global abbreviation already exists for %s" +msgstr "E224: глобална Ñкраћеница за %s већ поÑтоји" + +#, c-format +msgid "E225: global mapping already exists for %s" +msgstr "E225: глобално мапирање за %s већ поÑтоји" + +#, c-format +msgid "E226: abbreviation already exists for %s" +msgstr "E226: Ñкраћеница за %s већ поÑтоји" + +#, c-format +msgid "E227: mapping already exists for %s" +msgstr "E227: мапирање за %s већ поÑтоји" + +msgid "No abbreviation found" +msgstr "Скраћеница није пронађена" + +msgid "No mapping found" +msgstr "Мапирање није пронађено" + +msgid "E228: makemap: Illegal mode" +msgstr "E228: makemap: Ðедозвољен режим" + +msgid "E851: Failed to create a new process for the GUI" +msgstr "E851: Креирање новог процеÑа за GUI није уÑпело" + +msgid "E852: The child process failed to start the GUI" +msgstr "E852: ÐŸÑ€Ð¾Ñ†ÐµÑ Ð¿Ð¾Ñ‚Ð¾Ð¼Ð°Ðº није уÑпео да покрене GUI" + +msgid "E229: Cannot start the GUI" +msgstr "E229: GUI не може да Ñе покрене" + +#, c-format +msgid "E230: Cannot read from \"%s\"" +msgstr "E230: Из \"%s\" не може да Ñе чита" + +msgid "E665: Cannot start GUI, no valid font found" +msgstr "E665: GUI не може да Ñе покрене, није пронађен валидан фонт" + +msgid "E231: 'guifontwide' invalid" +msgstr "E231: 'guifontwide' неиÑправан" + +msgid "E599: Value of 'imactivatekey' is invalid" +msgstr "E599: ВредноÑÑ‚ 'imactivatekey' није иÑправна" + +#, c-format +msgid "E254: Cannot allocate color %s" +msgstr "E254: Боја %s не може да Ñе алоцира" + +msgid "No match at cursor, finding next" +msgstr "Ðема подударања на меÑту курÑора, тражи Ñе даље" + +msgid " " +msgstr "<не може да Ñе отвори> " + +#, c-format +msgid "E616: vim_SelFile: can't get font %s" +msgstr "E616: vim_SelFile: не може да Ñе добије фонт %s" + +msgid "E614: vim_SelFile: can't return to current directory" +msgstr "E614: vim_SelFile: повратак у текући директоријум није могућ" + +msgid "Pathname:" +msgstr "Име путање:" + +msgid "E615: vim_SelFile: can't get current directory" +msgstr "E615: vim_SelFile: не може да Ñе добије текући директоријум" + +msgid "OK" +msgstr "ОК" + +msgid "Cancel" +msgstr "Откажи" + +msgid "Scrollbar Widget: Could not get geometry of thumb pixmap." +msgstr "Scrollbar Widget: Ðе може да Ñе добије геометрија thumb pixmap." + +msgid "Vim dialog" +msgstr "Vim дијалог" + +msgid "E232: Cannot create BalloonEval with both message and callback" +msgstr "E232: Ðе може да Ñе креира BalloonEval и Ñа поруком и Ñа повратним позивом" + +msgid "_Cancel" +msgstr "_Откажи" + +msgid "_Save" +msgstr "_Сачувај" + +msgid "_Open" +msgstr "_Отвори" + +msgid "_OK" +msgstr "_OK" + +msgid "" +"&Yes\n" +"&No\n" +"&Cancel" +msgstr "" +"&Да\n" +"&Ðе\n" +"&Откажи" + +msgid "Yes" +msgstr "Да" + +msgid "No" +msgstr "Ðе" + +msgid "Input _Methods" +msgstr "_Методе уноÑа" + +msgid "VIM - Search and Replace..." +msgstr "VIM - Претрага and Замена..." + +msgid "VIM - Search..." +msgstr "VIM - Претрага..." + +msgid "Find what:" +msgstr "Пронађи:" + +msgid "Replace with:" +msgstr "Замени Ñа:" + +msgid "Match whole word only" +msgstr "Само целе речи подударају" + +msgid "Match case" +msgstr "Мала/велика Ñлова" + +msgid "Direction" +msgstr "Смер" + +msgid "Up" +msgstr "Горе" + +msgid "Down" +msgstr "Доле" + +msgid "Find Next" +msgstr "Пронађи наредно" + +msgid "Replace" +msgstr "Замени" + +msgid "Replace All" +msgstr "Замени Ñве" + +msgid "_Close" +msgstr "_Затвори" + +msgid "Vim: Received \"die\" request from session manager\n" +msgstr "Vim: Примљен је \"die\" захтев од менаџера ÑеÑије\n" + +msgid "Close tab" +msgstr "Затвори картицу" + +msgid "New tab" +msgstr "Ðова картица" + +msgid "Open Tab..." +msgstr "Отвори картицу..." + +msgid "Vim: Main window unexpectedly destroyed\n" +msgstr "Vim: Главни прозор је неочекивано уништен\n" + +msgid "&Filter" +msgstr "&Филтер" + +msgid "&Cancel" +msgstr "&Откажи" + +msgid "Directories" +msgstr "Директоријуми" + +msgid "Filter" +msgstr "Филтер" + +msgid "&Help" +msgstr "&Помоћ" + +msgid "Files" +msgstr "Датотеке" + +msgid "&OK" +msgstr "&ОК" + +msgid "Selection" +msgstr "Селекција" + +msgid "Find &Next" +msgstr "Пронађи &Следеће" + +msgid "&Replace" +msgstr "&Замени" + +msgid "Replace &All" +msgstr "Замени Ñ&Ве" + +msgid "&Undo" +msgstr "О&позови" + +msgid "Open tab..." +msgstr "Отвори картицу" + +msgid "Find string (use '\\\\' to find a '\\')" +msgstr "Пронађи Ñтринг (кориÑтите '\\\\' да пронађете '\\')" + +msgid "Find & Replace (use '\\\\' to find a '\\')" +msgstr "Пронађи & Замени (кориÑтите '\\\\' да пронађете '\\')" + +msgid "Not Used" +msgstr "Ðе кориÑти Ñе" + +msgid "Directory\t*.nothing\n" +msgstr "Директоријум\t*.ништа\n" + +#, c-format +msgid "E671: Cannot find window title \"%s\"" +msgstr "E671: ÐаÑлов прозора \"%s\" не може да Ñе пронађе" + +#, c-format +msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +msgstr "E243: Ðргумент није подржан: \"-%s\"; КориÑтите OLE верзију." + +msgid "E672: Unable to open window inside MDI application" +msgstr "E672: Ðије могуће отварање прозора унутар MDI апликације" + +msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" +msgstr "Vim E458: colormap ÑƒÐ½Ð¾Ñ Ð½Ðµ може да Ñе алоцира, неке боје Ñу можда неиÑправне" + +#, c-format +msgid "E250: Fonts for the following charsets are missing in fontset %s:" +msgstr "E250: Фонтови за Ñледеће Ñетове карактера недоÑтају у фонтÑету %s:" + +#, c-format +msgid "E252: Fontset name: %s" +msgstr "E252: Име фонтÑета: %s" + +#, c-format +msgid "Font '%s' is not fixed-width" +msgstr "Фонт %s' није фикÑне ширине" + +#, c-format +msgid "E253: Fontset name: %s" +msgstr "E253: Име фонтÑета: %s" + +#, c-format +msgid "Font0: %s" +msgstr "Фонт0: %s" + +#, c-format +msgid "Font1: %s" +msgstr "Фонт1: %s" + +#, c-format +msgid "Font%ld width is not twice that of font0" +msgstr "Ширина фонт%ld није двоÑтрука од ширине фонт0" + +#, c-format +msgid "Font0 width: %ld" +msgstr "Фонт0 ширина: %ld" + +#, c-format +msgid "Font1 width: %ld" +msgstr "Фонт1 ширина: %ld" + +msgid "Invalid font specification" +msgstr "ÐеиÑправна Ñпецификација фонта" + +msgid "&Dismiss" +msgstr "О&дбаци" + +msgid "no specific match" +msgstr "нема поÑебног подударања" + +msgid "Vim - Font Selector" +msgstr "Vim - Фонт Ñелектор" + +msgid "Name:" +msgstr "Име:" + +msgid "Show size in Points" +msgstr "Прикажи величину у Тачкама" + +msgid "Encoding:" +msgstr "Кодирање:" + +msgid "Font:" +msgstr "Фонт:" + +msgid "Style:" +msgstr "Стил:" + +msgid "Size:" +msgstr "Величина:" + +msgid "E256: Hangul automata ERROR" +msgstr "E256: ГРЕШКРHangul аутомата" + +msgid "E550: Missing colon" +msgstr "E550: ÐедоÑтаје двотачка" + +msgid "E551: Illegal component" +msgstr "E551: ÐеиÑправна компонента" + +msgid "E552: digit expected" +msgstr "E552: очекује Ñе цифра" + +#, c-format +msgid "Page %d" +msgstr "Страна %d" + +msgid "No text to be printed" +msgstr "Ðема текÑта за штампу" + +#, c-format +msgid "Printing page %d (%d%%)" +msgstr "Штампање Ñтране %d (%d%%)" + +#, c-format +msgid " Copy %d of %d" +msgstr " Копија %d од %d" + +#, c-format +msgid "Printed: %s" +msgstr "Одштампано: %s" + +msgid "Printing aborted" +msgstr "Штампање прекинуто" + +msgid "E455: Error writing to PostScript output file" +msgstr "E455: Грешка приликом упиÑа у PostScript излазну датотеку" + +#, c-format +msgid "E624: Can't open file \"%s\"" +msgstr "E624: Датотека \"%s\" не може да Ñе отвори" + +#, c-format +msgid "E457: Can't read PostScript resource file \"%s\"" +msgstr "E457: PostScript resource датотека \"%s\" не може да Ñе чита" + +#, c-format +msgid "E618: file \"%s\" is not a PostScript resource file" +msgstr "E618: датотека \"%s\" није PostScript resource датотека" + +#, c-format +msgid "E619: file \"%s\" is not a supported PostScript resource file" +msgstr "E619: датотека \"%s\" није подржана PostScript resource датотека" + +#, c-format +msgid "E621: \"%s\" resource file has wrong version" +msgstr "E621: \"%s\" resource датотека је погрешне верзије" + +msgid "E673: Incompatible multi-byte encoding and character set." +msgstr "E673: Вишебајтно кодирање и Ñкуп карактера ниÑу компатибилни." + +msgid "E674: printmbcharset cannot be empty with multi-byte encoding." +msgstr "E674: printmbcharset не може бити празно Ñа вишебајтним кодирањем." + +msgid "E675: No default font specified for multi-byte printing." +msgstr "E675: Ðије наведен подразумевани фонт за вишебајтно штампање." + +msgid "E324: Can't open PostScript output file" +msgstr "E324: PostScript излазна датотека не може да Ñе отвори" + +#, c-format +msgid "E456: Can't open file \"%s\"" +msgstr "E456: Датотека \"%s\" не може да Ñе отвори" + +msgid "E456: Can't find PostScript resource file \"prolog.ps\"" +msgstr "E456: PostScript resource датотека \"prolog.ps\" не може да Ñе пронађе" + +msgid "E456: Can't find PostScript resource file \"cidfont.ps\"" +msgstr "E456: PostScript resource датотека \"cidfont.ps\" не може да Ñе пронађе" + +#, c-format +msgid "E456: Can't find PostScript resource file \"%s.ps\"" +msgstr "E456: PostScript resource датотека \"%s.ps\" не може да Ñе пронађе" + +#, c-format +msgid "E620: Unable to convert to print encoding \"%s\"" +msgstr "E620: Ðије могућа конверзија у кодирање за штампу \"%s\"" + +msgid "Sending to printer..." +msgstr "Слање штампачу..." + +msgid "E365: Failed to print PostScript file" +msgstr "E365: PostScript датотека није уÑпела да Ñе одштампа" + +msgid "Print job sent." +msgstr "Задатак штампе је поÑлат" + +msgid "Add a new database" +msgstr "Додај нову базу" + +msgid "Query for a pattern" +msgstr "Упит за шаблон" + +msgid "Show this message" +msgstr "Прикажи ову поруку" + +msgid "Kill a connection" +msgstr "Затвори везу" + +msgid "Reinit all connections" +msgstr "Поново иницијализуј Ñве везе" + +msgid "Show connections" +msgstr "Прикажи везе" + +#, c-format +msgid "E560: Usage: cs[cope] %s" +msgstr "E560: Употреба: cs[cope] %s" + +msgid "This cscope command does not support splitting the window.\n" +msgstr "Ова cscope команда не подржава поделу прозора.\n" + +msgid "E562: Usage: cstag " +msgstr "E562: Употреба: cstag " + +msgid "E257: cstag: tag not found" +msgstr "E257: cstag: ознака није пронађена" + +#, c-format +msgid "E563: stat(%s) error: %d" +msgstr "E563: stat(%s) грешка: %d" + +msgid "E563: stat error" +msgstr "E563: stat грешка" + +#, c-format +msgid "E564: %s is not a directory or a valid cscope database" +msgstr "E564: %s није директоријум или валидна cscope база података" + +#, c-format +msgid "Added cscope database %s" +msgstr "cscope база података %s је додата" + +#, c-format +msgid "E262: error reading cscope connection %ld" +msgstr "E262: грешка код читања cscope везе %ld" + +msgid "E561: unknown cscope search type" +msgstr "E561: непознат cscope тип претраге" + +msgid "E566: Could not create cscope pipes" +msgstr "E566: cscope процеÑни токови ниÑу могли да Ñе креирају" + +msgid "E622: Could not fork for cscope" +msgstr "E622: Рачвање за cscope није уÑпело" + +msgid "cs_create_connection setpgid failed" +msgstr "cs_create_connection setpgid није уÑпео" + +msgid "cs_create_connection exec failed" +msgstr "cs_create_connection exec није уÑпео" + +msgid "cs_create_connection: fdopen for to_fp failed" +msgstr "cs_create_connection: fdopen за to_fp није уÑпео" + +msgid "cs_create_connection: fdopen for fr_fp failed" +msgstr "cs_create_connection: fdopen за fr_fp није уÑпео" + +msgid "E623: Could not spawn cscope process" +msgstr "E623: Мрешћење cscope процеÑа није уÑпело" + +msgid "E567: no cscope connections" +msgstr "E567: нема cscope веза" + +#, c-format +msgid "E469: invalid cscopequickfix flag %c for %c" +msgstr "E469: неиÑправан cscopequickfix индикатор %c за %c" + +#, c-format +msgid "E259: no matches found for cscope query %s of %s" +msgstr "E259: ниÑу пронађена подударања за cscope упит %s на %s" + +msgid "cscope commands:\n" +msgstr "cscope команде:\n" + +#, c-format +msgid "%-5s: %s%*s (Usage: %s)" +msgstr "%-5s: %s%*s (Употреба: %s)" + +msgid "" +"\n" +" a: Find assignments to this symbol\n" +" c: Find functions calling this function\n" +" d: Find functions called by this function\n" +" e: Find this egrep pattern\n" +" f: Find this file\n" +" g: Find this definition\n" +" i: Find files #including this file\n" +" s: Find this C symbol\n" +" t: Find this text string\n" +msgstr "" +"\n" +" a: Пронађи доделе овом Ñимболу\n" +" c: Пронађи функције које позивају ову функцију\n" +" d: Пронађи функције које зове ова функција\n" +" e: Пронађи овај egrep шаблон\n" +" f: Пронађи ову датотеку\n" +" g: Пронађи ову дефиницију\n" +" i: Пронађи датотеке које #includе ову датотеку\n" +" s: Пронађи овај C Ñимбол\n" +" t: Пронађи овај текÑÑ‚ Ñтринг\n" + +#, c-format +msgid "E625: cannot open cscope database: %s" +msgstr "E625: cscope database: %s не може да Ñе отвори" + +msgid "E626: cannot get cscope database information" +msgstr "E626: Инфорамције о cscope бази података не могу да Ñе добију" + +msgid "E568: duplicate cscope database not added" +msgstr "E568: Дупликат cscope база података није додата" + +#, c-format +msgid "E261: cscope connection %s not found" +msgstr "E261: cscope веза %s није пронађена" + +#, c-format +msgid "cscope connection %s closed" +msgstr "cscope веза %s је затворена" + +msgid "E570: fatal error in cs_manage_matches" +msgstr "E570: фатална грешка у cs_manage_matches" + +#, c-format +msgid "Cscope tag: %s" +msgstr "Cscope ознака: %s" + +msgid "" +"\n" +" # line" +msgstr "" +"\n" +" # линија" + +msgid "filename / context / line\n" +msgstr "датотека / контекÑÑ‚ / линија\n" + +#, c-format +msgid "E609: Cscope error: %s" +msgstr "E609: Cscope грешка: %s" + +msgid "All cscope databases reset" +msgstr "Све cscope базе података реÑетоване" + +msgid "no cscope connections\n" +msgstr "нема cscope веза\n" + +msgid " # pid database name prepend path\n" +msgstr " # pid име базе података додај путању иÑпред\n" + +msgid "Lua library cannot be loaded." +msgstr "Lua библиотека не може да Ñе учита" + +msgid "cannot save undo information" +msgstr "инфорамције за опозив не могу да Ñе Ñачувају" + +msgid "" +"E815: Sorry, this command is disabled, the MzScheme libraries could not be " +"loaded." +msgstr "" +"E815: Жао нам је, ова команда је онемогућена, MzScheme библиотеке ниÑу могле да " +"Ñе учитају." + +msgid "" +"E895: Sorry, this command is disabled, the MzScheme's racket/base module " +"could not be loaded." +msgstr "" +"E895: Жао нам је, ова команда је онемогућена, MzScheme-ов racket/base модул " +"није могао да Ñе учита." + +msgid "invalid expression" +msgstr "неиÑправан израз" + +msgid "expressions disabled at compile time" +msgstr "изрази Ñу онемогућени у време компилације" + +msgid "hidden option" +msgstr "Ñкривена опција" + +msgid "unknown option" +msgstr "непозната опција" + +msgid "window index is out of range" +msgstr "Ð¸Ð½Ð´ÐµÐºÑ Ð¿Ñ€Ð¾Ð·Ð¾Ñ€Ð° је ван опÑега" + +msgid "couldn't open buffer" +msgstr "бафер не може да Ñе отвори" + +msgid "cannot delete line" +msgstr "линија не може да Ñе обрише" + +msgid "cannot replace line" +msgstr "линија не може да Ñе замени" + +msgid "cannot insert line" +msgstr "линија не може да Ñе уметне" + +msgid "string cannot contain newlines" +msgstr "Ñтринг не може да Ñадржи нове редове" + +msgid "error converting Scheme values to Vim" +msgstr "грешка при конверзији Scheme вредноÑти у Vim" + +msgid "Vim error: ~a" +msgstr "Vim грешка: ~a" + +msgid "Vim error" +msgstr "Vim грешка" + +msgid "buffer is invalid" +msgstr "бафер је неважећи" + +msgid "window is invalid" +msgstr "прозор је неважећи" + +msgid "linenr out of range" +msgstr "linenr је ван опÑега" + +msgid "not allowed in the Vim sandbox" +msgstr "није дозвољено у Vim sandbox-у" + +msgid "E836: This Vim cannot execute :python after using :py3" +msgstr "E836: Овај Vim не може да изврши :python након коришћења :py3" + +msgid "" +"E263: Sorry, this command is disabled, the Python library could not be " +"loaded." +msgstr "" +"E263: Жао нам је, ова команда је онемогућена, Python библиотека није " +"могла да Ñе учита." + +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: Жао нам је, ова команда је онемогућена, Python-ов site модул " +"није могао да Ñе учита." + +msgid "E659: Cannot invoke Python recursively" +msgstr "E659: Python не може да Ñе позива рекурзивно" + +msgid "E837: This Vim cannot execute :py3 after using :python" +msgstr "E837: Овај Vim не може да изврши :py3 након коришћења :python" + +msgid "E265: $_ must be an instance of String" +msgstr "E265: $_ мора да буде инÑтанца String-а" + +msgid "" +"E266: Sorry, this command is disabled, the Ruby library could not be loaded." +msgstr "" +"E266: Жао нам је, ова команда је онемогућена, Ruby библиотека није могла да Ñе учита." + +msgid "E267: unexpected return" +msgstr "E267: неочекиван return" + +msgid "E268: unexpected next" +msgstr "E268: неочекивано next" + +msgid "E269: unexpected break" +msgstr "E269: неочекивано break" + +msgid "E270: unexpected redo" +msgstr "E270: неочекивано redo" + +msgid "E271: retry outside of rescue clause" +msgstr "E271: retry ван rescue клаузуле" + +msgid "E272: unhandled exception" +msgstr "E272: необрађени изузетак" + +#, c-format +msgid "E273: unknown longjmp status %d" +msgstr "E273: непознат longjmp ÑÑ‚Ð°Ñ‚ÑƒÑ %d" + +msgid "invalid buffer number" +msgstr "неиÑправан број бафера" + +msgid "not implemented yet" +msgstr "још није имплементирано" + +msgid "cannot set line(s)" +msgstr "линија(е) не може да Ñе поÑтави" + +msgid "invalid mark name" +msgstr "неиÑправно име маркера" + +msgid "mark not set" +msgstr "маркер није поÑтављен" + +#, c-format +msgid "row %d column %d" +msgstr "ред %d колона %d" + +msgid "cannot insert/append line" +msgstr "линија не може да Ñе уметне/дода на крај" + +msgid "line number out of range" +msgstr "број линије је ван опÑега" + +msgid "unknown flag: " +msgstr "непознат индикатор" + +msgid "unknown vimOption" +msgstr "непозната vimОпција" + +msgid "keyboard interrupt" +msgstr "прекид таÑтатуре" + +msgid "vim error" +msgstr "vim грешка" + +msgid "cannot create buffer/window command: object is being deleted" +msgstr "бафер/прозор команда не може да Ñе креира: објекат Ñе брише" + +msgid "" +"cannot register callback command: buffer/window is already being deleted" +msgstr "" +"команда повратног позива не може да Ñе региÑтрује: бафер/прозор је већ обриÑан" + +msgid "" +"E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." +"org" +msgstr "" +"E280: TCL ФÐТÐЛÐРГРЕШКÐ: reflist је оштећена!? Молимо пријавите ово на vim-dev@vim." +"org" + +msgid "cannot register callback command: buffer/window reference not found" +msgstr "команда повратног позива не може да Ñе региÑтрује: референца бафера/прозора није пронађена" + +msgid "" +"E571: Sorry, this command is disabled: the Tcl library could not be loaded." +msgstr "" +"E571: Жао нам је, ова команда је онемогућена: Tcl библиотека није могла да Ñе учита." + +#, c-format +msgid "E572: exit code %d" +msgstr "E572: излазни код %d" + +msgid "cannot get line" +msgstr "линија не може да Ñе добије" + +msgid "Unable to register a command server name" +msgstr "Име Ñервера команди није могло да Ñе региÑтрује" + +msgid "E248: Failed to send command to the destination program" +msgstr "E248: Слање команде циљном програму није уÑпело" + +#, c-format +msgid "E573: Invalid server id used: %s" +msgstr "E573: КориÑти Ñе неÑправан ид Ñервера: %s" + +msgid "E251: VIM instance registry property is badly formed. Deleted!" +msgstr "E251: registry ÑвојÑтво VIM инÑтанце је лоше формирано. ОбриÑано!" + +#, c-format +msgid "E938: Duplicate key in JSON: \"%s\"" +msgstr "E938: Дупли кључ у JSON: \"%s\"" + +#, c-format +msgid "E696: Missing comma in List: %s" +msgstr "E696: У ЛиÑти недоÑтаје зарез: %s" + +#, c-format +msgid "E697: Missing end of List ']': %s" +msgstr "E697: ÐедоÑтаје крај ЛиÑте ']': %s" + +msgid "Unknown option argument" +msgstr "Ðепознат аргумент опције" + +msgid "Too many edit arguments" +msgstr "Сувише аргумента уређивања" + +msgid "Argument missing after" +msgstr "Ðргумент недоÑтаје након" + +msgid "Garbage after option argument" +msgstr "Смеће након аргумента опције" + +msgid "Too many \"+command\", \"-c command\" or \"--cmd command\" arguments" +msgstr "Сувише \"+command\", \"-c command\" или \"--cmd command\" аргумената" + +msgid "Invalid argument for" +msgstr "ÐеиÑправан аргумент for" + +#, c-format +msgid "%d files to edit\n" +msgstr "%d датотека за уређивање\n" + +msgid "netbeans is not supported with this GUI\n" +msgstr "NetBeans није подржан Ñа овим GUI\n" + +msgid "'-nb' cannot be used: not enabled at compile time\n" +msgstr "'-nb' не може да Ñе кориÑти: није омогућено у време компилације\n" + +msgid "This Vim was not compiled with the diff feature." +msgstr "Овај Vim није компајлиран Ñа diff могућношћу." + +msgid "Attempt to open script file again: \"" +msgstr "Покушај да Ñе поново отвори Ñкрипт датотека: \"" + +msgid "Cannot open for reading: \"" +msgstr "Ðе може да Ñе отвори за читање: \"" + +msgid "Cannot open for script output: \"" +msgstr "Ðе може да Ñе отвори за излаз Ñкрипте: \"" + +msgid "Vim: Error: Failure to start gvim from NetBeans\n" +msgstr "Vim: Грешка: Покретање gvim из NetBeans није уÑпело\n" + +msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +msgstr "Vim: Грешка: Ова верзија Vim не може да Ñе покрене из Cygwin терминала\n" + +msgid "Vim: Warning: Output is not to a terminal\n" +msgstr "Vim: Упозорење: Излаз није у терминал\n" + +msgid "Vim: Warning: Input is not from a terminal\n" +msgstr "Vim: Упозорење: Улаз није из терминала\n" + +msgid "pre-vimrc command line" +msgstr "pre-vimrc командна линија" + +#, c-format +msgid "E282: Cannot read from \"%s\"" +msgstr "E282: Ðе може да Ñе чита из \"%s\"" + +msgid "" +"\n" +"More info with: \"vim -h\"\n" +msgstr "" +"\n" +"Више инфо Ñа: \"vim -h\"\n" + +msgid "[file ..] edit specified file(s)" +msgstr "[датотека ..] уређуј наведену(е) датотеку(е)" + +msgid "- read text from stdin" +msgstr "- читај текÑÑ‚ Ñа stdin" + +msgid "-t tag edit file where tag is defined" +msgstr "-t tag уређуј датотеку где је дефиниÑана ознака" + +msgid "-q [errorfile] edit file with first error" +msgstr "-q [дат.грешке] уређуј датотеку Ñа првом грешком" + +msgid "" +"\n" +"\n" +"usage:" +msgstr "" +"\n" +"\n" +"употреба:" + +msgid " vim [arguments] " +msgstr " vim [аргументи] " + +msgid "" +"\n" +" or:" +msgstr "" +"\n" +" или:" + +msgid "" +"\n" +"Where case is ignored prepend / to make flag upper case" +msgstr "" +"\n" +"Где Ñе мала/велика Ñлова игноришу Ñтавите иÑпред / како би претворили индикатор у велика Ñлова" + +msgid "" +"\n" +"\n" +"Arguments:\n" +msgstr "" +"\n" +"\n" +"Ðргументи:\n" + +msgid "--\t\t\tOnly file names after this" +msgstr "--\t\t\tСамо имена датотека након овога" + +msgid "--literal\t\tDon't expand wildcards" +msgstr "--literal\t\tÐе развијај џокере" + +msgid "-register\t\tRegister this gvim for OLE" +msgstr "-register\t\tРегиÑтруј овај gvim за OLE" + +msgid "-unregister\t\tUnregister gvim for OLE" +msgstr "-unregister\t\tУклони региÑтрацију gvim за OLE" + +msgid "-g\t\t\tRun using GUI (like \"gvim\")" +msgstr "-g\t\t\tПокрени кориÑтећи GUI (као \"gvim\")" + +msgid "-f or --nofork\tForeground: Don't fork when starting GUI" +msgstr "-f или --nofork\tУ предњем плану: немој да рачваш кад Ñе покреће GUI" + +msgid "-v\t\t\tVi mode (like \"vi\")" +msgstr "-v\t\t\tVi режим (као \"vi\")" + +msgid "-e\t\t\tEx mode (like \"ex\")" +msgstr "-e\t\t\tEx режим (као \"ex\")" + +msgid "-E\t\t\tImproved Ex mode" +msgstr "-E\t\t\tУнапређен Ex режим" + +msgid "-s\t\t\tSilent (batch) mode (only for \"ex\")" +msgstr "-s\t\t\tÐечујни (batch) режим (Ñамо за \"ex\")" + +msgid "-d\t\t\tDiff mode (like \"vimdiff\")" +msgstr "-d\t\t\tDiff режим (као \"vimdiff\")" + +msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" +msgstr "-y\t\t\tEasy режим (као \"evim\", безрежимни)" + +msgid "-R\t\t\tReadonly mode (like \"view\")" +msgstr "-R\t\t\tReadonly режим (као \"view\")" + +msgid "-Z\t\t\tRestricted mode (like \"rvim\")" +msgstr "-Z\t\t\tRestricted режим (као \"rvim\")" + +msgid "-m\t\t\tModifications (writing files) not allowed" +msgstr "-m\t\t\tИзмене (упиÑивање датотека) ниÑу дозвољене" + +msgid "-M\t\t\tModifications in text not allowed" +msgstr "-M\t\t\tИзмене у текÑту ниÑу дозвољене" + +msgid "-b\t\t\tBinary mode" +msgstr "-b\t\t\tБинарни режим" + +msgid "-l\t\t\tLisp mode" +msgstr "-l\t\t\tLisp режим" + +msgid "-C\t\t\tCompatible with Vi: 'compatible'" +msgstr "-C\t\t\tКомпатибилан Ñа Vi: 'compatible'" + +msgid "-N\t\t\tNot fully Vi compatible: 'nocompatible'" +msgstr "-N\t\t\tÐе потпуно Vi компатибилан: 'nocompatible'" + +msgid "-V[N][fname]\t\tBe verbose [level N] [log messages to fname]" +msgstr "-V[N][fname]\t\tБуди опширан [ниво N] [бележи поруке у fname]" + +msgid "-D\t\t\tDebugging mode" +msgstr "-D\t\t\tDebugging режим" + +msgid "-n\t\t\tNo swap file, use memory only" +msgstr "-n\t\t\tБез swap датотеке, кориÑти Ñамо меморију" + +msgid "-r\t\t\tList swap files and exit" +msgstr "-r\t\t\tИзлиÑтај swap датотеке и изађи" + +msgid "-r (with file name)\tRecover crashed session" +msgstr "-r (Ñа именом датотеке)\tОбнови Ñрушену ÑеÑију" + +msgid "-L\t\t\tSame as -r" +msgstr "-L\t\t\tИÑто као -r" + +msgid "-f\t\t\tDon't use newcli to open window" +msgstr "-f\t\t\tÐемој да кориÑтиш нов cli да отвориш прозор" + +msgid "-dev \t\tUse for I/O" +msgstr "-dev <уређај>\t\tКориÑти <уређај> за У/И" + +msgid "-A\t\t\tstart in Arabic mode" +msgstr "-A\t\t\tПокрени у ÐрапÑком режиму" + +msgid "-H\t\t\tStart in Hebrew mode" +msgstr "-H\t\t\tПокрени у ХебрејÑком режиму" + +msgid "-F\t\t\tStart in Farsi mode" +msgstr "-F\t\t\tПокрени у ФарÑи режиму" + +msgid "-T \tSet terminal type to " +msgstr "-T <терминал>\tПоÑтави тип терминала на <терминал>" + +msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +msgstr "--not-a-term\t\tПреÑкочи упозорење да улаз/излаз није терминал" + +msgid "--ttyfail\t\tExit if input or output is not a terminal" +msgstr "--ttyfail\t\tИзађи ако улаз или излаз ниÑу терминал" + +msgid "-u \t\tUse instead of any .vimrc" +msgstr "-u \t\tКориÑти умеÑто било ког .vimrc" + +msgid "-U \t\tUse instead of any .gvimrc" +msgstr "-U \t\tКориÑти умеÑто било ког .gvimrc" + +msgid "--noplugin\t\tDon't load plugin scripts" +msgstr "--noplugin\t\tÐе учитавај Ñкрипте додатака" + +msgid "-p[N]\t\tOpen N tab pages (default: one for each file)" +msgstr "-p[N]\t\tОтвори N картица (подразумевано: по једну за Ñваку датотеку)" + +msgid "-o[N]\t\tOpen N windows (default: one for each file)" +msgstr "-o[N]\t\tОтвори N прозора (подразумевано: по један за Ñваку датотеку)" + +msgid "-O[N]\t\tLike -o but split vertically" +msgstr "-O[N]\t\tКао -o али подели по вертикали" + +msgid "+\t\t\tStart at end of file" +msgstr "+\t\t\tПочни на крају датотеке" + +msgid "+\t\tStart at line " +msgstr "+<бројл>\t\tПочни на линији <бројл>" + +msgid "--cmd \tExecute before loading any vimrc file" +msgstr "--cmd <команда>\tИзврши <команда> пре учитавања било које vimrc датотеке" + +msgid "-c \t\tExecute after loading the first file" +msgstr "-c <команда>\t\tИзврши <команда> након учитавања прве датотеке" + +msgid "-S \t\tSource file after loading the first file" +msgstr "-S <ÑеÑија>\t\tУчитај као извор датотеку <ÑеÑија> након учитавања прве датотеке" + +msgid "-s \tRead Normal mode commands from file " +msgstr "-s <Ñкриптулаз>\tЧитај команде Ðормалног режима из датотеке <Ñкриптулаз>" + +msgid "-w \tAppend all typed commands to file " +msgstr "-w <Ñкриптизлаз>\tÐадовежи Ñве откуцане команде на крај датотеке <Ñкриптизлаз>" + +msgid "-W \tWrite all typed commands to file " +msgstr "-W <Ñкриптизлаз>\tУпиÑуј Ñве откуцане команде у датотеку <Ñкриптизлаз>" + +msgid "-x\t\t\tEdit encrypted files" +msgstr "-x\t\t\tУређуј шифроване датотеке" + +msgid "-display \tConnect vim to this particular X-server" +msgstr "-display <диÑплеј>\tПовежи vim на овај X-Ñервер" + +msgid "-X\t\t\tDo not connect to X server" +msgstr "-X\t\t\tÐе повезуј Ñе на X Ñервер" + +msgid "--remote \tEdit in a Vim server if possible" +msgstr "--remote <датотеке>\tУређуј <датотеке> у Vim Ñерверу ако је могуће" + +msgid "--remote-silent Same, don't complain if there is no server" +msgstr "--remote-silent <датотеке> ИÑто, не буни Ñе ако нема Ñервера" + +msgid "" +"--remote-wait As --remote but wait for files to have been edited" +msgstr "" +"--remote-wait <датотеке> Као --remote али чекај да датотеке буду уређене" + +msgid "" +"--remote-wait-silent Same, don't complain if there is no server" +msgstr "" +"--remote-wait-silent <датотеке> ИÑто, не буни Ñе ако нема Ñервера" + +msgid "" +"--remote-tab[-wait][-silent] As --remote but use tab page per file" +msgstr "" +"--remote-tab[-wait][-silent] <датотеке> Као --remote али кориÑти једну картицу по датотеци" + +msgid "--remote-send \tSend to a Vim server and exit" +msgstr "--remote-send <таÑтери>\tПошаљи <таÑтери> Vim Ñерверу и изађи" + +msgid "--remote-expr \tEvaluate in a Vim server and print result" +msgstr "--remote-expr <израз>\tИзрачунај <израз> у Vim Ñерверу и одштампај резултат" + +msgid "--serverlist\t\tList available Vim server names and exit" +msgstr "--serverlist\t\tИзлиÑтај имена доÑтупних Vim Ñервера и изађи" + +msgid "--servername \tSend to/become the Vim server " +msgstr "--servername <име>\tПошаљи/поÑтани Vim Ñервер <име>" + +msgid "--startuptime \tWrite startup timing messages to " +msgstr "--startuptime <датотека>\tУпиши поруке о дужини покретања у <датотеку>" + +msgid "-i \t\tUse instead of .viminfo" +msgstr "-i \t\tКориÑти умеÑто .viminfo" + +msgid "--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo" +msgstr "--clean\t\t'nocompatible', Vim подразумеване вредноÑти, без додатака, без viminfo" + +msgid "-h or --help\tPrint Help (this message) and exit" +msgstr "-h or --help\tИÑпиши Помоћ (ову поруку) и изађи" + +msgid "--version\t\tPrint version information and exit" +msgstr "--version\t\tИÑпиши информације о верзији и изађи" + +msgid "" +"\n" +"Arguments recognised by gvim (Motif version):\n" +msgstr "" +"\n" +"Ðргументи које препознаје gvim (Motif верзија):\n" + +msgid "" +"\n" +"Arguments recognised by gvim (neXtaw version):\n" +msgstr "" +"\n" +"Ðргументи које препознаје gvim (neXtaw верзија):\n" + +msgid "" +"\n" +"Arguments recognised by gvim (Athena version):\n" +msgstr "" +"\n" +"Ðргументи које препознаје gvim (Athena верзија):\n" + +msgid "-display \tRun vim on " +msgstr "-display <диÑплеј>\tПокрени vim на <диÑплеј>" + +msgid "-iconic\t\tStart vim iconified" +msgstr "-iconic\t\tПокрени vim као икону" + +msgid "-background \tUse for the background (also: -bg)" +msgstr "-background <боја>\tКориÑти <боја> за позадину (такође: -bg)" + +msgid "-foreground \tUse for normal text (also: -fg)" +msgstr "-foreground <боја>\tКориÑти <боја> за нормални текÑÑ‚ (такође: -fg)" + +msgid "-font \t\tUse for normal text (also: -fn)" +msgstr "-font <фонт>\t\tКориÑти <фонт> за нормални текÑÑ‚ (такође: -fn)" + +msgid "-boldfont \tUse for bold text" +msgstr "-boldfont <фонт>\tКориÑти <фонт> за подебљани текÑÑ‚" + +msgid "-italicfont \tUse for italic text" +msgstr "-italicfont <фонт>\tКориÑти <фонт> за курзивни текÑÑ‚" + +msgid "-geometry \tUse for initial geometry (also: -geom)" +msgstr "-geometry <геом>\tКориÑти <геом> за почетну геометрију (такође: -geom)" + +msgid "-borderwidth \tUse a border width of (also: -bw)" +msgstr "-borderwidth <ширина>\tКориÑти оквир ширине <ширина> (такође: -bw)" + +msgid "-scrollbarwidth Use a scrollbar width of (also: -sw)" +msgstr "-scrollbarwidth <ширина> КориÑти Линију за Ñкроловање ширине <ширина> (такође: -sw)" + +msgid "-menuheight \tUse a menu bar height of (also: -mh)" +msgstr "-menuheight <ширина>\tКориÑти линију менија виÑине <виÑина> (такође: -mh)" + +msgid "-reverse\t\tUse reverse video (also: -rv)" +msgstr "-reverse\t\tКориÑти обрнути видео (такође: -rv)" + +msgid "+reverse\t\tDon't use reverse video (also: +rv)" +msgstr "+reverse\t\tÐемој да кориÑтиш обрнути видео (такође: +rv)" + +msgid "-xrm \tSet the specified resource" +msgstr "-xrm <реÑурÑ>\tПоÑтави наведени реÑурÑ" + +msgid "" +"\n" +"Arguments recognised by gvim (GTK+ version):\n" +msgstr "" +"\n" +"Ðргументи које препознаје gvim (GTK+ верзија):\n" + +msgid "-display \tRun vim on (also: --display)" +msgstr "-display <диÑплеј>\tПокрени vim на <диÑплеј> (такође: --display)" + +msgid "--role \tSet a unique role to identify the main window" +msgstr "--role <улога>\tПоÑтави јединÑтвену улогу да би Ñе идентификовао главни прозор" + +msgid "--socketid \tOpen Vim inside another GTK widget" +msgstr "--socketid \tОтвори Vim унутар другог GTK виџета" + +msgid "--echo-wid\t\tMake gvim echo the Window ID on stdout" +msgstr "--echo-wid\t\tÐека gvim иÑпише Window ID на stdout" + +msgid "-P \tOpen Vim inside parent application" +msgstr "-P <назив родитеља>\tОтвори Vim унутар родитељÑке апликације" + +msgid "--windowid \tOpen Vim inside another win32 widget" +msgstr "--windowid \tОтвори Vim унутар другог win32 виџета" + +msgid "No display" +msgstr "Ðема приказа" + +msgid ": Send failed.\n" +msgstr ": Слање није уÑпело.\n" + +msgid ": Send failed. Trying to execute locally\n" +msgstr ": Слање није уÑпело. Покушава Ñе локално извршавање\n" + +#, c-format +msgid "%d of %d edited" +msgstr "%d од %d уређено" + +msgid "No display: Send expression failed.\n" +msgstr "Ðема приказа: Израз Ñлања није уÑпео.\n" + +msgid ": Send expression failed.\n" +msgstr ": Израз Ñлања није уÑпео.\n" + +msgid "No marks set" +msgstr "Ðема поÑтављених маркера" + +#, c-format +msgid "E283: No marks matching \"%s\"" +msgstr "E283: Ðема маркера који Ñе подударају Ñа \"%s\"" + +msgid "" +"\n" +"mark line col file/text" +msgstr "" +"\n" +"линија маркера кол датотека/текÑÑ‚" + +msgid "" +"\n" +" jump line col file/text" +msgstr "" +"\n" +" линија Ñкока кол датотека/текÑÑ‚" + +msgid "" +"\n" +"change line col text" +msgstr "" +"\n" +"линија промене кол текÑÑ‚" + +msgid "" +"\n" +"# File marks:\n" +msgstr "" +"\n" +"# Маркери датотеке:\n" + +msgid "" +"\n" +"# Jumplist (newest first):\n" +msgstr "" +"\n" +"# Скок-лиÑта (прво најновији):\n" + +msgid "" +"\n" +"# History of marks within files (newest to oldest):\n" +msgstr "" +"\n" +"# ИÑторија маркера унутар датотека (ок најновијег до најÑтаријег):\n" + +msgid "Missing '>'" +msgstr "ÐедоÑтаје '>'" + +msgid "E543: Not a valid codepage" +msgstr "E543: Ðеважећа кодна Ñтрана" + +msgid "E284: Cannot set IC values" +msgstr "E284: IC вредноÑти не могу да Ñе поÑтаве" + +msgid "E285: Failed to create input context" +msgstr "E285: Креирање контекÑта уноÑа није уÑпело" + +msgid "E286: Failed to open input method" +msgstr "E286: Отварање методе уноÑа није уÑпело" + +msgid "E287: Warning: Could not set destroy callback to IM" +msgstr "E287: Упозорење: ПоÑтављање повратне функције за уништење IM није уÑпело" + +msgid "E288: input method doesn't support any style" +msgstr "E288: метод уноÑа не подржава ниједан Ñтил" + +msgid "E289: input method doesn't support my preedit type" +msgstr "E289: метод уноÑа не подржава мој preedit тип" + +msgid "E293: block was not locked" +msgstr "E293: блок није закључан" + +msgid "E294: Seek error in swap file read" +msgstr "E294: Грешка код поÑтављања показивача за читање swap датотеке" + +msgid "E295: Read error in swap file" +msgstr "E295: Грешка при читању swap датотеке" + +msgid "E296: Seek error in swap file write" +msgstr "E296: Грешка код поÑтављања показивача за ÑƒÐ¿Ð¸Ñ swap датотеке" + +msgid "E297: Write error in swap file" +msgstr "E297: Грешка при упиÑу swap датотеке" + +msgid "E300: Swap file already exists (symlink attack?)" +msgstr "E300: Swap датотека већ поÑтоји (symlink напад?)" + +msgid "E298: Didn't get block nr 0?" +msgstr "E298: Блок бр 0 није добављен?" + +msgid "E298: Didn't get block nr 1?" +msgstr "E298: Блок бр 1 није добављен?" + +msgid "E298: Didn't get block nr 2?" +msgstr "E298: Блок бр 2 није добављен?" + +msgid "E843: Error while updating swap file crypt" +msgstr "E843: Грешка приликом оÑважавања криптовања swap датотеке" + +msgid "E301: Oops, lost the swap file!!!" +msgstr "E301: УупÑ, swap датотека је изгубљена!!!" + +msgid "E302: Could not rename swap file" +msgstr "E302: Промена имена swap датотеке није уÑпела" + +#, c-format +msgid "E303: Unable to open swap file for \"%s\", recovery impossible" +msgstr "E303: Отварање swap датотеке за \"%s\" није уÑпело, опоравак је немогућ" + +msgid "E304: ml_upd_block0(): Didn't get block 0??" +msgstr "E304: ml_upd_block0(): Блок бр 0 није добављен??" + +#, c-format +msgid "E305: No swap file found for %s" +msgstr "E305: За %s није пронађена swap датотека" + +msgid "Enter number of swap file to use (0 to quit): " +msgstr "УнеÑите број swap датотеке која ће да Ñе кориÑти (0 за отказивање): " + +#, c-format +msgid "E306: Cannot open %s" +msgstr "E306: %s не може да Ñе отвори" + +msgid "Unable to read block 0 from " +msgstr "Ðије могуће литање блока 0 из " + +msgid "" +"\n" +"Maybe no changes were made or Vim did not update the swap file." +msgstr "" +"\n" +"Можда ниÑу направљене никакве измене или Vim није оÑвежио swap датотеку." + +msgid " cannot be used with this version of Vim.\n" +msgstr " не може да Ñе кориÑти Ñа овом верзијом Vim-а.\n" + +msgid "Use Vim version 3.0.\n" +msgstr "КориÑтите Vim верзијe 3.0.\n" + +#, c-format +msgid "E307: %s does not look like a Vim swap file" +msgstr "E307: %s не изгледа као Vim swap датотека" + +msgid " cannot be used on this computer.\n" +msgstr " не може да Ñе кориÑти на овом компјутеру.\n" + +msgid "The file was created on " +msgstr "Ова датотека је креирана Ñа " + +msgid "" +",\n" +"or the file has been damaged." +msgstr "" +",\n" +"или је датотека оштећена." + +#, c-format +msgid "" +"E833: %s is encrypted and this version of Vim does not support encryption" +msgstr "" +"E833: %s је шифрована и ова верзија Vim-а не подржава шифровање" + +msgid " has been damaged (page size is smaller than minimum value).\n" +msgstr " је оштећена (величина Ñтранице је маља од минималне вредноÑти).\n" + +#, c-format +msgid "Using swap file \"%s\"" +msgstr "КориÑти Ñе swap датотека \"%s\"" + +#, c-format +msgid "Original file \"%s\"" +msgstr "Оригинална датотека \"%s\"" + +msgid "E308: Warning: Original file may have been changed" +msgstr "E308: Упозорење: Можда је промењена оригинална датотека" + +#, c-format +msgid "Swap file is encrypted: \"%s\"" +msgstr "Swap датотека је шифрована: \"%s\"" + +msgid "" +"\n" +"If you entered a new crypt key but did not write the text file," +msgstr "" +"\n" +"Ðко Ñте унели нов кључ за шифрирање али ниÑте упиÑали текÑÑ‚ датотеку," + +msgid "" +"\n" +"enter the new crypt key." +msgstr "" +"\n" +"унеÑите нови кључ за шифрирање." + +msgid "" +"\n" +"If you wrote the text file after changing the crypt key press enter" +msgstr "" +"\n" +"Ðко Ñте упиÑали текÑÑ‚ датотеку на диÑк након промене кључа за шифрирање притиÑните ентер" + +msgid "" +"\n" +"to use the same key for text file and swap file" +msgstr "" +"\n" +"да биÑте кориÑтили иÑти кључ за текÑÑ‚ датотеку и swap датотеку" + +#, c-format +msgid "E309: Unable to read block 1 from %s" +msgstr "E309: Блок 1 из %s не може да Ñе прочита" + +msgid "???MANY LINES MISSING" +msgstr "??ÐЕДОСТÐЈЕ ÐœÐОГО ЛИÐИЈÐ" + +msgid "???LINE COUNT WRONG" +msgstr "???БРОЈ ЛИÐИЈРЈЕ ПОГРЕШÐÐ" + +msgid "???EMPTY BLOCK" +msgstr "???ПРÐЗÐРБЛОК" + +msgid "???LINES MISSING" +msgstr "???ÐЕДОСТÐЈУ ЛИÐИЈЕ" + +#, c-format +msgid "E310: Block 1 ID wrong (%s not a .swp file?)" +msgstr "E310: ID блока 1 је погрешан (%s није .swp датотека?)" + +msgid "???BLOCK MISSING" +msgstr "???ÐЕДОСТÐЈЕ БЛОК" + +msgid "??? from here until ???END lines may be messed up" +msgstr "??? одавде па до ???КРÐЈ линије Ñу можда забрљане" + +msgid "??? from here until ???END lines may have been inserted/deleted" +msgstr "??? одавде па до ???КРÐЈ линије Ñу можда уметане/бриÑане" + +msgid "???END" +msgstr "???КРÐЈ" + +msgid "E311: Recovery Interrupted" +msgstr "E311: Опоравак је прекинут" + +msgid "" +"E312: Errors detected while recovering; look for lines starting with ???" +msgstr "" +"E312: Откривене Ñу грешке приликом опоравка; потражите линије које почињу Ñа ???" + +msgid "See \":help E312\" for more information." +msgstr "Погледајте \":help E312\" за више информација." + +msgid "Recovery completed. You should check if everything is OK." +msgstr "Опоравак је завршен. Требало би да проверите да ли је Ñве OK." + +msgid "" +"\n" +"(You might want to write out this file under another name\n" +msgstr "" +"\n" +"(Можда биÑте хтели да запишете ову датотеку под другим именом\n" + +msgid "and run diff with the original file to check for changes)" +msgstr "и покренете diff Ñа оригиналном датотеком да провелите има ли измена)" + +msgid "Recovery completed. Buffer contents equals file contents." +msgstr "Опоравак је завршен. Садржај бафера је иÑтоветан Ñадржају датотеке." + +msgid "" +"\n" +"You may want to delete the .swp file now.\n" +"\n" +msgstr "" +"\n" +"Сада можда желите да обришете .swp датотеку.\n" +"\n" + +msgid "Using crypt key from swap file for the text file.\n" +msgstr "За текÑÑ‚ датотеку Ñе кориÑти кључ за шифрирање из swap датотеке.\n" + +msgid "Swap files found:" +msgstr "Пронађене Ñу swap датотеке:" + +msgid " In current directory:\n" +msgstr " У текућем директоријуму:\n" + +msgid " Using specified name:\n" +msgstr " КориÑтећи наведено име:\n" + +msgid " In directory " +msgstr " У директоријуму " + +msgid " -- none --\n" +msgstr " -- ниједна --\n" + +msgid " owned by: " +msgstr " које поÑедује: " + +msgid " dated: " +msgstr " датиране: " + +msgid " dated: " +msgstr " датиране: " + +msgid " [from Vim version 3.0]" +msgstr " [од Vim верзије 3.0]" + +msgid " [does not look like a Vim swap file]" +msgstr " [не изгледа као Vim swap датотека]" + +msgid " file name: " +msgstr " име датотеке: " + +msgid "" +"\n" +" modified: " +msgstr "" +"\n" +" измењено: " + +msgid "YES" +msgstr "ДÐ" + +msgid "no" +msgstr "не" + +msgid "" +"\n" +" user name: " +msgstr "" +"\n" +" кориÑничко име: " + +msgid " host name: " +msgstr " име хоÑта: " + +msgid "" +"\n" +" host name: " +msgstr "" +"\n" +" име хоÑта: " + +msgid "" +"\n" +" process ID: " +msgstr "" +"\n" +" ИД процеÑа: " + +msgid " (still running)" +msgstr " (још Ñе извршава)" + +msgid "" +"\n" +" [not usable with this version of Vim]" +msgstr "" +"\n" +" [није употребљива Ñа овом верзијом Vim-а]" + +msgid "" +"\n" +" [not usable on this computer]" +msgstr "" +"\n" +" [није употребљива на овом компјутеру]" + +msgid " [cannot be read]" +msgstr " [не може да Ñе прочита]" + +msgid " [cannot be opened]" +msgstr " [не може да Ñе отвори]" + +msgid "E313: Cannot preserve, there is no swap file" +msgstr "E313: Ðе може да Ñе презервира, нема swap датотеке" + +msgid "File preserved" +msgstr "Датотека је презервирана" + +msgid "E314: Preserve failed" +msgstr "E314: Презервација није уÑпела" + +#, c-format +msgid "E315: ml_get: invalid lnum: %ld" +msgstr "E315: ml_get: неиÑправан lnum: %ld" + +#, c-format +msgid "E316: ml_get: cannot find line %ld" +msgstr "E316: ml_get: линија %ld не може да Ñе пронађе" + +msgid "E317: pointer block id wrong 3" +msgstr "E317: ид показивача блока је погрешан 3" + +msgid "stack_idx should be 0" +msgstr "stack_idx би требало да је 0" + +msgid "E318: Updated too many blocks?" +msgstr "E318: ОÑвежено превише блокова?" + +msgid "E317: pointer block id wrong 4" +msgstr "E317: ид показивача блока је погрешан 4" + +msgid "deleted block 1?" +msgstr "блок 1 обриÑан?" + +#, c-format +msgid "E320: Cannot find line %ld" +msgstr "E320: Линија %ld не може да Ñе пронађе" + +msgid "E317: pointer block id wrong" +msgstr "E317: ид показивача блока је погрешан" + +msgid "pe_line_count is zero" +msgstr "pe_line_count је нула" + +#, c-format +msgid "E322: line number out of range: %ld past the end" +msgstr "E322: број линије је ван опÑега: %ld иза краја" + +#, c-format +msgid "E323: line count wrong in block %ld" +msgstr "E323: број линија је погрешан у блоку %ld" + +msgid "Stack size increases" +msgstr "Величина Ñтека Ñе повећава" + +msgid "E317: pointer block id wrong 2" +msgstr "E317: ид показивача блока је погрешан 2" + +#, c-format +msgid "E773: Symlink loop for \"%s\"" +msgstr "E773: Symlink петља за \"%s\"" + +msgid "E325: ATTENTION" +msgstr "E325: ПÐЖЊÐ" + +msgid "" +"\n" +"Found a swap file by the name \"" +msgstr "" +"\n" +"Пронађена је swap датотека под именом \"" + +msgid "While opening file \"" +msgstr "Док Ñе отварала датотекa \"" + +msgid " NEWER than swap file!\n" +msgstr " ÐОВИЈРод swap датотеке!\n" + +msgid "" +"\n" +"(1) Another program may be editing the same file. If this is the case,\n" +" be careful not to end up with two different instances of the same\n" +" file when making changes. Quit, or continue with caution.\n" +msgstr "" +"\n" +"(1) Можда други програм уређује иÑту датотеку. Ðко је ово Ñлучај,\n" +" кад правите измене, пазите да не завршите Ñа две различите\n" +" инÑтанце иÑте датотеке. Изађите, или опрезно наÑтавите.\n" + +msgid "(2) An edit session for this file crashed.\n" +msgstr "(2) СеÑија уређивања ове датотеке Ñе Ñрушила.\n" + +msgid " If this is the case, use \":recover\" or \"vim -r " +msgstr " Ðко је ово Ñлучај, кориÑтите \":recover\" или \"vim -r " + +msgid "" +"\"\n" +" to recover the changes (see \":help recovery\").\n" +msgstr "" +"\"\n" +" да опоравите измене (погледајте \":help recovery\").\n" + +msgid " If you did this already, delete the swap file \"" +msgstr " Ðко Ñте ово већ учинили, обришите swap датотеку \"" + +msgid "" +"\"\n" +" to avoid this message.\n" +msgstr "" +"\"\n" +" како би избегли ову поруку.\n" + +msgid "Swap file \"" +msgstr "Swap датотека \"" + +msgid "\" already exists!" +msgstr "\" већ поÑтоји!" + +msgid "VIM - ATTENTION" +msgstr "VIM - ПÐЖЊÐ" + +msgid "Swap file already exists!" +msgstr "Swap датотека већ поÑтоји!" + +msgid "" +"&Open Read-Only\n" +"&Edit anyway\n" +"&Recover\n" +"&Quit\n" +"&Abort" +msgstr "" +"Отвори &Само за читање\n" +"Ипак &Уређуј\n" +"&Опорави\n" +"&Изађи\n" +"&Прекини" + +msgid "" +"&Open Read-Only\n" +"&Edit anyway\n" +"&Recover\n" +"&Delete it\n" +"&Quit\n" +"&Abort" +msgstr "" +"Отвори &Само за читање\n" +"Ипак &Уређуј\n" +"&Опорави\n" +"&Изађи\n" +"&Прекини" + +msgid "E326: Too many swap files found" +msgstr "E326: Пронађено је превише swap датотека" + +msgid "E327: Part of menu-item path is not sub-menu" +msgstr "E327: Део путање Ñтавке менија није подмени" + +msgid "E328: Menu only exists in another mode" +msgstr "E328: Мени поÑтоји Ñамо у другом режиму" + +#, c-format +msgid "E329: No menu \"%s\"" +msgstr "E329: Ðема менија \"%s\"" + +msgid "E792: Empty menu name" +msgstr "E792: Празно име менија" + +msgid "E330: Menu path must not lead to a sub-menu" +msgstr "E330: Путања менија не Ñме да води у подмени" + +msgid "E331: Must not add menu items directly to menu bar" +msgstr "E331: Ставке менија не Ñмеју да Ñе додају директно у линију менија" + +msgid "E332: Separator cannot be part of a menu path" +msgstr "E332: Сепаратор не може да буде део путање менија" + +msgid "" +"\n" +"--- Menus ---" +msgstr "" +"\n" +"--- Менији ---" + +msgid "Tear off this menu" +msgstr "Отцепи овај мени" + +#, c-format +msgid "E335: Menu not defined for %s mode" +msgstr "E335: Мени није дефиниÑан за %s Ñ€eжим" + +msgid "E333: Menu path must lead to a menu item" +msgstr "E333: Путања менија мора да води у Ñтавку менија" + +#, c-format +msgid "E334: Menu not found: %s" +msgstr "E334: Мени није пронађен: %s" + +msgid "E336: Menu path must lead to a sub-menu" +msgstr "E336: Путања менија мора да води у подмени" + +msgid "E337: Menu not found - check menu names" +msgstr "E337: Мени није пронађен - проверите имена менија" + +#, c-format +msgid "Error detected while processing %s:" +msgstr "Откривена је грешка током обраде %s:" + +#, c-format +msgid "line %4ld:" +msgstr "линија %4ld:" + +#, c-format +msgid "E354: Invalid register name: '%s'" +msgstr "E354: ÐеиÑправно име региÑтра: '%s'" + +msgid "Messages maintainer: Bram Moolenaar " +msgstr "Поруке одржава: Иван Пешић " + +msgid "Interrupt: " +msgstr "Прекид: " + +msgid "Press ENTER or type command to continue" +msgstr "Да биÑте наÑтавили, притиÑните ЕÐТЕР или откуцајте команду" + +#, c-format +msgid "%s line %ld" +msgstr "%s линија %ld" + +msgid "-- More --" +msgstr "-- Још --" + +msgid " SPACE/d/j: screen/page/line down, b/u/k: up, q: quit " +msgstr " РÐЗМÐКÐИЦÐ/d/j: екран/Ñтрана/линија наниже, b/u/k: навише, q: излаз " + +msgid "Question" +msgstr "Питање" + +msgid "" +"&Yes\n" +"&No" +msgstr "" +"&Да\n" +"&Ðе" + +msgid "" +"&Yes\n" +"&No\n" +"Save &All\n" +"&Discard All\n" +"&Cancel" +msgstr "" +"&Да\n" +"&Ðе\n" +"Сачувај &Све\n" +"о&Дбаци Ñве\n" +"&Откажи" + +msgid "Select Directory dialog" +msgstr "Дијалог избора директоријума" + +msgid "Save File dialog" +msgstr "Дијалог чувања датотеке" + +msgid "Open File dialog" +msgstr "Дијалог отварања датотеке" + +msgid "E338: Sorry, no file browser in console mode" +msgstr "E338: Жао нам је, нема претраживача датотека у конзолном режиму" + +msgid "E766: Insufficient arguments for printf()" +msgstr "E766: Ðедовољно аргумената за printf()" + +msgid "E807: Expected Float argument for printf()" +msgstr "E807: Очекује Ñе Float аргумент за printf()" + +msgid "E767: Too many arguments to printf()" +msgstr "E767: Сувише аргумената за printf()" + +msgid "W10: Warning: Changing a readonly file" +msgstr "W10: Упозорење: Мења Ñе датотека која може Ñамо да Ñе чита" + +msgid "Type number and or click with mouse (empty cancels): " +msgstr "УнеÑите број и или кликните мишем (ништа за отказ): " + +msgid "Type number and (empty cancels): " +msgstr "УнеÑите број и (ништа за отказ): " + +msgid "1 more line" +msgstr "1 линија више" + +msgid "1 line less" +msgstr "1 линија мање" + +#, c-format +msgid "%ld more lines" +msgstr "%ld линија више" + +#, c-format +msgid "%ld fewer lines" +msgstr "%ld линија мање" + +msgid " (Interrupted)" +msgstr " (Прекинуто)" + +msgid "Beep!" +msgstr "Биип!" + +msgid "ERROR: " +msgstr "ГРЕШКÐ: " + +#, c-format +msgid "" +"\n" +"[bytes] total alloc-freed %lu-%lu, in use %lu, peak use %lu\n" +msgstr "" +"\n" +"[бајтова] укупно алоц-оÑлоб %lu-%lu, у употр %lu, вршна употр %lu\n" + +#, c-format +msgid "" +"[calls] total re/malloc()'s %lu, total free()'s %lu\n" +"\n" +msgstr "" +"[позива] укупно re/malloc()-а %lu, укупно free()-ова %lu\n" +"\n" + +msgid "E340: Line is becoming too long" +msgstr "E340: Линија поÑтаје предугачка" + +#, c-format +msgid "E341: Internal error: lalloc(%ld, )" +msgstr "E341: Интерна грешка: lalloc(%ld, )" + +#, c-format +msgid "E342: Out of memory! (allocating %lu bytes)" +msgstr "E342: Ðема више меморије! (код алокације %lu бајтова)" + +#, c-format +msgid "Calling shell to execute: \"%s\"" +msgstr "Позива Ñе командно окружење да изврши: \"%s\"" + +msgid "E545: Missing colon" +msgstr "E545: ÐедоÑтаје двотачка" + +msgid "E546: Illegal mode" +msgstr "E546: Ðедозвољени режим" + +msgid "E547: Illegal mouseshape" +msgstr "E547: Ðедозвољени mouseshape" + +msgid "E548: digit expected" +msgstr "E548: очекује Ñе цифра" + +msgid "E549: Illegal percentage" +msgstr "E549: Ðедозвољени проценат" + +msgid "E854: path too long for completion" +msgstr "E854: путања је Ñувише дугачка да би Ñе довршила" + +#, c-format +msgid "" +"E343: Invalid path: '**[number]' must be at the end of the path or be " +"followed by '%s'." +msgstr "" +"E343: ÐеиÑправна путања: '**[број]' мора бити на крају путање или да " +"иза њега Ñледи '%s'." + +#, c-format +msgid "E344: Can't find directory \"%s\" in cdpath" +msgstr "E344: Директоријум \"%s\" не може да Ñе пронађе у cdpath" + +#, c-format +msgid "E345: Can't find file \"%s\" in path" +msgstr "E345: Датотека \"%s\" не може да Ñе пронађе у path" + +#, c-format +msgid "E346: No more directory \"%s\" found in cdpath" +msgstr "E346: Директоријум \"%s\" више не може да Ñе пронађе у cdpath" + +#, c-format +msgid "E347: No more file \"%s\" found in path" +msgstr "E347: Датотека \"%s\" више не може да Ñе пронађе у path" + +#, c-format +msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" +msgstr "E668: Погрешан режим приÑтупа за инфо датотеку NetBeans везе: \"%s\"" + +#, c-format +msgid "E658: NetBeans connection lost for buffer %ld" +msgstr "E658: NetBeans веза је изгубљена за бафер %ld" + +msgid "E838: netbeans is not supported with this GUI" +msgstr "E838: netbeans није подржан Ñа овим GUI" + +msgid "E511: netbeans already connected" +msgstr "E511: netbeans је већ повезан" + +#, c-format +msgid "E505: %s is read-only (add ! to override)" +msgstr "E505: %s је Ñамо за читање (додајте ! за премошћавање)" + +msgid "E349: No identifier under cursor" +msgstr "E349: Под курÑором није идентификатор" + +msgid "E774: 'operatorfunc' is empty" +msgstr "E774: 'operatorfunc' је празна" + +msgid "E775: Eval feature not available" +msgstr "E775: Eval могућноÑÑ‚ није доÑтупна" + +msgid "Warning: terminal cannot highlight" +msgstr "Упозорење: терминал не може да иÑтакне текÑÑ‚" + +msgid "E348: No string under cursor" +msgstr "E348: Под курÑором нема Ñтринга" + +msgid "E352: Cannot erase folds with current 'foldmethod'" +msgstr "E352: Са текућим 'foldmethod' не могу да Ñе обришу Ñклапања" + +msgid "E664: changelist is empty" +msgstr "E664: лиÑта промена је празна" + +msgid "E662: At start of changelist" +msgstr "E662: Ðа почетку лиÑте промена" + +msgid "E663: At end of changelist" +msgstr "E663: Ðа крају лиÑте промена" + +msgid "Type :qa! and press to abandon all changes and exit Vim" +msgstr "Откуцајте :qa! и притиÑните <Ентер> да одбаците Ñве измене и напуÑтите Vim" + +#, c-format +msgid "1 line %sed 1 time" +msgstr "1 линија %sрана 1 пут" + +#, c-format +msgid "1 line %sed %d times" +msgstr "1 линија %sрана %d пута" + +#, c-format +msgid "%ld lines %sed 1 time" +msgstr "%ld линија %sрано 1 пут" + +#, c-format +msgid "%ld lines %sed %d times" +msgstr "%ld линија %sрано %d пута" + +#, c-format +msgid "%ld lines to indent... " +msgstr "%ld за увлачење... " + +msgid "1 line indented " +msgstr "1 линија увучена " + +#, c-format +msgid "%ld lines indented " +msgstr "%ld инија увучено " + +msgid "E748: No previously used register" +msgstr "E748: Ðема претходно коришћеног региÑтра" + +msgid "cannot yank; delete anyway" +msgstr "не може да Ñе тргне; ипак обриÑати" + +msgid "1 line changed" +msgstr "1 линија је промењена" + +#, c-format +msgid "%ld lines changed" +msgstr "%ld линија је промењено" + +#, c-format +msgid "freeing %ld lines" +msgstr "оÑлобађа Ñе %ld линија" + +#, c-format +msgid " into \"%c" +msgstr " у \"%c" + +#, c-format +msgid "block of 1 line yanked%s" +msgstr "блок од 1 линије је тргнут%s" + +#, c-format +msgid "1 line yanked%s" +msgstr "1 линија је тргнута%s" + +#, c-format +msgid "block of %ld lines yanked%s" +msgstr "блок од %ld линија је тргнут%s" + +#, c-format +msgid "%ld lines yanked%s" +msgstr "%ld линија је тргнуто%s" + +#, c-format +msgid "E353: Nothing in register %s" +msgstr "E353: РегиÑтар %s је празан" + +msgid "" +"\n" +"--- Registers ---" +msgstr "" +"\n" +"--- РегиÑтри ---" + +msgid "Illegal register name" +msgstr "Ðеважеће име региÑтра" + +msgid "" +"\n" +"# Registers:\n" +msgstr "" +"\n" +"# РегиÑтри:\n" + +#, c-format +msgid "E574: Unknown register type %d" +msgstr "E574: Ðепознат тип региÑтра %d" + +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: региÑтар за шаблон претраге и израз не може да Ñадржи две или више " +"линија" + +#, c-format +msgid "%ld Cols; " +msgstr "%ld Кол; " + +#, c-format +msgid "Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes" +msgstr "Изабрано %s%ld од %ld Линија; %lld од %lld Речи; %lld од %lld Бајтова" + +#, c-format +msgid "" +"Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of " +"%lld Bytes" +msgstr "" +"Изабрано %s%ld од %ld Линија; %lld од %lld Речи; %lld од %lld Знака; %lld од " +"%lld Бајтова" + +#, c-format +msgid "Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld" +msgstr "Кол %s од %s; Линија %ld од %ld; Реч %lld од %lld; Бајт %lld од %lld" + +#, c-format +msgid "" +"Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte %" +"lld of %lld" +msgstr "" +"Кол %s од %s; Линија %ld од %ld; Реч %lld од %lld; Знак %lld од %lld; Бајт %" +"lld од %lld" + +#, c-format +msgid "(+%ld for BOM)" +msgstr "(+%ld за BOM)" + +msgid "Thanks for flying Vim" +msgstr "Хвала што летите Ñа Vim" + +msgid "E518: Unknown option" +msgstr "E518: Ðепозната опција" + +msgid "E519: Option not supported" +msgstr "E519: Опција није подржана" + +msgid "E520: Not allowed in a modeline" +msgstr "E520: Ðије довољено у режимÑкој линији" + +msgid "E846: Key code not set" +msgstr "E846: Ðије поÑтављрн код таÑтера" + +msgid "E521: Number required after =" +msgstr "E521: Потребан је број након =" + +msgid "E522: Not found in termcap" +msgstr "E522: Ðије пронађено у termcap" + +#, c-format +msgid "E539: Illegal character <%s>" +msgstr "E539: Ðедозвољен карактер <%s>" + +#, c-format +msgid "For option %s" +msgstr "За опцију %s" + +msgid "E529: Cannot set 'term' to empty string" +msgstr "E529: 'term' не може да Ñе поÑтави на празан Ñтринг" + +msgid "E530: Cannot change term in GUI" +msgstr "E530: term не може да Ñе промени из GUI" + +msgid "E531: Use \":gui\" to start the GUI" +msgstr "E531: КориÑтите \":gui\" да покренете GUI" + +msgid "E589: 'backupext' and 'patchmode' are equal" +msgstr "E589: 'backupext' и 'patchmode' Ñу иÑтоветни" + +msgid "E834: Conflicts with value of 'listchars'" +msgstr "E834: У конфликту Ñа вредношћу 'listchars'" + +msgid "E835: Conflicts with value of 'fillchars'" +msgstr "E835: У конфликту Ñа вредношћу 'fillchars'" + +msgid "E617: Cannot be changed in the GTK+ 2 GUI" +msgstr "E617: Ðе може да Ñе промени у GTK+ 2 GUI" + +#, c-format +msgid "E950: Cannot convert between %s and %s" +msgstr "E950: Ðе може да Ñе конвертује између %s и %s" + +msgid "E524: Missing colon" +msgstr "E524: ÐедоÑтаје двотачка" + +msgid "E525: Zero length string" +msgstr "E525: Стринг дужине нула" + +#, c-format +msgid "E526: Missing number after <%s>" +msgstr "E526: ÐедоÑтаје број након <%s>" + +msgid "E527: Missing comma" +msgstr "E527: ÐедоÑтаје зарез" + +msgid "E528: Must specify a ' value" +msgstr "E528: Мора да Ñе наведе ' вредноÑÑ‚" + +msgid "E595: contains unprintable or wide character" +msgstr "E595: Ñадржи карактер који не може да Ñе одштампа, или широки карактер" + +msgid "E596: Invalid font(s)" +msgstr "E596: ÐеиÑправни фонт(ови)" + +msgid "E597: can't select fontset" +msgstr "E597: fontset не може да Ñе изабере" + +msgid "E598: Invalid fontset" +msgstr "E598: ÐеиÑправан fontset" + +msgid "E533: can't select wide font" +msgstr "E533: широки фонт не може да Ñе изабере" + +msgid "E534: Invalid wide font" +msgstr "E534: ÐеиÑправан широки фонт" + +#, c-format +msgid "E535: Illegal character after <%c>" +msgstr "E535: Ðеважећи карактер након <%c>" + +msgid "E536: comma required" +msgstr "E536: потребан зарез" + +#, c-format +msgid "E537: 'commentstring' must be empty or contain %s" +msgstr "E537: 'commentstring' мора бити празно или да Ñадржи %s" + +msgid "E538: No mouse support" +msgstr "E538: Ðема подршке за миша" + +msgid "E540: Unclosed expression sequence" +msgstr "E540: Ðиз израза није затворен" + +msgid "E541: too many items" +msgstr "E541: превише Ñтавки" + +msgid "E542: unbalanced groups" +msgstr "E542: неуравнотежене групе" + +msgid "E946: Cannot make a terminal with running job modifiable" +msgstr "E946: Терминал Ñа задатком који Ñе извршава не може да Ñе учини измењивим" + +msgid "E590: A preview window already exists" +msgstr "E590: Прозор за преглед већ поÑтоји" + +msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" +msgstr "W17: ÐрапÑки захтева UTF-8, извршите ':set encoding=utf-8'" + +#, c-format +msgid "E593: Need at least %d lines" +msgstr "E593: Потребно је најмање %d линија" + +#, c-format +msgid "E594: Need at least %d columns" +msgstr "E594: Потребно је најмање %d колона" + +#, c-format +msgid "E355: Unknown option: %s" +msgstr "E355: Ðепозната опција: %s" + +#, c-format +msgid "E521: Number required: &%s = '%s'" +msgstr "E521: Захтева Ñе број: &%s = '%s'" + +msgid "" +"\n" +"--- Terminal codes ---" +msgstr "" +"\n" +"--- Кодови терминала ---" + +msgid "" +"\n" +"--- Global option values ---" +msgstr "" +"\n" +"--- ВредноÑти глобалних опција ---" + +msgid "" +"\n" +"--- Local option values ---" +msgstr "" +"\n" +"--- ВредноÑти локалних опција ---" + +msgid "" +"\n" +"--- Options ---" +msgstr "" +"\n" +"--- Опције ---" + +msgid "E356: get_varp ERROR" +msgstr "E356: get_varp ГРЕШКÐ" + +#, c-format +msgid "E357: 'langmap': Matching character missing for %s" +msgstr "E357: 'langmap': ÐедоÑтаје одговарајући карактер за %s" + +#, c-format +msgid "E358: 'langmap': Extra characters after semicolon: %s" +msgstr "E358: 'langmap': Има још карактера након тачказареза: %s" + +msgid "cannot open " +msgstr "не може да Ñе отвори " + +msgid "VIM: Can't open window!\n" +msgstr "VIM: Прозор не може да Ñе отвори!\n" + +msgid "Need Amigados version 2.04 or later\n" +msgstr "Потребан је Amigados верзија 2.04 или каÑнији\n" + +#, c-format +msgid "Need %s version %ld\n" +msgstr "Потребан је %s верзија %ld\n" + +msgid "Cannot open NIL:\n" +msgstr "Ðе може да Ñе отвори NIL:\n" + +msgid "Cannot create " +msgstr "Ðе може да Ñе креира " + +#, c-format +msgid "Vim exiting with %d\n" +msgstr "Vim излази Ñа %d\n" + +msgid "cannot change console mode ?!\n" +msgstr "конзолни режим не може да Ñе промени ?!\n" + +msgid "mch_get_shellsize: not a console??\n" +msgstr "mch_get_shellsize: није конзола??\n" + +msgid "E360: Cannot execute shell with -f option" +msgstr "E360: Командно окружење не може да Ñе изврши Ñа -f опцијом" + +msgid "Cannot execute " +msgstr "Ðе може да Ñе изврши " + +msgid "shell " +msgstr "командно окружење " + +msgid " returned\n" +msgstr " вратило\n" + +msgid "ANCHOR_BUF_SIZE too small." +msgstr "ANCHOR_BUF_SIZE Ñувише мали." + +msgid "I/O ERROR" +msgstr "У/И ГРЕШКÐ" + +msgid "Message" +msgstr "Порука" + +msgid "E237: Printer selection failed" +msgstr "E237: Избор штампача није уÑпео" + +#, c-format +msgid "to %s on %s" +msgstr "у %s на %s" + +#, c-format +msgid "E613: Unknown printer font: %s" +msgstr "E613: Ðепознат фонт штампача: %s" + +#, c-format +msgid "E238: Print error: %s" +msgstr "E238: Грешка код штампања: %s" + +#, c-format +msgid "Printing '%s'" +msgstr "Штампа Ñе '%s'" + +#, c-format +msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" +msgstr "E244: Ðедозвољено име Ñета карактера \"%s\" у имену фонту \"%s\"" + +#, c-format +msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +msgstr "E244: Ðедозвољено име варијанте \"%s\" у имену фонту \"%s\"" + +#, c-format +msgid "E245: Illegal char '%c' in font name \"%s\"" +msgstr "E245: ÐеиÑправан карактер '%c' у имену фонта \"%s\"" + +#, c-format +msgid "Opening the X display took %ld msec" +msgstr "Отварање X приказа је трајало %ld мÑек" + +msgid "" +"\n" +"Vim: Got X error\n" +msgstr "" +"\n" +"Vim: Дошло је до X грешке\n" + +msgid "Testing the X display failed" +msgstr "ТеÑтирање X приказа није уÑпело" + +msgid "Opening the X display timed out" +msgstr "ИÑтекло је макÑимално време за отварање X приказа" + +msgid "" +"\n" +"Could not get security context for " +msgstr "" +"\n" +"Ðије могао да Ñе очита безбедноÑни контекÑÑ‚ за " + +msgid "" +"\n" +"Could not set security context for " +msgstr "" +"\n" +"Ðије могао да Ñе поÑтави безбедноÑни контекÑÑ‚ за " + +#, c-format +msgid "Could not set security context %s for %s" +msgstr "БезбедноÑни контекÑÑ‚ %s за %s није могао да Ñе поÑтави" + +#, c-format +msgid "Could not get security context %s for %s. Removing it!" +msgstr "БезбедноÑни контекÑÑ‚ %s за %s није могао да Ñе очита. Уклања Ñе!" + +msgid "" +"\n" +"Cannot execute shell sh\n" +msgstr "" +"\n" +"Командно окружење sh не може да Ñе изврши\n" + +msgid "" +"\n" +"shell returned " +msgstr "" +"\n" +"командно окружење је вратило " + +msgid "" +"\n" +"Cannot create pipes\n" +msgstr "" +"\n" +"Токови података не могу да Ñе креирају\n" + +msgid "" +"\n" +"Cannot fork\n" +msgstr "" +"\n" +"Рачвање није могуће\n" + +msgid "" +"\n" +"Cannot execute shell " +msgstr "" +"\n" +"Командно окружење не може да Ñе изврши " + +msgid "" +"\n" +"Command terminated\n" +msgstr "" +"\n" +"Команда је прекинута\n" + +msgid "XSMP lost ICE connection" +msgstr "XSMP је изгубио ICE везу" + +#, c-format +msgid "dlerror = \"%s\"" +msgstr "dlerror = \"%s\"" + +msgid "Opening the X display failed" +msgstr "Отварање X приказа није уÑпело" + +msgid "XSMP handling save-yourself request" +msgstr "XSMP опÑлужује Ñачувај-Ñе захтев" + +msgid "XSMP opening connection" +msgstr "XSMP отвара везу" + +msgid "XSMP ICE connection watch failed" +msgstr "XSMP ICE надгледање везе није уÑпело" + +#, c-format +msgid "XSMP SmcOpenConnection failed: %s" +msgstr "XSMP SmcOpenConnection није уÑпело: %s" + +msgid "At line" +msgstr "Код линије" + +msgid "Could not load vim32.dll!" +msgstr "vim32.dll није могла да Ñе учита!" + +msgid "VIM Error" +msgstr "VIM Грешка" + +msgid "Could not fix up function pointers to the DLL!" +msgstr "Показивачи на функције у DLL-у ниÑу могли да Ñе поправе!" + +#, c-format +msgid "Vim: Caught %s event\n" +msgstr "Vim: Ухваћен је %s догађај\n" + +msgid "close" +msgstr "затварање" + +msgid "logoff" +msgstr "одјављивање" + +msgid "shutdown" +msgstr "иÑкључивање" + +msgid "E371: Command not found" +msgstr "E371: Команда није пронађена" + +msgid "" +"VIMRUN.EXE not found in your $PATH.\n" +"External commands will not pause after completion.\n" +"See :help win32-vimrun for more information." +msgstr "" +"VIMRUN.EXE није пронађен у вашем $PATH.\n" +"ЕкÑтерне команде неће моћи да Ñе паузирају након завршетка.\n" +"Погледајте :help win32-vimrun за више информација." + +msgid "Vim Warning" +msgstr "Vim Упозорење" + +#, c-format +msgid "shell returned %d" +msgstr "командно окружење је вратило %d" + +#, c-format +msgid "E372: Too many %%%c in format string" +msgstr "E372: Превише %%%c Ñтрингу формата" + +#, c-format +msgid "E373: Unexpected %%%c in format string" +msgstr "E373: Ðеочекивано %%%c Ñтрингу формата" + +msgid "E374: Missing ] in format string" +msgstr "E374: ÐедоÑтаје ] у Ñтрингу формата" + +#, c-format +msgid "E375: Unsupported %%%c in format string" +msgstr "E375: Ðеподржано %%%c у Ñтрингу формата" + +#, c-format +msgid "E376: Invalid %%%c in format string prefix" +msgstr "E376: Ðеважеће %%%c у префикÑу Ñтринга формата" + +#, c-format +msgid "E377: Invalid %%%c in format string" +msgstr "E377: Ðеважеће %%%c у Ñтрингу формата" + +msgid "E378: 'errorformat' contains no pattern" +msgstr "E378: 'errorformat' не Ñадржи шаблон" + +msgid "E379: Missing or empty directory name" +msgstr "E379: Име директоријума недоÑтаје или је празно" + +msgid "E553: No more items" +msgstr "E553: Ðема више Ñтавки" + +msgid "E924: Current window was closed" +msgstr "E924: Текући прозор је затворен" + +msgid "E925: Current quickfix was changed" +msgstr "E925: Текући quickfix је промењен" + +msgid "E926: Current location list was changed" +msgstr "E926: Текућа лиÑта локација је промењена" + +#, c-format +msgid "(%d of %d)%s%s: " +msgstr "(%d од %d)%s%s: " + +msgid " (line deleted)" +msgstr " (линија обриÑана)" + +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%sлиÑта грешака %d од %d; %d грешака " + +msgid "E380: At bottom of quickfix stack" +msgstr "E380: Ðа дну quickfix Ñтека" + +msgid "E381: At top of quickfix stack" +msgstr "E381: Ðа врху quickfix Ñтека" + +msgid "No entries" +msgstr "Ðема уноÑа" + +msgid "Error file" +msgstr "Датотека грешака" + +msgid "E683: File name missing or invalid pattern" +msgstr "E683: ÐедоÑтаје име датотеке или неважећи шаблон" + +#, c-format +msgid "Cannot open file \"%s\"" +msgstr "Датотека \"%s\" не може да Ñе отвори" + +msgid "E681: Buffer is not loaded" +msgstr "E681: Бафер није учитан" + +msgid "E777: String or List expected" +msgstr "E777: Очекује Ñе String или List" + +#, c-format +msgid "E369: invalid item in %s%%[]" +msgstr "E369: неважећа Ñтавка у %s%%[]" + +#, c-format +msgid "E769: Missing ] after %s[" +msgstr "E769: ÐедоÑтаје ] након %s[" + +msgid "E944: Reverse range in character class" +msgstr "E944: Обрнути опÑег у карактер клаÑи" + +msgid "E945: Range too large in character class" +msgstr "E945: Превелики опÑег у карактер клаÑи" + +#, c-format +msgid "E53: Unmatched %s%%(" +msgstr "E53: Ðеупарена %s%%(" + +#, c-format +msgid "E54: Unmatched %s(" +msgstr "E54: Ðеупарена %s(" + +#, c-format +msgid "E55: Unmatched %s)" +msgstr "E55: Ðеупарена %s)" + +msgid "E66: \\z( not allowed here" +msgstr "E66: \\z( овде није дозвољено" + +msgid "E67: \\z1 et al. not allowed here" +msgstr "E67: \\z1 и оÑтали онвде ниÑу дозвољени" + +#, c-format +msgid "E69: Missing ] after %s%%[" +msgstr "E69: ÐедоÑтаје ] након %s%%[" + +#, c-format +msgid "E70: Empty %s%%[]" +msgstr "E70: Празан %s%%[]" + +msgid "E65: Illegal back reference" +msgstr "E65: Ðеважећа повратна референца" + +msgid "E339: Pattern too long" +msgstr "E339: Шаблон је предугачак" + +msgid "E50: Too many \\z(" +msgstr "E50: Превише \\z(" + +#, c-format +msgid "E51: Too many %s(" +msgstr "E51: Превише %s(" + +msgid "E52: Unmatched \\z(" +msgstr "E52: Ðеупарено \\z(" + +#, c-format +msgid "E59: invalid character after %s@" +msgstr "E59: неважећи карактер након %s@" + +#, c-format +msgid "E60: Too many complex %s{...}s" +msgstr "E60: Превише комплекÑних %s{...}s" + +#, c-format +msgid "E61: Nested %s*" +msgstr "E61: Угњеждено %s*" + +#, c-format +msgid "E62: Nested %s%c" +msgstr "E62: Угњеждено %s%c" + +msgid "E63: invalid use of \\_" +msgstr "E63: неиÑправна употреба \\_" + +#, c-format +msgid "E64: %s%c follows nothing" +msgstr "E64: %s%c je иза ничега" + +msgid "E68: Invalid character after \\z" +msgstr "E68: Ðеважећи карактер након \\z" + +#, c-format +msgid "E678: Invalid character after %s%%[dxouU]" +msgstr "E678: Ðеважећи карактер након %s%%[dxouU]" + +#, c-format +msgid "E71: Invalid character after %s%%" +msgstr "E71: Ðеважећи карактер након %s%%" + +#, c-format +msgid "E554: Syntax error in %s{...}" +msgstr "E554: СинтакÑна грешка у %s{...}" + +msgid "External submatches:\n" +msgstr "Спољна подпоклапања:\n" + +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA regexp) не може да Ñе понови %s" + +msgid "" +"E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " +"used " +msgstr "" +"E864: Иза \\%#= може да Ñледи једино 0, 1, или 2. КориÑтиће Ñе аутоматÑки " +"енџин " + +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Пребацивање на backtracking RE енџин за шаблон: " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: Крај (NFA) Regexp израза је доÑтигнут прерано" + +#, c-format +msgid "E866: (NFA regexp) Misplaced %c" +msgstr "E866: (NFA regexp) %c је на погрешном меÑту" + +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA regexp) Ðеважећа карактер клаÑа: %ld" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\z%c'" +msgstr "E867: (NFA) Ðепознати оператор '\\z%c'" + +#, c-format +msgid "E867: (NFA) Unknown operator '\\%%%c'" +msgstr "E867: (NFA) Ðепознати оператор '\\%%%c'" + +msgid "E868: Error building NFA with equivalence class!" +msgstr "E868: Грешка при грађењу NFA Ñа клаÑом еквиваленције!" + +#, c-format +msgid "E869: (NFA) Unknown operator '\\@%c'" +msgstr "E869: (NFA) Ðепознати оператор '\\@%c'" + +msgid "E870: (NFA regexp) Error reading repetition limits" +msgstr "E870: (NFA regexp) Грешка при читању граница понављања" + +msgid "E871: (NFA regexp) Can't have a multi follow a multi !" +msgstr "E871: (NFA regexp) Мулти не може Ñледи иза мулти !" + +msgid "E872: (NFA regexp) Too many '('" +msgstr "E872: (NFA regexp) Превише '('" + +msgid "E879: (NFA regexp) Too many \\z(" +msgstr "E879: (NFA regexp) Превише \\z(" + +msgid "E873: (NFA regexp) proper termination error" +msgstr "E873: (NFA regexp) грешка правилне терминације" + +msgid "E874: (NFA) Could not pop the stack !" +msgstr "E874: (NFA) Скидање Ñа Ñтека није уÑпело !" + +msgid "" +"E875: (NFA regexp) (While converting from postfix to NFA), too many states " +"left on stack" +msgstr "" +"E875: (NFA regexp) (Док је вршена конверзија из postfix у NFA), превише Ñтања " +"је оÑтало на Ñтеку" + +msgid "E876: (NFA regexp) Not enough space to store the whole NFA " +msgstr "E876: (NFA regexp) Ðема довољно проÑтора да Ñе уÑкладишти комплетан NFA " + +msgid "E878: (NFA) Could not allocate memory for branch traversal!" +msgstr "E878: (NFA) Ðије могла да Ñе алоцира меморија за обилазак грана!" + +msgid "" +"Could not open temporary log file for writing, displaying on stderr ... " +msgstr "" +"Привремена лог датотека није могла да Ñе отвори за упиÑ, приказује Ñе на stderr ... " + +#, c-format +msgid "(NFA) COULD NOT OPEN %s !" +msgstr "(NFA) %s ÐЕ МОЖЕ ДРСЕ ОТВОРИ !" + +msgid "Could not open temporary log file for writing " +msgstr "Привремена лог датотека није могла да Ñе отвори за ÑƒÐ¿Ð¸Ñ " + +msgid " VREPLACE" +msgstr "ВЗÐМЕÐÐ" + +msgid " REPLACE" +msgstr " ЗÐМЕÐÐ" + +msgid " REVERSE" +msgstr " ОБРÐУТО" + +msgid " INSERT" +msgstr " УМЕТÐЊЕ" + +msgid " (insert)" +msgstr " (уметање)" + +msgid " (replace)" +msgstr " (замена)" + +msgid " (vreplace)" +msgstr " (взамена)" + +msgid " Hebrew" +msgstr " хебрејÑки" + +msgid " Arabic" +msgstr " арапÑки" + +msgid " (paste)" +msgstr " (налепи)" + +msgid " VISUAL" +msgstr " ВИЗУЕЛÐО" + +msgid " VISUAL LINE" +msgstr " ВИЗУЕЛÐРЛИÐИЈÐ" + +msgid " VISUAL BLOCK" +msgstr " ВИЗУЕЛÐИ БЛОК" + +msgid " SELECT" +msgstr " ИЗБОР" + +msgid " SELECT LINE" +msgstr " ИЗБОР ЛИÐИЈÐ" + +msgid " SELECT BLOCK" +msgstr " ИЗБОР БЛОКÐ" + +msgid "recording" +msgstr "Ñнимање" + +#, c-format +msgid "E383: Invalid search string: %s" +msgstr "E383: ÐеиÑправан Ñтринг за претрагу: %s" + +#, c-format +msgid "E384: search hit TOP without match for: %s" +msgstr "E384: претрага је доÑтигла ВРХ без подударања за: %s" + +#, c-format +msgid "E385: search hit BOTTOM without match for: %s" +msgstr "E385: претрага је доÑтигла ДÐО без подударања за: %s" + +msgid "E386: Expected '?' or '/' after ';'" +msgstr "E386: Ðакон ';' Ñе очекује '?' или '/'" + +msgid " (includes previously listed match)" +msgstr " (укључује претходно наведена подударања)" + +msgid "--- Included files " +msgstr "--- Прикључене датотеке " + +msgid "not found " +msgstr "ниÑу пронађене " + +msgid "in path ---\n" +msgstr "у путањи ---\n" + +msgid " (Already listed)" +msgstr " (Већ наведено)" + +msgid " NOT FOUND" +msgstr " ÐИЈЕ ПРОÐÐЂЕÐО" + +#, c-format +msgid "Scanning included file: %s" +msgstr "Прегледање уметнуте датотеке: %s" + +#, c-format +msgid "Searching included file %s" +msgstr "Претраживање уметнуте датотеке %s" + +msgid "E387: Match is on current line" +msgstr "E387: Подударање је у текућој линији" + +msgid "All included files were found" +msgstr "Све уметнуте датотеке Ñу пронађене" + +msgid "No included files" +msgstr "Ðема уметнутих датотека" + +msgid "E388: Couldn't find definition" +msgstr "E388: Дефиниција не може да Ñе пронађе" + +msgid "E389: Couldn't find pattern" +msgstr "E389: Шаблон за претрагу није пронађен" + +msgid "Substitute " +msgstr "Замена " + +#, c-format +msgid "" +"\n" +"# Last %sSearch Pattern:\n" +"~" +msgstr "" +"\n" +"# ПоÑледњи %sШаблон Претраге:\n" +"~" + +msgid "E756: Spell checking is not enabled" +msgstr "E756: Провера правопиÑа није омогућена" + +#, c-format +msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +msgstr "Упозорење: ЛиÑта речи \"%s_%s.spl\" или \"%s_ascii.spl\" не може да Ñе пронађе" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "Упозорење: ЛиÑта речи \"%s.%s.spl\" или \"%s.ascii.spl\" не може да Ñе пронађе" + +msgid "E797: SpellFileMissing autocommand deleted buffer" +msgstr "E797: SpellFileMissing аутокоманда је обриÑала бафер" + +#, c-format +msgid "Warning: region %s not supported" +msgstr "Упозорење: регион %s није подржан" + +msgid "Sorry, no suggestions" +msgstr "Жао нам је, нема ÑугеÑтија" + +#, c-format +msgid "Sorry, only %ld suggestions" +msgstr "Жао нам је, Ñамо %ld ÑугеÑтија" + +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "Променити \"%.*s\" у:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < \"%.*s\"" + +msgid "E752: No previous spell replacement" +msgstr "E752: Ðема претходне правопиÑне замене" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: Ðије пронађено: %s" + +msgid "E758: Truncated spell file" +msgstr "E758: ПравопиÑна датотека је прекраћена" + +#, c-format +msgid "Trailing text in %s line %d: %s" +msgstr "ТекÑÑ‚ вишак у %s линија %d: %s" + +#, c-format +msgid "Affix name too long in %s line %d: %s" +msgstr "Име наÑтавка је предугачко у %s линија %d: %s" + +msgid "E761: Format error in affix file FOL, LOW or UPP" +msgstr "E761: Грешка формата у датотеци наÑтавака FOL, LOW или UPP" + +msgid "E762: Character in FOL, LOW or UPP is out of range" +msgstr "E762: Карактер у FOL, LOW или UPP је ван опÑега" + +msgid "Compressing word tree..." +msgstr "Стабло речи Ñе компреÑује..." + +#, c-format +msgid "Reading spell file \"%s\"" +msgstr "Читање правопиÑне датотеке \"%s\"" + +msgid "E757: This does not look like a spell file" +msgstr "E757: Ово не изгледа као правопиÑна датотека" + +msgid "E771: Old spell file, needs to be updated" +msgstr "E771: Стара правопиÑна датотека, потребно је да Ñе оÑвежи" + +msgid "E772: Spell file is for newer version of Vim" +msgstr "E772: ПравопиÑна датотека је за новију верзију Vim-а" + +msgid "E770: Unsupported section in spell file" +msgstr "E770: Ðеподржана Ñекција у правопиÑној датотеци" + +#, c-format +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: Ово не изгледа као .sug датотека: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: Стара .sug датотека, потребно је да Ñе оÑвежи: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: .sug датотека је за новију верзију Vim-а: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug датотека не одговара .spl датотеци: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: грешка приликом читања .sug датотеке: %s" + +#, c-format +msgid "Reading affix file %s ..." +msgstr "Читање датотеке наÑтавака %s ..." + +#, c-format +msgid "Conversion failure for word in %s line %d: %s" +msgstr "ÐеуÑпешна конверзија за реч у %s линија %d: %s" + +#, c-format +msgid "Conversion in %s not supported: from %s to %s" +msgstr "Конверзија у %s није подржана: из %s у %s" + +#, c-format +msgid "Conversion in %s not supported" +msgstr "Конверзија у %s није подржана" + +#, c-format +msgid "Invalid value for FLAG in %s line %d: %s" +msgstr "Ðеважећа вредноÑÑ‚ за FLAG у %s линија %d: %s" + +#, c-format +msgid "FLAG after using flags in %s line %d: %s" +msgstr "FLAG након коришћења индикатора у %s линија %d: %s" + +#, c-format +msgid "" +"Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line " +"%d" +msgstr "" +"ДефиниÑање COMPOUNDFORBIDFLAG након PFX Ñтавке може да дâ погрешне резултате " +"у %s line %d" + +#, c-format +msgid "" +"Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line " +"%d" +msgstr "" +"ДефиниÑање COMPOUNDPERMITFLAG након PFX Ñтавке може да дâ погрешне резултате " +"у %s line %d" + +#, c-format +msgid "Wrong COMPOUNDRULES value in %s line %d: %s" +msgstr "Погрешна COMPOUNDRULES вредноÑÑ‚ у %s линија %d: %s" + +#, c-format +msgid "Wrong COMPOUNDWORDMAX value in %s line %d: %s" +msgstr "Погрешна COMPOUNDWORDMAX вредноÑÑ‚ у %s линија %d: %s" + +#, c-format +msgid "Wrong COMPOUNDMIN value in %s line %d: %s" +msgstr "Погрешна COMPOUNDMIN вредноÑÑ‚ у %s линија %d: %s" + +#, c-format +msgid "Wrong COMPOUNDSYLMAX value in %s line %d: %s" +msgstr "Погрешна COMPOUNDSYLMAX вредноÑÑ‚ у %s линија %d: %s" + +#, c-format +msgid "Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s" +msgstr "Погрешна CHECKCOMPOUNDPATTERN вредноÑÑ‚ у %s линија %d: %s" + +#, c-format +msgid "Different combining flag in continued affix block in %s line %d: %s" +msgstr "Различит индикатор комбиновања у наÑтављеном блоку наÑтавака у %s линија %d: %s" + +#, c-format +msgid "Duplicate affix in %s line %d: %s" +msgstr "Дупликат наÑтавка у %s линија %d: %s" + +#, c-format +msgid "" +"Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s " +"line %d: %s" +msgstr "" +"ÐаÑтавак Ñе такође кориÑтиBAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST " +"у %s линија %d: %s" + +#, c-format +msgid "Expected Y or N in %s line %d: %s" +msgstr "Очекује Ñе Y или N у %s линија %d: %s" + +#, c-format +msgid "Broken condition in %s line %d: %s" +msgstr "Ðеправилан уÑлов у %s линија %d: %s" + +#, c-format +msgid "Expected REP(SAL) count in %s line %d" +msgstr "Очекује Ñе број REP(SAL) у %s линија %d" + +#, c-format +msgid "Expected MAP count in %s line %d" +msgstr "Очекује Ñе број MAP у %s линија %d" + +#, c-format +msgid "Duplicate character in MAP in %s line %d" +msgstr "Дупликат карактера у MAP у %s линија %d" + +#, c-format +msgid "Unrecognized or duplicate item in %s line %d: %s" +msgstr "ÐепрепоÑната или дупла Ñтавка у %s линија %d: %s" + +#, c-format +msgid "Missing FOL/LOW/UPP line in %s" +msgstr "ÐедоÑтаје FOL/LOW/UPP линија у %s" + +msgid "COMPOUNDSYLMAX used without SYLLABLE" +msgstr "COMPOUNDSYLMAX Ñе кориÑти без SYLLABLE" + +msgid "Too many postponed prefixes" +msgstr "Превише закашњених префикÑа" + +msgid "Too many compound flags" +msgstr "Превише индикатора Ñложеница" + +msgid "Too many postponed prefixes and/or compound flags" +msgstr "Превише закашњених префикÑа и/или индикатора Ñложеница" + +#, c-format +msgid "Missing SOFO%s line in %s" +msgstr "ÐедоÑтаје SOFO%s линија у %s" + +#, c-format +msgid "Both SAL and SOFO lines in %s" +msgstr "И SAL и SOFO линије у %s" + +#, c-format +msgid "Flag is not a number in %s line %d: %s" +msgstr "Индикатор није број у %s линија %d: %s" + +#, c-format +msgid "Illegal flag in %s line %d: %s" +msgstr "Ðеважећи индикатор у %s линија %d: %s" + +#, c-format +msgid "%s value differs from what is used in another .aff file" +msgstr "%s вредноÑÑ‚ Ñе разликује од онога што је коришћено у другој .aff датотеци" + +#, c-format +msgid "Reading dictionary file %s ..." +msgstr "Читање датотеке речника %s ..." + +#, c-format +msgid "E760: No word count in %s" +msgstr "E760: Ðема броја речи у %s" + +#, c-format +msgid "line %6d, word %6d - %s" +msgstr "линија %6d, реч %6d - %s" + +#, c-format +msgid "Duplicate word in %s line %d: %s" +msgstr "Дупликат речи у %s линија %d: %s" + +#, c-format +msgid "First duplicate word in %s line %d: %s" +msgstr "Прва реч дупликат у %s линија %d: %s" + +#, c-format +msgid "%d duplicate word(s) in %s" +msgstr "%d реч(и) дупликат(а) у %s" + +#, c-format +msgid "Ignored %d word(s) with non-ASCII characters in %s" +msgstr "ИгнориÑана/о %d реч(и) Ñа не-ASCII карактерима у %s" + +#, c-format +msgid "Reading word file %s ..." +msgstr "Читање датотеке речи %s ..." + +#, c-format +msgid "Duplicate /encoding= line ignored in %s line %d: %s" +msgstr "Дупликат /encoding= линија је игнориÑана у %s линија %d: %s" + +#, c-format +msgid "/encoding= line after word ignored in %s line %d: %s" +msgstr "/encoding= линија након речи је игнориÑана у %s линија %d: %s" + +#, c-format +msgid "Duplicate /regions= line ignored in %s line %d: %s" +msgstr "Дупликат /regions= линија је игнориÑана у %s линија %d: %s" + +#, c-format +msgid "Too many regions in %s line %d: %s" +msgstr "Превише региона у %s линија %d: %s" + +#, c-format +msgid "/ line ignored in %s line %d: %s" +msgstr "/ линија игнориÑана у %s линија %d: %s" + +#, c-format +msgid "Invalid region nr in %s line %d: %s" +msgstr "Ðеважећи број региона у %s линија %d: %s" + +#, c-format +msgid "Unrecognized flags in %s line %d: %s" +msgstr "Ðепрепознати индикатори у %s линија %d: %s" + +#, c-format +msgid "Ignored %d words with non-ASCII characters" +msgstr "ИгнориÑано је %d рћи Ñа не-ASCII карактерима" + +msgid "E845: Insufficient memory, word list will be incomplete" +msgstr "E845: Ðедовољно меморије, лиÑта речи неће бити комплетна" + +#, c-format +msgid "Compressed %d of %d nodes; %d (%d%%) remaining" +msgstr "КомпреÑовано је %d од %d чворова; преоÑтало је још %d (%d%%)" + +msgid "Reading back spell file..." +msgstr "Читање правопиÑне датотеке..." + +msgid "Performing soundfolding..." +msgstr "Извођење Ñклапања по звучноÑти..." + +#, c-format +msgid "Number of words after soundfolding: %ld" +msgstr "Број речи након Ñклапања по звучноÑти: %ld" + +#, c-format +msgid "Total number of words: %d" +msgstr "Укупан број речи: %d" + +#, c-format +msgid "Writing suggestion file %s ..." +msgstr "УпиÑивање датотеке предлога %s ..." + +#, c-format +msgid "Estimated runtime memory use: %d bytes" +msgstr "Процењена потребна величина меморије у време извршавања: %d бајтова" + +msgid "E751: Output file name must not have region name" +msgstr "E751: Име излазне датотеке не Ñме да има име региона" + +msgid "E754: Only up to 8 regions supported" +msgstr "E754: Подржано је Ñамо до 8 региона" + +#, c-format +msgid "E755: Invalid region in %s" +msgstr "E755: Ðеважећи регион у %s" + +msgid "Warning: both compounding and NOBREAK specified" +msgstr "Упозорење: наведени Ñу и Ñлагање и NOBREAK" + +#, c-format +msgid "Writing spell file %s ..." +msgstr "УпиÑивање правопиÑне датотеке %s ..." + +msgid "Done!" +msgstr "Завршено!" + +#, c-format +msgid "E765: 'spellfile' does not have %ld entries" +msgstr "E765: 'spellfile' не Ñадржи %ld Ñтавке" + +#, c-format +msgid "Word '%.*s' removed from %s" +msgstr "Реч '%.*s' је уклоњена из %s" + +#, c-format +msgid "Word '%.*s' added to %s" +msgstr "Реч '%.*s' је додата у %s" + +msgid "E763: Word characters differ between spell files" +msgstr "E763: Карактери у речи Ñе разликују између правопиÑних датотека" + +msgid "E783: duplicate char in MAP entry" +msgstr "E783: карактер дупликат у MAP Ñтавци" + +msgid "No Syntax items defined for this buffer" +msgstr "За оба јбафер ниÑу дефиниÑане ÑинтакÑне Ñтавке" + +msgid "syntax conceal on" +msgstr "Ñкривање ÑинтакÑе укључено" + +msgid "syntax conceal off" +msgstr "Ñкривање ÑинтакÑе иÑкључено" + +#, c-format +msgid "E390: Illegal argument: %s" +msgstr "E390: Ðеважећи аргумент: %s" + +msgid "syntax case ignore" +msgstr "мала/велика Ñлова Ñе не разликују у ÑинтакÑи" + +msgid "syntax case match" +msgstr "мала/велика Ñлова Ñе разликују у ÑинтакÑи" + +msgid "syntax spell toplevel" +msgstr "ÑинтакÑа правопиÑа toplevel" + +msgid "syntax spell notoplevel" +msgstr "ÑинтакÑа правопиÑа notoplevel" + +msgid "syntax spell default" +msgstr "ÑинтакÑа правопиÑа подразумевано" + +msgid "syntax iskeyword " +msgstr "ÑинтакÑа iskeyword " + +#, c-format +msgid "E391: No such syntax cluster: %s" +msgstr "E391: Ðе поÑтоји такав ÑинтакÑни клаÑтер: %s" + +msgid "syncing on C-style comments" +msgstr "Ñинхронизација на коментарима C-Ñтила" + +msgid "no syncing" +msgstr "без Ñинхронизације" + +msgid "syncing starts " +msgstr "Ñинхронизација почиње " + +msgid " lines before top line" +msgstr " линија пре линије на врху" + +msgid "" +"\n" +"--- Syntax sync items ---" +msgstr "" +"\n" +"--- Ставке Ñинхро ÑинтакÑе ---" + +msgid "" +"\n" +"syncing on items" +msgstr "" +"\n" +"Ñинхро на Ñтавкама" + +msgid "" +"\n" +"--- Syntax items ---" +msgstr "" +"\n" +"--- Ставке ÑинтакÑе ---" + +#, c-format +msgid "E392: No such syntax cluster: %s" +msgstr "E392: не поÑтоји такав ÑинтакÑни клаÑтер: %s" + +msgid "minimal " +msgstr "минимално " + +msgid "maximal " +msgstr "макÑимално " + +msgid "; match " +msgstr "; подударања " + +msgid " line breaks" +msgstr " прелома линије" + +msgid "E395: contains argument not accepted here" +msgstr "E395: Ñадржи аргумент који Ñе овде не прихвата" + +msgid "E844: invalid cchar value" +msgstr "E844: неважећа cchar вредноÑÑ‚" + +msgid "E393: group[t]here not accepted here" +msgstr "E393: group[t]here Ñе овде не прихвата" + +#, c-format +msgid "E394: Didn't find region item for %s" +msgstr "E394: Ставка региона није пронађена за %s" + +msgid "E397: Filename required" +msgstr "E397: Потребно име датотеке" + +msgid "E847: Too many syntax includes" +msgstr "E847: Превише ÑинтакÑних уметања" + +#, c-format +msgid "E789: Missing ']': %s" +msgstr "E789: ÐедоÑтаје ']': %s" + +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: карактер вишка након ']': %s]%s" + +#, c-format +msgid "E398: Missing '=': %s" +msgstr "E398: ÐедоÑтаје '=': %s" + +#, c-format +msgid "E399: Not enough arguments: syntax region %s" +msgstr "E399: Ðема довољно аргумената: ÑинтакÑни регион %s" + +msgid "E848: Too many syntax clusters" +msgstr "E848: Превише ÑинтакÑних клаÑтера" + +msgid "E400: No cluster specified" +msgstr "E400: Ðије наведен ниједан клаÑтер" + +#, c-format +msgid "E401: Pattern delimiter not found: %s" +msgstr "E401: Ðије пронађен граничник шаблона: %s" + +#, c-format +msgid "E402: Garbage after pattern: %s" +msgstr "E402: Смеће након шаблона: %s" + +msgid "E403: syntax sync: line continuations pattern specified twice" +msgstr "E403: ÑинтакÑна Ñинхро: шаблон наÑтављања линије је наведен двапут" + +#, c-format +msgid "E404: Illegal arguments: %s" +msgstr "E404: Ðеважећи аргументи: %s" + +#, c-format +msgid "E405: Missing equal sign: %s" +msgstr "E405: недоÑтаје знак једнакоÑти: %s" + +#, c-format +msgid "E406: Empty argument: %s" +msgstr "E406: Празан аргумент: %s" + +#, c-format +msgid "E407: %s not allowed here" +msgstr "E407: %s овде није дозвољено" + +#, c-format +msgid "E408: %s must be first in contains list" +msgstr "E408: %s мора да буде прво у contains лиÑти" + +#, c-format +msgid "E409: Unknown group name: %s" +msgstr "E409: Ðепознато име групе: %s" + +#, c-format +msgid "E410: Invalid :syntax subcommand: %s" +msgstr "E410: Ðеважећа :syntax подкоманда: %s" + +msgid "" +" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN" +msgstr "" +" УКУПÐО БРОЈ ПОДУД ÐÐЈСПОРИЈЕ ПРОСЕК ИМЕ ШÐБЛОÐ" + +msgid "E679: recursive loop loading syncolor.vim" +msgstr "E679: Рекурзивна петља код учитавања syncolor.vim" + +#, c-format +msgid "E411: highlight group not found: %s" +msgstr "E411: група иÑтицања није пронађена: %s" + +#, c-format +msgid "E412: Not enough arguments: \":highlight link %s\"" +msgstr "E412: Ðема довољно аргумената: \":highlight link %s\"" + +#, c-format +msgid "E413: Too many arguments: \":highlight link %s\"" +msgstr "E413: Сувише аргумената: \":highlight link %s\"" + +msgid "E414: group has settings, highlight link ignored" +msgstr "E414: група има поÑтавке, highlight link Ñе игнорише" + +#, c-format +msgid "E415: unexpected equal sign: %s" +msgstr "E415: неочкиван знак једнакоÑти: %s" + +#, c-format +msgid "E416: missing equal sign: %s" +msgstr "E416: недоÑтаје знак једнакоÑти: %s" + +#, c-format +msgid "E417: missing argument: %s" +msgstr "E417: недоÑтаје аргумент: %s" + +#, c-format +msgid "E418: Illegal value: %s" +msgstr "E418: Ðеважећа вредноÑÑ‚: %s" + +msgid "E419: FG color unknown" +msgstr "E419: Ðепозната FG боја" + +msgid "E420: BG color unknown" +msgstr "E420: Ðепозната BG боја" + +#, c-format +msgid "E421: Color name or number not recognized: %s" +msgstr "E421: Име боје или број ниÑу препознати: %s" + +#, c-format +msgid "E422: terminal code too long: %s" +msgstr "E422: код терминала је предугачак: %s" + +#, c-format +msgid "E423: Illegal argument: %s" +msgstr "E423: Ðеважећи аргумент: %s" + +msgid "E424: Too many different highlighting attributes in use" +msgstr "E424: У употреби је превише различитих атрибута иÑтицања" + +msgid "E669: Unprintable character in group name" +msgstr "E669: У имену групе је карактер који не може да Ñе штампа" + +msgid "W18: Invalid character in group name" +msgstr "W18: Ðеважећи карактер у имену групе" + +msgid "E849: Too many highlight and syntax groups" +msgstr "E849: Превише ÑинтакÑних и група иÑтицања" + +msgid "E555: at bottom of tag stack" +msgstr "E555: на дну Ñтека ознака" + +msgid "E556: at top of tag stack" +msgstr "E556: на врху Ñтека ознака" + +msgid "E425: Cannot go before first matching tag" +msgstr "E425: Ðе може да Ñе иде иÑпред прве подударајуће ознаке" + +#, c-format +msgid "E426: tag not found: %s" +msgstr "E426: ознака није пронађена: %s" + +msgid " # pri kind tag" +msgstr " # ознака pri врÑте" + +msgid "file\n" +msgstr "датотека\n" + +msgid "E427: There is only one matching tag" +msgstr "E427: ПоÑтоји Ñамо једна подударајућа ознака" + +msgid "E428: Cannot go beyond last matching tag" +msgstr "E428: Ðе може да Ñе иде иза поÑледње подударајуће ознаке" + +#, c-format +msgid "File \"%s\" does not exist" +msgstr "Датотека \"%s\" не поÑтоји" + +#, c-format +msgid "tag %d of %d%s" +msgstr "ознака %d од %d%s" + +msgid " or more" +msgstr " или више" + +msgid " Using tag with different case!" +msgstr " КориÑти Ñе ознака за другом врÑтом Ñлова (мала/велика)!" + +#, c-format +msgid "E429: File \"%s\" does not exist" +msgstr "E429: Датотека \"%s\" не поÑтоји" + +msgid "" +"\n" +" # TO tag FROM line in file/text" +msgstr "" +"\n" +" # ÐРознака ОД линије у датот/текÑÑ‚" + +#, c-format +msgid "Searching tags file %s" +msgstr "Претраживање датотеке ознака %s" + +#, c-format +msgid "E430: Tag file path truncated for %s\n" +msgstr "E430: Путања датотеке ознака је прекинута за %s\n" + +msgid "Ignoring long line in tags file" +msgstr "Дугачка линија у датотеци ознака Ñе игнорише" + +#, c-format +msgid "E431: Format error in tags file \"%s\"" +msgstr "E431: Грешка формата у датотеци ознака \"%s\"" + +#, c-format +msgid "Before byte %ld" +msgstr "Пре бајта %ld" + +#, c-format +msgid "E432: Tags file not sorted: %s" +msgstr "E432: Датотека ознака није Ñортирана: %s" + +msgid "E433: No tags file" +msgstr "E433: Ðема датотеке ознака" + +msgid "E434: Can't find tag pattern" +msgstr "E434: Ðе може да Ñе пронађе шаблон ознаке" + +msgid "E435: Couldn't find tag, just guessing!" +msgstr "E435: Ознака није могла да Ñе пронађе, Ñамо нагађам!" + +#, c-format +msgid "Duplicate field name: %s" +msgstr "Дупло име поља: %s" + +msgid "' not known. Available builtin terminals are:" +msgstr "' није познат. ДоÑтупни уграђени терминали Ñу:" + +msgid "defaulting to '" +msgstr "подразумева Ñе '" + +msgid "E557: Cannot open termcap file" +msgstr "E557: termcap датотека не може да Ñе отвори" + +msgid "E558: Terminal entry not found in terminfo" +msgstr "E558: У terminfo није пронађена Ñтавка за терминал" + +msgid "E559: Terminal entry not found in termcap" +msgstr "E559: У termcap није пронађена Ñтавка терминала" + +#, c-format +msgid "E436: No \"%s\" entry in termcap" +msgstr "E436: Ðема \"%s\" Ñтавке у termcap" + +msgid "E437: terminal capability \"cm\" required" +msgstr "E437: потребна је могућноÑÑ‚ терминала \"cm\"" + +msgid "" +"\n" +"--- Terminal keys ---" +msgstr "" +"\n" +"--- ТаÑтери терминала ---" + +msgid "Cannot open $VIMRUNTIME/rgb.txt" +msgstr "Ðе може да Ñе отвори $VIMRUNTIME/rgb.txt" + +msgid "Terminal" +msgstr "Терминал" + +msgid "Terminal-finished" +msgstr "Терминал-завршен" + +msgid "active" +msgstr "aktivan" + +msgid "running" +msgstr "ради" + +msgid "finished" +msgstr "завршен" + +msgid "new shell started\n" +msgstr "покренуто ново командно окружење\n" + +msgid "Vim: Error reading input, exiting...\n" +msgstr "Vim: Грешка при читању улаза, излазак...\n" + +msgid "Used CUT_BUFFER0 instead of empty selection" +msgstr "УмеÑто празне Ñелекције корићен је CUT_BUFFER0" + +msgid "E881: Line count changed unexpectedly" +msgstr "E881: Број линија Ñе неочекивано променио" + +msgid "No undo possible; continue anyway" +msgstr "Ðије могућ опозив; ипак наÑтави" + +#, c-format +msgid "E828: Cannot open undo file for writing: %s" +msgstr "E828: Датотека опозива не може да Ñе отвори за упиÑ: %s" + +#, c-format +msgid "E825: Corrupted undo file (%s): %s" +msgstr "E825: ИÑкварена датотека за опозив (%s): %s" + +msgid "Cannot write undo file in any directory in 'undodir'" +msgstr "Датотека за опозив не може да Ñе упише ни у један директоријум из 'undodir'" + +#, c-format +msgid "Will not overwrite with undo file, cannot read: %s" +msgstr "Ðеће Ñе вршити препиÑивање Ñа датотеком опозива, читање није могуће: %s" + +#, c-format +msgid "Will not overwrite, this is not an undo file: %s" +msgstr "Ðеће Ñе цршити препиÑивање, ово није датотека за опозив: %s" + +msgid "Skipping undo file write, nothing to undo" +msgstr "ПреÑкакање упиÑа у датотеку за опозив, нема шта да Ñе опозове" + +#, c-format +msgid "Writing undo file: %s" +msgstr "Ð£Ð¿Ð¸Ñ Ð´Ð°Ñ‚Ð¾Ñ‚ÐµÐºÐµ за опозив: %s" + +#, c-format +msgid "E829: write error in undo file: %s" +msgstr "E829: грешка код упиÑа у датотеку за опозив: %s" + +#, c-format +msgid "Not reading undo file, owner differs: %s" +msgstr "Датотека за опозив Ñе не чита, влаÑник Ñе разликује: %s" + +#, c-format +msgid "Reading undo file: %s" +msgstr "Читање датотеке за опозив: %s" + +#, c-format +msgid "E822: Cannot open undo file for reading: %s" +msgstr "E822: Датотека за опозив не може да Ñе отвори за читање: %s" + +#, c-format +msgid "E823: Not an undo file: %s" +msgstr "E823: Ðије датотека за опозив: %s" + +#, c-format +msgid "E832: Non-encrypted file has encrypted undo file: %s" +msgstr "E832: Датотека која није шифрована има шифровану датотеку за опозив: %s" + +#, c-format +msgid "E826: Undo file decryption failed: %s" +msgstr "E826: Дешифровање датотеке за опозив није уÑпело: %s" + +#, c-format +msgid "E827: Undo file is encrypted: %s" +msgstr "E827: Датотека за опозив је шифрована: %s" + +#, c-format +msgid "E824: Incompatible undo file: %s" +msgstr "E824: Ðекомпатибилна датотека за опозив: %s" + +msgid "File contents changed, cannot use undo info" +msgstr "Садржај датотеке је промењен, информације за опозив не могу да Ñе кориÑте" + +#, c-format +msgid "Finished reading undo file %s" +msgstr "Тавршено је читање датотеке за опозив %s" + +msgid "Already at oldest change" +msgstr "Већ Ñте на најÑтаријој измени" + +msgid "Already at newest change" +msgstr "Већ Ñте на најновијој измени" + +#, c-format +msgid "E830: Undo number %ld not found" +msgstr "E830: Број опозива %ld није пронађен" + +msgid "E438: u_undo: line numbers wrong" +msgstr "E438: u_undo: погрешни бројеви линије" + +msgid "more line" +msgstr "линија више" + +msgid "more lines" +msgstr "линија више" + +msgid "line less" +msgstr "линија мање" + +msgid "fewer lines" +msgstr "линија мање" + +msgid "change" +msgstr "измена" + +msgid "changes" +msgstr "измена" + +#, c-format +msgid "%ld %s; %s #%ld %s" +msgstr "%ld %s; %s #%ld %s" + +msgid "before" +msgstr "пре" + +msgid "after" +msgstr "након" + +msgid "Nothing to undo" +msgstr "Ðишта за опозив" + +msgid "number changes when saved" +msgstr "број измене када Ñачувано" + +#, c-format +msgid "%ld seconds ago" +msgstr "пре %ld Ñекунди" + +msgid "E790: undojoin is not allowed after undo" +msgstr "E790: undojoin ије дозвољен након undo" + +msgid "E439: undo list corrupt" +msgstr "E439: лиÑта опозива је иÑкварена" + +msgid "E440: undo line missing" +msgstr "E440: недоÑтаје линија опозива" + +#, c-format +msgid "E122: Function %s already exists, add ! to replace it" +msgstr "E122: Функција %s већ поÑтоји, додајте ! да је замените" + +msgid "E717: Dictionary entry already exists" +msgstr "E717: Ð£Ð½Ð¾Ñ Ð²ÐµÑ› поÑтоји у речнику" + +msgid "E718: Funcref required" +msgstr "E718: Потребна funcref" + +#, c-format +msgid "E130: Unknown function: %s" +msgstr "E130: Ðепозната функција: %s" + +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: Ðеважећи аргумент: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: Име аргумента је дуплирано: %s" + +#, c-format +msgid "E740: Too many arguments for function %s" +msgstr "E740: Превише аргумената за функцију %s" + +#, c-format +msgid "E116: Invalid arguments for function %s" +msgstr "E116: Ðеважећи аргументи за функцију %s" + +msgid "E132: Function call depth is higher than 'maxfuncdepth'" +msgstr "E132: Дубина позива функције је већа од 'maxfuncdepth'" + +#, c-format +msgid "calling %s" +msgstr "позива Ñе %s" + +#, c-format +msgid "%s aborted" +msgstr "%s је прекинута" + +#, c-format +msgid "%s returning #%ld" +msgstr "%s враћа #%ld" + +#, c-format +msgid "%s returning %s" +msgstr "%s враћа %s" + +msgid "E699: Too many arguments" +msgstr "E699: Сувише аргумената" + +#, c-format +msgid "E117: Unknown function: %s" +msgstr "E117: Ðепозната функција: %s" + +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: Функција је обриÑана: %s" + +#, c-format +msgid "E119: Not enough arguments for function: %s" +msgstr "E119: Ðема довољно аргумената за функцију: %s" + +#, c-format +msgid "E120: Using not in a script context: %s" +msgstr "E120: Коришћење ван Ñкрипт контекÑта: %s" + +#, c-format +msgid "E725: Calling dict function without Dictionary: %s" +msgstr "E725: Позивање dict функције без Речника: %s" + +msgid "E129: Function name required" +msgstr "E129: Потребно је име функције" + +#, c-format +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: Име функције мора да почне великим Ñловом или \"s:\": %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: Име функције не може да Ñадржи двотачку: %s" + +#, c-format +msgid "E123: Undefined function: %s" +msgstr "E123: ÐедефиниÑана функција: %s" + +#, c-format +msgid "E124: Missing '(': %s" +msgstr "E124: ÐедоÑтаје '(': %s" + +msgid "E862: Cannot use g: here" +msgstr "E862: g: не може овде да Ñе кориÑти" + +#, c-format +msgid "E932: Closure function should not be at top level: %s" +msgstr "E932: Затварајућа функција не би требало да буде на највишем нивоу: %s" + +msgid "E126: Missing :endfunction" +msgstr "E126: ÐедоÑтаје :endfunction" + +#, c-format +msgid "W22: Text found after :endfunction: %s" +msgstr "W22: Пронађен текÑÑ‚ након :endfunction: %s" + +#, c-format +msgid "E707: Function name conflicts with variable: %s" +msgstr "E707: Име функције је у конфликту Ñа променљивом: %s" + +#, c-format +msgid "E127: Cannot redefine function %s: It is in use" +msgstr "E127: Функција %s не може да Ñе редефинише: Тренутно Ñе кориÑти" + +#, c-format +msgid "E746: Function name does not match script file name: %s" +msgstr "E746: Име функције Ñе не поклапа Ñа именом Ñкрипт датотеке: %s" + +#, c-format +msgid "E131: Cannot delete function %s: It is in use" +msgstr "E131: Функција %s не може да Ñе обрише: Тренутно Ñе кориÑти" + +msgid "E133: :return not inside a function" +msgstr "E133: :return није унутар функције" + +#, c-format +msgid "E107: Missing parentheses: %s" +msgstr "E107: ÐедоÑтају заграде: %s" + +msgid "" +"\n" +"MS-Windows 64-bit GUI version" +msgstr "" +"\n" +"MS-Windows 64-битна GUI верзија" + +msgid "" +"\n" +"MS-Windows 32-bit GUI version" +msgstr "" +"\n" +"MS-Windows 32-битна GUI верзија" + +msgid " with OLE support" +msgstr " Ñа OLE подршком" + +msgid "" +"\n" +"MS-Windows 64-bit console version" +msgstr "" +"\n" +"MS-Windows 64-битна конзолна верзија" + +msgid "" +"\n" +"MS-Windows 32-bit console version" +msgstr "" +"\n" +"MS-Windows 32-битна конзолна верзија" + +msgid "" +"\n" +"macOS version" +msgstr "" +"\n" +"macOS верзија" + +msgid "" +"\n" +"macOS version w/o darwin feat." +msgstr "" +"\n" +"macOS верзија без darwin могућ." + +msgid "" +"\n" +"OpenVMS version" +msgstr "" +"\n" +"OpenVMS верзија" + +msgid "" +"\n" +"Included patches: " +msgstr "" +"\n" +"Укључене иÑправке: " + +msgid "" +"\n" +"Extra patches: " +msgstr "" +"\n" +"ЕкÑтра иÑправке: " + +msgid "Modified by " +msgstr "Модификовао " + +msgid "" +"\n" +"Compiled " +msgstr "" +"\n" +"Компајлирао" + +msgid "by " +msgstr " " + +msgid "" +"\n" +"Huge version " +msgstr "" +"\n" +"Огромна верзија " + +msgid "" +"\n" +"Big version " +msgstr "" +"\n" +"Велика верзија " + +msgid "" +"\n" +"Normal version " +msgstr "" +"\n" +"Ðормална верзија " + +msgid "" +"\n" +"Small version " +msgstr "" +"\n" +"Мала верзија " + +msgid "" +"\n" +"Tiny version " +msgstr "" +"\n" +"Сићушна верзија " + +msgid "without GUI." +msgstr "без GUI." + +msgid "with GTK3 GUI." +msgstr "Ñа GTK3 GUI." + +msgid "with GTK2-GNOME GUI." +msgstr "Ñа GTK2-GNOME GUI." + +msgid "with GTK2 GUI." +msgstr "Ñа GTK2 GUI." + +msgid "with X11-Motif GUI." +msgstr "Ñа X11-Motif GUI." + +msgid "with X11-neXtaw GUI." +msgstr "Ñа X11-neXtaw GUI." + +msgid "with X11-Athena GUI." +msgstr "Ñа X11-Athena GUI." + +msgid "with Photon GUI." +msgstr "Ñа Photon GUI." + +msgid "with GUI." +msgstr "Ñа GUI." + +msgid "with Carbon GUI." +msgstr "Ñа Carbon GUI." + +msgid "with Cocoa GUI." +msgstr "Ñа Cocoa GUI." + +msgid " Features included (+) or not (-):\n" +msgstr " МогућноÑти укључене (+) или не (-):\n" + +msgid " system vimrc file: \"" +msgstr " ÑиÑтемÑкa vimrc датотека: \"" + +msgid " user vimrc file: \"" +msgstr " кориÑничка vimrc датотека: \"" + +msgid " 2nd user vimrc file: \"" +msgstr " 2га кориÑничка vimrc датотека: \"" + +msgid " 3rd user vimrc file: \"" +msgstr " 3ћа кориÑничка vimrc датотека: \"" + +msgid " user exrc file: \"" +msgstr " кориÑничка exrc датотека: \"" + +msgid " 2nd user exrc file: \"" +msgstr " 2га кориÑничка exrc датотека: \"" + +msgid " system gvimrc file: \"" +msgstr " ÑиÑтемÑка gvimrc датотека: \"" + +msgid " user gvimrc file: \"" +msgstr " кориÑничка gvimrc датотека: \"" + +msgid "2nd user gvimrc file: \"" +msgstr "2га кориÑничка gvimrc датотека: \"" + +msgid "3rd user gvimrc file: \"" +msgstr "3ћа кориÑничка gvimrc датотека: \"" + +msgid " defaults file: \"" +msgstr " датотека Ñа подраз. опцијама: \"" + +msgid " system menu file: \"" +msgstr " ÑиÑтемÑка датотека менија: \"" + +msgid " fall-back for $VIM: \"" +msgstr " резервна вредноÑÑ‚ за $VIM: \"" + +msgid " f-b for $VIMRUNTIME: \"" +msgstr "резервна вредн. за $VIMRUNTIME: \"" + +msgid "Compilation: " +msgstr "Компилација: " + +msgid "Compiler: " +msgstr "Компајлер: " + +msgid "Linking: " +msgstr "Повезивање: " + +msgid " DEBUG BUILD" +msgstr " DEBUG ИЗДÐЊЕ" + +msgid "VIM - Vi IMproved" +msgstr "VIM - Vi IMproved" + +msgid "version " +msgstr "верзија " + +msgid "by Bram Moolenaar et al." +msgstr "напиÑали Bram Moolenaar et al." + +msgid "Vim is open source and freely distributable" +msgstr "Vim је отвореног кода и може Ñлободно да Ñе диÑтрибуира" + +msgid "Help poor children in Uganda!" +msgstr "Помозите Ñиромашној деци у Уганди!" + +msgid "type :help iccf for information " +msgstr "откуцајте :help iccf за информације " + +msgid "type :q to exit " +msgstr "откуцајте :q за излаз " + +msgid "type :help or for on-line help" +msgstr "откуцајте :help или за on-line помоћ " + +msgid "type :help version8 for version info" +msgstr "откуцајте :help version8 за инфо о верзији" + +msgid "Running in Vi compatible mode" +msgstr "Рад у Vi компатибилном режиму" + +msgid "type :set nocp for Vim defaults" +msgstr "откуцајте :set nocp за Vim подразумевано" + +msgid "type :help cp-default for info on this" +msgstr "откуцајте :help cp-default за инфо о овоме" + +msgid "menu Help->Orphans for information " +msgstr "мени Помоћ->Сирочићи за информације " + +msgid "Running modeless, typed text is inserted" +msgstr "БезрежимÑки рад, умеће Ñе откуцани текÑÑ‚" + +msgid "menu Edit->Global Settings->Toggle Insert Mode " +msgstr "мени Уређивање->Глобална подешавања->Преклапај режим Уметање " + +msgid " for two modes " +msgstr " за два режима " + +msgid "menu Edit->Global Settings->Toggle Vi Compatible" +msgstr "мени Уређивање->Глобална подешавања->Преклапај Vi Компатибилно" + +msgid " for Vim defaults " +msgstr " за Vim подразумевано " + +msgid "Sponsor Vim development!" +msgstr "Спонзоришите Vim развој!" + +msgid "Become a registered Vim user!" +msgstr "ПоÑтаните региÑтровани Vim кориÑник!" + +msgid "type :help sponsor for information " +msgstr "откуцајте :help sponsor за информације " + +msgid "type :help register for information " +msgstr "откуцајте :help register за информације " + +msgid "menu Help->Sponsor/Register for information " +msgstr "мени Помоћ->Спонзор/РегиÑтруј Ñе за информације " + +msgid "Already only one window" +msgstr "Већ поÑтоји Ñамо један прозор" + +msgid "E441: There is no preview window" +msgstr "E441: Ðема прозора за преглед" + +msgid "E442: Can't split topleft and botright at the same time" +msgstr "E442: topleft и botright не могу да Ñе поделе у иÑто време" + +msgid "E443: Cannot rotate when another window is split" +msgstr "E443: Ðе може да Ñе ротира када је подељен други прозор" + +msgid "E444: Cannot close last window" +msgstr "E444: ПоÑледњи прозор не може да Ñе затвори" + +msgid "E813: Cannot close autocmd window" +msgstr "E813: autocmd прозор не може да Ñе затвори" + +msgid "E814: Cannot close window, only autocmd window would remain" +msgstr "E814: Прозор не може да Ñе затвори, преоÑтао би једино autocmd прозор" + +msgid "E445: Other window contains changes" +msgstr "E445: Други прозори Ñадрже измене" + +msgid "E446: No file name under cursor" +msgstr "E446: Под курÑором Ñе не налази име датотеке" + +#, c-format +msgid "E447: Can't find file \"%s\" in path" +msgstr "E447: Датотека \"%s\" не може да Ñе пронађе у путањи" + +#, c-format +msgid "E799: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E799: Ðеважећи ИД: %ld (мора бити већи од или једнак 1)" + +#, c-format +msgid "E801: ID already taken: %ld" +msgstr "E801: ИД је већ заузет: %ld" + +msgid "List or number required" +msgstr "Захтева Ñе лиÑта или број" + +#, c-format +msgid "E802: Invalid ID: %ld (must be greater than or equal to 1)" +msgstr "E802: Ðеважећи ИД: %ld (мора бити већи од или једнак 1)" + +#, c-format +msgid "E803: ID not found: %ld" +msgstr "E803: ИД није пронађен: %ld" + +msgid "Edit with &multiple Vims" +msgstr "Уређуј Ñа &више Vim-ова" + +msgid "Edit with single &Vim" +msgstr "Уређуј Ñа једним &Vim-ом" + +msgid "Diff with Vim" +msgstr "Diff Ñа Vim" + +msgid "Edit with &Vim" +msgstr "Уређуј Ñа &Vim-ом" + +msgid "Edit with existing Vim - " +msgstr "Уређуј Ñа поÑтојећим Vim - " + +msgid "Edits the selected file(s) with Vim" +msgstr "Уређује Ñелектовауе датотеку(е) Ñа Vim-ом" + +msgid "Error creating process: Check if gvim is in your path!" +msgstr "Грешка приликом креирања процеÑа: Проверите да ли је gvim у вашој путањи!" + +msgid "gvimext.dll error" +msgstr "gvimext.dll грешка" + +msgid "Path length too long!" +msgstr "Путања је предугачка!" + +msgid "--No lines in buffer--" +msgstr "--У баферу нема линија--" + +msgid "E470: Command aborted" +msgstr "E470: Команда прекинута" + +msgid "E471: Argument required" +msgstr "E471: Потребан је аргумент" + +msgid "E10: \\ should be followed by /, ? or &" +msgstr "E10: Иза \\ треба да је /, ? или &" + +msgid "E11: Invalid in command-line window; executes, CTRL-C quits" +msgstr "E11: Ðеважеће у прозору командне линије; извршава, CTRL-C отказује" + +msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search" +msgstr "E12: ПоÑтији забрана за команду у exrc/vimrc у текућој претрази директоријума или ознаке" + +msgid "E171: Missing :endif" +msgstr "E171: ÐедоÑтаје :endif" + +msgid "E600: Missing :endtry" +msgstr "E600: ÐедоÑтаје :endtry" + +msgid "E170: Missing :endwhile" +msgstr "E170: ÐедоÑтаје :endwhile" + +msgid "E170: Missing :endfor" +msgstr "E170: ÐедоÑтаје :endfor" + +msgid "E588: :endwhile without :while" +msgstr "E588: :endwhile без :while" + +msgid "E588: :endfor without :for" +msgstr "E588: :endfor без :for" + +msgid "E13: File exists (add ! to override)" +msgstr "E13: Датотека поÑтоји (додајте ! за премошћавање)" + +msgid "E472: Command failed" +msgstr "E472: Команда није уÑпела" + +#, c-format +msgid "E234: Unknown fontset: %s" +msgstr "E234: Ðепознат fontset: %s" + +#, c-format +msgid "E235: Unknown font: %s" +msgstr "E235: Ðепознат фонт: %s" + +#, c-format +msgid "E236: Font \"%s\" is not fixed-width" +msgstr "E236: Фонт \"%s\" није фикÑне ширине" + +msgid "E473: Internal error" +msgstr "E473: Интерна грешка" + +#, c-format +msgid "E685: Internal error: %s" +msgstr "E685: Интерна грешка: %s" + +msgid "Interrupted" +msgstr "Прекинуто" + +msgid "E14: Invalid address" +msgstr "E14: Ðеважећа адреÑа" + +msgid "E474: Invalid argument" +msgstr "E474: Ðеважећи аргумент" + +#, c-format +msgid "E475: Invalid argument: %s" +msgstr "E475: Ðеважећи аргумент: %s" + +#, c-format +msgid "E15: Invalid expression: %s" +msgstr "E15: Ðеважећи израз: %s" + +msgid "E16: Invalid range" +msgstr "E16: Ðеважећи опÑег" + +msgid "E476: Invalid command" +msgstr "E476: Ðеважећа команда" + +#, c-format +msgid "E17: \"%s\" is a directory" +msgstr "E17: \"%s\" је директоријум" + +#, c-format +msgid "E364: Library call failed for \"%s()\"" +msgstr "E364: Позив библиотеке није уÑпео за \"%s()\"" + +msgid "E667: Fsync failed" +msgstr "E667: Fsync није уÑпео" + +#, c-format +msgid "E370: Could not load library %s" +msgstr "E370: Библиотека %s није могла да Ñе учита" + +#, c-format +msgid "E448: Could not load library function %s" +msgstr "E448: Библиотечка функција %s није могла да Ñе учита" + +msgid "E19: Mark has invalid line number" +msgstr "E19: Маркер Ñадржи неиÑправан број линије" + +msgid "E20: Mark not set" +msgstr "E20: Маркер није поÑтављен" + +msgid "E21: Cannot make changes, 'modifiable' is off" +msgstr "E21: Измене не могу да Ñе учине, опција 'modifiable' је иÑкључена" + +msgid "E22: Scripts nested too deep" +msgstr "E22: Скрипте Ñу предубоко угњеждене" + +msgid "E23: No alternate file" +msgstr "E23: Ðема алтернативне датотеке" + +msgid "E24: No such abbreviation" +msgstr "E24: Таква Ñкраћеница не поÑтоји" + +msgid "E477: No ! allowed" +msgstr "E477: ! није дозвољен" + +msgid "E25: GUI cannot be used: Not enabled at compile time" +msgstr "E25: GUI не може да Ñе кориÑти: Ðије омогућен у време компилације" + +msgid "E26: Hebrew cannot be used: Not enabled at compile time\n" +msgstr "E26: хебрејÑки не може да Ñе кориÑти: Ðије омогућен у време компилације\n" + +msgid "E27: Farsi cannot be used: Not enabled at compile time\n" +msgstr "E27: фарÑи не може да Ñе кориÑти: Ðије омогућен у време компилације\n" + +msgid "E800: Arabic cannot be used: Not enabled at compile time\n" +msgstr "E800: арапÑки не може да Ñе кориÑти: Ðије омогућен у време компилације\n" + +#, c-format +msgid "E28: No such highlight group name: %s" +msgstr "E28: Ðема групе иÑтицања Ñа таквим именом: %s" + +msgid "E29: No inserted text yet" +msgstr "E29: ТекÑÑ‚ још није унет" + +msgid "E30: No previous command line" +msgstr "E30: Ðема претходне командне линије" + +msgid "E31: No such mapping" +msgstr "E31: Такво мапирање не поÑтоји" + +msgid "E479: No match" +msgstr "E479: Ðема подударања" + +#, c-format +msgid "E480: No match: %s" +msgstr "E480: Ðема подударања: %s" + +msgid "E32: No file name" +msgstr "E32: Ðема имена датотеке" + +msgid "E33: No previous substitute regular expression" +msgstr "E33: Ðема претходног регуларног израза за замену" + +msgid "E34: No previous command" +msgstr "E34: Ðема претходне команде" + +msgid "E35: No previous regular expression" +msgstr "E35: Ðема претходног регуларног израза" + +msgid "E481: No range allowed" +msgstr "E481: ОпÑег није дозвољен" + +msgid "E36: Not enough room" +msgstr "E36: Ðема довољно проÑтора" + +#, c-format +msgid "E247: no registered server named \"%s\"" +msgstr "E247: нема региÑтованог Ñервера под именом \"%s\"" + +#, c-format +msgid "E482: Can't create file %s" +msgstr "E482: Датотека %s не може да Ñе креира" + +msgid "E483: Can't get temp file name" +msgstr "E483: Име привремене датотке не може да Ñе добије" + +#, c-format +msgid "E484: Can't open file %s" +msgstr "E484: Датотека %s не може да Ñе отвори" + +#, c-format +msgid "E485: Can't read file %s" +msgstr "E485: Датотека %s не може да Ñе прочита" + +msgid "E38: Null argument" +msgstr "E38: Празан аргумент" + +msgid "E39: Number expected" +msgstr "E39: Очекује Ñе број" + +#, c-format +msgid "E40: Can't open errorfile %s" +msgstr "E40: Датотека грешке %s не може да Ñе отвори" + +msgid "E233: cannot open display" +msgstr "E233: проказ не може да Ñе отвори" + +msgid "E41: Out of memory!" +msgstr "E41: Ðема више меморије!" + +msgid "Pattern not found" +msgstr "Шаблон није пронађен" + +#, c-format +msgid "E486: Pattern not found: %s" +msgstr "E486: Шаблон није пронађен: %s" + +msgid "E487: Argument must be positive" +msgstr "E487: Ðргумент мора бити позитиван" + +msgid "E459: Cannot go back to previous directory" +msgstr "E459: Ðе може да Ñе оде назад на претходни директоријум" + +msgid "E42: No Errors" +msgstr "E42: Ðема грешака" + +msgid "E776: No location list" +msgstr "E776: Ðема лиÑте локација" + +msgid "E43: Damaged match string" +msgstr "E43: Оштећен Ñтринг за подударање" + +msgid "E44: Corrupted regexp program" +msgstr "E44: regexp програм је покварен" + +msgid "E45: 'readonly' option is set (add ! to override)" +msgstr "E45: ПоÑтављена је 'readonly' опција (додајте ! за премошћавање)" + +#, c-format +msgid "E46: Cannot change read-only variable \"%s\"" +msgstr "E46: Променљива Ñамо за читање \"%s\" не може да Ñе измени" + +#, c-format +msgid "E794: Cannot set variable in the sandbox: \"%s\"" +msgstr "E794: Ðе може да Ñе поÑтави променљива у sandbox-у: \"%s\"" + +msgid "E713: Cannot use empty key for Dictionary" +msgstr "E713: Ðе може да Ñе кориÑти празан кључ за Речник" + +msgid "E715: Dictionary required" +msgstr "E715: Потребан Речник" + +#, c-format +msgid "E684: list index out of range: %ld" +msgstr "E684: Ð¸Ð½Ð´ÐµÐºÑ Ð»Ð¸Ñте је ван опÑега: %ld" + +#, c-format +msgid "E118: Too many arguments for function: %s" +msgstr "E118: Превише аргумената за функцију: %s" + +#, c-format +msgid "E716: Key not present in Dictionary: %s" +msgstr "E716: У Речнику нема кључа: %s" + +msgid "E714: List required" +msgstr "E714: Потребна ЛиÑта" + +#, c-format +msgid "E712: Argument of %s must be a List or Dictionary" +msgstr "E712: Ðргумент за %s мора бити ЛиÑта или Речник" + +msgid "E47: Error while reading errorfile" +msgstr "E47: Грешка приликом читаља датотеке грешке" + +msgid "E48: Not allowed in sandbox" +msgstr "E48: Ðије дозвољено у sandbox-у" + +msgid "E523: Not allowed here" +msgstr "E523: Ðије дозвољено овде" + +msgid "E359: Screen mode setting not supported" +msgstr "E359: Подешавање режима екрана није подржано" + +msgid "E49: Invalid scroll size" +msgstr "E49: Ðеважећа величина линије за Ñкроловање" + +msgid "E91: 'shell' option is empty" +msgstr "E91: Опција 'shell' је празна" + +msgid "E255: Couldn't read in sign data!" +msgstr "E255: Подаци за знак ниÑу могли да Ñе прочитају!" + +msgid "E72: Close error on swap file" +msgstr "E72: Грешка код затвањара swap датотеке" + +msgid "E73: tag stack empty" +msgstr "E73: Ñтек ознака је празан" + +msgid "E74: Command too complex" +msgstr "E74: Команда је Ñувише комплекÑна" + +msgid "E75: Name too long" +msgstr "E75: Име је предугачко" + +msgid "E76: Too many [" +msgstr "E76: Превише [" + +msgid "E77: Too many file names" +msgstr "E77: Превише имена датотека" + +msgid "E488: Trailing characters" +msgstr "E488: Карактери вишка на крају" + +msgid "E78: Unknown mark" +msgstr "E78: Ðепознат маркер" + +msgid "E79: Cannot expand wildcards" +msgstr "E79: Ðокери не могу да Ñе развију" + +msgid "E591: 'winheight' cannot be smaller than 'winminheight'" +msgstr "E591: 'winheight' не може да буде мање од 'winminheight'" + +msgid "E592: 'winwidth' cannot be smaller than 'winminwidth'" +msgstr "E592: 'winwidth' не може да буде мање од 'winminwidth'" + +msgid "E80: Error while writing" +msgstr "E80: Грешка приликом упиÑа" + +msgid "E939: Positive count required" +msgstr "E939: Потребан је позитиван број" + +msgid "E81: Using not in a script context" +msgstr "E81: Ñе кориÑти ван Ñкрипт контекÑта" + +msgid "E449: Invalid expression received" +msgstr "E449: Примљен је неважећи израз" + +msgid "E463: Region is guarded, cannot modify" +msgstr "E463: Регион је чуван, измена није могућа" + +msgid "E744: NetBeans does not allow changes in read-only files" +msgstr "E744: NetBeans не дозвољава измене датотека које Ñмеју Ñамо да Ñе читају" + +msgid "E363: pattern uses more memory than 'maxmempattern'" +msgstr "E363: шаблон кориÑти више меморије од 'maxmempattern'" + +msgid "E749: empty buffer" +msgstr "E749: празан бафер" + +#, c-format +msgid "E86: Buffer %ld does not exist" +msgstr "E86: Бафер %ld не поÑтоји" + +msgid "E682: Invalid search pattern or delimiter" +msgstr "E682: Ðеважећи шаблон претраге или раздвојни карактер" + +msgid "E139: File is loaded in another buffer" +msgstr "E139: Датотека је учитана у други бафер" + +#, c-format +msgid "E764: Option '%s' is not set" +msgstr "E764: Опција '%s' није поÑтављена" + +msgid "E850: Invalid register name" +msgstr "E850: Ðеважеће име региÑтра" + +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: Ðије пронађен директоријум у '%s': \"%s\"" + +msgid "search hit TOP, continuing at BOTTOM" +msgstr "претрага је доÑтигла ВРХ, наÑтавља Ñе на ДÐУ" + +msgid "search hit BOTTOM, continuing at TOP" +msgstr "претрага је доÑтигла ДÐО, наÑтавља Ñе на ВРХУ" + +#, c-format +msgid "Need encryption key for \"%s\"" +msgstr "Потребан је кључ за шифровање \"%s\"" + +msgid "empty keys are not allowed" +msgstr "празни кључеви ниÑу дозвољени" + +msgid "dictionary is locked" +msgstr "речник је закључан" + +msgid "list is locked" +msgstr "лиÑта је закључана" + +#, c-format +msgid "failed to add key '%s' to dictionary" +msgstr "кључ '%s' није могао да Ñе дода у речник" + +#, c-format +msgid "index must be int or slice, not %s" +msgstr "index мора бити типа int или slice, не %s" + +#, c-format +msgid "expected str() or unicode() instance, but got %s" +msgstr "очекивала Ñе инÑтанца str() или unicode(), али је добијена %s" + +#, c-format +msgid "expected bytes() or str() instance, but got %s" +msgstr "очекивала Ñе инÑтанца bytes() или str(), али је добијена %s" + +#, c-format +msgid "" +"expected int(), long() or something supporting coercing to long(), but got %s" +msgstr "" +"очекивало Ñе int(), long() или нешто што подржава Ñпајање Ñа long(), али је добијено %s" + +#, c-format +msgid "expected int() or something supporting coercing to int(), but got %s" +msgstr "очекивало Ñе int() или нешто што подржава Ñпајање Ñа int(), али је добијено %s" + +msgid "value is too large to fit into C int type" +msgstr "вредноÑÑ‚ је Ñувише велика да Ñе ÑмеÑти у C int тип" + +msgid "value is too small to fit into C int type" +msgstr "вредноÑÑ‚ је Ñувише мала да Ñе ÑмеÑти у C int тип" + +msgid "number must be greater than zero" +msgstr "број мора бити већи од нуле" + +msgid "number must be greater or equal to zero" +msgstr "број мора бити већи од или једнак нули" + +msgid "can't delete OutputObject attributes" +msgstr "атрибути OutputObject не могу да Ñе обришу" + +#, c-format +msgid "invalid attribute: %s" +msgstr "неважећи атрибут: %s" + +msgid "E264: Python: Error initialising I/O objects" +msgstr "E264: Python: Грешка код иницијализације У/И објеката" + +msgid "failed to change directory" +msgstr "не може да Ñе промени директоријум" + +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got %s" +msgstr "Као резултат imp.find_module() очекује Ñе триплет, али је добијено %s" + +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" +msgstr "Као резултат imp.find_module() очекује Ñе триплет, али је добијена н-торка величине %d" + +msgid "internal error: imp.find_module returned tuple with NULL" +msgstr "интерна грешка: imp.find_module је вратио н-торку Ñа NULL" + +msgid "cannot delete vim.Dictionary attributes" +msgstr "vim.Dictionary атрибути не могу да Ñе обришу" + +msgid "cannot modify fixed dictionary" +msgstr "фикÑни речник не може да Ñе измени" + +#, c-format +msgid "cannot set attribute %s" +msgstr "атрибут %s не може да Ñе поÑтави" + +msgid "hashtab changed during iteration" +msgstr "hashtab је промењен током итерације" + +#, c-format +msgid "expected sequence element of size 2, but got sequence of size %d" +msgstr "очекивао Ñе елемент Ñеквенце величине 2, алил је добијена Ñеквенца величине %d" + +msgid "list constructor does not accept keyword arguments" +msgstr "конÑтруктор лиÑте не прихвата кључне речи за аргументе" + +msgid "list index out of range" +msgstr "Ð¸Ð½Ð´ÐµÐºÑ Ð»Ð¸Ñте је ван опÑега" + +#, c-format +msgid "internal error: failed to get vim list item %d" +msgstr "интерна грешка: Ñтавка %d vim лиÑте није могла да Ñе добије" + +msgid "slice step cannot be zero" +msgstr "slice корак не може да буде нула" + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "покушај доделе Ñеквенце величине веће од %d како би Ñе продужио slice" + +#, c-format +msgid "internal error: no vim list item %d" +msgstr "интерна грешка: нема Ñтавке %d у vim лиÑти" + +msgid "internal error: not enough list items" +msgstr "интерна грешка: нема довољно Ñтавки лиÑте" + +msgid "internal error: failed to add item to list" +msgstr "интерна грешка: Ñтавка није могла да Ñе дода лиÑти" + +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "покушај доделе Ñеквенце величине %d како би Ñе продужио slice величине %d" + +msgid "failed to add item to list" +msgstr "Ñтавка није могла да Ñе дода лиÑти" + +msgid "cannot delete vim.List attributes" +msgstr "vim.List атрибути не могу да Ñе обришу" + +msgid "cannot modify fixed list" +msgstr "фикÑна лиÑта не може да Ñе измени" + +#, c-format +msgid "unnamed function %s does not exist" +msgstr "неименована функција %s не поÑтоји" + +#, c-format +msgid "function %s does not exist" +msgstr "функција %s не поÑтоји" + +#, c-format +msgid "failed to run function %s" +msgstr "функција %s није могла да Ñе покрене" + +msgid "unable to get option value" +msgstr "вредноÑÑ‚ опције није могла да Ñе добије" + +msgid "internal error: unknown option type" +msgstr "интерна грешка: непознат тип опције" + +msgid "problem while switching windows" +msgstr "проблем код пребацивања прозора" + +#, c-format +msgid "unable to unset global option %s" +msgstr "глобална опција %s није могла да Ñе иÑкључи" + +#, c-format +msgid "unable to unset option %s which does not have global value" +msgstr "опција %s која нема глобалну вредноÑÑ‚ није могла да Ñе иÑкључи" + +msgid "attempt to refer to deleted tab page" +msgstr "покушај рефериÑања на обриÑану картицу" + +msgid "no such tab page" +msgstr "не поÑтоји таква картица" + +msgid "attempt to refer to deleted window" +msgstr "покушај рефериÑања на обриÑан прозор" + +msgid "readonly attribute: buffer" +msgstr "атрибут Ñамо за читање: бафер" + +msgid "cursor position outside buffer" +msgstr "позиција курÑора је ван бафера" + +msgid "no such window" +msgstr "нема таквог прозора" + +msgid "attempt to refer to deleted buffer" +msgstr "покушај рефериÑања на обриÑан бафер" + +msgid "failed to rename buffer" +msgstr "име бафера није могло да Ñе промени" + +msgid "mark name must be a single character" +msgstr "име маркера мора бити Ñамо један карактер" + +#, c-format +msgid "expected vim.Buffer object, but got %s" +msgstr "очекивао Ñе vim.Buffer објекат, али је добијен %s" + +#, c-format +msgid "failed to switch to buffer %d" +msgstr "прелазак на бафер %d није био могућ" + +#, c-format +msgid "expected vim.Window object, but got %s" +msgstr "очекивао Ñе vim.Window објекат, али је добијен %s" + +msgid "failed to find window in the current tab page" +msgstr "прозор није пронађен у текућој картици" + +msgid "did not switch to the specified window" +msgstr "није Ñе прешло у наведени прозор" + +#, c-format +msgid "expected vim.TabPage object, but got %s" +msgstr "очекивао Ñе vim.TabPage објекат, али је добијен %s" + +msgid "did not switch to the specified tab page" +msgstr "није Ñе прешло у наведену картицу" + +msgid "failed to run the code" +msgstr "кôд није могао да Ñе покрене" + +msgid "E858: Eval did not return a valid python object" +msgstr "E858: Eval није вратио важећи python објекат" + +msgid "E859: Failed to convert returned python object to vim value" +msgstr "E859: Конверзија враћеног python објекта у vim вредноÑÑ‚ није уÑпела" + +#, c-format +msgid "unable to convert %s to vim dictionary" +msgstr "%s не може да Ñе конвертује у vim речник" + +#, c-format +msgid "unable to convert %s to vim list" +msgstr "%s не може да Ñе конвертује у vim лиÑту" + +#, c-format +msgid "unable to convert %s to vim structure" +msgstr "%s не може да Ñе конвертује у vim Ñтруктуру" + +msgid "internal error: NULL reference passed" +msgstr "интерна грешка: проÑлеђена је NULL референца" + +msgid "internal error: invalid value type" +msgstr "интерна грешка: вредноÑÑ‚ неважећег типа" + +msgid "" +"Failed to set path hook: sys.path_hooks is not a list\n" +"You should now do the following:\n" +"- append vim.path_hook to sys.path_hooks\n" +"- append vim.VIM_SPECIAL_PATH to sys.path\n" +msgstr "" +"Кука за путању није могла да Ñе поÑтави: sys.path_hooks није у лиÑти\n" +"Сада би требало да урадите Ñледеће:\n" +"- додајте vim.path_hook на крај sys.path_hooks\n" +"- додајте vim.VIM_SPECIAL_PATH на крај sys.path\n" + +msgid "" +"Failed to set path: sys.path is not a list\n" +"You should now append vim.VIM_SPECIAL_PATH to sys.path" +msgstr "" +"Путања није могла да Ñе поÑтави: sys.path није у лиÑти\n" +"Сада би требало да додате vim.VIM_SPECIAL_PATH на крај sys.path" diff -Nru vim-8.0.1453/src/popupmnu.c vim-8.0.1766/src/popupmnu.c --- vim-8.0.1453/src/popupmnu.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/popupmnu.c 2018-04-26 20:30:33.000000000 +0000 @@ -69,7 +69,7 @@ /* * Show the popup menu with items "array[size]". * "array" must remain valid until pum_undisplay() is called! - * When possible the leftmost character is aligned with screen column "col". + * When possible the leftmost character is aligned with cursor column. * The menu appears above the screen line "row" or at "row" + "height" - 1. */ void @@ -83,7 +83,7 @@ int max_width; int row; int context_lines; - int col; + int cursor_col; int above_row; int below_row; int redo_count = 0; @@ -93,7 +93,7 @@ do { - def_width = PUM_DEF_WIDTH; + def_width = p_pw; above_row = 0; below_row = cmdline_row; @@ -199,10 +199,11 @@ /* Calculate column */ #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) - col = curwin->w_wincol + curwin->w_width - curwin->w_wcol - 1; + cursor_col = curwin->w_wincol + curwin->w_width + - curwin->w_wcol - 1; else #endif - col = curwin->w_wincol + curwin->w_wcol; + cursor_col = curwin->w_wincol + curwin->w_wcol; /* if there are more items than room we need a scrollbar */ if (pum_height < size) @@ -216,16 +217,19 @@ if (def_width < max_width) def_width = max_width; - if (((col < Columns - PUM_DEF_WIDTH || col < Columns - max_width) + if (((cursor_col < Columns - p_pw + || cursor_col < Columns - max_width) #ifdef FEAT_RIGHTLEFT && !curwin->w_p_rl) - || (curwin->w_p_rl && (col > PUM_DEF_WIDTH || col > max_width) + || (curwin->w_p_rl + && (cursor_col > p_pw || cursor_col > max_width) #endif )) { - /* align pum column with "col" */ - pum_col = col; + /* align pum with "cursor_col" */ + pum_col = cursor_col; + /* start with the maximum space available */ #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) pum_width = pum_col - pum_scrollbar + 1; @@ -234,12 +238,78 @@ pum_width = Columns - pum_col - pum_scrollbar; if (pum_width > max_width + pum_kind_width + pum_extra_width + 1 - && pum_width > PUM_DEF_WIDTH) + && pum_width > p_pw) { + /* the width is more than needed for the items, make it + * narrower */ pum_width = max_width + pum_kind_width + pum_extra_width + 1; - if (pum_width < PUM_DEF_WIDTH) - pum_width = PUM_DEF_WIDTH; + if (pum_width < p_pw) + pum_width = p_pw; + } + else if (((cursor_col > p_pw || cursor_col > max_width) +#ifdef FEAT_RIGHTLEFT + && !curwin->w_p_rl) + || (curwin->w_p_rl && (cursor_col < Columns - p_pw + || cursor_col < Columns - max_width) +#endif + )) + { + /* align pum edge with "cursor_col" */ +#ifdef FEAT_RIGHTLEFT + if (curwin->w_p_rl + && W_ENDCOL(curwin) < max_width + pum_scrollbar + 1) + { + pum_col = cursor_col + max_width + pum_scrollbar + 1; + if (pum_col >= Columns) + pum_col = Columns - 1; + } + else if (!curwin->w_p_rl) +#endif + { + if (curwin->w_wincol > Columns - max_width - pum_scrollbar + && max_width <= p_pw) + { + /* use full width to end of the screen */ + pum_col = Columns - max_width - pum_scrollbar; + if (pum_col < 0) + pum_col = 0; + } + } + +#ifdef FEAT_RIGHTLEFT + if (curwin->w_p_rl) + pum_width = pum_col - pum_scrollbar + 1; + else +#endif + pum_width = Columns - pum_col - pum_scrollbar; + + if (pum_width < p_pw) + { + pum_width = p_pw; +#ifdef FEAT_RIGHTLEFT + if (curwin->w_p_rl) + { + if (pum_width > pum_col) + pum_width = pum_col; + } + else +#endif + { + if (pum_width >= Columns - pum_col) + pum_width = Columns - pum_col - 1; + } + } + else if (pum_width > max_width + pum_kind_width + + pum_extra_width + 1 + && pum_width > p_pw) + { + pum_width = max_width + pum_kind_width + + pum_extra_width + 1; + if (pum_width < p_pw) + pum_width = p_pw; + } } + } else if (Columns < def_width) { @@ -254,8 +324,8 @@ } else { - if (max_width > PUM_DEF_WIDTH) - max_width = PUM_DEF_WIDTH; /* truncate */ + if (max_width > p_pw) + max_width = p_pw; /* truncate */ #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) pum_col = max_width - 1; @@ -352,9 +422,11 @@ char_u *st; int saved = *p; - *p = NUL; + if (saved != NUL) + *p = NUL; st = transstr(s); - *p = saved; + if (saved != NUL) + *p = saved; #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) { @@ -760,6 +832,43 @@ return pum_height; } +# if defined(FEAT_BEVAL_TERM) || defined(FEAT_TERM_POPUP_MENU) || defined(PROTO) + static void +pum_position_at_mouse(int min_width) +{ + if (Rows - mouse_row > pum_size) + { + /* Enough space below the mouse row. */ + pum_row = mouse_row + 1; + if (pum_height > Rows - pum_row) + pum_height = Rows - pum_row; + } + else + { + /* Show above the mouse row, reduce height if it does not fit. */ + pum_row = mouse_row - pum_size; + if (pum_row < 0) + { + pum_height += pum_row; + pum_row = 0; + } + } + if (Columns - mouse_col >= pum_base_width + || Columns - mouse_col > min_width) + /* Enough space to show at mouse column. */ + pum_col = mouse_col; + else + /* Not enough space, right align with window. */ + pum_col = Columns - (pum_base_width > min_width + ? min_width : pum_base_width); + + pum_width = Columns - pum_col; + if (pum_width > pum_base_width + 1) + pum_width = pum_base_width + 1; +} + +# endif + # if defined(FEAT_BEVAL_TERM) || defined(PROTO) static pumitem_T *balloon_array = NULL; static int balloon_arraysize; @@ -915,8 +1024,7 @@ pum_undisplay(); while (balloon_arraysize > 0) vim_free(balloon_array[--balloon_arraysize].pum_text); - vim_free(balloon_array); - balloon_array = NULL; + VIM_CLEAR(balloon_array); } } @@ -959,36 +1067,7 @@ pum_scrollbar = 0; pum_height = balloon_arraysize; - if (Rows - mouse_row > pum_size) - { - /* Enough space below the mouse row. */ - pum_row = mouse_row + 1; - if (pum_height > Rows - pum_row) - pum_height = Rows - pum_row; - } - else - { - /* Show above the mouse row, reduce height if it does not fit. */ - pum_row = mouse_row - pum_size; - if (pum_row < 0) - { - pum_height += pum_row; - pum_row = 0; - } - } - if (Columns - mouse_col >= pum_base_width - || Columns - mouse_col > BALLOON_MIN_WIDTH) - /* Enough space to show at mouse column. */ - pum_col = mouse_col; - else - /* Not enough space, right align with window. */ - pum_col = Columns - (pum_base_width > BALLOON_MIN_WIDTH - ? BALLOON_MIN_WIDTH : pum_base_width); - - pum_width = Columns - pum_col; - if (pum_width > pum_base_width + 1) - pum_width = pum_base_width + 1; - + pum_position_at_mouse(BALLOON_MIN_WIDTH); pum_selected = -1; pum_first = 0; pum_redraw(); @@ -1005,4 +1084,176 @@ ui_remove_balloon(); } # endif + +# if defined(FEAT_TERM_POPUP_MENU) || defined(PROTO) +/* + * Select the pum entry at the mouse position. + */ + static void +pum_select_mouse_pos(void) +{ + int idx = mouse_row - pum_row; + + if (idx < 0 || idx >= pum_size) + pum_selected = -1; + else if (*pum_array[idx].pum_text != NUL) + pum_selected = idx; +} + +/* + * Execute the currently selected popup menu item. + */ + static void +pum_execute_menu(vimmenu_T *menu, int mode) +{ + vimmenu_T *mp; + int idx = 0; + exarg_T ea; + + for (mp = menu->children; mp != NULL; mp = mp->next) + if ((mp->modes & mp->enabled & mode) && idx++ == pum_selected) + { + vim_memset(&ea, 0, sizeof(ea)); + execute_menu(&ea, mp); + break; + } +} + +/* + * Open the terminal version of the popup menu and don't return until it is + * closed. + */ + void +pum_show_popupmenu(vimmenu_T *menu) +{ + vimmenu_T *mp; + int idx = 0; + pumitem_T *array; +#ifdef FEAT_BEVAL_TERM + int save_bevalterm = p_bevalterm; +#endif + int mode; + + pum_undisplay(); + pum_size = 0; + mode = get_menu_mode_flag(); + + for (mp = menu->children; mp != NULL; mp = mp->next) + if (menu_is_separator(mp->dname) + || (mp->modes & mp->enabled & mode)) + ++pum_size; + + array = (pumitem_T *)alloc_clear((unsigned)sizeof(pumitem_T) * pum_size); + if (array == NULL) + return; + + for (mp = menu->children; mp != NULL; mp = mp->next) + if (menu_is_separator(mp->dname)) + array[idx++].pum_text = (char_u *)""; + else if (mp->modes & mp->enabled & mode) + array[idx++].pum_text = mp->dname; + + pum_array = array; + pum_compute_size(); + pum_scrollbar = 0; + pum_height = pum_size; + pum_position_at_mouse(20); + + pum_selected = -1; + pum_first = 0; +# ifdef FEAT_BEVAL_TERM + p_bevalterm = TRUE; /* track mouse movement */ + mch_setmouse(TRUE); +# endif + + for (;;) + { + int c; + + pum_redraw(); + setcursor_mayforce(TRUE); + out_flush(); + + c = vgetc(); + if (c == ESC || c == Ctrl_C) + break; + else if (c == CAR || c == NL) + { + /* enter: select current item, if any, and close */ + pum_execute_menu(menu, mode); + break; + } + else if (c == 'k' || c == K_UP || c == K_MOUSEUP) + { + /* cursor up: select previous item */ + while (pum_selected > 0) + { + --pum_selected; + if (*array[pum_selected].pum_text != NUL) + break; + } + } + else if (c == 'j' || c == K_DOWN || c == K_MOUSEDOWN) + { + /* cursor down: select next item */ + while (pum_selected < pum_size - 1) + { + ++pum_selected; + if (*array[pum_selected].pum_text != NUL) + break; + } + } + else if (c == K_RIGHTMOUSE) + { + /* Right mouse down: reposition the menu. */ + vungetc(c); + break; + } + else if (c == K_LEFTDRAG || c == K_RIGHTDRAG || c == K_MOUSEMOVE) + { + /* mouse moved: select item in the mouse row */ + pum_select_mouse_pos(); + } + else if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM || c == K_RIGHTRELEASE) + { + /* left mouse click: select clicked item, if any, and close; + * right mouse release: select clicked item, close if any */ + pum_select_mouse_pos(); + if (pum_selected >= 0) + { + pum_execute_menu(menu, mode); + break; + } + if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM) + break; + } + } + + vim_free(array); + pum_undisplay(); +# ifdef FEAT_BEVAL_TERM + p_bevalterm = save_bevalterm; + mch_setmouse(TRUE); +# endif +} + + void +pum_make_popup(char_u *path_name, int use_mouse_pos) +{ + vimmenu_T *menu; + + if (!use_mouse_pos) + { + /* Hack: set mouse position at the cursor so that the menu pops up + * around there. */ + mouse_row = curwin->w_winrow + curwin->w_wrow; + mouse_col = curwin->w_wincol + curwin->w_wcol; + } + + menu = gui_find_menu(path_name); + if (menu != NULL) + pum_show_popupmenu(menu); +} +# endif + #endif diff -Nru vim-8.0.1453/src/proto/buffer.pro vim-8.0.1766/src/proto/buffer.pro --- vim-8.0.1453/src/proto/buffer.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/buffer.pro 2018-04-26 20:30:33.000000000 +0000 @@ -14,7 +14,8 @@ void enter_buffer(buf_T *buf); void do_autochdir(void); void no_write_message(void); -void no_write_message_nobang(void); +void no_write_message_nobang(buf_T *buf); +int curbuf_reusable(void); buf_T *buflist_new(char_u *ffname, char_u *sfname, linenr_T lnum, int flags); void free_buf_options(buf_T *buf, int free_p_ff); int buflist_getfile(int n, linenr_T lnum, int options, int forceit); diff -Nru vim-8.0.1453/src/proto/channel.pro vim-8.0.1766/src/proto/channel.pro --- vim-8.0.1453/src/proto/channel.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/channel.pro 2018-04-26 20:30:33.000000000 +0000 @@ -1,7 +1,6 @@ /* channel.c */ void ch_logfile(char_u *fname, char_u *opt); int ch_log_active(void); -void ch_log(channel_T *ch, const char *fmt, ...); channel_T *add_channel(void); int has_any_channel(void); int channel_unref(channel_T *channel); @@ -66,8 +65,9 @@ void job_stop_on_exit(void); int has_pending_job(void); void job_check_ended(void); -job_T *job_start(typval_T *argvars, jobopt_T *opt_arg); +job_T *job_start(typval_T *argvars, char **argv_arg, jobopt_T *opt_arg); char *job_status(job_T *job); void job_info(job_T *job, dict_T *dict); +void job_info_all(list_T *l); int job_stop(job_T *job, typval_T *argvars, char *type); /* vim: set ft=c : */ diff -Nru vim-8.0.1453/src/proto/digraph.pro vim-8.0.1766/src/proto/digraph.pro --- vim-8.0.1453/src/proto/digraph.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/digraph.pro 2018-04-26 20:30:33.000000000 +0000 @@ -1,5 +1,6 @@ /* digraph.c */ int do_digraph(int c); +char_u *get_digraph_for_char(int val); int get_digraph(int cmdline); int getdigraph(int char1, int char2, int meta_char); void putdigraph(char_u *str); diff -Nru vim-8.0.1453/src/proto/edit.pro vim-8.0.1766/src/proto/edit.pro --- vim-8.0.1453/src/proto/edit.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/edit.pro 2018-04-26 20:30:33.000000000 +0000 @@ -6,6 +6,8 @@ void change_indent(int type, int amount, int round, int replaced, int call_changed_bytes); void truncate_spaces(char_u *line); void backspace_until_column(int col); +int ctrl_x_mode_not_default(void); +int ctrl_x_mode_not_defined_yet(void); int vim_is_ctrl_x_key(int c); int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int dir, int flags); void completeopt_was_set(void); diff -Nru vim-8.0.1453/src/proto/eval.pro vim-8.0.1766/src/proto/eval.pro --- vim-8.0.1453/src/proto/eval.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/eval.pro 2018-04-26 20:30:33.000000000 +0000 @@ -64,7 +64,7 @@ varnumber_T get_vim_var_nr(int idx); char_u *get_vim_var_str(int idx); list_T *get_vim_var_list(int idx); -dict_T * get_vim_var_dict(int idx); +dict_T *get_vim_var_dict(int idx); void set_vim_var_char(int c); void set_vcount(long count, long count1, int set_prevcount); void set_vim_var_string(int idx, char_u *val, int len); @@ -122,13 +122,18 @@ void prepare_assert_error(garray_T *gap); void assert_error(garray_T *gap); void assert_equal_common(typval_T *argvars, assert_type_T atype); +void assert_equalfile(typval_T *argvars); void assert_match_common(typval_T *argvars, assert_type_T atype); void assert_inrange(typval_T *argvars); void assert_bool(typval_T *argvars, int isTrue); void assert_report(typval_T *argvars); void assert_exception(typval_T *argvars); +void assert_beeps(typval_T *argvars); void assert_fails(typval_T *argvars); void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, char_u *exp_str, typval_T *exp_tv, typval_T *got_tv, assert_type_T atype); +int typval_compare(typval_T *typ1, typval_T *typ2, exptype_T type, int type_is, int ic); +char_u *typval_tostring(typval_T *arg); +int var_exists(char_u *var); int modify_fname(char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen); char_u *do_string_sub(char_u *str, char_u *pat, char_u *sub, typval_T *expr, char_u *flags); void filter_map(typval_T *argvars, typval_T *rettv, int map); diff -Nru vim-8.0.1453/src/proto/ex_cmds2.pro vim-8.0.1766/src/proto/ex_cmds2.pro --- vim-8.0.1453/src/proto/ex_cmds2.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/ex_cmds2.pro 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,5 @@ /* ex_cmds2.c */ +int has_watchexpr (void); void do_debug(char_u *cmd); void ex_debug(exarg_T *eap); void dbg_check_breakpoint(exarg_T *eap); @@ -66,6 +67,7 @@ void ex_argadd(exarg_T *eap); void ex_argdelete(exarg_T *eap); void ex_listdo(exarg_T *eap); +char_u *get_arglist_name(expand_T *xp, int idx); void ex_compiler(exarg_T *eap); void ex_runtime(exarg_T *eap); int do_in_path(char_u *path, char_u *name, int flags, void (*callback)(char_u *fname, void *ck), void *cookie); diff -Nru vim-8.0.1453/src/proto/ex_docmd.pro vim-8.0.1766/src/proto/ex_docmd.pro --- vim-8.0.1453/src/proto/ex_docmd.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/ex_docmd.pro 2018-04-26 20:30:33.000000000 +0000 @@ -12,6 +12,7 @@ void ex_ni(exarg_T *eap); int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp); void separate_nextcmd(exarg_T *eap); +int get_bad_opt(char_u *p, exarg_T *eap); int ends_excmd(int c); char_u *find_nextcmd(char_u *p); char_u *check_nextcmd(char_u *p); diff -Nru vim-8.0.1453/src/proto/fileio.pro vim-8.0.1766/src/proto/fileio.pro --- vim-8.0.1453/src/proto/fileio.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/fileio.pro 2018-04-26 20:30:33.000000000 +0000 @@ -48,6 +48,7 @@ int has_cursormovedI(void); int has_textchanged(void); int has_textchangedI(void); +int has_textchangedP(void); int has_insertcharpre(void); int has_cmdundefined(void); int has_funcundefined(void); diff -Nru vim-8.0.1453/src/proto/list.pro vim-8.0.1766/src/proto/list.pro --- vim-8.0.1453/src/proto/list.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/list.pro 2018-04-26 20:30:33.000000000 +0000 @@ -21,6 +21,7 @@ void list_append(list_T *l, listitem_T *item); int list_append_tv(list_T *l, typval_T *tv); int list_append_dict(list_T *list, dict_T *dict); +int list_append_list(list_T *list1, list_T *list2); int list_append_string(list_T *l, char_u *str, int len); int list_append_number(list_T *l, varnumber_T n); int list_insert_tv(list_T *l, typval_T *tv, listitem_T *item); diff -Nru vim-8.0.1453/src/proto/mark.pro vim-8.0.1766/src/proto/mark.pro --- vim-8.0.1453/src/proto/mark.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/mark.pro 2018-04-26 20:30:33.000000000 +0000 @@ -9,6 +9,7 @@ pos_T *getmark(int c, int changefile); pos_T *getmark_buf_fnum(buf_T *buf, int c, int changefile, int *fnum); pos_T *getnextmark(pos_T *startpos, int dir, int begin_line); +void fname2fnum(xfmark_T *fm); void fmarks_check_names(buf_T *buf); int check_mark(pos_T *pos); void clrallmarks(buf_T *buf); @@ -23,6 +24,7 @@ void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount, long col_amount); void copy_jumplist(win_T *from, win_T *to); void free_jumplist(win_T *wp); +void cleanup_jumplist(win_T *wp, int loadfiles); void set_last_cursor(win_T *win); void free_all_marks(void); int read_viminfo_filemark(vir_T *virp, int force); diff -Nru vim-8.0.1453/src/proto/menu.pro vim-8.0.1766/src/proto/menu.pro --- vim-8.0.1453/src/proto/menu.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/menu.pro 2018-04-26 20:30:33.000000000 +0000 @@ -12,12 +12,14 @@ int menu_is_child_of_popup(vimmenu_T *menu); int menu_is_toolbar(char_u *name); int menu_is_separator(char_u *name); +int get_menu_mode_flag(void); +void show_popupmenu(void); int check_menu_pointer(vimmenu_T *root, vimmenu_T *menu_to_check); void gui_create_initial_menus(vimmenu_T *menu); void gui_update_menus(int modes); int gui_is_menu_shortcut(int key); -void gui_show_popupmenu(void); void gui_mch_toggle_tearoffs(int enable); +void execute_menu(exarg_T *eap, vimmenu_T *menu); void ex_emenu(exarg_T *eap); void winbar_click(win_T *wp, int col); vimmenu_T *gui_find_menu(char_u *path_name); diff -Nru vim-8.0.1453/src/proto/misc2.pro vim-8.0.1766/src/proto/misc2.pro --- vim-8.0.1453/src/proto/misc2.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/misc2.pro 2018-04-26 20:30:33.000000000 +0000 @@ -82,7 +82,7 @@ int get_real_state(void); int after_pathsep(char_u *b, char_u *p); int same_directory(char_u *f1, char_u *f2); -int vim_chdirfile(char_u *fname); +int vim_chdirfile(char_u *fname, char *trigger_autocmd); int vim_stat(const char *name, stat_T *stp); char_u *parse_shape_opt(int what); int get_shape_idx(int mouse); @@ -110,4 +110,7 @@ void time_to_bytes(time_T the_time, char_u *buf); int has_non_ascii(char_u *s); void parse_queued_messages(void); +int mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc); +int build_argv_from_string(char_u *cmd, char ***argv, int *argc); +int build_argv_from_list(list_T *l, char ***argv, int *argc); /* vim: set ft=c : */ diff -Nru vim-8.0.1453/src/proto/ops.pro vim-8.0.1766/src/proto/ops.pro --- vim-8.0.1453/src/proto/ops.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/ops.pro 2018-04-26 20:30:33.000000000 +0000 @@ -11,7 +11,7 @@ char_u *get_expr_line(void); char_u *get_expr_line_src(void); int valid_yank_reg(int regname, int writing); -void get_yank_register(int regname, int writing); +int get_yank_register(int regname, int writing); int may_get_selection(int regname); void *get_register(int name, int copy); void put_register(int name, void *reg); @@ -19,7 +19,7 @@ int yank_register_mline(int regname); int do_record(int c); int do_execreg(int regname, int colon, int addcr, int silent); -int insert_reg(int regname, int literally); +int insert_reg(int regname, int literally_arg); int get_spec_reg(int regname, char_u **argp, int *allocated, int errmsg); int cmdline_paste_reg(int regname, int literally, int remcr); void adjust_clip_reg(int *rp); diff -Nru vim-8.0.1453/src/proto/option.pro vim-8.0.1766/src/proto/option.pro --- vim-8.0.1453/src/proto/option.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/option.pro 2018-04-26 20:30:33.000000000 +0000 @@ -1,5 +1,5 @@ /* option.c */ -void set_init_1(void); +void set_init_1(int clean_arg); void set_string_default(char *name, char_u *val); void set_number_default(char *name, long val); void free_all_options(void); diff -Nru vim-8.0.1453/src/proto/os_win32.pro vim-8.0.1766/src/proto/os_win32.pro --- vim-8.0.1453/src/proto/os_win32.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/os_win32.pro 2018-04-26 20:30:33.000000000 +0000 @@ -6,6 +6,7 @@ void dyn_libintl_end(void); void PlatformId(void); void mch_setmouse(int on); +void mch_bevalterm_changed(void); void mch_update_cursor(void); int mch_char_avail(void); int mch_check_messages(void); @@ -42,6 +43,7 @@ void mch_new_shellsize(void); void mch_set_winsize_now(void); int mch_call_shell(char_u *cmd, int options); +void win32_build_env(dict_T *env, garray_T *gap, int is_terminal); void mch_job_start(char *cmd, job_T *job, jobopt_T *options); char *mch_job_status(job_T *job); job_T *mch_detect_ended_job(job_T *job_list); @@ -67,5 +69,7 @@ void set_alist_count(void); void fix_arg_enc(void); int mch_setenv(char *var, char *value, int x); -void win32_build_env(dict_T *l, garray_T *gap, int is_terminal); +void control_console_color_rgb(void); +int has_vtp_working(void); +int use_vtp(void); /* vim: set ft=c : */ diff -Nru vim-8.0.1453/src/proto/popupmnu.pro vim-8.0.1766/src/proto/popupmnu.pro --- vim-8.0.1453/src/proto/popupmnu.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/popupmnu.pro 2018-04-26 20:30:33.000000000 +0000 @@ -9,4 +9,6 @@ void ui_remove_balloon(void); void ui_post_balloon(char_u *mesg, list_T *list); void ui_may_remove_balloon(void); +void pum_show_popupmenu(vimmenu_T *menu); +void pum_make_popup(char_u *path_name, int mouse_pos); /* vim: set ft=c : */ diff -Nru vim-8.0.1453/src/proto/screen.pro vim-8.0.1766/src/proto/screen.pro --- vim-8.0.1453/src/proto/screen.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/screen.pro 2018-04-26 20:30:33.000000000 +0000 @@ -44,6 +44,7 @@ void screen_start(void); void windgoto(int row, int col); void setcursor(void); +void setcursor_mayforce(int force); int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear); int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear, int clear_attr); int screen_ins_lines(int off, int row, int line_count, int end, int clear_attr, win_T *wp); diff -Nru vim-8.0.1453/src/proto/terminal.pro vim-8.0.1766/src/proto/terminal.pro --- vim-8.0.1453/src/proto/terminal.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/terminal.pro 2018-04-26 20:30:33.000000000 +0000 @@ -1,14 +1,20 @@ /* terminal.c */ +void init_job_options(jobopt_T *opt); +buf_T *term_start(typval_T *argvar, char **argv, jobopt_T *opt, int flags); void ex_terminal(exarg_T *eap); +int term_write_session(FILE *fd, win_T *wp); +int term_should_restore(buf_T *buf); void free_terminal(buf_T *buf); void write_to_term(buf_T *buffer, char_u *msg, channel_T *channel); int term_job_running(term_T *term); int term_none_open(term_T *term); +int term_try_stop_job(buf_T *buf); int term_in_normal_mode(void); void term_enter_job_mode(void); int send_keys_to_term(term_T *term, int c, int typed); int terminal_is_active(void); cursorentry_T *term_get_cursor_shape(guicolor_T *fg, guicolor_T *bg); +void term_win_entered(void); int term_use_loop(void); int terminal_loop(int blocking); void term_job_ended(job_T *job); @@ -21,6 +27,10 @@ char_u *term_get_status_text(term_T *term); int set_ref_in_term(int copyID); void set_terminal_default_colors(int cterm_fg, int cterm_bg); +void f_term_dumpwrite(typval_T *argvars, typval_T *rettv); +int term_swap_diff(void); +void f_term_dumpdiff(typval_T *argvars, typval_T *rettv); +void f_term_dumpload(typval_T *argvars, typval_T *rettv); void f_term_getaltscreen(typval_T *argvars, typval_T *rettv); void f_term_getattr(typval_T *argvars, typval_T *rettv); void f_term_getcursor(typval_T *argvars, typval_T *rettv); @@ -28,12 +38,17 @@ void f_term_getline(typval_T *argvars, typval_T *rettv); void f_term_getscrolled(typval_T *argvars, typval_T *rettv); void f_term_getsize(typval_T *argvars, typval_T *rettv); +void f_term_setsize(typval_T *argvars, typval_T *rettv); void f_term_getstatus(typval_T *argvars, typval_T *rettv); void f_term_gettitle(typval_T *argvars, typval_T *rettv); void f_term_gettty(typval_T *argvars, typval_T *rettv); void f_term_list(typval_T *argvars, typval_T *rettv); void f_term_scrape(typval_T *argvars, typval_T *rettv); void f_term_sendkeys(typval_T *argvars, typval_T *rettv); +void f_term_getansicolors(typval_T *argvars, typval_T *rettv); +void f_term_setansicolors(typval_T *argvars, typval_T *rettv); +void f_term_setrestore(typval_T *argvars, typval_T *rettv); +void f_term_setkill(typval_T *argvars, typval_T *rettv); void f_term_start(typval_T *argvars, typval_T *rettv); void f_term_wait(typval_T *argvars, typval_T *rettv); void term_send_eof(channel_T *ch); diff -Nru vim-8.0.1453/src/proto/term.pro vim-8.0.1766/src/proto/term.pro --- vim-8.0.1453/src/proto/term.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/term.pro 2018-04-26 20:30:33.000000000 +0000 @@ -24,7 +24,7 @@ void term_append_lines(int line_count); void term_delete_lines(int line_count); void term_set_winpos(int x, int y); -int term_get_winpos(int *x, int *y); +int term_get_winpos(int *x, int *y, varnumber_T timeout); void term_set_winsize(int height, int width); void term_fg_color(int n); void term_bg_color(int n); @@ -73,6 +73,7 @@ int show_one_termcode(char_u *name, char_u *code, int printit); char_u *translate_mapping(char_u *str, int expmap); void update_tcap(int attr); +void swap_tcap(void); guicolor_T gui_get_color_cmn(char_u *name); guicolor_T gui_get_rgb_color_cmn(int r, int g, int b); /* vim: set ft=c : */ diff -Nru vim-8.0.1453/src/proto/version.pro vim-8.0.1766/src/proto/version.pro --- vim-8.0.1453/src/proto/version.pro 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto/version.pro 2018-04-26 20:30:33.000000000 +0000 @@ -3,6 +3,7 @@ int highest_patch(void); int has_patch(int n); void ex_version(exarg_T *eap); +void list_in_columns(char_u **items, int size, int current); void list_version(void); void maybe_intro_message(void); void intro_message(int colon); diff -Nru vim-8.0.1453/src/proto.h vim-8.0.1766/src/proto.h --- vim-8.0.1453/src/proto.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/proto.h 2018-04-26 20:30:33.000000000 +0000 @@ -119,13 +119,21 @@ # ifdef __BORLANDC__ _RTLENTRYF # endif -vim_snprintf_add(char *, size_t, char *, ...); +vim_snprintf_add(char *, size_t, char *, ...) +#ifdef USE_PRINTF_FORMAT_ATTRIBUTE + __attribute__((format(printf, 3, 4))) +#endif + ; int # ifdef __BORLANDC__ _RTLENTRYF # endif -vim_snprintf(char *, size_t, char *, ...); +vim_snprintf(char *, size_t, char *, ...) +#ifdef USE_PRINTF_FORMAT_ATTRIBUTE + __attribute__((format(printf, 3, 4))) +#endif + ; int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap); int vim_vsnprintf_typval(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs); @@ -212,6 +220,14 @@ # endif # ifdef FEAT_JOB_CHANNEL # include "channel.pro" + +/* Not generated automatically, to add extra attribute. */ +void ch_log(channel_T *ch, const char *fmt, ...) +#ifdef USE_PRINTF_FORMAT_ATTRIBUTE + __attribute__((format(printf, 2, 3))) +#endif + ; + # endif # if defined(FEAT_GUI) || defined(FEAT_JOB_CHANNEL) diff -Nru vim-8.0.1453/src/pty.c vim-8.0.1766/src/pty.c --- vim-8.0.1453/src/pty.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/pty.c 2018-04-26 20:30:33.000000000 +0000 @@ -268,7 +268,7 @@ #endif #if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) \ - && !(defined(MACOS_X) && !defined(MAC_OS_X_VERSION_10_6)) + && !(defined(MACOS_X) && !defined(MAC_OS_X_VERSION_10_6)) /* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! * Same for Mac OS X Leopard (10.5). */ diff -Nru vim-8.0.1453/src/quickfix.c vim-8.0.1766/src/quickfix.c --- vim-8.0.1453/src/quickfix.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/quickfix.c 2018-04-26 20:30:33.000000000 +0000 @@ -46,6 +46,7 @@ * There is a stack of error lists. */ #define LISTCOUNT 10 +#define INVALID_QFIDX (-1) /* * Quickfix/Location list definition @@ -133,29 +134,22 @@ static efm_T *fmt_start = NULL; /* cached across qf_parse_line() calls */ static int qf_init_ext(qf_info_T *qi, int qf_idx, char_u *efile, buf_T *buf, typval_T *tv, char_u *errorformat, int newlist, linenr_T lnumfirst, linenr_T lnumlast, char_u *qf_title, char_u *enc); -static void qf_store_title(qf_info_T *qi, int qf_idx, char_u *title); static void qf_new_list(qf_info_T *qi, char_u *qf_title); -static void ll_free_all(qf_info_T **pqi); static int qf_add_entry(qf_info_T *qi, int qf_idx, char_u *dir, char_u *fname, int bufnum, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid); -static qf_info_T *ll_new_list(void); static void qf_free(qf_info_T *qi, int idx); static char_u *qf_types(int, int); static int qf_get_fnum(qf_info_T *qi, int qf_idx, char_u *, char_u *); static char_u *qf_push_dir(char_u *, struct dir_stack_T **, int is_file_stack); static char_u *qf_pop_dir(struct dir_stack_T **); static char_u *qf_guess_filepath(qf_info_T *qi, int qf_idx, char_u *); -static int qflist_valid(win_T *wp, int_u qf_id); static void qf_fmt_text(char_u *text, char_u *buf, int bufsize); -static void qf_clean_dir_stack(struct dir_stack_T **); static int qf_win_pos_update(qf_info_T *qi, int old_qf_index); -static int is_qf_win(win_T *win, qf_info_T *qi); static win_T *qf_find_win(qf_info_T *qi); static buf_T *qf_find_buf(qf_info_T *qi); static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last); static void qf_set_title_var(qf_info_T *qi); static void qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last); static char_u *get_mef_name(void); -static void restore_start_dir(char_u *dirname_start); static buf_T *load_dummy_buffer(char_u *fname, char_u *dirname_start, char_u *resulting_dir); static void wipe_dummy_buffer(buf_T *buf, char_u *dirname_start); static void unload_dummy_buffer(buf_T *buf, char_u *dirname_start); @@ -851,6 +845,7 @@ /* Always ignore case when looking for a matching error. */ regmatch.rm_ic = TRUE; +restofline: /* If there was no %> item start at the first pattern */ if (fmt_start == NULL) fmt_ptr = fmt_first; @@ -865,7 +860,6 @@ * match or no match. */ fields->valid = TRUE; -restofline: for ( ; fmt_ptr != NULL; fmt_ptr = fmt_ptr->next) { int r; @@ -1177,8 +1171,7 @@ int status; /* Do not used the cached buffer, it may have been wiped out. */ - vim_free(qf_last_bufname); - qf_last_bufname = NULL; + VIM_CLEAR(qf_last_bufname); vim_memset(&state, 0, sizeof(state)); vim_memset(&fields, 0, sizeof(fields)); @@ -1191,7 +1184,8 @@ fields.errmsglen = CMDBUFFSIZE + 1; fields.errmsg = alloc_id(fields.errmsglen, aid_qf_errmsg); fields.pattern = alloc_id(CMDBUFFSIZE + 1, aid_qf_pattern); - if (fields.namebuf == NULL || fields.errmsg == NULL || fields.pattern == NULL) + if (fields.namebuf == NULL || fields.errmsg == NULL + || fields.pattern == NULL) goto qf_init_end; if (efile != NULL && (state.fd = mch_fopen((char *)efile, "r")) == NULL) @@ -1229,8 +1223,7 @@ if (last_efm == NULL || (STRCMP(last_efm, efm) != 0)) { /* free the previously parsed data */ - vim_free(last_efm); - last_efm = NULL; + VIM_CLEAR(last_efm); free_efm_list(&fmt_first); /* parse the current 'efm' */ @@ -1351,8 +1344,7 @@ static void qf_store_title(qf_info_T *qi, int qf_idx, char_u *title) { - vim_free(qi->qf_lists[qf_idx].qf_title); - qi->qf_lists[qf_idx].qf_title = NULL; + VIM_CLEAR(qi->qf_lists[qf_idx].qf_title); if (title != NULL) { @@ -1827,7 +1819,6 @@ } } - /* * pop dirbuf from the directory stack and return previous directory or NULL if * stack is empty @@ -3003,8 +2994,7 @@ qf_free_items(qi, idx); - vim_free(qfl->qf_title); - qfl->qf_title = NULL; + VIM_CLEAR(qfl->qf_title); free_tv(qfl->qf_ctx); qfl->qf_ctx = NULL; qfl->qf_id = 0; @@ -3630,13 +3620,10 @@ /* Set the 'filetype' to "qf" each time after filling the buffer. * This resembles reading a file into a buffer, it's more logical when * using autocommands. */ -#ifdef FEAT_AUTOCMD ++curbuf_lock; -#endif set_option_value((char_u *)"ft", 0L, (char_u *)"qf", OPT_LOCAL); curbuf->b_p_ma = FALSE; -#ifdef FEAT_AUTOCMD keep_filetype = TRUE; /* don't detect 'filetype' */ apply_autocmds(EVENT_BUFREADPOST, (char_u *)"quickfix", NULL, FALSE, curbuf); @@ -3644,7 +3631,7 @@ FALSE, curbuf); keep_filetype = FALSE; --curbuf_lock; -#endif + /* make sure it will be redrawn */ redraw_curbuf_later(NOT_VALID); } @@ -3686,7 +3673,6 @@ win_T *wp = NULL; qf_info_T *qi = &ql_info; int res; -#ifdef FEAT_AUTOCMD char_u *au_name = NULL; /* Redirect ":grep" to ":vimgrep" if 'grepprg' is "internal". */ @@ -3709,12 +3695,11 @@ if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) return; -# endif - } #endif + } #ifdef FEAT_MBYTE enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc; #endif @@ -3770,17 +3755,15 @@ qi = GET_LOC_LIST(wp); if (res >= 0 && qi != NULL) qf_list_changed(qi, qi->qf_curlist); -#ifdef FEAT_AUTOCMD if (au_name != NULL) { apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); - if (qi->qf_curlist < qi->qf_listcount) + if (qi != NULL && qi->qf_curlist < qi->qf_listcount) res = qi->qf_lists[qi->qf_curlist].qf_count; else res = 0; } -#endif if (res > 0 && !eap->forceit) qf_jump(qi, 0, 0, FALSE); /* display first error */ @@ -4109,13 +4092,10 @@ char_u *enc = NULL; win_T *wp = NULL; qf_info_T *qi = &ql_info; -#ifdef FEAT_AUTOCMD char_u *au_name = NULL; - int save_qfid; -#endif + int save_qfid = 0; /* init for gcc */ int res; -#ifdef FEAT_AUTOCMD switch (eap->cmdidx) { case CMD_cfile: au_name = (char_u *)"cfile"; break; @@ -4128,7 +4108,6 @@ } if (au_name != NULL) apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, NULL, FALSE, curbuf); -#endif #ifdef FEAT_MBYTE enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc; #endif @@ -4168,20 +4147,270 @@ qi = GET_LOC_LIST(wp); if (res >= 0 && qi != NULL) qf_list_changed(qi, qi->qf_curlist); -#ifdef FEAT_AUTOCMD - save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; + if (qi != NULL) + save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; if (au_name != NULL) apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf); - /* - * Autocmd might have freed the quickfix/location list. Check whether it is - * still valid - */ - if (!qflist_valid(wp, save_qfid)) + + /* An autocmd might have freed the quickfix/location list. Check whether it + * is still valid. */ + if (qi != NULL && !qflist_valid(wp, save_qfid)) return; -#endif if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile)) - { qf_jump(qi, 0, 0, eap->forceit); /* display first error */ +} + +/* + * Return the quickfix/location list number with the given identifier. + * Returns -1 if list is not found. + */ + static int +qf_id2nr(qf_info_T *qi, int_u qfid) +{ + int qf_idx; + + for (qf_idx = 0; qf_idx < qi->qf_listcount; qf_idx++) + if (qi->qf_lists[qf_idx].qf_id == qfid) + return qf_idx; + return -1; +} + +/* + * Return the vimgrep autocmd name. + */ + static char_u * +vgr_get_auname(cmdidx_T cmdidx) +{ + switch (cmdidx) + { + case CMD_vimgrep: return (char_u *)"vimgrep"; + case CMD_lvimgrep: return (char_u *)"lvimgrep"; + case CMD_vimgrepadd: return (char_u *)"vimgrepadd"; + case CMD_lvimgrepadd: return (char_u *)"lvimgrepadd"; + case CMD_grep: return (char_u *)"grep"; + case CMD_lgrep: return (char_u *)"lgrep"; + case CMD_grepadd: return (char_u *)"grepadd"; + case CMD_lgrepadd: return (char_u *)"lgrepadd"; + default: return NULL; + } +} + +/* + * Initialize the regmatch used by vimgrep for pattern "s". + */ + static void +vgr_init_regmatch(regmmatch_T *regmatch, char_u *s) +{ + /* Get the search pattern: either white-separated or enclosed in // */ + regmatch->regprog = NULL; + + if (s == NULL || *s == NUL) + { + /* Pattern is empty, use last search pattern. */ + if (last_search_pat() == NULL) + { + EMSG(_(e_noprevre)); + return; + } + regmatch->regprog = vim_regcomp(last_search_pat(), RE_MAGIC); + } + else + regmatch->regprog = vim_regcomp(s, RE_MAGIC); + + regmatch->rmm_ic = p_ic; + regmatch->rmm_maxcol = 0; +} + +/* + * Display a file name when vimgrep is running. + */ + static void +vgr_display_fname(char_u *fname) +{ + char_u *p; + + msg_start(); + p = msg_strtrunc(fname, TRUE); + if (p == NULL) + msg_outtrans(fname); + else + { + msg_outtrans(p); + vim_free(p); + } + msg_clr_eos(); + msg_didout = FALSE; /* overwrite this message */ + msg_nowait = TRUE; /* don't wait for this message */ + msg_col = 0; + out_flush(); +} + +/* + * Load a dummy buffer to search for a pattern using vimgrep. + */ + static buf_T * +vgr_load_dummy_buf( + char_u *fname, + char_u *dirname_start, + char_u *dirname_now) +{ + int save_mls; +#if defined(FEAT_SYN_HL) + char_u *save_ei = NULL; +#endif + buf_T *buf; + +#if defined(FEAT_SYN_HL) + /* Don't do Filetype autocommands to avoid loading syntax and + * indent scripts, a great speed improvement. */ + save_ei = au_event_disable(",Filetype"); +#endif + /* Don't use modelines here, it's useless. */ + save_mls = p_mls; + p_mls = 0; + + /* Load file into a buffer, so that 'fileencoding' is detected, + * autocommands applied, etc. */ + buf = load_dummy_buffer(fname, dirname_start, dirname_now); + + p_mls = save_mls; +#if defined(FEAT_SYN_HL) + au_event_restore(save_ei); +#endif + + return buf; +} + +/* + * Check whether a quickfix/location list valid. Autocmds may remove or change + * a quickfix list when vimgrep is running. If the list is not found, create a + * new list. + */ + static int +vgr_qflist_valid( + win_T *wp, + qf_info_T *qi, + int_u qfid, + char_u *title) +{ + /* Verify that the quickfix/location list was not freed by an autocmd */ + if (!qflist_valid(wp, qfid)) + { + if (wp != NULL) + { + /* An autocmd has freed the location list. */ + EMSG(_(e_loc_list_changed)); + return FALSE; + } + else + { + /* Quickfix list is not found, create a new one. */ + qf_new_list(qi, title); + return TRUE; + } + } + + if (qi->qf_lists[qi->qf_curlist].qf_id != qfid) + /* Autocommands changed the quickfix list. Find the one we were + * using and restore it. */ + qi->qf_curlist = qf_id2nr(qi, qfid); + + return TRUE; +} + +/* + * Search for a pattern in all the lines in a buffer and add the matching lines + * to a quickfix list. + */ + static int +vgr_match_buflines( + qf_info_T *qi, + char_u *fname, + buf_T *buf, + regmmatch_T *regmatch, + long tomatch, + int duplicate_name, + int flags) +{ + int found_match = FALSE; + long lnum; + colnr_T col; + + for (lnum = 1; lnum <= buf->b_ml.ml_line_count && tomatch > 0; ++lnum) + { + col = 0; + while (vim_regexec_multi(regmatch, curwin, buf, lnum, + col, NULL, NULL) > 0) + { + /* Pass the buffer number so that it gets used even for a + * dummy buffer, unless duplicate_name is set, then the + * buffer will be wiped out below. */ + if (qf_add_entry(qi, + qi->qf_curlist, + NULL, /* dir */ + fname, + duplicate_name ? 0 : buf->b_fnum, + ml_get_buf(buf, + regmatch->startpos[0].lnum + lnum, FALSE), + regmatch->startpos[0].lnum + lnum, + regmatch->startpos[0].col + 1, + FALSE, /* vis_col */ + NULL, /* search pattern */ + 0, /* nr */ + 0, /* type */ + TRUE /* valid */ + ) == FAIL) + { + got_int = TRUE; + break; + } + found_match = TRUE; + if (--tomatch == 0) + break; + if ((flags & VGR_GLOBAL) == 0 + || regmatch->endpos[0].lnum > 0) + break; + col = regmatch->endpos[0].col + + (col == regmatch->endpos[0].col); + if (col > (colnr_T)STRLEN(ml_get_buf(buf, lnum, FALSE))) + break; + } + line_breakcheck(); + if (got_int) + break; + } + + return found_match; +} + +/* + * Jump to the first match and update the directory. + */ + static void +vgr_jump_to_match( + qf_info_T *qi, + int forceit, + int *redraw_for_dummy, + buf_T *first_match_buf, + char_u *target_dir) +{ + buf_T *buf; + + buf = curbuf; + qf_jump(qi, 0, 0, forceit); + if (buf != curbuf) + /* If we jumped to another buffer redrawing will already be + * taken care of. */ + *redraw_for_dummy = FALSE; + + /* Jump to the directory used after loading the buffer. */ + if (curbuf == first_match_buf && target_dir != NULL) + { + exarg_T ea; + + ea.arg = target_dir; + ea.cmdidx = CMD_lcd; + ex_cd(&ea); } } @@ -4203,13 +4432,8 @@ char_u *p; int fi; qf_info_T *qi = &ql_info; - int loclist_cmd = FALSE; -#ifdef FEAT_AUTOCMD int_u save_qfid; - qfline_T *cur_qf_start; - win_T *wp; -#endif - long lnum; + win_T *wp = NULL; buf_T *buf; int duplicate_name = FALSE; int using_dummy; @@ -4217,41 +4441,23 @@ int found_match; buf_T *first_match_buf = NULL; time_t seconds = 0; - int save_mls; -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) - char_u *save_ei = NULL; -#endif aco_save_T aco; int flags = 0; - colnr_T col; long tomatch; char_u *dirname_start = NULL; char_u *dirname_now = NULL; char_u *target_dir = NULL; -#ifdef FEAT_AUTOCMD char_u *au_name = NULL; - switch (eap->cmdidx) - { - case CMD_vimgrep: au_name = (char_u *)"vimgrep"; break; - case CMD_lvimgrep: au_name = (char_u *)"lvimgrep"; break; - case CMD_vimgrepadd: au_name = (char_u *)"vimgrepadd"; break; - case CMD_lvimgrepadd: au_name = (char_u *)"lvimgrepadd"; break; - case CMD_grep: au_name = (char_u *)"grep"; break; - case CMD_lgrep: au_name = (char_u *)"lgrep"; break; - case CMD_grepadd: au_name = (char_u *)"grepadd"; break; - case CMD_lgrepadd: au_name = (char_u *)"lgrepadd"; break; - default: break; - } + au_name = vgr_get_auname(eap->cmdidx); if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) return; -# endif - } #endif + } if (eap->cmdidx == CMD_lgrep || eap->cmdidx == CMD_lvimgrep @@ -4261,7 +4467,7 @@ qi = ll_get_or_alloc_list(curwin); if (qi == NULL) return; - loclist_cmd = TRUE; + wp = curwin; } if (eap->addr_count > 0) @@ -4279,23 +4485,9 @@ goto theend; } - if (s != NULL && *s == NUL) - { - /* Pattern is empty, use last search pattern. */ - if (last_search_pat() == NULL) - { - EMSG(_(e_noprevre)); - goto theend; - } - regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC); - } - else - regmatch.regprog = vim_regcomp(s, RE_MAGIC); - + vgr_init_regmatch(®match, s); if (regmatch.regprog == NULL) goto theend; - regmatch.rmm_ic = p_ic; - regmatch.rmm_maxcol = 0; p = skipwhite(p); if (*p == NUL) @@ -4305,7 +4497,8 @@ } if ((eap->cmdidx != CMD_grepadd && eap->cmdidx != CMD_lgrepadd - && eap->cmdidx != CMD_vimgrepadd && eap->cmdidx != CMD_lvimgrepadd) + && eap->cmdidx != CMD_vimgrepadd + && eap->cmdidx != CMD_lvimgrepadd) || qi->qf_curlist == qi->qf_listcount) /* make place for a new list */ qf_new_list(qi, title != NULL ? title : *eap->cmdlinep); @@ -4331,12 +4524,9 @@ * ":lcd %:p:h" changes the meaning of short path names. */ mch_dirname(dirname_start, MAXPATHL); -#ifdef FEAT_AUTOCMD - /* Remember the current values of the quickfix list and qf_start, so that - * we can check for autocommands changing the current quickfix list. */ + /* Remember the current quickfix list identifier, so that we can check for + * autocommands changing the current quickfix list. */ save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; - cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start; -#endif seconds = (time_t)0; for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi) @@ -4347,20 +4537,7 @@ /* Display the file name every second or so, show the user we are * working on it. */ seconds = time(NULL); - msg_start(); - p = msg_strtrunc(fname, TRUE); - if (p == NULL) - msg_outtrans(fname); - else - { - msg_outtrans(p); - vim_free(p); - } - msg_clr_eos(); - msg_didout = FALSE; /* overwrite this message */ - msg_nowait = TRUE; /* don't wait for this message */ - msg_col = 0; - out_flush(); + vgr_display_fname(fname); } buf = buflist_findname_exp(fnames[fi]); @@ -4371,61 +4548,20 @@ using_dummy = TRUE; redraw_for_dummy = TRUE; -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) - /* Don't do Filetype autocommands to avoid loading syntax and - * indent scripts, a great speed improvement. */ - save_ei = au_event_disable(",Filetype"); -#endif - /* Don't use modelines here, it's useless. */ - save_mls = p_mls; - p_mls = 0; - - /* Load file into a buffer, so that 'fileencoding' is detected, - * autocommands applied, etc. */ - buf = load_dummy_buffer(fname, dirname_start, dirname_now); - - p_mls = save_mls; -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) - au_event_restore(save_ei); -#endif + buf = vgr_load_dummy_buf(fname, dirname_start, dirname_now); } else /* Use existing, loaded buffer. */ using_dummy = FALSE; -#ifdef FEAT_AUTOCMD - if (loclist_cmd) + /* Check whether the quickfix list is still valid. When loading a + * buffer above, autocommands might have changed the quickfix list. */ + if (!vgr_qflist_valid(wp, qi, save_qfid, *eap->cmdlinep)) { - /* - * Verify that the location list is still valid. An autocmd might - * have freed the location list. - */ - if (!qflist_valid(curwin, save_qfid)) - { - EMSG(_(e_loc_list_changed)); - goto theend; - } - } - if (cur_qf_start != qi->qf_lists[qi->qf_curlist].qf_start) - { - int idx; - - /* Autocommands changed the quickfix list. Find the one we were - * using and restore it. */ - for (idx = 0; idx < LISTCOUNT; ++idx) - if (cur_qf_start == qi->qf_lists[idx].qf_start) - { - qi->qf_curlist = idx; - break; - } - if (idx == LISTCOUNT) - { - /* List cannot be found, create a new one. */ - qf_new_list(qi, *eap->cmdlinep); - cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start; - } + FreeWild(fcount, fnames); + goto theend; } -#endif + save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; if (buf == NULL) { @@ -4436,54 +4572,8 @@ { /* Try for a match in all lines of the buffer. * For ":1vimgrep" look for first match only. */ - found_match = FALSE; - for (lnum = 1; lnum <= buf->b_ml.ml_line_count && tomatch > 0; - ++lnum) - { - col = 0; - while (vim_regexec_multi(®match, curwin, buf, lnum, - col, NULL, NULL) > 0) - { - /* Pass the buffer number so that it gets used even for a - * dummy buffer, unless duplicate_name is set, then the - * buffer will be wiped out below. */ - if (qf_add_entry(qi, - qi->qf_curlist, - NULL, /* dir */ - fname, - duplicate_name ? 0 : buf->b_fnum, - ml_get_buf(buf, - regmatch.startpos[0].lnum + lnum, FALSE), - regmatch.startpos[0].lnum + lnum, - regmatch.startpos[0].col + 1, - FALSE, /* vis_col */ - NULL, /* search pattern */ - 0, /* nr */ - 0, /* type */ - TRUE /* valid */ - ) == FAIL) - { - got_int = TRUE; - break; - } - found_match = TRUE; - if (--tomatch == 0) - break; - if ((flags & VGR_GLOBAL) == 0 - || regmatch.endpos[0].lnum > 0) - break; - col = regmatch.endpos[0].col - + (col == regmatch.endpos[0].col); - if (col > (colnr_T)STRLEN(ml_get_buf(buf, lnum, FALSE))) - break; - } - line_breakcheck(); - if (got_int) - break; - } -#ifdef FEAT_AUTOCMD - cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start; -#endif + found_match = vgr_match_buflines(qi, fname, buf, ®match, + tomatch, duplicate_name, flags); if (using_dummy) { @@ -4538,7 +4628,7 @@ * need to be done (again). But not the window-local * options! */ aucmd_prepbuf(&aco, buf); -#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) +#if defined(FEAT_SYN_HL) apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, buf->b_fname, TRUE, buf); #endif @@ -4558,7 +4648,6 @@ qf_update_buffer(qi, NULL); -#ifdef FEAT_AUTOCMD if (au_name != NULL) apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); @@ -4566,33 +4655,15 @@ * The QuickFixCmdPost autocmd may free the quickfix list. Check the list * is still valid. */ - wp = loclist_cmd ? curwin : NULL; if (!qflist_valid(wp, save_qfid)) goto theend; -#endif /* Jump to first match. */ if (qi->qf_lists[qi->qf_curlist].qf_count > 0) { if ((flags & VGR_NOJUMP) == 0) - { - buf = curbuf; - qf_jump(qi, 0, 0, eap->forceit); - if (buf != curbuf) - /* If we jumped to another buffer redrawing will already be - * taken care of. */ - redraw_for_dummy = FALSE; - - /* Jump to the directory used after loading the buffer. */ - if (curbuf == first_match_buf && target_dir != NULL) - { - exarg_T ea; - - ea.arg = target_dir; - ea.cmdidx = CMD_lcd; - ex_cd(&ea); - } - } + vgr_jump_to_match(qi, eap->forceit, &redraw_for_dummy, + first_match_buf, target_dir); } else EMSG2(_(e_nomatch2), s); @@ -4754,7 +4825,7 @@ { if (curbuf != buf) /* safety check */ { -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) cleanup_T cs; /* Reset the error/interrupt/exception state here so that aborting() @@ -4765,7 +4836,7 @@ wipe_buffer(buf, FALSE); -#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) /* Restore the error/interrupt/exception state if not discarded by a * new aborting error, interrupt, or uncaught exception. */ leave_cleanup(&cs); @@ -4878,7 +4949,8 @@ }; /* - * Parse text from 'di' and return the quickfix list items + * Parse text from 'di' and return the quickfix list items. + * Existing quickfix lists are not modified. */ static int qf_get_list_from_lines(dict_T *what, dictitem_T *di, dict_T *retdict) @@ -4929,21 +5001,6 @@ } /* - * Return the quickfix/location list number with the given identifier. - * Returns -1 if list is not found. - */ - static int -qf_id2nr(qf_info_T *qi, int_u qfid) -{ - int qf_idx; - - for (qf_idx = 0; qf_idx < qi->qf_listcount; qf_idx++) - if (qi->qf_lists[qf_idx].qf_id == qfid) - return qf_idx; - return -1; -} - -/* * Return the quickfix/location list window identifier in the current tabpage. */ static int @@ -4962,25 +5019,13 @@ } /* - * Return quickfix/location list details (title) as a - * dictionary. 'what' contains the details to return. If 'list_idx' is -1, - * then current list is used. Otherwise the specified list is used. + * Convert the keys in 'what' to quickfix list property flags. */ - int -qf_get_properties(win_T *wp, dict_T *what, dict_T *retdict) + static int +qf_getprop_keys2flags(dict_T *what) { - qf_info_T *qi = &ql_info; - int status = OK; - int qf_idx; - dictitem_T *di; int flags = QF_GETLIST_NONE; - if ((di = dict_find(what, (char_u *)"lines", -1)) != NULL) - return qf_get_list_from_lines(what, di, retdict); - - if (wp != NULL) - qi = GET_LOC_LIST(wp); - if (dict_find(what, (char_u *)"all", -1) != NULL) flags |= QF_GETLIST_ALL; @@ -5011,140 +5056,223 @@ if (dict_find(what, (char_u *)"changedtick", -1) != NULL) flags |= QF_GETLIST_TICK; - if (qi != NULL && qi->qf_listcount != 0) + return flags; +} + +/* + * Return the quickfix list index based on 'nr' or 'id' in 'what'. + * If 'nr' and 'id' are not present in 'what' then return the current + * quickfix list index. + * If 'nr' is zero then return the current quickfix list index. + * If 'nr' is '$' then return the last quickfix list index. + * If 'id' is present then return the index of the quickfix list with that id. + * If 'id' is zero then return the quickfix list index specified by 'nr'. + * Return -1, if quickfix list is not present or if the stack is empty. + */ + static int +qf_getprop_qfidx(qf_info_T *qi, dict_T *what) +{ + int qf_idx; + dictitem_T *di; + + qf_idx = qi->qf_curlist; /* default is the current list */ + if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL) { - qf_idx = qi->qf_curlist; /* default is the current list */ - if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL) + /* Use the specified quickfix/location list */ + if (di->di_tv.v_type == VAR_NUMBER) { - /* Use the specified quickfix/location list */ - if (di->di_tv.v_type == VAR_NUMBER) + /* for zero use the current list */ + if (di->di_tv.vval.v_number != 0) { - /* for zero use the current list */ - if (di->di_tv.vval.v_number != 0) - { - qf_idx = di->di_tv.vval.v_number - 1; - if (qf_idx < 0 || qf_idx >= qi->qf_listcount) - qf_idx = -1; - } + qf_idx = di->di_tv.vval.v_number - 1; + if (qf_idx < 0 || qf_idx >= qi->qf_listcount) + qf_idx = INVALID_QFIDX; } - else if (di->di_tv.v_type == VAR_STRING - && di->di_tv.vval.v_string != NULL - && STRCMP(di->di_tv.vval.v_string, "$") == 0) - /* Get the last quickfix list number */ - qf_idx = qi->qf_listcount - 1; - else - qf_idx = -1; - flags |= QF_GETLIST_NR; } + else if (di->di_tv.v_type == VAR_STRING + && di->di_tv.vval.v_string != NULL + && STRCMP(di->di_tv.vval.v_string, "$") == 0) + /* Get the last quickfix list number */ + qf_idx = qi->qf_listcount - 1; + else + qf_idx = INVALID_QFIDX; + } - if ((di = dict_find(what, (char_u *)"id", -1)) != NULL) + if ((di = dict_find(what, (char_u *)"id", -1)) != NULL) + { + /* Look for a list with the specified id */ + if (di->di_tv.v_type == VAR_NUMBER) { - /* Look for a list with the specified id */ - if (di->di_tv.v_type == VAR_NUMBER) - { - /* - * For zero, use the current list or the list specifed by 'nr' - */ - if (di->di_tv.vval.v_number != 0) - qf_idx = qf_id2nr(qi, di->di_tv.vval.v_number); - flags |= QF_GETLIST_ID; - } - else - qf_idx = -1; + /* + * For zero, use the current list or the list specified by 'nr' + */ + if (di->di_tv.vval.v_number != 0) + qf_idx = qf_id2nr(qi, di->di_tv.vval.v_number); } + else + qf_idx = INVALID_QFIDX; } - /* List is not present or is empty */ - if (qi == NULL || qi->qf_listcount == 0 || qf_idx == -1) - { - if (flags & QF_GETLIST_TITLE) - status = dict_add_nr_str(retdict, "title", 0L, (char_u *)""); - if ((status == OK) && (flags & QF_GETLIST_ITEMS)) - { - list_T *l = list_alloc(); - if (l != NULL) - status = dict_add_list(retdict, "items", l); - else - status = FAIL; - } - if ((status == OK) && (flags & QF_GETLIST_NR)) - status = dict_add_nr_str(retdict, "nr", 0L, NULL); - if ((status == OK) && (flags & QF_GETLIST_WINID)) - status = dict_add_nr_str(retdict, "winid", qf_winid(qi), NULL); - if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) - status = dict_add_nr_str(retdict, "context", 0L, (char_u *)""); - if ((status == OK) && (flags & QF_GETLIST_ID)) - status = dict_add_nr_str(retdict, "id", 0L, NULL); - if ((status == OK) && (flags & QF_GETLIST_IDX)) - status = dict_add_nr_str(retdict, "idx", 0L, NULL); - if ((status == OK) && (flags & QF_GETLIST_SIZE)) - status = dict_add_nr_str(retdict, "size", 0L, NULL); - if ((status == OK) && (flags & QF_GETLIST_TICK)) - status = dict_add_nr_str(retdict, "changedtick", 0L, NULL); + return qf_idx; +} - return status; - } +/* + * Return default values for quickfix list properties in retdict. + */ + static int +qf_getprop_defaults(qf_info_T *qi, int flags, dict_T *retdict) +{ + int status = OK; if (flags & QF_GETLIST_TITLE) - { - char_u *t; - t = qi->qf_lists[qf_idx].qf_title; - if (t == NULL) - t = (char_u *)""; - status = dict_add_nr_str(retdict, "title", 0L, t); - } - if ((status == OK) && (flags & QF_GETLIST_NR)) - status = dict_add_nr_str(retdict, "nr", qf_idx + 1, NULL); - if ((status == OK) && (flags & QF_GETLIST_WINID)) - status = dict_add_nr_str(retdict, "winid", qf_winid(qi), NULL); + status = dict_add_nr_str(retdict, "title", 0L, (char_u *)""); if ((status == OK) && (flags & QF_GETLIST_ITEMS)) { list_T *l = list_alloc(); if (l != NULL) - { - (void)get_errorlist(qi, NULL, qf_idx, l); - dict_add_list(retdict, "items", l); - } + status = dict_add_list(retdict, "items", l); else status = FAIL; } - + if ((status == OK) && (flags & QF_GETLIST_NR)) + status = dict_add_nr_str(retdict, "nr", 0L, NULL); + if ((status == OK) && (flags & QF_GETLIST_WINID)) + status = dict_add_nr_str(retdict, "winid", qf_winid(qi), NULL); if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) + status = dict_add_nr_str(retdict, "context", 0L, (char_u *)""); + if ((status == OK) && (flags & QF_GETLIST_ID)) + status = dict_add_nr_str(retdict, "id", 0L, NULL); + if ((status == OK) && (flags & QF_GETLIST_IDX)) + status = dict_add_nr_str(retdict, "idx", 0L, NULL); + if ((status == OK) && (flags & QF_GETLIST_SIZE)) + status = dict_add_nr_str(retdict, "size", 0L, NULL); + if ((status == OK) && (flags & QF_GETLIST_TICK)) + status = dict_add_nr_str(retdict, "changedtick", 0L, NULL); + + return status; +} + +/* + * Return the quickfix list title as 'title' in retdict + */ + static int +qf_getprop_title(qf_info_T *qi, int qf_idx, dict_T *retdict) +{ + char_u *t; + + t = qi->qf_lists[qf_idx].qf_title; + if (t == NULL) + t = (char_u *)""; + return dict_add_nr_str(retdict, "title", 0L, t); +} + +/* + * Return the quickfix list items/entries as 'items' in retdict + */ + static int +qf_getprop_items(qf_info_T *qi, int qf_idx, dict_T *retdict) +{ + int status = OK; + list_T *l = list_alloc(); + if (l != NULL) + { + (void)get_errorlist(qi, NULL, qf_idx, l); + dict_add_list(retdict, "items", l); + } + else + status = FAIL; + + return status; +} + +/* + * Return the quickfix list context (if any) as 'context' in retdict. + */ + static int +qf_getprop_ctx(qf_info_T *qi, int qf_idx, dict_T *retdict) +{ + int status; + dictitem_T *di; + + if (qi->qf_lists[qf_idx].qf_ctx != NULL) { - if (qi->qf_lists[qf_idx].qf_ctx != NULL) + di = dictitem_alloc((char_u *)"context"); + if (di != NULL) { - di = dictitem_alloc((char_u *)"context"); - if (di != NULL) - { - copy_tv(qi->qf_lists[qf_idx].qf_ctx, &di->di_tv); - status = dict_add(retdict, di); - if (status == FAIL) - dictitem_free(di); - } - else - status = FAIL; + copy_tv(qi->qf_lists[qf_idx].qf_ctx, &di->di_tv); + status = dict_add(retdict, di); + if (status == FAIL) + dictitem_free(di); } else - status = dict_add_nr_str(retdict, "context", 0L, (char_u *)""); + status = FAIL; } + else + status = dict_add_nr_str(retdict, "context", 0L, (char_u *)""); + + return status; +} + +/* + * Return the quickfix list index as 'idx' in retdict + */ + static int +qf_getprop_idx(qf_info_T *qi, int qf_idx, dict_T *retdict) +{ + int idx = qi->qf_lists[qf_idx].qf_index; + if (qi->qf_lists[qf_idx].qf_count == 0) + /* For empty lists, qf_index is set to 1 */ + idx = 0; + return dict_add_nr_str(retdict, "idx", idx, NULL); +} + +/* + * Return quickfix/location list details (title) as a + * dictionary. 'what' contains the details to return. If 'list_idx' is -1, + * then current list is used. Otherwise the specified list is used. + */ + int +qf_get_properties(win_T *wp, dict_T *what, dict_T *retdict) +{ + qf_info_T *qi = &ql_info; + int status = OK; + int qf_idx; + dictitem_T *di; + int flags = QF_GETLIST_NONE; + if ((di = dict_find(what, (char_u *)"lines", -1)) != NULL) + return qf_get_list_from_lines(what, di, retdict); + + if (wp != NULL) + qi = GET_LOC_LIST(wp); + + flags = qf_getprop_keys2flags(what); + + if (qi != NULL && qi->qf_listcount != 0) + qf_idx = qf_getprop_qfidx(qi, what); + + /* List is not present or is empty */ + if (qi == NULL || qi->qf_listcount == 0 || qf_idx == INVALID_QFIDX) + return qf_getprop_defaults(qi, flags, retdict); + + if (flags & QF_GETLIST_TITLE) + status = qf_getprop_title(qi, qf_idx, retdict); + if ((status == OK) && (flags & QF_GETLIST_NR)) + status = dict_add_nr_str(retdict, "nr", qf_idx + 1, NULL); + if ((status == OK) && (flags & QF_GETLIST_WINID)) + status = dict_add_nr_str(retdict, "winid", qf_winid(qi), NULL); + if ((status == OK) && (flags & QF_GETLIST_ITEMS)) + status = qf_getprop_items(qi, qf_idx, retdict); + if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) + status = qf_getprop_ctx(qi, qf_idx, retdict); if ((status == OK) && (flags & QF_GETLIST_ID)) status = dict_add_nr_str(retdict, "id", qi->qf_lists[qf_idx].qf_id, NULL); - if ((status == OK) && (flags & QF_GETLIST_IDX)) - { - int idx = qi->qf_lists[qf_idx].qf_index; - if (qi->qf_lists[qf_idx].qf_count == 0) - /* For empty lists, qf_index is set to 1 */ - idx = 0; - status = dict_add_nr_str(retdict, "idx", idx, NULL); - } - + status = qf_getprop_idx(qi, qf_idx, retdict); if ((status == OK) && (flags & QF_GETLIST_SIZE)) status = dict_add_nr_str(retdict, "size", qi->qf_lists[qf_idx].qf_count, NULL); - if ((status == OK) && (flags & QF_GETLIST_TICK)) status = dict_add_nr_str(retdict, "changedtick", qi->qf_lists[qf_idx].qf_changedtick, NULL); @@ -5278,19 +5406,19 @@ return retval; } +/* + * Get the quickfix list index from 'nr' or 'id' + */ static int -qf_set_properties(qf_info_T *qi, dict_T *what, int action, char_u *title) +qf_setprop_get_qfidx( + qf_info_T *qi, + dict_T *what, + int action, + int *newlist) { dictitem_T *di; - int retval = FAIL; - int qf_idx; - int newlist = FALSE; - char_u *errorformat = p_efm; - - if (action == ' ' || qi->qf_curlist == qi->qf_listcount) - newlist = TRUE; + int qf_idx = qi->qf_curlist; /* default is the current list */ - qf_idx = qi->qf_curlist; /* default is the current list */ if ((di = dict_find(what, (char_u *)"nr", -1)) != NULL) { /* Use the specified quickfix/location list */ @@ -5307,118 +5435,179 @@ * non-available list and add the new list at the end of the * stack. */ - newlist = TRUE; - qf_idx = qi->qf_listcount - 1; + *newlist = TRUE; + qf_idx = qi->qf_listcount > 0 ? qi->qf_listcount - 1 : 0; } else if (qf_idx < 0 || qf_idx >= qi->qf_listcount) - return FAIL; + return INVALID_QFIDX; else if (action != ' ') - newlist = FALSE; /* use the specified list */ + *newlist = FALSE; /* use the specified list */ } else if (di->di_tv.v_type == VAR_STRING - && di->di_tv.vval.v_string != NULL - && STRCMP(di->di_tv.vval.v_string, "$") == 0) + && di->di_tv.vval.v_string != NULL + && STRCMP(di->di_tv.vval.v_string, "$") == 0) { if (qi->qf_listcount > 0) qf_idx = qi->qf_listcount - 1; - else if (newlist) + else if (*newlist) qf_idx = 0; else - return FAIL; + return INVALID_QFIDX; } else - return FAIL; + return INVALID_QFIDX; } - if (!newlist && (di = dict_find(what, (char_u *)"id", -1)) != NULL) + if (!*newlist && (di = dict_find(what, (char_u *)"id", -1)) != NULL) { /* Use the quickfix/location list with the specified id */ - if (di->di_tv.v_type == VAR_NUMBER) - { - qf_idx = qf_id2nr(qi, di->di_tv.vval.v_number); - if (qf_idx == -1) - return FAIL; /* List not found */ - } - else - return FAIL; - } + if (di->di_tv.v_type != VAR_NUMBER) + return INVALID_QFIDX; - if (newlist) - { - qi->qf_curlist = qf_idx; - qf_new_list(qi, title); - qf_idx = qi->qf_curlist; + return qf_id2nr(qi, di->di_tv.vval.v_number); } - if ((di = dict_find(what, (char_u *)"title", -1)) != NULL) - { - if (di->di_tv.v_type == VAR_STRING) - { - vim_free(qi->qf_lists[qf_idx].qf_title); - qi->qf_lists[qf_idx].qf_title = - get_dict_string(what, (char_u *)"title", TRUE); - if (qf_idx == qi->qf_curlist) - qf_update_win_titlevar(qi); - retval = OK; - } - } + return qf_idx; +} - if ((di = dict_find(what, (char_u *)"items", -1)) != NULL) - { - if (di->di_tv.v_type == VAR_LIST) - { - char_u *title_save = vim_strsave(qi->qf_lists[qf_idx].qf_title); +/* + * Set the quickfix list title. + */ + static int +qf_setprop_title(qf_info_T *qi, int qf_idx, dict_T *what, dictitem_T *di) +{ + if (di->di_tv.v_type != VAR_STRING) + return FAIL; - retval = qf_add_entries(qi, qf_idx, di->di_tv.vval.v_list, - title_save, action == ' ' ? 'a' : action); - if (action == 'r') - { - /* - * When replacing the quickfix list entries using - * qf_add_entries(), the title is set with a ':' prefix. - * Restore the title with the saved title. - */ - vim_free(qi->qf_lists[qf_idx].qf_title); - qi->qf_lists[qf_idx].qf_title = vim_strsave(title_save); - } - vim_free(title_save); - } - } + vim_free(qi->qf_lists[qf_idx].qf_title); + qi->qf_lists[qf_idx].qf_title = + get_dict_string(what, (char_u *)"title", TRUE); + if (qf_idx == qi->qf_curlist) + qf_update_win_titlevar(qi); + + return OK; +} - if ((di = dict_find(what, (char_u *)"efm", -1)) != NULL) +/* + * Set quickfix list items/entries. + */ + static int +qf_setprop_items(qf_info_T *qi, int qf_idx, dictitem_T *di, int action) +{ + int retval = FAIL; + char_u *title_save; + + if (di->di_tv.v_type != VAR_LIST) + return FAIL; + + title_save = vim_strsave(qi->qf_lists[qf_idx].qf_title); + retval = qf_add_entries(qi, qf_idx, di->di_tv.vval.v_list, + title_save, action == ' ' ? 'a' : action); + if (action == 'r') { - if (di->di_tv.v_type != VAR_STRING || di->di_tv.vval.v_string == NULL) - return FAIL; - errorformat = di->di_tv.vval.v_string; + /* + * When replacing the quickfix list entries using + * qf_add_entries(), the title is set with a ':' prefix. + * Restore the title with the saved title. + */ + vim_free(qi->qf_lists[qf_idx].qf_title); + qi->qf_lists[qf_idx].qf_title = vim_strsave(title_save); } + vim_free(title_save); - if ((di = dict_find(what, (char_u *)"lines", -1)) != NULL) + return retval; +} + +/* + * Set quickfix list items/entries from a list of lines. + */ + static int +qf_setprop_items_from_lines( + qf_info_T *qi, + int qf_idx, + dict_T *what, + dictitem_T *di, + int action) +{ + char_u *errorformat = p_efm; + dictitem_T *efm_di; + int retval = FAIL; + + /* Use the user supplied errorformat settings (if present) */ + if ((efm_di = dict_find(what, (char_u *)"efm", -1)) != NULL) { - /* Only a List value is supported */ - if (di->di_tv.v_type == VAR_LIST && di->di_tv.vval.v_list != NULL) - { - if (action == 'r') - qf_free_items(qi, qf_idx); - if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, errorformat, - FALSE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) - retval = OK; - } - else + if (efm_di->di_tv.v_type != VAR_STRING || + efm_di->di_tv.vval.v_string == NULL) return FAIL; + errorformat = efm_di->di_tv.vval.v_string; } - if ((di = dict_find(what, (char_u *)"context", -1)) != NULL) - { - typval_T *ctx; + /* Only a List value is supported */ + if (di->di_tv.v_type != VAR_LIST || di->di_tv.vval.v_list == NULL) + return FAIL; - free_tv(qi->qf_lists[qf_idx].qf_ctx); - ctx = alloc_tv(); - if (ctx != NULL) - copy_tv(&di->di_tv, ctx); - qi->qf_lists[qf_idx].qf_ctx = ctx; + if (action == 'r') + qf_free_items(qi, qf_idx); + if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, errorformat, + FALSE, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) retval = OK; + + return retval; +} + +/* + * Set quickfix list context. + */ + static int +qf_setprop_context(qf_info_T *qi, int qf_idx, dictitem_T *di) +{ + typval_T *ctx; + + free_tv(qi->qf_lists[qf_idx].qf_ctx); + ctx = alloc_tv(); + if (ctx != NULL) + copy_tv(&di->di_tv, ctx); + qi->qf_lists[qf_idx].qf_ctx = ctx; + + return OK; +} + +/* + * Set quickfix/location list properties (title, items, context). + * Also used to add items from parsing a list of lines. + * Used by the setqflist() and setloclist() VimL functions. + */ + static int +qf_set_properties(qf_info_T *qi, dict_T *what, int action, char_u *title) +{ + dictitem_T *di; + int retval = FAIL; + int qf_idx; + int newlist = FALSE; + + if (action == ' ' || qi->qf_curlist == qi->qf_listcount) + newlist = TRUE; + + qf_idx = qf_setprop_get_qfidx(qi, what, action, &newlist); + if (qf_idx == INVALID_QFIDX) /* List not found */ + return FAIL; + + if (newlist) + { + qi->qf_curlist = qf_idx; + qf_new_list(qi, title); + qf_idx = qi->qf_curlist; } + if ((di = dict_find(what, (char_u *)"title", -1)) != NULL) + retval = qf_setprop_title(qi, qf_idx, what, di); + if ((di = dict_find(what, (char_u *)"items", -1)) != NULL) + retval = qf_setprop_items(qi, qf_idx, di, action); + if ((di = dict_find(what, (char_u *)"lines", -1)) != NULL) + retval = qf_setprop_items_from_lines(qi, qf_idx, what, di, action); + if ((di = dict_find(what, (char_u *)"context", -1)) != NULL) + retval = qf_setprop_context(qi, qf_idx, di); + if (retval == OK) qf_list_changed(qi, qf_idx); @@ -5554,7 +5743,7 @@ /* * Mark the context of the quickfix list and the location lists (if present) as - * "in use". So that garabage collection doesn't free the context. + * "in use". So that garbage collection doesn't free the context. */ int set_ref_in_quickfix(int copyID) @@ -5604,12 +5793,9 @@ { buf_T *buf = NULL; qf_info_T *qi = &ql_info; -#ifdef FEAT_AUTOCMD char_u *au_name = NULL; -#endif int res; -#ifdef FEAT_AUTOCMD switch (eap->cmdidx) { case CMD_cbuffer: au_name = (char_u *)"cbuffer"; break; @@ -5623,12 +5809,11 @@ if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) return; -# endif - } #endif + } /* Must come after autocommands. */ if (eap->cmdidx == CMD_lbuffer @@ -5676,11 +5861,9 @@ qf_title, NULL); if (res >= 0) qf_list_changed(qi, qi->qf_curlist); -#ifdef FEAT_AUTOCMD if (au_name != NULL) apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); -#endif if (res > 0 && (eap->cmdidx == CMD_cbuffer || eap->cmdidx == CMD_lbuffer)) qf_jump(qi, 0, 0, eap->forceit); /* display first error */ @@ -5698,12 +5881,9 @@ { typval_T *tv; qf_info_T *qi = &ql_info; -#ifdef FEAT_AUTOCMD char_u *au_name = NULL; -#endif int res; -#ifdef FEAT_AUTOCMD switch (eap->cmdidx) { case CMD_cexpr: au_name = (char_u *)"cexpr"; break; @@ -5717,12 +5897,11 @@ if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) return; -# endif - } #endif + } if (eap->cmdidx == CMD_lexpr || eap->cmdidx == CMD_lgetexpr @@ -5748,11 +5927,9 @@ NULL); if (res >= 0) qf_list_changed(qi, qi->qf_curlist); -#ifdef FEAT_AUTOCMD if (au_name != NULL) apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); -#endif if (res > 0 && (eap->cmdidx == CMD_cexpr || eap->cmdidx == CMD_lexpr)) qf_jump(qi, 0, 0, eap->forceit); /* display first error */ @@ -5765,36 +5942,227 @@ #endif /* - * ":helpgrep {pattern}" + * Get the location list for ":lhelpgrep" */ - void -ex_helpgrep(exarg_T *eap) + static qf_info_T * +hgr_get_ll(int *new_ll) +{ + win_T *wp; + qf_info_T *qi; + + /* If the current window is a help window, then use it */ + if (bt_help(curwin->w_buffer)) + wp = curwin; + else + /* Find an existing help window */ + FOR_ALL_WINDOWS(wp) + if (bt_help(wp->w_buffer)) + break; + + if (wp == NULL) /* Help window not found */ + qi = NULL; + else + qi = wp->w_llist; + + if (qi == NULL) + { + /* Allocate a new location list for help text matches */ + if ((qi = ll_new_list()) == NULL) + return NULL; + *new_ll = TRUE; + } + + return qi; +} + +/* + * Search for a pattern in a help file. + */ + static void +hgr_search_file( + qf_info_T *qi, + char_u *fname, +#ifdef FEAT_MBYTE + vimconv_T *p_vc, +#endif + regmatch_T *p_regmatch) +{ + FILE *fd; + long lnum; + + fd = mch_fopen((char *)fname, "r"); + if (fd == NULL) + return; + + lnum = 1; + while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int) + { + char_u *line = IObuff; +#ifdef FEAT_MBYTE + /* Convert a line if 'encoding' is not utf-8 and + * the line contains a non-ASCII character. */ + if (p_vc->vc_type != CONV_NONE + && has_non_ascii(IObuff)) + { + line = string_convert(p_vc, IObuff, NULL); + if (line == NULL) + line = IObuff; + } +#endif + + if (vim_regexec(p_regmatch, line, (colnr_T)0)) + { + int l = (int)STRLEN(line); + + /* remove trailing CR, LF, spaces, etc. */ + while (l > 0 && line[l - 1] <= ' ') + line[--l] = NUL; + + if (qf_add_entry(qi, + qi->qf_curlist, + NULL, /* dir */ + fname, + 0, + line, + lnum, + (int)(p_regmatch->startp[0] - line) + + 1, /* col */ + FALSE, /* vis_col */ + NULL, /* search pattern */ + 0, /* nr */ + 1, /* type */ + TRUE /* valid */ + ) == FAIL) + { + got_int = TRUE; +#ifdef FEAT_MBYTE + if (line != IObuff) + vim_free(line); +#endif + break; + } + } +#ifdef FEAT_MBYTE + if (line != IObuff) + vim_free(line); +#endif + ++lnum; + line_breakcheck(); + } + fclose(fd); +} + +/* + * Search for a pattern in all the help files in the doc directory under + * the given directory. + */ + static void +hgr_search_files_in_dir( + qf_info_T *qi, + char_u *dirname, + regmatch_T *p_regmatch +#ifdef FEAT_MBYTE + , vimconv_T *p_vc +#endif +#ifdef FEAT_MULTI_LANG + , char_u *lang +#endif + ) { - regmatch_T regmatch; - char_u *save_cpo; - char_u *p; int fcount; char_u **fnames; - FILE *fd; int fi; - long lnum; + + /* Find all "*.txt" and "*.??x" files in the "doc" directory. */ + add_pathsep(dirname); + STRCAT(dirname, "doc/*.\\(txt\\|??x\\)"); + if (gen_expand_wildcards(1, &dirname, &fcount, + &fnames, EW_FILE|EW_SILENT) == OK + && fcount > 0) + { + for (fi = 0; fi < fcount && !got_int; ++fi) + { +#ifdef FEAT_MULTI_LANG + /* Skip files for a different language. */ + if (lang != NULL + && STRNICMP(lang, fnames[fi] + + STRLEN(fnames[fi]) - 3, 2) != 0 + && !(STRNICMP(lang, "en", 2) == 0 + && STRNICMP("txt", fnames[fi] + + STRLEN(fnames[fi]) - 3, 3) == 0)) + continue; +#endif + + hgr_search_file(qi, fnames[fi], +#ifdef FEAT_MBYTE + p_vc, +#endif + p_regmatch); + } + FreeWild(fcount, fnames); + } +} + +/* + * Search for a pattern in all the help files in the 'runtimepath'. + */ + static void +hgr_search_in_rtp(qf_info_T *qi, regmatch_T *p_regmatch, char_u *arg) +{ + char_u *p; #ifdef FEAT_MULTI_LANG char_u *lang; #endif - qf_info_T *qi = &ql_info; - qf_info_T *save_qi; - int new_qi = FALSE; - win_T *wp; -#ifdef FEAT_AUTOCMD - char_u *au_name = NULL; + +#ifdef FEAT_MBYTE + vimconv_T vc; + + /* Help files are in utf-8 or latin1, convert lines when 'encoding' + * differs. */ + vc.vc_type = CONV_NONE; + if (!enc_utf8) + convert_setup(&vc, (char_u *)"utf-8", p_enc); #endif #ifdef FEAT_MULTI_LANG /* Check for a specified language */ - lang = check_help_lang(eap->arg); + lang = check_help_lang(arg); +#endif + + /* Go through all directories in 'runtimepath' */ + p = p_rtp; + while (*p != NUL && !got_int) + { + copy_option_part(&p, NameBuff, MAXPATHL, ","); + + hgr_search_files_in_dir(qi, NameBuff, p_regmatch +#ifdef FEAT_MBYTE + , &vc #endif +#ifdef FEAT_MULTI_LANG + , lang +#endif + ); + } + +#ifdef FEAT_MBYTE + if (vc.vc_type != CONV_NONE) + convert_setup(&vc, NULL, NULL); +#endif +} + +/* + * ":helpgrep {pattern}" + */ + void +ex_helpgrep(exarg_T *eap) +{ + regmatch_T regmatch; + char_u *save_cpo; + qf_info_T *qi = &ql_info; + int new_qi = FALSE; + char_u *au_name = NULL; -#ifdef FEAT_AUTOCMD switch (eap->cmdidx) { case CMD_helpgrep: au_name = (char_u *)"helpgrep"; break; @@ -5804,12 +6172,11 @@ if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) { -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL if (aborting()) return; -# endif - } #endif + } /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ save_cpo = p_cpo; @@ -5817,144 +6184,21 @@ if (eap->cmdidx == CMD_lhelpgrep) { - /* If the current window is a help window, then use it */ - if (bt_help(curwin->w_buffer)) - wp = curwin; - else - /* Find an existing help window */ - FOR_ALL_WINDOWS(wp) - if (bt_help(wp->w_buffer)) - break; - - if (wp == NULL) /* Help window not found */ - qi = NULL; - else - qi = wp->w_llist; - + qi = hgr_get_ll(&new_qi); if (qi == NULL) - { - /* Allocate a new location list for help text matches */ - if ((qi = ll_new_list()) == NULL) - return; - new_qi = TRUE; - } + return; } - /* Autocommands may change the list. Save it for later comparison */ - save_qi = qi; - regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING); regmatch.rm_ic = FALSE; if (regmatch.regprog != NULL) { -#ifdef FEAT_MBYTE - vimconv_T vc; - - /* Help files are in utf-8 or latin1, convert lines when 'encoding' - * differs. */ - vc.vc_type = CONV_NONE; - if (!enc_utf8) - convert_setup(&vc, (char_u *)"utf-8", p_enc); -#endif - /* create a new quickfix list */ qf_new_list(qi, *eap->cmdlinep); - /* Go through all directories in 'runtimepath' */ - p = p_rtp; - while (*p != NUL && !got_int) - { - copy_option_part(&p, NameBuff, MAXPATHL, ","); - - /* Find all "*.txt" and "*.??x" files in the "doc" directory. */ - add_pathsep(NameBuff); - STRCAT(NameBuff, "doc/*.\\(txt\\|??x\\)"); - if (gen_expand_wildcards(1, &NameBuff, &fcount, - &fnames, EW_FILE|EW_SILENT) == OK - && fcount > 0) - { - for (fi = 0; fi < fcount && !got_int; ++fi) - { -#ifdef FEAT_MULTI_LANG - /* Skip files for a different language. */ - if (lang != NULL - && STRNICMP(lang, fnames[fi] - + STRLEN(fnames[fi]) - 3, 2) != 0 - && !(STRNICMP(lang, "en", 2) == 0 - && STRNICMP("txt", fnames[fi] - + STRLEN(fnames[fi]) - 3, 3) == 0)) - continue; -#endif - fd = mch_fopen((char *)fnames[fi], "r"); - if (fd != NULL) - { - lnum = 1; - while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int) - { - char_u *line = IObuff; -#ifdef FEAT_MBYTE - /* Convert a line if 'encoding' is not utf-8 and - * the line contains a non-ASCII character. */ - if (vc.vc_type != CONV_NONE - && has_non_ascii(IObuff)) - { - line = string_convert(&vc, IObuff, NULL); - if (line == NULL) - line = IObuff; - } -#endif - - if (vim_regexec(®match, line, (colnr_T)0)) - { - int l = (int)STRLEN(line); - - /* remove trailing CR, LF, spaces, etc. */ - while (l > 0 && line[l - 1] <= ' ') - line[--l] = NUL; - - if (qf_add_entry(qi, - qi->qf_curlist, - NULL, /* dir */ - fnames[fi], - 0, - line, - lnum, - (int)(regmatch.startp[0] - line) - + 1, /* col */ - FALSE, /* vis_col */ - NULL, /* search pattern */ - 0, /* nr */ - 1, /* type */ - TRUE /* valid */ - ) == FAIL) - { - got_int = TRUE; -#ifdef FEAT_MBYTE - if (line != IObuff) - vim_free(line); -#endif - break; - } - } -#ifdef FEAT_MBYTE - if (line != IObuff) - vim_free(line); -#endif - ++lnum; - line_breakcheck(); - } - fclose(fd); - } - } - FreeWild(fcount, fnames); - } - } + hgr_search_in_rtp(qi, ®match, eap->arg); vim_regfree(regmatch.regprog); -#ifdef FEAT_MBYTE - if (vc.vc_type != CONV_NONE) - convert_setup(&vc, NULL, NULL); -#endif qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE; qi->qf_lists[qi->qf_curlist].qf_ptr = @@ -5971,16 +6215,14 @@ qf_list_changed(qi, qi->qf_curlist); qf_update_buffer(qi, NULL); -#ifdef FEAT_AUTOCMD if (au_name != NULL) { apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); - if (!new_qi && qi != save_qi && qf_find_buf(qi) == NULL) + if (!new_qi && qi != &ql_info && qf_find_buf(qi) == NULL) /* autocommands made "qi" invalid */ return; } -#endif /* Jump to first match. */ if (qi->qf_lists[qi->qf_curlist].qf_count > 0) diff -Nru vim-8.0.1453/src/README.txt vim-8.0.1766/src/README.txt --- vim-8.0.1453/src/README.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/README.txt 2018-04-26 20:30:33.000000000 +0000 @@ -8,8 +8,8 @@ JUMPING AROUND -First of all, use ":make tags" to generate a tags file, so that you can use -the ":tag" command to jump around the source code. +First of all, use ":make tags" to generate a tags file, so that you can jump +around in the source code. To jump to a function or variable definition, move the cursor on the name and use the CTRL-] command. Use CTRL-T or CTRL-O to jump back. @@ -43,6 +43,21 @@ window.c handling split windows +DEBUGGING + +If you have a reasonable recent version of gdb, you can use the :Termdebug +command to debug Vim. See ":help :Termdebug". + +When something is time critical or stepping through code is a hassle, use the +channel logging to create a time-stamped log file. Add lines to the code like +this: + ch_log(NULL, "Value is now %02x", value); +After compiling and starting Vim, do: + :call ch_logfile('debuglog', 'w') +And edit "debuglog" to see what happens. The channel functions already have +ch_log() calls, thus you always see that in the log. + + IMPORTANT VARIABLES The current mode is stored in "State". The values it can have are NORMAL, diff -Nru vim-8.0.1453/src/regexp.c vim-8.0.1766/src/regexp.c --- vim-8.0.1453/src/regexp.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/regexp.c 2018-04-26 20:30:33.000000000 +0000 @@ -3996,10 +3996,7 @@ /* Free "reg_tofree" when it's a bit big. * Free regstack and backpos if they are bigger than their initial size. */ if (reg_tofreelen > 400) - { - vim_free(reg_tofree); - reg_tofree = NULL; - } + VIM_CLEAR(reg_tofree); if (regstack.ga_maxlen > REGSTACK_INITIAL) ga_clear(®stack); if (backpos.ga_maxlen > BACKPOS_INITIAL) @@ -5588,9 +5585,14 @@ { #ifdef FEAT_MBYTE if (has_mbyte) + { + char_u *line = + reg_getline(behind_pos.rs_u.pos.lnum); + rp->rs_un.regsave.rs_u.pos.col -= - (*mb_head_off)(regline, regline + (*mb_head_off)(line, line + rp->rs_un.regsave.rs_u.pos.col - 1) + 1; + } else #endif --rp->rs_un.regsave.rs_u.pos.col; @@ -7521,8 +7523,7 @@ { STRCPY(dest, eval_result); dst += STRLEN(eval_result); - vim_free(eval_result); - eval_result = NULL; + VIM_CLEAR(eval_result); } } else @@ -8150,7 +8151,7 @@ * First try the NFA engine, unless backtracking was requested. */ if (regexp_engine != BACKTRACKING_ENGINE) - prog = nfa_regengine.regcomp(expr, + prog = nfa_regengine.regcomp(expr, re_flags + (regexp_engine == AUTOMATIC_ENGINE ? RE_AUTO : 0)); else prog = bt_regengine.regcomp(expr, re_flags); @@ -8170,7 +8171,7 @@ } else EMSG2("(NFA) Could not open \"%s\" to write !!!", - BT_REGEXP_DEBUG_LOG_NAME); + BT_REGEXP_DEBUG_LOG_NAME); } #endif /* @@ -8341,10 +8342,10 @@ long vim_regexec_multi( regmmatch_T *rmp, - win_T *win, /* window in which to search or NULL */ - buf_T *buf, /* buffer in which to search */ - linenr_T lnum, /* nr of line to start looking for match */ - colnr_T col, /* column to start looking for match */ + win_T *win, /* window in which to search or NULL */ + buf_T *buf, /* buffer in which to search */ + linenr_T lnum, /* nr of line to start looking for match */ + colnr_T col, /* column to start looking for match */ proftime_T *tm, /* timeout limit or NULL */ int *timed_out) /* flag is set when timeout limit reached */ { diff -Nru vim-8.0.1453/src/regexp_nfa.c vim-8.0.1766/src/regexp_nfa.c --- vim-8.0.1453/src/regexp_nfa.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/regexp_nfa.c 2018-04-26 20:30:33.000000000 +0000 @@ -1600,7 +1600,7 @@ default: { - int n = 0; + long n = 0; int cmp = c; if (c == '<' || c == '>') @@ -1628,7 +1628,14 @@ /* \%{n}v \%{n}v */ EMIT(cmp == '<' ? NFA_VCOL_LT : cmp == '>' ? NFA_VCOL_GT : NFA_VCOL); - EMIT(n); +#if VIM_SIZEOF_INT < VIM_SIZEOF_LONG + if (n > INT_MAX) + { + EMSG(_("E951: \\% value too large")); + return FAIL; + } +#endif + EMIT((int)n); break; } else if (c == '\'' && n == 0) @@ -3970,7 +3977,7 @@ #ifdef FEAT_RELTIME static proftime_T *nfa_time_limit; static int *nfa_timed_out; -static int nfa_time_count; +static int nfa_time_count; #endif static void copy_pim(nfa_pim_T *to, nfa_pim_T *from); @@ -4068,10 +4075,10 @@ if (REG_MULTI) { if (from->list.multi[0].end_lnum >= 0) - { + { to->list.multi[0].end_lnum = from->list.multi[0].end_lnum; to->list.multi[0].end_col = from->list.multi[0].end_col; - } + } } else { @@ -5124,9 +5131,9 @@ } if (state->c == NFA_START_INVISIBLE_BEFORE - || state->c == NFA_START_INVISIBLE_BEFORE_FIRST - || state->c == NFA_START_INVISIBLE_BEFORE_NEG - || state->c == NFA_START_INVISIBLE_BEFORE_NEG_FIRST) + || state->c == NFA_START_INVISIBLE_BEFORE_FIRST + || state->c == NFA_START_INVISIBLE_BEFORE_NEG + || state->c == NFA_START_INVISIBLE_BEFORE_NEG_FIRST) { /* The recursive match must end at the current position. When "pim" is * not NULL it specifies the current position. */ @@ -6176,7 +6183,7 @@ { /* If \Z was present, then ignore composing characters. * When ignoring the base character this always matches. */ - if (len == 0 && sta->c != curc) + if (sta->c != curc) result = FAIL; else result = OK; @@ -6302,7 +6309,7 @@ } } else if (state->c < 0 ? check_char_class(state->c, curc) - : (curc == state->c + : (curc == state->c || (rex.reg_ic && MB_TOLOWER(curc) == MB_TOLOWER(state->c)))) { @@ -6863,7 +6870,7 @@ && (REG_MULTI ? (reglnum < nfa_endp->se_u.pos.lnum || (reglnum == nfa_endp->se_u.pos.lnum - && (int)(reginput - regline) + && (int)(reginput - regline) < nfa_endp->se_u.pos.col)) : reginput < nfa_endp->se_u.ptr)))) { @@ -7327,14 +7334,13 @@ nfa_regengine.expr = NULL; out: - vim_free(post_start); - post_start = post_ptr = post_end = NULL; + VIM_CLEAR(post_start); + post_ptr = post_end = NULL; state_ptr = NULL; return (regprog_T *)prog; fail: - vim_free(prog); - prog = NULL; + VIM_CLEAR(prog); #ifdef ENABLE_LOG nfa_postfix_dump(expr, FAIL); #endif diff -Nru vim-8.0.1453/src/screen.c vim-8.0.1766/src/screen.c --- vim-8.0.1453/src/screen.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/screen.c 2018-04-26 20:30:33.000000000 +0000 @@ -474,9 +474,8 @@ * flicker. */ out_flush_cursor(FALSE, FALSE); else -#else - out_flush(); #endif + out_flush(); --redrawing_for_callback; } @@ -1177,6 +1176,11 @@ */ if (term_update_window(wp) == OK) { +# ifdef FEAT_MENU + /* Draw the window toolbar, if there is one. */ + if (winbar_height(wp) > 0) + redraw_win_toolbar(wp); +# endif wp->w_redr_type = 0; return; } @@ -2173,6 +2177,25 @@ * End of loop over all window lines. */ +#ifdef FEAT_VTP + /* Rewrite the character at the end of the screen line. */ + if (use_vtp()) + { + int i; + + for (i = 0; i < Rows; ++i) +# ifdef FEAT_MBYTE + if (enc_utf8) + if ((*mb_off2cells)(LineOffset[i] + Columns - 2, + LineOffset[i] + screen_Columns) > 1) + screen_draw_rectangle(i, Columns - 2, 1, 2, FALSE); + else + screen_draw_rectangle(i, Columns - 1, 1, 1, FALSE); + else +# endif + screen_char(LineOffset[i] + Columns - 1, i, Columns - 1); + } +#endif if (idx > wp->w_lines_valid) wp->w_lines_valid = idx; @@ -2682,15 +2705,21 @@ } #ifdef FEAT_RIGHTLEFT -# define RL_MEMSET(p, v, l) if (wp->w_p_rl) \ - for (ri = 0; ri < l; ++ri) \ - ScreenAttrs[off + (wp->w_width - (p) - (l)) + ri] = v; \ - else \ - for (ri = 0; ri < l; ++ri) \ - ScreenAttrs[off + (p) + ri] = v +# define RL_MEMSET(p, v, l) \ + do { \ + if (wp->w_p_rl) \ + for (ri = 0; ri < l; ++ri) \ + ScreenAttrs[off + (wp->w_width - (p) - (l)) + ri] = v; \ + else \ + for (ri = 0; ri < l; ++ri) \ + ScreenAttrs[off + (p) + ri] = v; \ + } while (0) #else -# define RL_MEMSET(p, v, l) for (ri = 0; ri < l; ++ri) \ - ScreenAttrs[off + (p) + ri] = v +# define RL_MEMSET(p, v, l) \ + do { \ + for (ri = 0; ri < l; ++ri) \ + ScreenAttrs[off + (p) + ri] = v; \ + } while (0) #endif /* Set all attributes of the 'number' or 'relativenumber' column and the @@ -2795,7 +2824,7 @@ { ScreenLinesUC[off + col] = fill_fold; ScreenLinesC[0][off + col] = 0; - ScreenLines[off + col] = 0x80; /* avoid storing zero */ + ScreenLines[off + col] = 0x80; /* avoid storing zero */ } else { @@ -4327,10 +4356,7 @@ #endif if (p_extra_free != NULL) - { - vim_free(p_extra_free); - p_extra_free = NULL; - } + VIM_CLEAR(p_extra_free); /* * Get a character from the line itself. */ @@ -8046,16 +8072,13 @@ } if ((attr & HL_BOLD) && *T_MD != NUL) /* bold */ out_str(T_MD); - else if (aep != NULL && cterm_normal_fg_bold && + else if (aep != NULL && cterm_normal_fg_bold && ( #ifdef FEAT_TERMGUICOLORS - (p_tgc ? - (aep->ae_u.cterm.fg_rgb != INVALCOLOR): + p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR + ? aep->ae_u.cterm.fg_rgb != INVALCOLOR + : #endif - (t_colors > 1 && aep->ae_u.cterm.fg_color) -#ifdef FEAT_TERMGUICOLORS - ) -#endif - ) + t_colors > 1 && aep->ae_u.cterm.fg_color)) /* If the Normal FG color has BOLD attribute and the new HL * has a FG color defined, clear BOLD. */ out_str(T_ME); @@ -8081,28 +8104,39 @@ if (aep != NULL) { #ifdef FEAT_TERMGUICOLORS - if (p_tgc) + /* When 'termguicolors' is set but fg or bg is unset, + * fall back to the cterm colors. This helps for SpellBad, + * where the GUI uses a red undercurl. */ + if (p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR) { if (aep->ae_u.cterm.fg_rgb != INVALCOLOR) term_fg_rgb_color(aep->ae_u.cterm.fg_rgb); + } + else +#endif + if (t_colors > 1) + { + if (aep->ae_u.cterm.fg_color) + term_fg_color(aep->ae_u.cterm.fg_color - 1); + } +#ifdef FEAT_TERMGUICOLORS + if (p_tgc && aep->ae_u.cterm.bg_rgb != CTERMCOLOR) + { if (aep->ae_u.cterm.bg_rgb != INVALCOLOR) term_bg_rgb_color(aep->ae_u.cterm.bg_rgb); } else #endif + if (t_colors > 1) { - if (t_colors > 1) - { - if (aep->ae_u.cterm.fg_color) - term_fg_color(aep->ae_u.cterm.fg_color - 1); - if (aep->ae_u.cterm.bg_color) - term_bg_color(aep->ae_u.cterm.bg_color - 1); - } - else - { - if (aep->ae_u.term.start != NULL) - out_str(aep->ae_u.term.start); - } + if (aep->ae_u.cterm.bg_color) + term_bg_color(aep->ae_u.cterm.bg_color - 1); + } + + if (!IS_CTERM) + { + if (aep->ae_u.term.start != NULL) + out_str(aep->ae_u.term.start); } } } @@ -8142,17 +8176,19 @@ * Assume that t_me restores the original colors! */ aep = syn_cterm_attr2entry(screen_attr); - if (aep != NULL && + if (aep != NULL && (( #ifdef FEAT_TERMGUICOLORS - (p_tgc ? - (aep->ae_u.cterm.fg_rgb != INVALCOLOR - || aep->ae_u.cterm.bg_rgb != INVALCOLOR): + p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR + ? aep->ae_u.cterm.fg_rgb != INVALCOLOR + : #endif - (aep->ae_u.cterm.fg_color || aep->ae_u.cterm.bg_color) + aep->ae_u.cterm.fg_color) || ( #ifdef FEAT_TERMGUICOLORS - ) + p_tgc && aep->ae_u.cterm.bg_rgb != CTERMCOLOR + ? aep->ae_u.cterm.bg_rgb != INVALCOLOR + : #endif - ) + aep->ae_u.cterm.bg_color))) do_ME = TRUE; } else @@ -8663,7 +8699,8 @@ if (row == Rows - 1) /* overwritten the command line */ { redraw_cmdline = TRUE; - if (c1 == ' ' && c2 == ' ') + if (start_col == 0 && end_col == Columns + && c1 == ' ' && c2 == ' ' && attr == 0) clear_cmdline = FALSE; /* command line has been cleared */ if (start_col == 0) mode_displayed = FALSE; /* mode cleared or overwritten */ @@ -8737,11 +8774,9 @@ tabpage_T *tp; static int entered = FALSE; /* avoid recursiveness */ static int done_outofmem_msg = FALSE; /* did outofmem message */ -#ifdef FEAT_AUTOCMD int retry_count = 0; retry: -#endif /* * Allocation of the screen buffers is done only when the size changes and * when Rows and Columns have been set and we have started doing full @@ -8793,10 +8828,8 @@ */ FOR_ALL_TAB_WINDOWS(tp, wp) win_free_lsize(wp); -#ifdef FEAT_AUTOCMD if (aucmd_win != NULL) win_free_lsize(aucmd_win); -#endif new_ScreenLines = (schar_T *)lalloc((long_u)( (Rows + 1) * Columns * sizeof(schar_T)), FALSE); @@ -8829,11 +8862,9 @@ goto give_up; } } -#ifdef FEAT_AUTOCMD if (aucmd_win != NULL && aucmd_win->w_lines == NULL && win_alloc_lines(aucmd_win) == FAIL) outofmem = TRUE; -#endif give_up: #ifdef FEAT_MBYTE @@ -8861,27 +8892,17 @@ * and over again. */ done_outofmem_msg = TRUE; } - vim_free(new_ScreenLines); - new_ScreenLines = NULL; + VIM_CLEAR(new_ScreenLines); #ifdef FEAT_MBYTE - vim_free(new_ScreenLinesUC); - new_ScreenLinesUC = NULL; + VIM_CLEAR(new_ScreenLinesUC); for (i = 0; i < p_mco; ++i) - { - vim_free(new_ScreenLinesC[i]); - new_ScreenLinesC[i] = NULL; - } - vim_free(new_ScreenLines2); - new_ScreenLines2 = NULL; + VIM_CLEAR(new_ScreenLinesC[i]); + VIM_CLEAR(new_ScreenLines2); #endif - vim_free(new_ScreenAttrs); - new_ScreenAttrs = NULL; - vim_free(new_LineOffset); - new_LineOffset = NULL; - vim_free(new_LineWraps); - new_LineWraps = NULL; - vim_free(new_TabPageIdxs); - new_TabPageIdxs = NULL; + VIM_CLEAR(new_ScreenAttrs); + VIM_CLEAR(new_LineOffset); + VIM_CLEAR(new_LineWraps); + VIM_CLEAR(new_TabPageIdxs); } else { @@ -9012,7 +9033,6 @@ entered = FALSE; --RedrawingDisabled; -#ifdef FEAT_AUTOCMD /* * Do not apply autocommands more than 3 times to avoid an endless loop * in case applying autocommands always changes Rows or Columns. @@ -9024,7 +9044,6 @@ * jump back to check if we need to allocate the screen again. */ goto retry; } -#endif } void @@ -9459,7 +9478,17 @@ void setcursor(void) { - if (redrawing()) + setcursor_mayforce(FALSE); +} + +/* + * Set cursor to its position in the current window. + * When "force" is TRUE also when not redrawing. + */ + void +setcursor_mayforce(int force) +{ + if (force || redrawing()) { validate_cursor(); windgoto(W_WINROW(curwin) + curwin->w_wrow, @@ -10191,7 +10220,7 @@ } /* - * show the current mode and ruler + * Show the current mode and ruler. * * If clear_cmdline is TRUE, clear the rest of the cmdline. * If clear_cmdline is FALSE there may be a message there that needs to be @@ -10300,7 +10329,6 @@ msg_puts_attr(edit_submode_extra, sub_attr); } } - length = 0; } else #endif diff -Nru vim-8.0.1453/src/search.c vim-8.0.1766/src/search.c --- vim-8.0.1453/src/search.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/search.c 2018-04-26 20:30:33.000000000 +0000 @@ -97,10 +97,8 @@ static int lastc_bytelen = 1; /* >1 for multi-byte char */ #endif -#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) /* copy of spats[], for keeping the search patterns while executing autocmds */ static struct spat saved_spats[2]; -#endif # ifdef FEAT_SEARCH_EXTRA /* copy of spats[RE_SEARCH], for keeping the search patterns while incremental * searching */ @@ -300,7 +298,6 @@ } } -#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO) /* * Save the search patterns, so they can be restored later. * Used before/after executing autocommands and user functions. @@ -318,10 +315,10 @@ saved_spats[1] = spats[1]; if (spats[1].pat != NULL) saved_spats[1].pat = vim_strsave(spats[1].pat); +#ifdef FEAT_SEARCH_EXTRA saved_last_idx = last_idx; -# ifdef FEAT_SEARCH_EXTRA saved_no_hlsearch = no_hlsearch; -# endif +#endif } } @@ -332,18 +329,17 @@ { vim_free(spats[0].pat); spats[0] = saved_spats[0]; -# if defined(FEAT_EVAL) +#if defined(FEAT_EVAL) set_vv_searchforward(); -# endif +#endif vim_free(spats[1].pat); spats[1] = saved_spats[1]; +#ifdef FEAT_SEARCH_EXTRA last_idx = saved_last_idx; -# ifdef FEAT_SEARCH_EXTRA SET_NO_HLSEARCH(saved_no_hlsearch); -# endif +#endif } } -#endif #if defined(EXITFREE) || defined(PROTO) void @@ -421,7 +417,7 @@ if (ic && !no_smartcase && scs #ifdef FEAT_INS_EXPAND - && !(ctrl_x_mode && curbuf->b_p_inf) + && !(ctrl_x_mode_not_default() && curbuf->b_p_inf) #endif ) ic = !pat_has_uppercase(pat); @@ -684,11 +680,11 @@ && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count && pos->col < MAXCOL - 2) { - ptr = ml_get_buf(buf, pos->lnum, FALSE) + pos->col; - if (*ptr == NUL) + ptr = ml_get_buf(buf, pos->lnum, FALSE); + if ((int)STRLEN(ptr) <= pos->col) start_char_len = 1; else - start_char_len = (*mb_ptr2len)(ptr); + start_char_len = (*mb_ptr2len)(ptr + pos->col); } #endif else @@ -973,7 +969,16 @@ NULL, NULL #endif )) == 0) + { +#ifdef FEAT_RELTIME + /* If the search timed out, we did find a match + * but it might be the wrong one, so that's not + * OK. */ + if (timed_out != NULL && *timed_out) + match_ok = FALSE; +#endif break; + } /* Need to get the line pointer again, a * multi-line search may have made it invalid. */ @@ -4066,7 +4071,7 @@ goto again; } - if (do_include || r < 1) + if (do_include) { /* Include up to the '>'. */ while (*ml_get_cursor() != '>') @@ -5050,8 +5055,7 @@ prev_fname = NULL; } } - vim_free(new_fname); - new_fname = NULL; + VIM_CLEAR(new_fname); already_searched = TRUE; break; } diff -Nru vim-8.0.1453/src/spell.c vim-8.0.1766/src/spell.c --- vim-8.0.1453/src/spell.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/spell.c 2018-04-26 20:30:33.000000000 +0000 @@ -1849,9 +1849,7 @@ char_u fname_enc[85]; int r; spelload_T sl; -#ifdef FEAT_AUTOCMD int round; -#endif /* Copy the language name to pass it to spell_load_cb() as a cookie. * It's truncated when an error is detected. */ @@ -1859,11 +1857,9 @@ sl.sl_slang = NULL; sl.sl_nobreak = FALSE; -#ifdef FEAT_AUTOCMD /* We may retry when no spell file is found for the language, an * autocommand may load it then. */ for (round = 1; round <= 2; ++round) -#endif { /* * Find the first spell file for "lang" in 'runtimepath' and load it. @@ -1889,17 +1885,13 @@ lang); r = do_in_runtimepath(fname_enc, 0, spell_load_cb, &sl); -#ifdef FEAT_AUTOCMD if (r == FAIL && *sl.sl_lang != NUL && round == 1 && apply_autocmds(EVENT_SPELLFILEMISSING, lang, curbuf->b_fname, FALSE, curbuf)) continue; break; -#endif } -#ifdef FEAT_AUTOCMD break; -#endif } if (r == FAIL) @@ -1994,19 +1986,13 @@ int i; int round; - vim_free(lp->sl_fbyts); - lp->sl_fbyts = NULL; - vim_free(lp->sl_kbyts); - lp->sl_kbyts = NULL; - vim_free(lp->sl_pbyts); - lp->sl_pbyts = NULL; - - vim_free(lp->sl_fidxs); - lp->sl_fidxs = NULL; - vim_free(lp->sl_kidxs); - lp->sl_kidxs = NULL; - vim_free(lp->sl_pidxs); - lp->sl_pidxs = NULL; + VIM_CLEAR(lp->sl_fbyts); + VIM_CLEAR(lp->sl_kbyts); + VIM_CLEAR(lp->sl_pbyts); + + VIM_CLEAR(lp->sl_fidxs); + VIM_CLEAR(lp->sl_kidxs); + VIM_CLEAR(lp->sl_pidxs); for (round = 1; round <= 2; ++round) { @@ -2048,26 +2034,19 @@ for (i = 0; i < lp->sl_prefixcnt; ++i) vim_regfree(lp->sl_prefprog[i]); lp->sl_prefixcnt = 0; - vim_free(lp->sl_prefprog); - lp->sl_prefprog = NULL; + VIM_CLEAR(lp->sl_prefprog); - vim_free(lp->sl_info); - lp->sl_info = NULL; + VIM_CLEAR(lp->sl_info); - vim_free(lp->sl_midword); - lp->sl_midword = NULL; + VIM_CLEAR(lp->sl_midword); vim_regfree(lp->sl_compprog); - vim_free(lp->sl_comprules); - vim_free(lp->sl_compstartflags); - vim_free(lp->sl_compallflags); lp->sl_compprog = NULL; - lp->sl_comprules = NULL; - lp->sl_compstartflags = NULL; - lp->sl_compallflags = NULL; + VIM_CLEAR(lp->sl_comprules); + VIM_CLEAR(lp->sl_compstartflags); + VIM_CLEAR(lp->sl_compallflags); - vim_free(lp->sl_syllable); - lp->sl_syllable = NULL; + VIM_CLEAR(lp->sl_syllable); ga_clear(&lp->sl_syl_items); ga_clear_strings(&lp->sl_comppat); @@ -2094,10 +2073,8 @@ void slang_clear_sug(slang_T *lp) { - vim_free(lp->sl_sbyts); - lp->sl_sbyts = NULL; - vim_free(lp->sl_sidxs); - lp->sl_sidxs = NULL; + VIM_CLEAR(lp->sl_sbyts); + VIM_CLEAR(lp->sl_sidxs); close_spellbuf(lp->sl_sugbuf); lp->sl_sugbuf = NULL; lp->sl_sugloaded = FALSE; @@ -2363,11 +2340,9 @@ static int recursive = FALSE; char_u *ret_msg = NULL; char_u *spl_copy; -#ifdef FEAT_AUTOCMD bufref_T bufref; set_bufref(&bufref, wp->w_buffer); -#endif /* We don't want to do this recursively. May happen when a language is * not available and the SpellFileMissing autocommand opens a new buffer @@ -2419,7 +2394,6 @@ { vim_strncpy(region_cp, p + 1, 2); mch_memmove(p, p + 3, len - (p - lang) - 2); - len -= 3; region = region_cp; } else @@ -2465,7 +2439,6 @@ else { spell_load_lang(lang); -#ifdef FEAT_AUTOCMD /* SpellFileMissing autocommands may do anything, including * destroying the buffer we are using... */ if (!bufref_valid(&bufref)) @@ -2473,7 +2446,6 @@ ret_msg = (char_u *)N_("E797: SpellFileMissing autocommand deleted buffer"); goto theend; } -#endif } } @@ -2671,8 +2643,7 @@ { vim_memset(wp->w_s->b_spell_ismw, 0, 256); #ifdef FEAT_MBYTE - vim_free(wp->w_s->b_spell_ismw_mb); - wp->w_s->b_spell_ismw_mb = NULL; + VIM_CLEAR(wp->w_s->b_spell_ismw_mb); #endif } @@ -2859,8 +2830,7 @@ mch_remove(int_wordlist); int_wordlist_spl(fname); mch_remove(fname); - vim_free(int_wordlist); - int_wordlist = NULL; + VIM_CLEAR(int_wordlist); } } @@ -2887,10 +2857,8 @@ spell_delete_wordlist(); - vim_free(repl_to); - repl_to = NULL; - vim_free(repl_from); - repl_from = NULL; + VIM_CLEAR(repl_to); + VIM_CLEAR(repl_from); } #endif @@ -3425,10 +3393,8 @@ } else { - vim_free(repl_from); - repl_from = NULL; - vim_free(repl_to); - repl_to = NULL; + VIM_CLEAR(repl_from); + VIM_CLEAR(repl_to); #ifdef FEAT_RIGHTLEFT /* When 'rightleft' is set the list is drawn right-left. */ diff -Nru vim-8.0.1453/src/spellfile.c vim-8.0.1766/src/spellfile.c --- vim-8.0.1453/src/spellfile.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/spellfile.c 2018-04-26 20:30:33.000000000 +0000 @@ -54,8 +54,8 @@ * website, etc) * * sectionID == SN_REGION: ... - * 2 bytes Up to 8 region names: ca, au, etc. Lower case. - * First is region 1. + * 2 bytes Up to MAXREGIONS region names: ca, au, etc. Lower + * case. First is region 1. * * sectionID == SN_CHARFLAGS: * @@ -832,7 +832,7 @@ { int i; - if (len > 16) + if (len > MAXREGIONS * 2) return SP_FORMERROR; for (i = 0; i < len; ++i) lp->sl_regions[i] = getc(fd); /* */ @@ -1352,8 +1352,7 @@ { if (c == '?' || c == '+' || c == '*') { - vim_free(slang->sl_comprules); - slang->sl_comprules = NULL; + VIM_CLEAR(slang->sl_comprules); crp = NULL; } else @@ -1952,8 +1951,9 @@ char_u *si_info; /* info text chars or NULL */ int si_region_count; /* number of regions supported (1 when there are no regions) */ - char_u si_region_name[17]; /* region names; used only if - * si_region_count > 1) */ + char_u si_region_name[MAXREGIONS * 2 + 1]; + /* region names; used only if + * si_region_count > 1) */ garray_T si_rep; /* list of fromto_T entries from REP lines */ garray_T si_repsal; /* list of fromto_T entries from REPSAL lines */ @@ -3649,7 +3649,7 @@ { spin->si_msg_count = 0; vim_snprintf((char *)message, sizeof(message), - _("line %6d, word %6d - %s"), + _("line %6d, word %6ld - %s"), lnum, spin->si_foldwcount + spin->si_keepwcount, w); msg_start(); msg_puts_long_attr(message, 0); @@ -4234,7 +4234,7 @@ else { line += 8; - if (STRLEN(line) > 16) + if (STRLEN(line) > MAXREGIONS * 2) smsg((char_u *)_("Too many regions in %s line %d: %s"), fname, lnum, line); else @@ -5954,7 +5954,7 @@ char_u *wfname; char_u **innames; int incount; - afffile_T *(afile[8]); + afffile_T *(afile[MAXREGIONS]); int i; int len; stat_T st; @@ -6025,8 +6025,8 @@ EMSG(_(e_invarg)); /* need at least output and input names */ else if (vim_strchr(gettail(wfname), '_') != NULL) EMSG(_("E751: Output file name must not have region name")); - else if (incount > 8) - EMSG(_("E754: Only up to 8 regions supported")); + else if (incount > MAXREGIONS) + EMSGN(_("E754: Only up to %ld regions supported"), MAXREGIONS); else { /* Check for overwriting before doing things that may take a lot of diff -Nru vim-8.0.1453/src/spell.h vim-8.0.1766/src/spell.h --- vim-8.0.1453/src/spell.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/spell.h 2018-04-26 20:30:33.000000000 +0000 @@ -34,6 +34,8 @@ byte, thus it can't be above 255. Must be >= PFD_NOTSPECIAL. */ +#define MAXREGIONS 8 /* Number of regions supported. */ + /* Type used for indexes in the word tree need to be at least 4 bytes. If int * is 8 bytes we could use something smaller, but what? */ #if VIM_SIZEOF_INT > 3 @@ -80,7 +82,8 @@ char_u *sl_info; /* infotext string or NULL */ - char_u sl_regions[17]; /* table with up to 8 region names plus NUL */ + char_u sl_regions[MAXREGIONS * 2 + 1]; + /* table with up to 8 region names plus NUL */ char_u *sl_midword; /* MIDWORD string or NULL */ diff -Nru vim-8.0.1453/src/structs.h vim-8.0.1766/src/structs.h --- vim-8.0.1453/src/structs.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/structs.h 2018-04-26 20:30:33.000000000 +0000 @@ -101,7 +101,10 @@ # endif # define guicolor_T long # define INVALCOLOR ((guicolor_T)0x1ffffff) + /* only used for cterm.bg_rgb and cterm.fg_rgb: use cterm color */ +# define CTERMCOLOR ((guicolor_T)0x1fffffe) #endif +#define COLOR_INVALID(x) ((x) == INVALCOLOR || (x) == CTERMCOLOR) /* * marks: positions in a file @@ -241,14 +244,12 @@ char_u *wo_stl; #define w_p_stl w_onebuf_opt.wo_stl /* 'statusline' */ #endif -#ifdef FEAT_SCROLLBIND int wo_scb; -# define w_p_scb w_onebuf_opt.wo_scb /* 'scrollbind' */ +#define w_p_scb w_onebuf_opt.wo_scb /* 'scrollbind' */ int wo_diff_saved; /* options were saved for starting diff mode */ -# define w_p_diff_saved w_onebuf_opt.wo_diff_saved +#define w_p_diff_saved w_onebuf_opt.wo_diff_saved int wo_scb_save; /* 'scrollbind' saved for diff mode*/ -# define w_p_scb_save w_onebuf_opt.wo_scb_save -#endif +#define w_p_scb_save w_onebuf_opt.wo_scb_save int wo_wrap; #define w_p_wrap w_onebuf_opt.wo_wrap /* 'wrap' */ #ifdef FEAT_DIFF @@ -261,21 +262,19 @@ long wo_cole; /* 'conceallevel' */ # define w_p_cole w_onebuf_opt.wo_cole #endif -#ifdef FEAT_CURSORBIND int wo_crb; -# define w_p_crb w_onebuf_opt.wo_crb /* 'cursorbind' */ +#define w_p_crb w_onebuf_opt.wo_crb /* 'cursorbind' */ int wo_crb_save; /* 'cursorbind' state saved for diff mode*/ -# define w_p_crb_save w_onebuf_opt.wo_crb_save -#endif +#define w_p_crb_save w_onebuf_opt.wo_crb_save #ifdef FEAT_SIGNS char_u *wo_scl; # define w_p_scl w_onebuf_opt.wo_scl /* 'signcolumn' */ #endif #ifdef FEAT_TERMINAL - char_u *wo_tk; -#define w_p_tk w_onebuf_opt.wo_tk /* 'termkey' */ - char_u *wo_tms; -#define w_p_tms w_onebuf_opt.wo_tms /* 'termsize' */ + char_u *wo_twk; +# define w_p_twk w_onebuf_opt.wo_twk /* 'termwinkey' */ + char_u *wo_tws; +# define w_p_tws w_onebuf_opt.wo_tws /* 'termwinsize' */ #endif #ifdef FEAT_EVAL @@ -583,9 +582,7 @@ int lockmarks; /* TRUE when ":lockmarks" was used */ int keeppatterns; /* TRUE when ":keeppatterns" was used */ int noswapfile; /* TRUE when ":noswapfile" was used */ -# ifdef FEAT_AUTOCMD char_u *save_ei; /* saved value of 'eventignore' */ -# endif regmatch_T filter_regmatch; /* set by :filter /pat/ */ int filter_force; /* set for :filter! */ } cmdmod_T; @@ -830,9 +827,9 @@ */ typedef enum { - ET_USER, /* exception caused by ":throw" command */ - ET_ERROR, /* error exception */ - ET_INTERRUPT /* interrupt exception triggered by Ctrl-C */ + ET_USER, // exception caused by ":throw" command + ET_ERROR, // error exception + ET_INTERRUPT, // interrupt exception triggered by Ctrl-C } except_type_T; /* @@ -1193,16 +1190,16 @@ typedef enum { VAR_UNKNOWN = 0, - VAR_NUMBER, /* "v_number" is used */ - VAR_STRING, /* "v_string" is used */ - VAR_FUNC, /* "v_string" is function name */ - VAR_PARTIAL, /* "v_partial" is used */ - VAR_LIST, /* "v_list" is used */ - VAR_DICT, /* "v_dict" is used */ - VAR_FLOAT, /* "v_float" is used */ - VAR_SPECIAL, /* "v_number" is used */ - VAR_JOB, /* "v_job" is used */ - VAR_CHANNEL /* "v_channel" is used */ + VAR_NUMBER, // "v_number" is used + VAR_STRING, // "v_string" is used + VAR_FUNC, // "v_string" is function name + VAR_PARTIAL, // "v_partial" is used + VAR_LIST, // "v_list" is used + VAR_DICT, // "v_dict" is used + VAR_FLOAT, // "v_float" is used + VAR_SPECIAL, // "v_number" is used + VAR_JOB, // "v_job" is used + VAR_CHANNEL, // "v_channel" is used } vartype_T; /* @@ -1263,21 +1260,22 @@ /* * Structure to hold info about a list. + * Order of members is optimized to reduce padding. */ struct listvar_S { listitem_T *lv_first; /* first item, NULL if none */ listitem_T *lv_last; /* last item, NULL if none */ - int lv_refcount; /* reference count */ - int lv_len; /* number of items */ listwatch_T *lv_watch; /* first watcher, NULL if none */ - int lv_idx; /* cached index of an item */ listitem_T *lv_idx_item; /* when not NULL item at index "lv_idx" */ - int lv_copyID; /* ID used by deepcopy() */ list_T *lv_copylist; /* copied list used by deepcopy() */ - char lv_lock; /* zero, VAR_LOCKED, VAR_FIXED */ list_T *lv_used_next; /* next list in used lists list */ list_T *lv_used_prev; /* previous list in used lists list */ + int lv_refcount; /* reference count */ + int lv_len; /* number of items */ + int lv_idx; /* cached index of an item */ + int lv_copyID; /* ID used by deepcopy() */ + char lv_lock; /* zero, VAR_LOCKED, VAR_FIXED */ }; /* @@ -1458,8 +1456,8 @@ { JOB_FAILED, JOB_STARTED, - JOB_ENDED, /* detected job done */ - JOB_FINISHED /* job done and cleanup done */ + JOB_ENDED, // detected job done + JOB_FINISHED, // job done and cleanup done } jobstatus_T; /* @@ -1490,6 +1488,7 @@ int jv_copyID; channel_T *jv_channel; /* channel for I/O, reference counted */ + char_u **jv_argv; /* command line used to start the job */ }; /* @@ -1533,11 +1532,11 @@ MODE_NL = 0, MODE_RAW, MODE_JSON, - MODE_JS + MODE_JS, } ch_mode_T; typedef enum { - JIO_PIPE, /* default */ + JIO_PIPE, // default JIO_NULL, JIO_FILE, JIO_BUFFER, @@ -1559,7 +1558,7 @@ PART_IN, # define CH_IN_FD CH_PART_FD(PART_IN) #endif - PART_COUNT + PART_COUNT, } ch_part_T; #define INVALID_FD (-1) @@ -1708,7 +1707,9 @@ #define JO2_HIDDEN 0x0400 /* "hidden" */ #define JO2_TERM_OPENCMD 0x0800 /* "term_opencmd" */ #define JO2_EOF_CHARS 0x1000 /* "eof_chars" */ -#define JO2_ALL 0x1FFF +#define JO2_NORESTORE 0x2000 /* "norestore" */ +#define JO2_TERM_KILL 0x4000 /* "term_kill" */ +#define JO2_ANSI_COLORS 0x8000 /* "ansi_colors" */ #define JO_MODE_ALL (JO_MODE + JO_IN_MODE + JO_OUT_MODE + JO_ERR_MODE) #define JO_CB_ALL \ @@ -1771,10 +1772,15 @@ int jo_vertical; int jo_curwin; int jo_hidden; + int jo_term_norestore; char_u *jo_term_name; char_u *jo_term_opencmd; int jo_term_finish; char_u *jo_eof_chars; + char_u *jo_term_kill; +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + long_u jo_ansi_colors[16]; +# endif #endif } jobopt_T; @@ -1943,10 +1949,8 @@ int b_nwindows; /* nr of windows open on this buffer */ int b_flags; /* various BF_ flags */ -#ifdef FEAT_AUTOCMD int b_locked; /* Buffer is being closed or referenced, don't let autocommands wipe it out. */ -#endif /* * b_ffname has the full path of the file (NULL for no name). @@ -1983,6 +1987,13 @@ incremented for each change, also for undo */ #define CHANGEDTICK(buf) ((buf)->b_ct_di.di_tv.vval.v_number) + varnumber_T b_last_changedtick; /* b:changedtick when TextChanged or + TextChangedI was last triggered. */ +#ifdef FEAT_INS_EXPAND + varnumber_T b_last_changedtick_pum; /* b:changedtick when TextChangedP was + last triggered. */ +#endif + int b_saving; /* Set to TRUE if we are in the middle of saving the buffer. */ @@ -2159,9 +2170,7 @@ char_u *b_p_fenc; /* 'fileencoding' */ #endif char_u *b_p_ff; /* 'fileformat' */ -#ifdef FEAT_AUTOCMD char_u *b_p_ft; /* 'filetype' */ -#endif char_u *b_p_fo; /* 'formatoptions' */ char_u *b_p_flp; /* 'formatlistpat' */ int b_p_inf; /* 'infercase' */ @@ -2254,6 +2263,9 @@ #ifdef FEAT_LISP char_u *b_p_lw; /* 'lispwords' local value */ #endif +#ifdef FEAT_TERMINAL + long b_p_twsl; /* 'termwinscroll' */ +#endif /* end of buffer options */ @@ -2436,12 +2448,8 @@ #endif #define SNAP_HELP_IDX 0 -#ifdef FEAT_AUTOCMD -# define SNAP_AUCMD_IDX 1 -# define SNAP_COUNT 2 -#else -# define SNAP_COUNT 1 -#endif +#define SNAP_AUCMD_IDX 1 +#define SNAP_COUNT 2 /* * Tab pages point to the top frame of each tab page. @@ -2630,10 +2638,8 @@ win_T *w_prev; /* link to previous window */ win_T *w_next; /* link to next window */ -#ifdef FEAT_AUTOCMD int w_closing; /* window is being closed, don't let autocommands close it too. */ -#endif frame_T *w_frame; /* frame containing this window */ @@ -2664,10 +2670,8 @@ */ linenr_T w_topline; /* buffer line number of the line at the top of the window */ -#ifdef FEAT_AUTOCMD char w_topline_was_set; /* flag set to TRUE when topline is set, e.g. by winrestview() */ -#endif #ifdef FEAT_DIFF int w_topfill; /* number of filler lines above w_topline */ int w_old_topfill; /* w_topfill at last redraw */ @@ -2833,9 +2837,7 @@ /* transform a pointer to a "onebuf" option into a "allbuf" option */ #define GLOBAL_WO(p) ((char *)p + sizeof(winopt_T)) -#ifdef FEAT_SCROLLBIND long w_scbind_pos; -#endif #ifdef FEAT_EVAL dictitem_T w_winvar; /* variable for "w:" Dictionary */ @@ -2961,10 +2963,8 @@ int block_mode; /* current operator is Visual block mode */ colnr_T start_vcol; /* start col for block mode operator */ colnr_T end_vcol; /* end col for block mode operator */ -#ifdef FEAT_AUTOCMD long prev_opcount; /* ca.opcount saved for K_CURSORHOLD */ long prev_count0; /* ca.count0 saved for K_CURSORHOLD */ -#endif } oparg_T; /* @@ -3148,18 +3148,16 @@ /* * Struct to save values in before executing autocommands for a buffer that is - * not the current buffer. Without FEAT_AUTOCMD only "curbuf" is remembered. + * not the current buffer. */ typedef struct { buf_T *save_curbuf; /* saved curbuf */ -#ifdef FEAT_AUTOCMD int use_aucmd_win; /* using aucmd_win */ win_T *save_curwin; /* saved curwin */ win_T *new_curwin; /* new curwin */ bufref_T new_curbuf; /* new curbuf */ char_u *globaldir; /* saved value of globaldir */ -#endif } aco_save_T; /* @@ -3240,11 +3238,12 @@ /* * Array indexes used for cptext argument of ins_compl_add(). */ -#define CPT_ABBR 0 /* "abbr" */ -#define CPT_MENU 1 /* "menu" */ -#define CPT_KIND 2 /* "kind" */ -#define CPT_INFO 3 /* "info" */ -#define CPT_COUNT 4 /* Number of entries */ +#define CPT_ABBR 0 /* "abbr" */ +#define CPT_MENU 1 /* "menu" */ +#define CPT_KIND 2 /* "kind" */ +#define CPT_INFO 3 /* "info" */ +#define CPT_USER_DATA 4 /* "user data" */ +#define CPT_COUNT 5 /* Number of entries */ typedef struct { UINT32_T total[2]; @@ -3253,6 +3252,22 @@ } context_sha256_T; /* + * types for expressions. + */ +typedef enum +{ + TYPE_UNKNOWN = 0, + TYPE_EQUAL, // == + TYPE_NEQUAL, // != + TYPE_GREATER, // > + TYPE_GEQUAL, // >= + TYPE_SMALLER, // < + TYPE_SEQUAL, // <= + TYPE_MATCH, // =~ + TYPE_NOMATCH, // !~ +} exptype_T; + +/* * Structure used for reading in json_decode(). */ struct js_reader @@ -3304,6 +3319,7 @@ int evim_mode; /* started as "evim" */ char_u *use_vimrc; /* vimrc from -u argument */ + int clean; /* --clean argument */ int n_commands; /* no. of commands from + or -c */ char_u *commands[MAX_ARG_CMDS]; /* commands from + or -c arg. */ diff -Nru vim-8.0.1453/src/syntax.c vim-8.0.1766/src/syntax.c --- vim-8.0.1453/src/syntax.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/syntax.c 2018-04-26 20:30:33.000000000 +0000 @@ -145,30 +145,32 @@ * * A character offset can be given for the matched text (_m_start and _m_end) * and for the actually highlighted text (_h_start and _h_end). + * + * Note that ordering of members is optimized to reduce padding. */ typedef struct syn_pattern { char sp_type; /* see SPTYPE_ defines below */ char sp_syncing; /* this item used for syncing */ + short sp_syn_match_id; /* highlight group ID of pattern */ + short sp_off_flags; /* see below */ + int sp_offsets[SPO_COUNT]; /* offsets */ int sp_flags; /* see HL_ defines below */ #ifdef FEAT_CONCEAL int sp_cchar; /* conceal substitute character */ #endif + int sp_ic; /* ignore-case flag for sp_prog */ + int sp_sync_idx; /* sync item index (syncing only) */ + int sp_line_id; /* ID of last line where tried */ + int sp_startcol; /* next match in sp_line_id line */ + short *sp_cont_list; /* cont. group IDs, if non-zero */ + short *sp_next_list; /* next group IDs, if non-zero */ struct sp_syn sp_syn; /* struct passed to in_id_list() */ - short sp_syn_match_id; /* highlight group ID of pattern */ char_u *sp_pattern; /* regexp to match, pattern */ regprog_T *sp_prog; /* regexp to match, program */ #ifdef FEAT_PROFILE syn_time_T sp_time; #endif - int sp_ic; /* ignore-case flag for sp_prog */ - short sp_off_flags; /* see below */ - int sp_offsets[SPO_COUNT]; /* offsets */ - short *sp_cont_list; /* cont. group IDs, if non-zero */ - short *sp_next_list; /* next group IDs, if non-zero */ - int sp_sync_idx; /* sync item index (syncing only) */ - int sp_line_id; /* ID of last line where tried */ - int sp_startcol; /* next match in sp_line_id line */ } synpat_T; /* The sp_off_flags are computed like this: @@ -1189,8 +1191,7 @@ { for (p = block->b_sst_first; p != NULL; p = p->sst_next) clear_syn_state(p); - vim_free(block->b_sst_array); - block->b_sst_array = NULL; + VIM_CLEAR(block->b_sst_array); block->b_sst_len = 0; } } @@ -2134,7 +2135,7 @@ r = syn_regexec(®match, current_lnum, (colnr_T)lc_col, - IF_SYN_TIME(&spp->sp_time)); + IF_SYN_TIME(&spp->sp_time)); spp->sp_prog = regmatch.regprog; if (!r) { @@ -2469,7 +2470,8 @@ /* nextgroup ends at end of line, unless "skipnl" or "skipempty" present */ if (current_next_list != NULL - && syn_getcurline()[current_col + 1] == NUL + && (line = syn_getcurline())[current_col] != NUL + && line[current_col + 1] == NUL && !(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY))) current_next_list = NULL; @@ -3641,8 +3643,7 @@ vim_regfree(block->b_syn_linecont_prog); block->b_syn_linecont_prog = NULL; - vim_free(block->b_syn_linecont_pat); - block->b_syn_linecont_pat = NULL; + VIM_CLEAR(block->b_syn_linecont_pat); #ifdef FEAT_FOLDING block->b_syn_folditems = 0; #endif @@ -3690,8 +3691,7 @@ vim_regfree(curwin->w_s->b_syn_linecont_prog); curwin->w_s->b_syn_linecont_prog = NULL; - vim_free(curwin->w_s->b_syn_linecont_pat); - curwin->w_s->b_syn_linecont_pat = NULL; + VIM_CLEAR(curwin->w_s->b_syn_linecont_pat); clear_string_option(&curwin->w_s->b_syn_isk); syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */ @@ -3810,8 +3810,7 @@ */ short scl_id = id - SYNID_CLUSTER; - vim_free(SYN_CLSTR(curwin->w_s)[scl_id].scl_list); - SYN_CLSTR(curwin->w_s)[scl_id].scl_list = NULL; + VIM_CLEAR(SYN_CLSTR(curwin->w_s)[scl_id].scl_list); } } else @@ -5954,8 +5953,7 @@ if (curwin->w_s->b_syn_linecont_prog == NULL) { - vim_free(curwin->w_s->b_syn_linecont_pat); - curwin->w_s->b_syn_linecont_pat = NULL; + VIM_CLEAR(curwin->w_s->b_syn_linecont_pat); finished = TRUE; break; } @@ -6422,11 +6420,9 @@ if (old_value != NULL) old_value = vim_strsave(old_value); -#ifdef FEAT_AUTOCMD /* Apply the "syntax" autocommand event, this finds and loads the syntax * file. */ apply_autocmds(EVENT_SYNTAX, eap->arg, curbuf->b_fname, TRUE, curbuf); -#endif /* move value of b:current_syntax to w:current_syntax */ new_value = get_var_value((char_u *)"b:current_syntax"); @@ -6819,7 +6815,6 @@ MSG_PUTS("\n"); for (idx = 0; idx < ga.ga_len && !got_int; ++idx) { - spp = &(SYN_ITEMS(curwin->w_s)[idx]); p = ((time_entry_T *)ga.ga_data) + idx; MSG_PUTS(profile_msg(&p->total)); @@ -6998,10 +6993,8 @@ CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey", "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"), #endif -#ifdef FEAT_AUTOCMD CENT("MatchParen term=reverse ctermbg=Cyan", "MatchParen term=reverse ctermbg=Cyan guibg=Cyan"), -#endif #ifdef FEAT_GUI "Normal gui=NONE", #endif @@ -7092,10 +7085,8 @@ CENT("ColorColumn term=reverse ctermbg=DarkRed", "ColorColumn term=reverse ctermbg=DarkRed guibg=DarkRed"), #endif -#ifdef FEAT_AUTOCMD CENT("MatchParen term=reverse ctermbg=DarkCyan", "MatchParen term=reverse ctermbg=DarkCyan guibg=DarkCyan"), -#endif #ifdef FEAT_CONCEAL CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey", "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"), @@ -7236,9 +7227,7 @@ sprintf((char *)buf, "colors/%s.vim", name); retval = source_runtime(buf, DIP_START + DIP_OPT); vim_free(buf); -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, FALSE, curbuf); -#endif } recursive = FALSE; @@ -8369,10 +8358,8 @@ HL_TABLE()[idx].sg_cleared = TRUE; HL_TABLE()[idx].sg_term = 0; - vim_free(HL_TABLE()[idx].sg_start); - HL_TABLE()[idx].sg_start = NULL; - vim_free(HL_TABLE()[idx].sg_stop); - HL_TABLE()[idx].sg_stop = NULL; + VIM_CLEAR(HL_TABLE()[idx].sg_start); + VIM_CLEAR(HL_TABLE()[idx].sg_stop); HL_TABLE()[idx].sg_term_attr = 0; HL_TABLE()[idx].sg_cterm = 0; HL_TABLE()[idx].sg_cterm_bold = FALSE; @@ -8381,12 +8368,9 @@ HL_TABLE()[idx].sg_cterm_attr = 0; #if defined(FEAT_GUI) || defined(FEAT_EVAL) HL_TABLE()[idx].sg_gui = 0; - vim_free(HL_TABLE()[idx].sg_gui_fg_name); - HL_TABLE()[idx].sg_gui_fg_name = NULL; - vim_free(HL_TABLE()[idx].sg_gui_bg_name); - HL_TABLE()[idx].sg_gui_bg_name = NULL; - vim_free(HL_TABLE()[idx].sg_gui_sp_name); - HL_TABLE()[idx].sg_gui_sp_name = NULL; + VIM_CLEAR(HL_TABLE()[idx].sg_gui_fg_name); + VIM_CLEAR(HL_TABLE()[idx].sg_gui_bg_name); + VIM_CLEAR(HL_TABLE()[idx].sg_gui_sp_name); #endif #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) HL_TABLE()[idx].sg_gui_fg = INVALCOLOR; @@ -8400,8 +8384,7 @@ gui_mch_free_fontset(HL_TABLE()[idx].sg_fontset); HL_TABLE()[idx].sg_fontset = NOFONTSET; # endif - vim_free(HL_TABLE()[idx].sg_font_name); - HL_TABLE()[idx].sg_font_name = NULL; + VIM_CLEAR(HL_TABLE()[idx].sg_font_name); HL_TABLE()[idx].sg_gui_attr = 0; #endif #ifdef FEAT_EVAL @@ -8421,10 +8404,10 @@ void set_normal_colors(void) { -#ifdef FEAT_GUI -# ifdef FEAT_TERMGUICOLORS +# ifdef FEAT_GUI +# ifdef FEAT_TERMGUICOLORS if (gui.in_use) -# endif +# endif { if (set_group_colors((char_u *)"Normal", &gui.norm_pixel, &gui.back_pixel, @@ -8433,27 +8416,27 @@ gui_mch_new_colors(); must_redraw = CLEAR; } -# ifdef FEAT_GUI_X11 +# ifdef FEAT_GUI_X11 if (set_group_colors((char_u *)"Menu", &gui.menu_fg_pixel, &gui.menu_bg_pixel, TRUE, FALSE, FALSE)) { -# ifdef FEAT_MENU +# ifdef FEAT_MENU gui_mch_new_menu_colors(); -# endif +# endif must_redraw = CLEAR; } -# ifdef FEAT_BEVAL_GUI +# ifdef FEAT_BEVAL_GUI if (set_group_colors((char_u *)"Tooltip", &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel, FALSE, FALSE, TRUE)) { -# ifdef FEAT_TOOLBAR +# ifdef FEAT_TOOLBAR gui_mch_new_tooltip_colors(); -# endif +# endif must_redraw = CLEAR; } -# endif +# endif if (set_group_colors((char_u *)"Scrollbar", &gui.scroll_fg_pixel, &gui.scroll_bg_pixel, FALSE, FALSE, FALSE)) @@ -8461,13 +8444,13 @@ gui_new_scrollbar_colors(); must_redraw = CLEAR; } -# endif +# endif } -#endif -#ifdef FEAT_TERMGUICOLORS -# ifdef FEAT_GUI - else # endif +# ifdef FEAT_TERMGUICOLORS +# ifdef FEAT_GUI + else +# endif { int idx; @@ -8476,19 +8459,20 @@ { gui_do_one_color(idx, FALSE, FALSE); - if (HL_TABLE()[idx].sg_gui_fg != INVALCOLOR) + /* If the normal fg or bg color changed a complete redraw is + * required. */ + if (cterm_normal_fg_gui_color != HL_TABLE()[idx].sg_gui_fg + || cterm_normal_bg_gui_color != HL_TABLE()[idx].sg_gui_bg) { + /* if the GUI color is INVALCOLOR then we use the default cterm + * color */ cterm_normal_fg_gui_color = HL_TABLE()[idx].sg_gui_fg; - must_redraw = CLEAR; - } - if (HL_TABLE()[idx].sg_gui_bg != INVALCOLOR) - { cterm_normal_bg_gui_color = HL_TABLE()[idx].sg_gui_bg; must_redraw = CLEAR; } } } -#endif +# endif } #endif @@ -8939,6 +8923,10 @@ attrentry_T at_en; vim_memset(&at_en, 0, sizeof(attrentry_T)); +#ifdef FEAT_TERMGUICOLORS + at_en.ae_u.cterm.fg_rgb = INVALCOLOR; + at_en.ae_u.cterm.bg_rgb = INVALCOLOR; +#endif at_en.ae_attr = attr; at_en.ae_u.cterm.fg_color = fg; at_en.ae_u.cterm.bg_color = bg; @@ -8957,8 +8945,18 @@ vim_memset(&at_en, 0, sizeof(attrentry_T)); at_en.ae_attr = attr; - at_en.ae_u.cterm.fg_rgb = fg; - at_en.ae_u.cterm.bg_rgb = bg; + if (fg == INVALCOLOR && bg == INVALCOLOR) + { + /* If both GUI colors are not set fall back to the cterm colors. Helps + * if the GUI only has an attribute, such as undercurl. */ + at_en.ae_u.cterm.fg_rgb = CTERMCOLOR; + at_en.ae_u.cterm.bg_rgb = CTERMCOLOR; + } + else + { + at_en.ae_u.cterm.fg_rgb = fg; + at_en.ae_u.cterm.bg_rgb = bg; + } return get_attr_entry(&cterm_attr_table, &at_en); } #endif @@ -9099,10 +9097,23 @@ if (spell_aep->ae_u.cterm.bg_color > 0) new_en.ae_u.cterm.bg_color = spell_aep->ae_u.cterm.bg_color; #ifdef FEAT_TERMGUICOLORS - if (spell_aep->ae_u.cterm.fg_rgb != INVALCOLOR) - new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb; - if (spell_aep->ae_u.cterm.bg_rgb != INVALCOLOR) - new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb; + /* If both fg and bg are not set fall back to cterm colors. + * Helps for SpellBad which uses undercurl in the GUI. */ + if (COLOR_INVALID(spell_aep->ae_u.cterm.fg_rgb) + && COLOR_INVALID(spell_aep->ae_u.cterm.bg_rgb)) + { + if (spell_aep->ae_u.cterm.fg_color > 0) + new_en.ae_u.cterm.fg_rgb = CTERMCOLOR; + if (spell_aep->ae_u.cterm.bg_color > 0) + new_en.ae_u.cterm.bg_rgb = CTERMCOLOR; + } + else + { + if (spell_aep->ae_u.cterm.fg_rgb != INVALCOLOR) + new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb; + if (spell_aep->ae_u.cterm.bg_rgb != INVALCOLOR) + new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb; + } #endif } } @@ -9578,8 +9589,33 @@ at_en.ae_u.cterm.fg_color = sgp->sg_cterm_fg; at_en.ae_u.cterm.bg_color = sgp->sg_cterm_bg; # ifdef FEAT_TERMGUICOLORS +# ifdef WIN3264 + { + int id; + guicolor_T fg, bg; + + id = syn_name2id((char_u *)"Normal"); + if (id > 0) + { + syn_id2colors(id, &fg, &bg); + if (sgp->sg_gui_fg == INVALCOLOR) + sgp->sg_gui_fg = fg; + if (sgp->sg_gui_bg == INVALCOLOR) + sgp->sg_gui_bg = bg; + } + + } +# endif at_en.ae_u.cterm.fg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_fg); at_en.ae_u.cterm.bg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_bg); + if (at_en.ae_u.cterm.fg_rgb == INVALCOLOR + && at_en.ae_u.cterm.bg_rgb == INVALCOLOR) + { + /* If both fg and bg are invalid fall back to the cterm colors. + * Helps when the GUI only uses an attribute, e.g. undercurl. */ + at_en.ae_u.cterm.fg_rgb = CTERMCOLOR; + at_en.ae_u.cterm.bg_rgb = CTERMCOLOR; + } # endif sgp->sg_cterm_attr = get_attr_entry(&cterm_attr_table, &at_en); } @@ -9856,9 +9892,10 @@ return hl_id; } -#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) /* * Call this function just after the GUI has started. + * Also called when 'termguicolors' was set, gui.in_use will be FALSE then. * It finds the font and color handles for the highlighting groups. */ void @@ -9867,12 +9904,8 @@ int idx; /* First get the colors from the "Normal" and "Menu" group, if set */ -# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) -# ifdef FEAT_TERMGUICOLORS if (USE_24BIT) -# endif set_normal_colors(); -# endif for (idx = 0; idx < highlight_ga.ga_len; ++idx) gui_do_one_color(idx, FALSE, FALSE); @@ -10011,11 +10044,11 @@ #ifdef USER_HIGHLIGHT char_u userhl[10]; # ifdef FEAT_STL_OPT - int id_SNC = -1; int id_S = -1; + int id_SNC = 0; # ifdef FEAT_TERMINAL - int id_ST = -1; - int id_STNC = -1; + int id_ST = 0; + int id_STNC = 0; # endif int hlcnt; # endif diff -Nru vim-8.0.1453/src/tag.c vim-8.0.1766/src/tag.c --- vim-8.0.1453/src/tag.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/tag.c 2018-04-26 20:30:33.000000000 +0000 @@ -1017,7 +1017,7 @@ } } -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) /* Let the SwapExists event know what tag we are jumping to. */ vim_snprintf((char *)IObuff, IOSIZE, ":ta %s\r", name); set_vim_var_string(VV_SWAPCOMMAND, IObuff, -1); @@ -1028,7 +1028,7 @@ */ i = jumpto_tag(matches[cur_match], forceit, type != DT_CSCOPE); -#ifdef FEAT_AUTOCMD +#if defined(FEAT_EVAL) set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); #endif @@ -1091,8 +1091,7 @@ void tag_freematch(void) { - vim_free(tagmatchname); - tagmatchname = NULL; + VIM_CLEAR(tagmatchname); } static void @@ -2620,10 +2619,7 @@ # if defined(FEAT_QUICKFIX) if (ptag_entry.tagname) - { - vim_free(ptag_entry.tagname); - ptag_entry.tagname = NULL; - } + VIM_CLEAR(ptag_entry.tagname); # endif } #endif @@ -2958,12 +2954,9 @@ char_u *p = lbuf + 1; /* does the same thing as parse_match() */ - p += STRLEN(p) + 2; + p += STRLEN(p) + 1; #ifdef FEAT_EMACS_TAGS - if (*p) - p += STRLEN(p); - else - ++p; + p += STRLEN(p) + 1; #endif return (p - lbuf) + STRLEN(p); } @@ -3181,11 +3174,7 @@ * file. Also accept a file name for which there is a matching BufReadCmd * autocommand event (e.g., http://sys/file). */ - if (mch_getperm(fname) < 0 -#ifdef FEAT_AUTOCMD - && !has_autocmd(EVENT_BUFREADCMD, fname, NULL) -#endif - ) + if (mch_getperm(fname) < 0 && !has_autocmd(EVENT_BUFREADCMD, fname, NULL)) { retval = NOTAGFILE; vim_free(nofile_fname); diff -Nru vim-8.0.1453/src/term.c vim-8.0.1766/src/term.c --- vim-8.0.1453/src/term.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/term.c 2018-04-26 20:30:33.000000000 +0000 @@ -76,7 +76,6 @@ static struct builtin_term *find_builtin_term(char_u *name); static void parse_builtin_tcap(char_u *s); -static void term_color(char_u *s, int n); static void gather_termleader(void); #ifdef FEAT_TERMRESPONSE static void req_codes_from_term(void); @@ -109,10 +108,10 @@ /* Change this to "if 1" to debug what happens with termresponse. */ # if 0 # define DEBUG_TERMRESPONSE - static void log_tr(char *msg); -# define LOG_TR(msg) log_tr(msg) +static void log_tr(const char *fmt, ...); +# define LOG_TR(msg) log_tr msg # else -# define LOG_TR(msg) +# define LOG_TR(msg) do { /**/ } while (0) # endif # define STATUS_GET 1 /* send request when switching to RAW mode */ @@ -144,6 +143,9 @@ /* Request cursor style report: */ static int rcs_status = STATUS_GET; + +/* Request windos position report: */ +static int winpos_status = STATUS_GET; # endif /* @@ -600,6 +602,10 @@ # else {(int)KS_CS, "\033|%i%d;%dr"},/* scroll region */ # endif +# ifdef FEAT_TERMGUICOLORS + {(int)KS_8F, "\033|38;2;%lu;%lu;%lum"}, + {(int)KS_8B, "\033|48;2;%lu;%lu;%lum"}, +# endif {K_UP, "\316H"}, {K_DOWN, "\316P"}, @@ -1510,15 +1516,13 @@ init_highlight(TRUE, FALSE); # ifdef DEBUG_TERMRESPONSE { - char buf[100]; - int r = redraw_asap(CLEAR); + int r = redraw_asap(CLEAR); - sprintf(buf, "Received t_Co, redraw_asap(): %d", r); - log_tr(buf); + log_tr("Received t_Co, redraw_asap(): %d", r); } -# else +#else redraw_asap(CLEAR); -# endif +#endif } } #endif @@ -1942,7 +1946,7 @@ full_screen = TRUE; /* we can use termcap codes from now on */ set_term_defaults(); /* use current values as defaults */ #ifdef FEAT_TERMRESPONSE - LOG_TR("setting crv_status to STATUS_GET"); + LOG_TR(("setting crv_status to STATUS_GET")); crv_status = STATUS_GET; /* Get terminal version later */ #endif @@ -1982,7 +1986,6 @@ scroll_region_reset(); /* In case Rows changed */ check_map_keycodes(); /* check mappings for terminal codes used */ -#ifdef FEAT_AUTOCMD { bufref_T old_curbuf; @@ -2000,13 +2003,17 @@ if (bufref_valid(&old_curbuf)) curbuf = old_curbuf.br_buf; } -#endif } #ifdef FEAT_TERMRESPONSE may_req_termresponse(); #endif +#if defined(WIN3264) && !defined(FEAT_GUI) && defined(FEAT_TERMGUICOLORS) + if (STRCMP(term, "win32") == 0) + set_color_count((p_tgc) ? 256 : 16); +#endif + return OK; } @@ -2269,6 +2276,7 @@ if (termp->bt_string != NULL) /* found it */ { key = TERMCAP2KEY(name[0], name[1]); + ++termp; while (termp->bt_entry != (int)KS_NAME) { if ((int)termp->bt_entry == key) @@ -2351,7 +2359,7 @@ return 0; } -#ifdef FEAT_GUI +#if defined(FEAT_GUI) || defined(PROTO) int term_is_gui(char_u *name) { @@ -2502,7 +2510,8 @@ } /* - * out_flush_cursor(): flush the output buffer and redraw the cursor + * out_flush_cursor(): flush the output buffer and redraw the cursor. + * Does not flush recursively in the GUI to avoid slow drawing. */ void out_flush_cursor( @@ -2771,41 +2780,55 @@ && p_ek; } -static int winpos_x; -static int winpos_y; -static int waiting_for_winpos = FALSE; +static int winpos_x = -1; +static int winpos_y = -1; +static int did_request_winpos = 0; /* * Try getting the Vim window position from the terminal. * Returns OK or FAIL. */ int -term_get_winpos(int *x, int *y) +term_get_winpos(int *x, int *y, varnumber_T timeout) { int count = 0; + int prev_winpos_x = winpos_x; + int prev_winpos_y = winpos_y; if (*T_CGP == NUL || !can_get_termresponse()) return FAIL; winpos_x = -1; winpos_y = -1; - waiting_for_winpos = TRUE; + ++did_request_winpos; + winpos_status = STATUS_SENT; OUT_STR(T_CGP); out_flush(); - /* Try reading the result for 100 msec. */ - while (count++ < 10) + /* Try reading the result for "timeout" msec. */ + while (count++ <= timeout / 10 && !got_int) { (void)vpeekc_nomap(); if (winpos_x >= 0 && winpos_y >= 0) { *x = winpos_x; *y = winpos_y; - waiting_for_winpos = FALSE; return OK; } ui_delay(10, FALSE); } - waiting_for_winpos = FALSE; + /* Do not reset "did_request_winpos", if we timed out the response might + * still come later and we must consume it. */ + + winpos_x = prev_winpos_x; + winpos_y = prev_winpos_y; + if (timeout < 10 && prev_winpos_y >= 0 && prev_winpos_x >= 0) + { + /* Polling: return previous values if we have them. */ + *x = winpos_x; + *y = winpos_y; + return OK; + } + return FALSE; } # endif @@ -2817,31 +2840,12 @@ } #endif - void -term_fg_color(int n) -{ - /* Use "AF" termcap entry if present, "Sf" entry otherwise */ - if (*T_CAF) - term_color(T_CAF, n); - else if (*T_CSF) - term_color(T_CSF, n); -} - - void -term_bg_color(int n) -{ - /* Use "AB" termcap entry if present, "Sb" entry otherwise */ - if (*T_CAB) - term_color(T_CAB, n); - else if (*T_CSB) - term_color(T_CSB, n); -} - static void term_color(char_u *s, int n) { char buf[20]; - int i = 2; /* index in s[] just after [ or CSI */ + int i = *s == CSI ? 1 : 2; + /* index in s[] just after [ or CSI */ /* Special handling of 16 colors, because termcap can't handle it */ /* Also accept "\e[3%dm" for TERMINFO, it is sometimes used */ @@ -2868,6 +2872,26 @@ OUT_STR(tgoto((char *)s, 0, n)); } + void +term_fg_color(int n) +{ + /* Use "AF" termcap entry if present, "Sf" entry otherwise */ + if (*T_CAF) + term_color(T_CAF, n); + else if (*T_CSF) + term_color(T_CSF, n); +} + + void +term_bg_color(int n) +{ + /* Use "AB" termcap entry if present, "Sb" entry otherwise */ + if (*T_CAB) + term_color(T_CAB, n); + else if (*T_CSB) + term_color(T_CSB, n); +} + #if defined(FEAT_TERMGUICOLORS) || defined(PROTO) #define RED(rgb) (((long_u)(rgb) >> 16) & 0xFF) @@ -3289,10 +3313,8 @@ } else { -#ifdef FEAT_SCROLLBIND if (curwin->w_p_scb) do_check_scrollbind(TRUE); -#endif if (State & CMDLINE) { update_screen(NOT_VALID); @@ -3359,7 +3381,8 @@ #endif || rbg_status == STATUS_SENT || rbm_status == STATUS_SENT - || rcs_status == STATUS_SENT)) + || rcs_status == STATUS_SENT + || winpos_status == STATUS_SENT)) (void)vpeekc_nomap(); check_for_codes_from_term(); } @@ -3433,7 +3456,8 @@ # endif || rbg_status == STATUS_SENT || rbm_status == STATUS_SENT - || rcs_status == STATUS_SENT) + || rcs_status == STATUS_SENT + || winpos_status == STATUS_SENT) { # ifdef UNIX /* Give the terminal a chance to respond. */ @@ -3484,7 +3508,7 @@ && starting == 0 && *T_CRV != NUL) { - LOG_TR("Sending CRV request"); + LOG_TR(("Sending CRV request")); out_str(T_CRV); crv_status = STATUS_SENT; /* check for the characters now, otherwise they might be eaten by @@ -3515,7 +3539,7 @@ { char_u buf[16]; - LOG_TR("Sending U7 request"); + LOG_TR(("Sending U7 request")); /* Do this in the second row. In the first row the returned sequence * may be CSI 1;2R, which is the same as . */ term_windgoto(1, 0); @@ -3557,7 +3581,7 @@ /* Only request foreground if t_RF is set. */ if (rfg_status == STATUS_GET && *T_RFG != NUL) { - LOG_TR("Sending FG request"); + LOG_TR(("Sending FG request")); out_str(T_RFG); rfg_status = STATUS_SENT; didit = TRUE; @@ -3567,7 +3591,7 @@ /* Only request background if t_RB is set. */ if (rbg_status == STATUS_GET && *T_RBG != NUL) { - LOG_TR("Sending BG request"); + LOG_TR(("Sending BG request")); out_str(T_RBG); rbg_status = STATUS_SENT; didit = TRUE; @@ -3585,11 +3609,12 @@ # ifdef DEBUG_TERMRESPONSE static void -log_tr(char *msg) +log_tr(const char *fmt, ...) { static FILE *fd_tr = NULL; static proftime_T start; proftime_T now; + va_list ap; if (fd_tr == NULL) { @@ -3598,11 +3623,14 @@ } now = start; profile_end(&now); - fprintf(fd_tr, "%s: %s %s\n", - profile_msg(&now), - must_redraw == NOT_VALID ? "NV" - : must_redraw == CLEAR ? "CL" : " ", - msg); + fprintf(fd_tr, "%s: %s ", profile_msg(&now), + must_redraw == NOT_VALID ? "NV" + : must_redraw == CLEAR ? "CL" : " "); + va_start(ap, fmt); + vfprintf(fd_tr, fmt, ap); + va_end(ap); + fputc('\n', fd_tr); + fflush(fd_tr); } # endif #endif @@ -3616,7 +3644,7 @@ return (full_screen && *T_TI != NUL); } -#ifdef FEAT_MOUSE +#if defined(FEAT_MOUSE) || defined(PROTO) /* * setmouse() - switch mouse on/off depending on current mode and 'mouse' */ @@ -3912,8 +3940,7 @@ { while (tc_len > 0) vim_free(termcodes[--tc_len].code); - vim_free(termcodes); - termcodes = NULL; + VIM_CLEAR(termcodes); tc_max_len = 0; #ifdef HAVE_TGETENT @@ -4154,7 +4181,7 @@ need_gather = TRUE; /* need to fill termleader[] */ } detected_8bit = TRUE; - LOG_TR("Switching to 8 bit"); + LOG_TR(("Switching to 8 bit")); } #endif @@ -4463,7 +4490,7 @@ */ char_u *argp = tp[0] == ESC ? tp + 2 : tp + 1; - if ((*T_CRV != NUL || *T_U7 != NUL || waiting_for_winpos) + if ((*T_CRV != NUL || *T_U7 != NUL || did_request_winpos) && ((tp[0] == ESC && len >= 3 && tp[1] == '[') || (tp[0] == CSI && len >= 2)) && (VIM_ISDIGIT(*argp) || *argp == '>' || *argp == '?')) @@ -4487,7 +4514,7 @@ } if (i == len) { - LOG_TR("Not enough characters for CRV"); + LOG_TR(("Not enough characters for CRV")); return -1; } if (extra > 0) @@ -4504,11 +4531,9 @@ { char *aw = NULL; - LOG_TR("Received U7 status"); + LOG_TR(("Received U7 status: %s", tp)); u7_status = STATUS_GOT; -# ifdef FEAT_AUTOCMD did_cursorhold = TRUE; -# endif if (col == 2) aw = "single"; else if (col == 3) @@ -4522,13 +4547,9 @@ (char_u *)aw, 0); # ifdef DEBUG_TERMRESPONSE { - char buf[100]; - int r = redraw_asap(CLEAR); + int r = redraw_asap(CLEAR); - sprintf(buf, - "set 'ambiwidth', redraw_asap(): %d", - r); - log_tr(buf); + log_tr("set 'ambiwidth', redraw_asap(): %d", r); } # else redraw_asap(CLEAR); @@ -4549,11 +4570,9 @@ { int version = col; - LOG_TR("Received CRV response"); + LOG_TR(("Received CRV response: %s", tp)); crv_status = STATUS_GOT; -# ifdef FEAT_AUTOCMD did_cursorhold = TRUE; -# endif /* If this code starts with CSI, you can bet that the * terminal uses 8-bit codes. */ @@ -4577,7 +4596,7 @@ /* if xterm version >= 141 try to get termcap codes */ if (version >= 141) { - LOG_TR("Enable checking for XT codes"); + LOG_TR(("Enable checking for XT codes")); check_for_codes = TRUE; need_gather = TRUE; req_codes_from_term(); @@ -4667,7 +4686,7 @@ && *T_CSH != NUL && *T_CRS != NUL) { - LOG_TR("Sending cursor style request"); + LOG_TR(("Sending cursor style request")); out_str(T_CRS); rcs_status = STATUS_SENT; need_flush = TRUE; @@ -4680,7 +4699,7 @@ && !is_not_xterm && *T_CRC != NUL) { - LOG_TR("Sending cursor blink mode request"); + LOG_TR(("Sending cursor blink mode request")); out_str(T_CRC); rbm_status = STATUS_SENT; need_flush = TRUE; @@ -4693,10 +4712,8 @@ # ifdef FEAT_EVAL set_vim_var_string(VV_TERMRESPONSE, tp, slen); # endif -# ifdef FEAT_AUTOCMD apply_autocmds(EVENT_TERMRESPONSE, NULL, NULL, FALSE, curbuf); -# endif key_name[0] = (int)KS_EXTRA; key_name[1] = (int)KE_IGNORE; } @@ -4718,7 +4735,7 @@ { initial_cursor_blink = (tp[j + 4] == '1'); rbm_status = STATUS_GOT; - LOG_TR("Received cursor blinking mode response"); + LOG_TR(("Received cursor blinking mode response: %s", tp)); key_name[0] = (int)KS_EXTRA; key_name[1] = (int)KE_IGNORE; slen = i + 1; @@ -4731,7 +4748,7 @@ * Check for a window position response from the terminal: * {lead}3;{x}:{y}t */ - else if (waiting_for_winpos + else if (did_request_winpos && ((len >= 4 && tp[0] == ESC && tp[1] == '[') || (len >= 3 && tp[0] == CSI)) && tp[(j = 1 + (tp[0] == ESC))] == '3' @@ -4753,11 +4770,14 @@ key_name[0] = (int)KS_EXTRA; key_name[1] = (int)KE_IGNORE; slen = i + 1; + + if (--did_request_winpos <= 0) + winpos_status = STATUS_GOT; } } if (i == len) { - LOG_TR("not enough characters for winpos"); + LOG_TR(("not enough characters for winpos")); return -1; } } @@ -4803,7 +4823,7 @@ char *newval = (3 * '6' < tp[j+7] + tp[j+12] + tp[j+17]) ? "light" : "dark"; - LOG_TR("Received RBG response"); + LOG_TR(("Received RBG response: %s", tp)); rbg_status = STATUS_GOT; #ifdef FEAT_TERMINAL bg_r = rval; @@ -4823,7 +4843,7 @@ #ifdef FEAT_TERMINAL else { - LOG_TR("Received RFG response"); + LOG_TR(("Received RFG response: %s", tp)); rfg_status = STATUS_GOT; fg_r = rval; fg_g = gval; @@ -4844,7 +4864,7 @@ } if (i == len) { - LOG_TR("not enough characters for RB"); + LOG_TR(("not enough characters for RB")); return -1; } } @@ -4857,7 +4877,7 @@ * {tail} can be Esc>\ or STERM * * Check for cursor shape response from xterm: - * {lead}1$r q{tail} + * {lead}1$r q{tail} * * {lead} can be P or DCS * {tail} can be Esc>\ or STERM @@ -4888,35 +4908,46 @@ break; } } - else if ((len >= j + 6 && isdigit(argp[3])) - && argp[4] == ' ' - && argp[5] == 'q') + else { - /* cursor shape response */ - i = j + 6; - if ((tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\') - || tp[i] == STERM) + /* Probably the cursor shape response. Make sure that "i" + * is equal to "len" when there are not sufficient + * characters. */ + for (i = j + 3; i < len; ++i) { - int number = argp[3] - '0'; + if (i - j == 3 && !isdigit(tp[i])) + break; + if (i - j == 4 && tp[i] != ' ') + break; + if (i - j == 5 && tp[i] != 'q') + break; + if (i - j == 6 && tp[i] != ESC && tp[i] != STERM) + break; + if ((i - j == 6 && tp[i] == STERM) + || (i - j == 7 && tp[i] == '\\')) + { + int number = argp[3] - '0'; - /* 0, 1 = block blink, 2 = block - * 3 = underline blink, 4 = underline - * 5 = vertical bar blink, 6 = vertical bar */ - number = number == 0 ? 1 : number; - initial_cursor_shape = (number + 1) / 2; - /* The blink flag is actually inverted, compared to - * the value set with T_SH. */ - initial_cursor_shape_blink = + /* 0, 1 = block blink, 2 = block + * 3 = underline blink, 4 = underline + * 5 = vertical bar blink, 6 = vertical bar */ + number = number == 0 ? 1 : number; + initial_cursor_shape = (number + 1) / 2; + /* The blink flag is actually inverted, compared to + * the value set with T_SH. */ + initial_cursor_shape_blink = (number & 1) ? FALSE : TRUE; - rcs_status = STATUS_GOT; - LOG_TR("Received cursor shape response"); + rcs_status = STATUS_GOT; + LOG_TR(("Received cursor shape response: %s", tp)); - key_name[0] = (int)KS_EXTRA; - key_name[1] = (int)KE_IGNORE; - slen = i + 1 + (tp[i] == ESC); + key_name[0] = (int)KS_EXTRA; + key_name[1] = (int)KE_IGNORE; + slen = i + 1; # ifdef FEAT_EVAL - set_vim_var_string(VV_TERMSTYLERESP, tp, slen); + set_vim_var_string(VV_TERMSTYLERESP, tp, slen); # endif + break; + } } } @@ -4924,7 +4955,7 @@ { /* These codes arrive many together, each code can be * truncated at any point. */ - LOG_TR("not enough characters for XT"); + LOG_TR(("not enough characters for XT")); return -1; } } @@ -5162,10 +5193,13 @@ # ifdef FEAT_GUI && !gui.in_use # endif - && (mouse_code == 0x23 || mouse_code == 0x24)) + && (mouse_code == 0x23 || mouse_code == 0x24 + || mouse_code == 0x40 || mouse_code == 0x41)) { - /* Apparently used by rxvt scroll wheel. */ - wheel_code = mouse_code - 0x23 + MOUSEWHEEL_LOW; + /* Apparently 0x23 and 0x24 are used by rxvt scroll wheel. + * And 0x40 and 0x41 are used by some xterm emulator. */ + wheel_code = mouse_code - (mouse_code >= 0x40 ? 0x40 : 0x23) + + MOUSEWHEEL_LOW; } # endif @@ -5648,7 +5682,7 @@ /* Work out our pseudo mouse event. Note that MOUSE_RELEASE gets * added, then it's not mouse up/down. */ key_name[0] = (int)KS_EXTRA; - if (wheel_code != 0 + if (wheel_code != 0 && (wheel_code & MOUSE_RELEASE) != MOUSE_RELEASE) { if (wheel_code & MOUSE_CTRL) @@ -5874,7 +5908,7 @@ } #ifdef FEAT_TERMRESPONSE - LOG_TR("normal character"); + LOG_TR(("normal character")); #endif return 0; /* no match found */ @@ -6357,15 +6391,10 @@ * many, there can be a buffer overflow somewhere. */ while (xt_index_out < xt_index_in + 10 && key_names[xt_index_out] != NULL) { -# ifdef DEBUG_TERMRESPONSE - char dbuf[100]; + char *key_name = key_names[xt_index_out]; - sprintf(dbuf, "Requesting XT %d: %s", - xt_index_out, key_names[xt_index_out]); - log_tr(dbuf); -# endif - sprintf(buf, "\033P+q%02x%02x\033\\", - key_names[xt_index_out][0], key_names[xt_index_out][1]); + LOG_TR(("Requesting XT %d: %s", xt_index_out, key_name)); + sprintf(buf, "\033P+q%02x%02x\033\\", key_name[0], key_name[1]); out_str_nf((char_u *)buf); ++xt_index_out; } @@ -6408,14 +6437,9 @@ break; } } -# ifdef DEBUG_TERMRESPONSE - { - char buf[100]; - sprintf(buf, "Received XT %d: %s", xt_index_in, (char *)name); - log_tr(buf); - } -# endif + LOG_TR(("Received XT %d: %s", xt_index_in, (char *)name)); + if (key_names[i] != NULL) { for (i = 8; (c = hexhex2nr(code + i)) >= 0; i += 2) @@ -6614,6 +6638,107 @@ ++p; } } + +# ifdef FEAT_TERMGUICOLORS +struct ks_tbl_s +{ + int code; /* value of KS_ */ + char *vtp; /* code in vtp mode */ + char *buf; /* buffer in non-vtp mode */ + char *vbuf; /* buffer in vtp mode */ +}; + +static struct ks_tbl_s ks_tbl[] = +{ + {(int)KS_ME, "\033|0m" }, /* normal */ + {(int)KS_MR, "\033|7m" }, /* reverse */ + {(int)KS_MD, "\033|1m" }, /* bold */ + {(int)KS_SO, "\033|91m"}, /* standout: bright red text */ + {(int)KS_SE, "\033|39m"}, /* standout end: default color */ + {(int)KS_CZH, "\033|95m"}, /* italic: bright magenta text */ + {(int)KS_CZR, "\033|0m",}, /* italic end */ + {(int)KS_US, "\033|4m",}, /* underscore */ + {(int)KS_UE, "\033|24m"}, /* underscore end */ + {(int)KS_NAME, NULL} +}; + + static struct builtin_term * +find_first_tcap( + char_u *name, + int code) +{ + struct builtin_term *p; + + for (p = find_builtin_term(name); p->bt_string != NULL; ++p) + if (p->bt_entry == code) + return p; + return NULL; +} +# endif + +/* + * For Win32 console: replace the sequence immediately after termguicolors. + */ + void +swap_tcap(void) +{ +# ifdef FEAT_TERMGUICOLORS + static int init_done = FALSE; + static int last_tgc; + struct ks_tbl_s *ks; + struct builtin_term *bt; + + /* buffer initialization */ + if (!init_done) + { + for (ks = ks_tbl; ks->vtp != NULL; ks++) + { + bt = find_first_tcap(DEFAULT_TERM, ks->code); + if (bt != NULL) + { + ks->buf = bt->bt_string; + ks->vbuf = ks->vtp; + } + } + init_done = TRUE; + last_tgc = p_tgc; + return; + } + + if (last_tgc != p_tgc) + { + if (p_tgc) + { + /* switch to special character sequence */ + for (ks = ks_tbl; ks->vtp != NULL; ks++) + { + bt = find_first_tcap(DEFAULT_TERM, ks->code); + if (bt != NULL) + { + ks->buf = bt->bt_string; + bt->bt_string = ks->vbuf; + } + } + } + else + { + /* switch to index color */ + for (ks = ks_tbl; ks->vtp != NULL; ks++) + { + bt = find_first_tcap(DEFAULT_TERM, ks->code); + if (bt != NULL) + { + ks->vbuf = bt->bt_string; + bt->bt_string = ks->buf; + } + } + } + + last_tgc = p_tgc; + } +# endif +} + #endif #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) @@ -6671,6 +6796,7 @@ {(char_u *)"green", RGB(0x00, 0xFF, 0x00)}, {(char_u *)"grey", RGB(0xBE, 0xBE, 0xBE)}, {(char_u *)"grey40", RGB(0x66, 0x66, 0x66)}, + {(char_u *)"grey50", RGB(0x7F, 0x7F, 0x7F)}, {(char_u *)"grey90", RGB(0xE5, 0xE5, 0xE5)}, {(char_u *)"lightblue", RGB(0xAD, 0xD8, 0xE6)}, {(char_u *)"lightcyan", RGB(0xE0, 0xFF, 0xFF)}, diff -Nru vim-8.0.1453/src/terminal.c vim-8.0.1766/src/terminal.c --- vim-8.0.1453/src/terminal.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/terminal.c 2018-04-26 20:30:33.000000000 +0000 @@ -38,49 +38,29 @@ * in tl_scrollback are no longer used. * * TODO: - * - When using 'termguicolors' still use the 16 ANSI colors as-is. Helps for - * a job that uses 16 colors while Vim is using > 256. - * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito - * Higashi, 2017 Sep 19) - * - Trigger TerminalOpen event? #2422 patch in #2484 - * - Shift-Tab does not work. - * - after resizing windows overlap. (Boris Staletic, #2164) - * - Redirecting output does not work on MS-Windows, Test_terminal_redir_file() + * - Win32: Make terminal used for :!cmd in the GUI work better. Allow for + * redirection. Probably in call to channel_set_pipes(). + * - Win32: Redirecting output does not work, Test_terminal_redir_file() * is disabled. - * - cursor blinks in terminal on widows with a timer. (xtal8, #2142) - * - When closing gvim with an active terminal buffer, the dialog suggests - * saving the buffer. Should say something else. (Manas Thakur, #2215) - * Also: #2223 - * - Termdebug does not work when Vim build with mzscheme. gdb hangs. - * - MS-Windows GUI: WinBar has tearoff item - * - Adding WinBar to terminal window doesn't display, text isn't shifted down. - * - MS-Windows GUI: still need to type a key after shell exits? #1924 - * - After executing a shell command the status line isn't redraw. - * - What to store in a session file? Shell at the prompt would be OK to - * restore, but others may not. Open the window and let the user start the - * command? - * - implement term_setsize() - * - add test for giving error for invalid 'termsize' value. - * - support minimal size when 'termsize' is "rows*cols". - * - support minimal size when 'termsize' is empty? - * - if the job in the terminal does not support the mouse, we can use the - * mouse in the Terminal window for copy/paste and scrolling. + * - Add test for 'termwinkey'. + * - libvterm: bringg back using // comments and trailing comma in enum + * - When starting terminal window with shell in terminal, then using :gui to + * switch to GUI, shell stops working. Scrollback seems wrong, command + * running in shell is still running. * - GUI: when using tabs, focus in terminal, click on tab does not work. - * - GUI: when 'confirm' is set and trying to exit Vim, dialog offers to save - * changes to "!shell". - * (justrajdeep, 2017 Aug 22) + * - handle_moverect() scrolls one line at a time. Postpone scrolling, count + * the number of lines, until a redraw happens. Then if scrolling many lines + * a redraw is faster. + * - Copy text in the vterm to the Vim buffer once in a while, so that + * completion works. * - Redrawing is slow with Athena and Motif. Also other GUI? (Ramel Eshed) * - For the GUI fill termios with default values, perhaps like pangoterm: * http://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/head:/main.c#L134 - * - when 'encoding' is not utf-8, or the job is using another encoding, setup + * - When 'encoding' is not utf-8, or the job is using another encoding, setup * conversions. - * - In the GUI use a terminal emulator for :!cmd. Make the height the same as - * the window and position it higher up when it gets filled, so it looks like - * the text scrolls up. - * - Copy text in the vterm to the Vim buffer once in a while, so that - * completion works. - * - add an optional limit for the scrollback size. When reaching it remove - * 10% at the start. + * - Termdebug does not work when Vim build with mzscheme: gdb hangs just after + * "run". Everything else works, including communication channel. Not + * initializing mzscheme avoid the problem, thus it's not some #ifdef. */ #include "vim.h" @@ -100,7 +80,8 @@ typedef struct { VTermScreenCellAttrs attrs; char width; - VTermColor fg, bg; + VTermColor fg; + VTermColor bg; } cellattr_T; typedef struct sb_line_S { @@ -116,6 +97,10 @@ VTerm *tl_vterm; job_T *tl_job; buf_T *tl_buffer; +#if defined(FEAT_GUI) + int tl_system; /* when non-zero used for :!cmd output */ + int tl_toprow; /* row with first line of system terminal */ +#endif /* Set when setting the size of a vterm, reset after redrawing. */ int tl_vterm_size_changed; @@ -127,7 +112,11 @@ int tl_normal_mode; /* TRUE: Terminal-Normal mode */ int tl_channel_closed; - int tl_finish; /* 'c' for ++close, 'o' for ++open */ + int tl_finish; +#define TL_FINISH_UNSET NUL +#define TL_FINISH_CLOSE 'c' /* ++close or :terminal without argument */ +#define TL_FINISH_NOCLOSE 'n' /* ++noclose */ +#define TL_FINISH_OPEN 'o' /* ++open */ char_u *tl_opencmd; char_u *tl_eof_chars; @@ -135,13 +124,14 @@ void *tl_winpty_config; void *tl_winpty; #endif +#if defined(FEAT_SESSION) + char_u *tl_command; +#endif + char_u *tl_kill; /* last known vterm size */ int tl_rows; int tl_cols; - /* vterm size does not follow window size */ - int tl_rows_fixed; - int tl_cols_fixed; char_u *tl_title; /* NULL or allocated */ char_u *tl_status_text; /* NULL or allocated */ @@ -154,6 +144,9 @@ int tl_scrollback_scrolled; cellattr_T tl_default_color; + linenr_T tl_top_diff_rows; /* rows of top diff file or zero */ + linenr_T tl_bot_diff_rows; /* rows of bottom diff file */ + VTermPos tl_cursor_pos; int tl_cursor_visible; int tl_cursor_blink; @@ -180,10 +173,13 @@ /* * Functions with separate implementation for MS-Windows and Unix-like systems. */ -static int term_and_job_init(term_T *term, typval_T *argvar, jobopt_T *opt); +static int term_and_job_init(term_T *term, typval_T *argvar, char **argv, jobopt_T *opt); static int create_pty_only(term_T *term, jobopt_T *opt); static void term_report_winsize(term_T *term, int rows, int cols); static void term_free_vterm(term_T *term); +#ifdef FEAT_GUI +static void update_system_term(term_T *term); +#endif /* The character that we know (or assume) that the terminal expects for the * backspace key. */ @@ -193,45 +189,88 @@ static int term_default_cterm_fg = -1; static int term_default_cterm_bg = -1; +/* Store the last set and the desired cursor properties, so that we only update + * them when needed. Doing it unnecessary may result in flicker. */ +static char_u *last_set_cursor_color = (char_u *)""; +static char_u *desired_cursor_color = (char_u *)""; +static int last_set_cursor_shape = -1; +static int desired_cursor_shape = -1; +static int last_set_cursor_blink = -1; +static int desired_cursor_blink = -1; + + /************************************** * 1. Generic code for all systems. */ /* + * Parse 'termsize' and set "rows" and "cols" for the terminal size in the + * current window. + * Sets "rows" and/or "cols" to zero when it should follow the window size. + * Return TRUE if the size is the minimum size: "24*80". + */ + static int +parse_termsize(win_T *wp, int *rows, int *cols) +{ + int minsize = FALSE; + + *rows = 0; + *cols = 0; + + if (*wp->w_p_tws != NUL) + { + char_u *p = vim_strchr(wp->w_p_tws, 'x'); + + /* Syntax of value was already checked when it's set. */ + if (p == NULL) + { + minsize = TRUE; + p = vim_strchr(wp->w_p_tws, '*'); + } + *rows = atoi((char *)wp->w_p_tws); + *cols = atoi((char *)p + 1); + } + return minsize; +} + +/* * Determine the terminal size from 'termsize' and the current window. - * Assumes term->tl_rows and term->tl_cols are zero. */ static void set_term_and_win_size(term_T *term) { - if (*curwin->w_p_tms != NUL) +#ifdef FEAT_GUI + if (term->tl_system) { - char_u *p = vim_strchr(curwin->w_p_tms, 'x') + 1; - - term->tl_rows = atoi((char *)curwin->w_p_tms); - term->tl_cols = atoi((char *)p); + /* Use the whole screen for the system command. However, it will start + * at the command line and scroll up as needed, using tl_toprow. */ + term->tl_rows = Rows; + term->tl_cols = Columns; + return; + } +#endif + if (parse_termsize(curwin, &term->tl_rows, &term->tl_cols)) + { + if (term->tl_rows != 0) + term->tl_rows = MAX(term->tl_rows, curwin->w_height); + if (term->tl_cols != 0) + term->tl_cols = MAX(term->tl_cols, curwin->w_width); } if (term->tl_rows == 0) term->tl_rows = curwin->w_height; else - { win_setheight_win(term->tl_rows, curwin); - term->tl_rows_fixed = TRUE; - } if (term->tl_cols == 0) term->tl_cols = curwin->w_width; else - { win_setwidth_win(term->tl_cols, curwin); - term->tl_cols_fixed = TRUE; - } } /* * Initialize job options for a terminal job. * Caller may overrule some of them. */ - static void + void init_job_options(jobopt_T *opt) { clear_job_options(opt); @@ -274,11 +313,39 @@ } /* + * Close a terminal buffer (and its window). Used when creating the terminal + * fails. + */ + static void +term_close_buffer(buf_T *buf, buf_T *old_curbuf) +{ + free_terminal(buf); + if (old_curbuf != NULL) + { + --curbuf->b_nwindows; + curbuf = old_curbuf; + curwin->w_buffer = curbuf; + ++curbuf->b_nwindows; + } + + /* Wiping out the buffer will also close the window and call + * free_terminal(). */ + do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD, buf->b_fnum, TRUE); +} + +/* * Start a terminal window and return its buffer. + * Use either "argvar" or "argv", the other must be NULL. + * When "flags" has TERM_START_NOJOB only create the buffer, b_term and open + * the window. * Returns NULL when failed. */ - static buf_T * -term_start(typval_T *argvar, jobopt_T *opt, int forceit) + buf_T * +term_start( + typval_T *argvar, + char **argv, + jobopt_T *opt, + int flags) { exarg_T split_ea; win_T *old_curwin = curwin; @@ -286,6 +353,7 @@ buf_T *old_curbuf = NULL; int res; buf_T *newbuf; + int vertical = opt->jo_vertical || (cmdmod.split & WSP_VERT); if (check_restricted() || check_secure()) return NULL; @@ -306,26 +374,31 @@ term->tl_cursor_visible = TRUE; term->tl_cursor_shape = VTERM_PROP_CURSORSHAPE_BLOCK; term->tl_finish = opt->jo_term_finish; +#ifdef FEAT_GUI + term->tl_system = (flags & TERM_START_SYSTEM); +#endif ga_init2(&term->tl_scrollback, sizeof(sb_line_T), 300); vim_memset(&split_ea, 0, sizeof(split_ea)); if (opt->jo_curwin) { /* Create a new buffer in the current window. */ - if (!can_abandon(curbuf, forceit)) + if (!can_abandon(curbuf, flags & TERM_START_FORCEIT)) { no_write_message(); vim_free(term); return NULL; } if (do_ecmd(0, NULL, NULL, &split_ea, ECMD_ONE, - ECMD_HIDE + (forceit ? ECMD_FORCEIT : 0), curwin) == FAIL) + ECMD_HIDE + + ((flags & TERM_START_FORCEIT) ? ECMD_FORCEIT : 0), + curwin) == FAIL) { vim_free(term); return NULL; } } - else if (opt->jo_hidden) + else if (opt->jo_hidden || (flags & TERM_START_SYSTEM)) { buf_T *buf; @@ -350,17 +423,19 @@ split_ea.cmdidx = CMD_new; split_ea.cmd = (char_u *)"new"; split_ea.arg = (char_u *)""; - if (opt->jo_term_rows > 0 && !(cmdmod.split & WSP_VERT)) + if (opt->jo_term_rows > 0 && !vertical) { split_ea.line2 = opt->jo_term_rows; split_ea.addr_count = 1; } - if (opt->jo_term_cols > 0 && (cmdmod.split & WSP_VERT)) + if (opt->jo_term_cols > 0 && vertical) { split_ea.line2 = opt->jo_term_cols; split_ea.addr_count = 1; } + if (vertical) + cmdmod.split |= WSP_VERT; ex_splitview(&split_ea); if (curwin == old_curwin) { @@ -374,10 +449,11 @@ if (!opt->jo_hidden) { - /* only one size was taken care of with :new, do the other one */ - if (opt->jo_term_rows > 0 && (cmdmod.split & WSP_VERT)) + /* Only one size was taken care of with :new, do the other one. With + * "curwin" both need to be done. */ + if (opt->jo_term_rows > 0 && (opt->jo_curwin || vertical)) win_setheight(opt->jo_term_rows); - if (opt->jo_term_cols > 0 && !(cmdmod.split & WSP_VERT)) + if (opt->jo_term_cols > 0 && (opt->jo_curwin || !vertical)) win_setwidth(opt->jo_term_cols); } @@ -387,6 +463,8 @@ if (opt->jo_term_name != NULL) curbuf->b_ffname = vim_strsave(opt->jo_term_name); + else if (argv != NULL) + curbuf->b_ffname = vim_strsave((char_u *)"!system"); else { int i; @@ -445,13 +523,70 @@ set_term_and_win_size(term); setup_job_options(opt, term->tl_rows, term->tl_cols); + if (flags & TERM_START_NOJOB) + return curbuf; + +#if defined(FEAT_SESSION) + /* Remember the command for the session file. */ + if (opt->jo_term_norestore || argv != NULL) + { + term->tl_command = vim_strsave((char_u *)"NONE"); + } + else if (argvar->v_type == VAR_STRING) + { + char_u *cmd = argvar->vval.v_string; + + if (cmd != NULL && STRCMP(cmd, p_sh) != 0) + term->tl_command = vim_strsave(cmd); + } + else if (argvar->v_type == VAR_LIST + && argvar->vval.v_list != NULL + && argvar->vval.v_list->lv_len > 0) + { + garray_T ga; + listitem_T *item; + + ga_init2(&ga, 1, 100); + for (item = argvar->vval.v_list->lv_first; + item != NULL; item = item->li_next) + { + char_u *s = get_tv_string_chk(&item->li_tv); + char_u *p; + + if (s == NULL) + break; + p = vim_strsave_fnameescape(s, FALSE); + if (p == NULL) + break; + ga_concat(&ga, p); + vim_free(p); + ga_append(&ga, ' '); + } + if (item == NULL) + { + ga_append(&ga, NUL); + term->tl_command = ga.ga_data; + } + else + ga_clear(&ga); + } +#endif + + if (opt->jo_term_kill != NULL) + { + char_u *p = skiptowhite(opt->jo_term_kill); + + term->tl_kill = vim_strnsave(opt->jo_term_kill, p - opt->jo_term_kill); + } + /* System dependent: setup the vterm and maybe start the job in it. */ - if (argvar->v_type == VAR_STRING + if (argv == NULL + && argvar->v_type == VAR_STRING && argvar->vval.v_string != NULL && STRCMP(argvar->vval.v_string, "NONE") == 0) res = create_pty_only(term, opt); else - res = term_and_job_init(term, argvar, opt); + res = term_and_job_init(term, argvar, argv, opt); newbuf = curbuf; if (res == OK) @@ -459,18 +594,26 @@ /* Get and remember the size we ended up with. Update the pty. */ vterm_get_size(term->tl_vterm, &term->tl_rows, &term->tl_cols); term_report_winsize(term, term->tl_rows, term->tl_cols); +#ifdef FEAT_GUI + if (term->tl_system) + { + /* display first line below typed command */ + term->tl_toprow = msg_row + 1; + term->tl_dirty_row_end = 0; + } +#endif /* Make sure we don't get stuck on sending keys to the job, it leads to * a deadlock if the job is waiting for Vim to read. */ channel_set_nonblock(term->tl_job->jv_channel, PART_IN); -#ifdef FEAT_AUTOCMD - ++curbuf->b_locked; - apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); - --curbuf->b_locked; -#endif - - if (old_curbuf != NULL) + if (old_curbuf == NULL) + { + ++curbuf->b_locked; + apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); + --curbuf->b_locked; + } + else { --curbuf->b_nwindows; curbuf = old_curbuf; @@ -480,22 +623,11 @@ } else { - buf_T *buf = curbuf; - - free_terminal(curbuf); - if (old_curbuf != NULL) - { - --curbuf->b_nwindows; - curbuf = old_curbuf; - curwin->w_buffer = curbuf; - ++curbuf->b_nwindows; - } - - /* Wiping out the buffer will also close the window and call - * free_terminal(). */ - do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD, buf->b_fnum, TRUE); + term_close_buffer(curbuf, old_curbuf); return NULL; } + + apply_autocmds(EVENT_TERMINALOPEN, NULL, NULL, FALSE, newbuf); return newbuf; } @@ -513,7 +645,7 @@ init_job_options(&opt); cmd = eap->arg; - while (*cmd && *cmd == '+' && *(cmd + 1) == '+') + while (*cmd == '+' && *(cmd + 1) == '+') { char_u *p, *ep; @@ -525,12 +657,23 @@ if ((int)(p - cmd) == 5 && STRNICMP(cmd, "close", 5) == 0) opt.jo_term_finish = 'c'; + else if ((int)(p - cmd) == 7 && STRNICMP(cmd, "noclose", 7) == 0) + opt.jo_term_finish = 'n'; else if ((int)(p - cmd) == 4 && STRNICMP(cmd, "open", 4) == 0) opt.jo_term_finish = 'o'; else if ((int)(p - cmd) == 6 && STRNICMP(cmd, "curwin", 6) == 0) opt.jo_curwin = 1; else if ((int)(p - cmd) == 6 && STRNICMP(cmd, "hidden", 6) == 0) opt.jo_hidden = 1; + else if ((int)(p - cmd) == 9 && STRNICMP(cmd, "norestore", 9) == 0) + opt.jo_term_norestore = 1; + else if ((int)(p - cmd) == 4 && STRNICMP(cmd, "kill", 4) == 0 + && ep != NULL) + { + opt.jo_set2 |= JO2_TERM_KILL; + opt.jo_term_kill = ep + 1; + p = skiptowhite(cmd); + } else if ((int)(p - cmd) == 4 && STRNICMP(cmd, "rows", 4) == 0 && ep != NULL && isdigit(ep[1])) { @@ -564,14 +707,20 @@ if (*p) *p = NUL; EMSG2(_("E181: Invalid attribute: %s"), cmd); - return; + goto theend; } cmd = skipwhite(p); } if (*cmd == NUL) + { /* Make a copy of 'shell', an autocommand may change the option. */ tofree = cmd = vim_strsave(p_sh); + /* default to close when the shell exits */ + if (opt.jo_term_finish == NUL) + opt.jo_term_finish = 'c'; + } + if (eap->addr_count > 0) { /* Write lines from current buffer to the job. */ @@ -585,11 +734,49 @@ argvar[0].v_type = VAR_STRING; argvar[0].vval.v_string = cmd; argvar[1].v_type = VAR_UNKNOWN; - term_start(argvar, &opt, eap->forceit); + term_start(argvar, NULL, &opt, eap->forceit ? TERM_START_FORCEIT : 0); vim_free(tofree); + +theend: vim_free(opt.jo_eof_chars); } +#if defined(FEAT_SESSION) || defined(PROTO) +/* + * Write a :terminal command to the session file to restore the terminal in + * window "wp". + * Return FAIL if writing fails. + */ + int +term_write_session(FILE *fd, win_T *wp) +{ + term_T *term = wp->w_buffer->b_term; + + /* Create the terminal and run the command. This is not without + * risk, but let's assume the user only creates a session when this + * will be OK. */ + if (fprintf(fd, "terminal ++curwin ++cols=%d ++rows=%d ", + term->tl_cols, term->tl_rows) < 0) + return FAIL; + if (term->tl_command != NULL && fputs((char *)term->tl_command, fd) < 0) + return FAIL; + + return put_eol(fd); +} + +/* + * Return TRUE if "buf" has a terminal that should be restored. + */ + int +term_should_restore(buf_T *buf) +{ + term_T *term = buf->b_term; + + return term != NULL && (term->tl_command == NULL + || STRCMP(term->tl_command, "NONE") != 0); +} +#endif + /* * Free the scrollback buffer for "term". */ @@ -630,7 +817,7 @@ { if (term->tl_job->jv_status != JOB_ENDED && term->tl_job->jv_status != JOB_FINISHED - && term->tl_job->jv_status != JOB_FAILED) + && term->tl_job->jv_status != JOB_FAILED) job_stop(term->tl_job, NULL, "kill"); job_unref(term->tl_job); } @@ -639,9 +826,15 @@ term_free_vterm(term); vim_free(term->tl_title); +#ifdef FEAT_SESSION + vim_free(term->tl_command); +#endif + vim_free(term->tl_kill); vim_free(term->tl_status_text); vim_free(term->tl_opencmd); vim_free(term->tl_eof_chars); + if (desired_cursor_color == term->tl_cursor_color) + desired_cursor_color = (char_u *)""; vim_free(term->tl_cursor_color); vim_free(term); buf->b_term = NULL; @@ -703,7 +896,13 @@ { if (term->tl_normal_mode) return; - setcursor(); +#ifdef FEAT_GUI + if (term->tl_system) + windgoto(term->tl_cursor_pos.row + term->tl_toprow, + term->tl_cursor_pos.col); + else +#endif + setcursor(); if (redraw) { if (term->tl_buffer == curbuf && term->tl_cursor_visible) @@ -737,6 +936,15 @@ ch_log(channel, "writing %d bytes to terminal", (int)len); term_write_job_output(term, msg, len); +#ifdef FEAT_GUI + if (term->tl_system) + { + /* show system output, scrolling up the screen as needed */ + update_system_term(term); + update_cursor(term, TRUE); + } + else +#endif /* In Terminal-Normal mode we are displaying the buffer, not the terminal * contents, thus no screen update is needed. */ if (!term->tl_normal_mode) @@ -768,6 +976,105 @@ return TRUE; } +static int enter_mouse_col = -1; +static int enter_mouse_row = -1; + +/* + * Handle a mouse click, drag or release. + * Return TRUE when a mouse event is sent to the terminal. + */ + static int +term_mouse_click(VTerm *vterm, int key) +{ +#if defined(FEAT_CLIPBOARD) + /* For modeless selection mouse drag and release events are ignored, unless + * they are preceded with a mouse down event */ + static int ignore_drag_release = TRUE; + VTermMouseState mouse_state; + + vterm_state_get_mousestate(vterm_obtain_state(vterm), &mouse_state); + if (mouse_state.flags == 0) + { + /* Terminal is not using the mouse, use modeless selection. */ + switch (key) + { + case K_LEFTDRAG: + case K_LEFTRELEASE: + case K_RIGHTDRAG: + case K_RIGHTRELEASE: + /* Ignore drag and release events when the button-down wasn't + * seen before. */ + if (ignore_drag_release) + { + int save_mouse_col, save_mouse_row; + + if (enter_mouse_col < 0) + break; + + /* mouse click in the window gave us focus, handle that + * click now */ + save_mouse_col = mouse_col; + save_mouse_row = mouse_row; + mouse_col = enter_mouse_col; + mouse_row = enter_mouse_row; + clip_modeless(MOUSE_LEFT, TRUE, FALSE); + mouse_col = save_mouse_col; + mouse_row = save_mouse_row; + } + /* FALLTHROUGH */ + case K_LEFTMOUSE: + case K_RIGHTMOUSE: + if (key == K_LEFTRELEASE || key == K_RIGHTRELEASE) + ignore_drag_release = TRUE; + else + ignore_drag_release = FALSE; + /* Should we call mouse_has() here? */ + if (clip_star.available) + { + int button, is_click, is_drag; + + button = get_mouse_button(KEY2TERMCAP1(key), + &is_click, &is_drag); + if (mouse_model_popup() && button == MOUSE_LEFT + && (mod_mask & MOD_MASK_SHIFT)) + { + /* Translate shift-left to right button. */ + button = MOUSE_RIGHT; + mod_mask &= ~MOD_MASK_SHIFT; + } + clip_modeless(button, is_click, is_drag); + } + break; + + case K_MIDDLEMOUSE: + if (clip_star.available) + insert_reg('*', TRUE); + break; + } + enter_mouse_col = -1; + return FALSE; + } +#endif + enter_mouse_col = -1; + + switch (key) + { + case K_LEFTMOUSE: + case K_LEFTMOUSE_NM: term_send_mouse(vterm, 1, 1); break; + case K_LEFTDRAG: term_send_mouse(vterm, 1, 1); break; + case K_LEFTRELEASE: + case K_LEFTRELEASE_NM: term_send_mouse(vterm, 1, 0); break; + case K_MOUSEMOVE: term_send_mouse(vterm, 0, 0); break; + case K_MIDDLEMOUSE: term_send_mouse(vterm, 2, 1); break; + case K_MIDDLEDRAG: term_send_mouse(vterm, 2, 1); break; + case K_MIDDLERELEASE: term_send_mouse(vterm, 2, 0); break; + case K_RIGHTMOUSE: term_send_mouse(vterm, 3, 1); break; + case K_RIGHTDRAG: term_send_mouse(vterm, 3, 1); break; + case K_RIGHTRELEASE: term_send_mouse(vterm, 3, 0); break; + } + return TRUE; +} + /* * Convert typed key "c" into bytes to send to the job. * Return the number of bytes in "buf". @@ -854,6 +1161,8 @@ case K_S_UP: mod = VTERM_MOD_SHIFT; key = VTERM_KEY_UP; break; case TAB: key = VTERM_KEY_TAB; break; + case K_S_TAB: mod = VTERM_MOD_SHIFT; + key = VTERM_KEY_TAB; break; case K_MOUSEUP: other = term_send_mouse(vterm, 5, 1); break; case K_MOUSEDOWN: other = term_send_mouse(vterm, 4, 1); break; @@ -861,17 +1170,21 @@ case K_MOUSERIGHT: /* TODO */ return 0; case K_LEFTMOUSE: - case K_LEFTMOUSE_NM: other = term_send_mouse(vterm, 1, 1); break; - case K_LEFTDRAG: other = term_send_mouse(vterm, 1, 1); break; + case K_LEFTMOUSE_NM: + case K_LEFTDRAG: case K_LEFTRELEASE: - case K_LEFTRELEASE_NM: other = term_send_mouse(vterm, 1, 0); break; - case K_MOUSEMOVE: other = term_send_mouse(vterm, 0, 0); break; - case K_MIDDLEMOUSE: other = term_send_mouse(vterm, 2, 1); break; - case K_MIDDLEDRAG: other = term_send_mouse(vterm, 2, 1); break; - case K_MIDDLERELEASE: other = term_send_mouse(vterm, 2, 0); break; - case K_RIGHTMOUSE: other = term_send_mouse(vterm, 3, 1); break; - case K_RIGHTDRAG: other = term_send_mouse(vterm, 3, 1); break; - case K_RIGHTRELEASE: other = term_send_mouse(vterm, 3, 0); break; + case K_LEFTRELEASE_NM: + case K_MOUSEMOVE: + case K_MIDDLEMOUSE: + case K_MIDDLEDRAG: + case K_MIDDLERELEASE: + case K_RIGHTMOUSE: + case K_RIGHTDRAG: + case K_RIGHTRELEASE: if (!term_mouse_click(vterm, c)) + return 0; + other = TRUE; + break; + case K_X1MOUSE: /* TODO */ return 0; case K_X1DRAG: /* TODO */ return 0; case K_X1RELEASE: /* TODO */ return 0; @@ -902,9 +1215,7 @@ #ifdef FEAT_DND case K_DROP: return 0; #endif -#ifdef FEAT_AUTOCMD case K_CURSORHOLD: return 0; -#endif case K_PS: vterm_keyboard_start_paste(vterm); other = TRUE; break; @@ -932,17 +1243,32 @@ /* * Return TRUE if the job for "term" is still running. + * If "check_job_status" is TRUE update the job status. */ - int -term_job_running(term_T *term) + static int +term_job_running_check(term_T *term, int check_job_status) { /* Also consider the job finished when the channel is closed, to avoid a * race condition when updating the title. */ - return term != NULL + if (term != NULL && term->tl_job != NULL - && channel_is_open(term->tl_job->jv_channel) - && (term->tl_job->jv_status == JOB_STARTED + && channel_is_open(term->tl_job->jv_channel)) + { + if (check_job_status) + job_status(term->tl_job); + return (term->tl_job->jv_status == JOB_STARTED || term->tl_job->jv_channel->ch_keep_open); + } + return FALSE; +} + +/* + * Return TRUE if the job for "term" is still running. + */ + int +term_job_running(term_T *term) +{ + return term_job_running_check(term, FALSE); } /* @@ -960,6 +1286,56 @@ } /* + * Used when exiting: kill the job in "buf" if so desired. + * Return OK when the job finished. + * Return FAIL when the job is still running. + */ + int +term_try_stop_job(buf_T *buf) +{ + int count; + char *how = (char *)buf->b_term->tl_kill; + +#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) + if ((how == NULL || *how == NUL) && (p_confirm || cmdmod.confirm)) + { + char_u buff[DIALOG_MSG_SIZE]; + int ret; + + dialog_msg(buff, _("Kill job in \"%s\"?"), buf->b_fname); + ret = vim_dialog_yesnocancel(VIM_QUESTION, NULL, buff, 1); + if (ret == VIM_YES) + how = "kill"; + else if (ret == VIM_CANCEL) + return FAIL; + } +#endif + if (how == NULL || *how == NUL) + return FAIL; + + job_stop(buf->b_term->tl_job, NULL, how); + + /* wait for up to a second for the job to die */ + for (count = 0; count < 100; ++count) + { + /* buffer, terminal and job may be cleaned up while waiting */ + if (!buf_valid(buf) + || buf->b_term == NULL + || buf->b_term->tl_job == NULL) + return OK; + + /* call job_status() to update jv_status */ + job_status(buf->b_term->tl_job); + if (buf->b_term->tl_job->jv_status >= JOB_ENDED) + return OK; + ui_delay(10L, FALSE); + mch_check_messages(); + parse_queued_messages(); + } + return FAIL; +} + +/* * Add the last line of the scrollback buffer to the buffer in the window. */ static void @@ -1019,6 +1395,36 @@ && a->bg.blue == b->bg.blue; } +/* + * Add an empty scrollback line to "term". When "lnum" is not zero, add the + * line at this position. Otherwise at the end. + */ + static int +add_empty_scrollback(term_T *term, cellattr_T *fill_attr, int lnum) +{ + if (ga_grow(&term->tl_scrollback, 1) == OK) + { + sb_line_T *line = (sb_line_T *)term->tl_scrollback.ga_data + + term->tl_scrollback.ga_len; + + if (lnum > 0) + { + int i; + + for (i = 0; i < term->tl_scrollback.ga_len - lnum; ++i) + { + *line = *(line - 1); + --line; + } + } + line->sb_cols = 0; + line->sb_cells = NULL; + line->sb_fill_attr = *fill_attr; + ++term->tl_scrollback.ga_len; + return OK; + } + return FALSE; +} /* * Add the current lines of the terminal to scrollback and to the buffer. @@ -1063,18 +1469,8 @@ { /* Line was skipped, add an empty line. */ --lines_skipped; - if (ga_grow(&term->tl_scrollback, 1) == OK) - { - sb_line_T *line = (sb_line_T *)term->tl_scrollback.ga_data - + term->tl_scrollback.ga_len; - - line->sb_cols = 0; - line->sb_cells = NULL; - line->sb_fill_attr = fill_attr; - ++term->tl_scrollback.ga_len; - + if (add_empty_scrollback(term, &fill_attr, 0) == OK) add_scrollback_line_to_buffer(term, (char_u *)"", 0); - } } if (len == 0) @@ -1164,8 +1560,7 @@ set_terminal_mode(term_T *term, int normal_mode) { term->tl_normal_mode = normal_mode; - vim_free(term->tl_status_text); - term->tl_status_text = NULL; + VIM_CLEAR(term->tl_status_text); if (term->tl_buffer == curbuf) maketitle(); } @@ -1177,7 +1572,7 @@ static void cleanup_vterm(term_T *term) { - if (term->tl_finish != 'c') + if (term->tl_finish != TL_FINISH_CLOSE) move_terminal_to_buffer(term); term_free_vterm(term); set_terminal_mode(term, FALSE); @@ -1251,10 +1646,9 @@ } /* - * Get a key from the user without mapping. + * Get a key from the user with terminal mode mappings. * Note: while waiting a terminal may be closed and freed if the channel is * closed and ++close was used. - * Uses terminal mode mappings. */ static int term_vgetc() @@ -1273,6 +1667,8 @@ return c; } +static int mouse_was_outside = FALSE; + /* * Send keys to terminal. * Return FAIL when the key needs to be handled in Normal mode. @@ -1283,7 +1679,6 @@ { char msg[KEY_BUF_LEN]; size_t len; - static int mouse_was_outside = FALSE; int dragging_outside = FALSE; /* Catch keys that need to be handled as in Normal mode. */ @@ -1472,8 +1867,28 @@ } #endif -static int did_change_cursor = FALSE; + static void +may_output_cursor_props(void) +{ + if (STRCMP(last_set_cursor_color, desired_cursor_color) != 0 + || last_set_cursor_shape != desired_cursor_shape + || last_set_cursor_blink != desired_cursor_blink) + { + last_set_cursor_color = desired_cursor_color; + last_set_cursor_shape = desired_cursor_shape; + last_set_cursor_blink = desired_cursor_blink; + term_cursor_color(desired_cursor_color); + if (desired_cursor_shape == -1 || desired_cursor_blink == -1) + /* this will restore the initial cursor style, if possible */ + ui_cursor_shape_forced(TRUE); + else + term_cursor_shape(desired_cursor_shape, desired_cursor_blink); + } +} +/* + * Set the cursor color and shape, if not last set to these. + */ static void may_set_cursor_props(term_T *term) { @@ -1485,44 +1900,79 @@ #endif if (in_terminal_loop == term) { - did_change_cursor = TRUE; if (term->tl_cursor_color != NULL) - term_cursor_color(term->tl_cursor_color); + desired_cursor_color = term->tl_cursor_color; else - term_cursor_color((char_u *)""); - term_cursor_shape(term->tl_cursor_shape, term->tl_cursor_blink); + desired_cursor_color = (char_u *)""; + desired_cursor_shape = term->tl_cursor_shape; + desired_cursor_blink = term->tl_cursor_blink; + may_output_cursor_props(); } } +/* + * Reset the desired cursor properties and restore them when needed. + */ static void -may_restore_cursor_props(void) +prepare_restore_cursor_props(void) { #ifdef FEAT_GUI if (gui.in_use) return; #endif - if (did_change_cursor) - { - did_change_cursor = FALSE; - term_cursor_color((char_u *)""); - /* this will restore the initial cursor style, if possible */ - ui_cursor_shape_forced(TRUE); - } + desired_cursor_color = (char_u *)""; + desired_cursor_shape = -1; + desired_cursor_blink = -1; + may_output_cursor_props(); } /* * Returns TRUE if the current window contains a terminal and we are sending * keys to the job. + * If "check_job_status" is TRUE update the job status. */ - int -term_use_loop(void) + static int +term_use_loop_check(int check_job_status) { term_T *term = curbuf->b_term; return term != NULL && !term->tl_normal_mode && term->tl_vterm != NULL - && term_job_running(term); + && term_job_running_check(term, check_job_status); +} + +/* + * Returns TRUE if the current window contains a terminal and we are sending + * keys to the job. + */ + int +term_use_loop(void) +{ + return term_use_loop_check(FALSE); +} + +/* + * Called when entering a window with the mouse. If this is a terminal window + * we may want to change state. + */ + void +term_win_entered() +{ + term_T *term = curbuf->b_term; + + if (term != NULL) + { + if (term_use_loop_check(TRUE)) + { + reset_VIsual_and_resel(); + if (State & INSERT) + stop_insert_mode = TRUE; + } + mouse_was_outside = FALSE; + enter_mouse_col = mouse_col; + enter_mouse_row = mouse_row; + } } /* @@ -1544,6 +1994,7 @@ int tty_fd = curbuf->b_term->tl_job->jv_channel ->ch_part[get_tty_part(curbuf->b_term)].ch_fd; #endif + int restore_cursor; /* Remember the terminal we are sending keys to. However, the terminal * might be closed while waiting for a character, e.g. typing "exit" in a @@ -1551,22 +2002,27 @@ * stored reference. */ in_terminal_loop = curbuf->b_term; - if (*curwin->w_p_tk != NUL) - termkey = string_to_key(curwin->w_p_tk, TRUE); + if (*curwin->w_p_twk != NUL) + termkey = string_to_key(curwin->w_p_twk, TRUE); position_cursor(curwin, &curbuf->b_term->tl_cursor_pos); may_set_cursor_props(curbuf->b_term); - while (blocking || vpeekc() != NUL) + while (blocking || vpeekc_nomap() != NUL) { - /* TODO: skip screen update when handling a sequence of keys. */ - /* Repeat redrawing in case a message is received while redrawing. */ - while (must_redraw != 0) - if (update_screen(0) == FAIL) - break; +#ifdef FEAT_GUI + if (!curbuf->b_term->tl_system) +#endif + /* TODO: skip screen update when handling a sequence of keys. */ + /* Repeat redrawing in case a message is received while redrawing. + */ + while (must_redraw != 0) + if (update_screen(0) == FAIL) + break; update_cursor(curbuf->b_term, FALSE); + restore_cursor = TRUE; c = term_vgetc(); - if (!term_use_loop()) + if (!term_use_loop_check(TRUE)) { /* Job finished while waiting for a character. Push back the * received character. */ @@ -1599,8 +2055,13 @@ if (ctrl_break_was_pressed) mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill"); #endif - /* Was either CTRL-W (termkey) or CTRL-\ pressed? */ - if (c == (termkey == 0 ? Ctrl_W : termkey) || c == Ctrl_BSL) + /* Was either CTRL-W (termkey) or CTRL-\ pressed? + * Not in a system terminal. */ + if ((c == (termkey == 0 ? Ctrl_W : termkey) || c == Ctrl_BSL) +#ifdef FEAT_GUI + && !curbuf->b_term->tl_system +#endif + ) { int prev_c = c; @@ -1612,7 +2073,7 @@ #ifdef FEAT_CMDL_INFO clear_showcmd(); #endif - if (!term_use_loop()) + if (!term_use_loop_check(TRUE)) /* job finished while waiting for a character */ break; @@ -1638,6 +2099,11 @@ /* "CTRL-W .": send CTRL-W to the job */ c = Ctrl_W; } + else if (termkey == 0 && c == Ctrl_BSL) + { + /* "CTRL-W CTRL-\": send CTRL-\ to the job */ + c = Ctrl_BSL; + } else if (c == 'N') { /* CTRL-W N : go to Terminal-Normal mode. */ @@ -1672,6 +2138,11 @@ # endif if (send_keys_to_term(curbuf->b_term, c, TRUE) != OK) { + if (c == K_MOUSEMOVE) + /* We are sure to come back here, don't reset the cursor color + * and shape to avoid flickering. */ + restore_cursor = FALSE; + ret = OK; goto theend; } @@ -1680,7 +2151,8 @@ theend: in_terminal_loop = NULL; - may_restore_cursor_props(); + if (restore_cursor) + prepare_restore_cursor_props(); return ret; } @@ -1698,10 +2170,8 @@ for (term = first_term; term != NULL; term = term->tl_next) if (term->tl_job == job) { - vim_free(term->tl_title); - term->tl_title = NULL; - vim_free(term->tl_status_text); - term->tl_status_text = NULL; + VIM_CLEAR(term->tl_title); + VIM_CLEAR(term->tl_status_text); redraw_buf_and_status_later(term->tl_buffer, VALID); did_one = TRUE; } @@ -1747,11 +2217,11 @@ switch (color->ansi_index) { case 0: return 0; - case 1: return lookup_color( 0, fg, boldp) + 1; + case 1: return lookup_color( 0, fg, boldp) + 1; /* black */ case 2: return lookup_color( 4, fg, boldp) + 1; /* dark red */ case 3: return lookup_color( 2, fg, boldp) + 1; /* dark green */ case 4: return lookup_color( 6, fg, boldp) + 1; /* brown */ - case 5: return lookup_color( 1, fg, boldp) + 1; /* dark blue*/ + case 5: return lookup_color( 1, fg, boldp) + 1; /* dark blue */ case 6: return lookup_color( 5, fg, boldp) + 1; /* dark magenta */ case 7: return lookup_color( 3, fg, boldp) + 1; /* dark cyan */ case 8: return lookup_color( 8, fg, boldp) + 1; /* light grey */ @@ -1807,10 +2277,10 @@ } /* - * Convert the attributes of a vterm cell into an attribute index. + * Convert Vterm attributes to highlight flags. */ static int -cell2attr(VTermScreenCellAttrs cellattrs, VTermColor cellfg, VTermColor cellbg) +vtermAttr2hl(VTermScreenCellAttrs cellattrs) { int attr = 0; @@ -1824,6 +2294,35 @@ attr |= HL_STRIKETHROUGH; if (cellattrs.reverse) attr |= HL_INVERSE; + return attr; +} + +/* + * Store Vterm attributes in "cell" from highlight flags. + */ + static void +hl2vtermAttr(int attr, cellattr_T *cell) +{ + vim_memset(&cell->attrs, 0, sizeof(VTermScreenCellAttrs)); + if (attr & HL_BOLD) + cell->attrs.bold = 1; + if (attr & HL_UNDERLINE) + cell->attrs.underline = 1; + if (attr & HL_ITALIC) + cell->attrs.italic = 1; + if (attr & HL_STRIKETHROUGH) + cell->attrs.strike = 1; + if (attr & HL_INVERSE) + cell->attrs.reverse = 1; +} + +/* + * Convert the attributes of a vterm cell into an attribute index. + */ + static int +cell2attr(VTermScreenCellAttrs cellattrs, VTermColor cellfg, VTermColor cellbg) +{ + int attr = vtermAttr2hl(cellattrs); #ifdef FEAT_GUI if (gui.in_use) @@ -1982,8 +2481,7 @@ #endif else term->tl_title = vim_strsave((char_u *)value->string); - vim_free(term->tl_status_text); - term->tl_status_text = NULL; + VIM_CLEAR(term->tl_status_text); if (term == curbuf->b_term) maketitle(); break; @@ -2005,6 +2503,8 @@ break; case VTERM_PROP_CURSORCOLOR: + if (desired_cursor_color == term->tl_cursor_color) + desired_cursor_color = (char_u *)""; vim_free(term->tl_cursor_color); if (*value->string == NUL) term->tl_cursor_color = NULL; @@ -2062,7 +2562,27 @@ { term_T *term = (term_T *)user; - /* TODO: Limit the number of lines that are stored. */ + /* If the number of lines that are stored goes over 'termscrollback' then + * delete the first 10%. */ + if (term->tl_scrollback.ga_len >= term->tl_buffer->b_p_twsl) + { + int todo = term->tl_buffer->b_p_twsl / 10; + int i; + + curbuf = term->tl_buffer; + for (i = 0; i < todo; ++i) + { + vim_free(((sb_line_T *)term->tl_scrollback.ga_data + i)->sb_cells); + ml_delete(1, FALSE); + } + curbuf = curwin->w_buffer; + + term->tl_scrollback.ga_len -= todo; + mch_memmove(term->tl_scrollback.ga_data, + (sb_line_T *)term->tl_scrollback.ga_data + todo, + sizeof(sb_line_T) * term->tl_scrollback.ga_len); + } + if (ga_grow(&term->tl_scrollback, 1) == OK) { cellattr_T *p = NULL; @@ -2146,10 +2666,8 @@ term->tl_channel_closed = TRUE; did_one = TRUE; - vim_free(term->tl_title); - term->tl_title = NULL; - vim_free(term->tl_status_text); - term->tl_status_text = NULL; + VIM_CLEAR(term->tl_title); + VIM_CLEAR(term->tl_status_text); /* Unless in Terminal-Normal mode: clear the vterm. */ if (!term->tl_normal_mode) @@ -2158,7 +2676,7 @@ cleanup_vterm(term); - if (term->tl_finish == 'c') + if (term->tl_finish == TL_FINISH_CLOSE) { aco_save_T aco; @@ -2169,7 +2687,8 @@ aucmd_restbuf(&aco); break; } - if (term->tl_finish == 'o' && term->tl_buffer->b_nwindows == 0) + if (term->tl_finish == TL_FINISH_OPEN + && term->tl_buffer->b_nwindows == 0) { char buf[50]; @@ -2206,6 +2725,141 @@ } /* + * Fill one screen line from a line of the terminal. + * Advances "pos" to past the last column. + */ + static void +term_line2screenline(VTermScreen *screen, VTermPos *pos, int max_col) +{ + int off = screen_get_current_line_off(); + + for (pos->col = 0; pos->col < max_col; ) + { + VTermScreenCell cell; + int c; + + if (vterm_screen_get_cell(screen, *pos, &cell) == 0) + vim_memset(&cell, 0, sizeof(cell)); + + c = cell.chars[0]; + if (c == NUL) + { + ScreenLines[off] = ' '; + if (enc_utf8) + ScreenLinesUC[off] = NUL; + } + else + { + if (enc_utf8) + { + int i; + + /* composing chars */ + for (i = 0; i < Screen_mco + && i + 1 < VTERM_MAX_CHARS_PER_CELL; ++i) + { + ScreenLinesC[i][off] = cell.chars[i + 1]; + if (cell.chars[i + 1] == 0) + break; + } + if (c >= 0x80 || (Screen_mco > 0 + && ScreenLinesC[0][off] != 0)) + { + ScreenLines[off] = ' '; + ScreenLinesUC[off] = c; + } + else + { + ScreenLines[off] = c; + ScreenLinesUC[off] = NUL; + } + } +#ifdef WIN3264 + else if (has_mbyte && c >= 0x80) + { + char_u mb[MB_MAXBYTES+1]; + WCHAR wc = c; + + if (WideCharToMultiByte(GetACP(), 0, &wc, 1, + (char*)mb, 2, 0, 0) > 1) + { + ScreenLines[off] = mb[0]; + ScreenLines[off + 1] = mb[1]; + cell.width = mb_ptr2cells(mb); + } + else + ScreenLines[off] = c; + } +#endif + else + ScreenLines[off] = c; + } + ScreenAttrs[off] = cell2attr(cell.attrs, cell.fg, cell.bg); + + ++pos->col; + ++off; + if (cell.width == 2) + { + if (enc_utf8) + ScreenLinesUC[off] = NUL; + + /* don't set the second byte to NUL for a DBCS encoding, it + * has been set above */ + if (enc_utf8 || !has_mbyte) + ScreenLines[off] = NUL; + + ++pos->col; + ++off; + } + } +} + +#if defined(FEAT_GUI) + static void +update_system_term(term_T *term) +{ + VTermPos pos; + VTermScreen *screen; + + if (term->tl_vterm == NULL) + return; + screen = vterm_obtain_screen(term->tl_vterm); + + /* Scroll up to make more room for terminal lines if needed. */ + while (term->tl_toprow > 0 + && (Rows - term->tl_toprow) < term->tl_dirty_row_end) + { + int save_p_more = p_more; + + p_more = FALSE; + msg_row = Rows - 1; + msg_puts((char_u *)"\n"); + p_more = save_p_more; + --term->tl_toprow; + } + + for (pos.row = term->tl_dirty_row_start; pos.row < term->tl_dirty_row_end + && pos.row < Rows; ++pos.row) + { + if (pos.row < term->tl_rows) + { + int max_col = MIN(Columns, term->tl_cols); + + term_line2screenline(screen, &pos, max_col); + } + else + pos.col = 0; + + screen_line(term->tl_toprow + pos.row, 0, pos.col, Columns, FALSE); + } + + term->tl_dirty_row_start = MAX_ROW; + term->tl_dirty_row_end = 0; + update_cursor(term, TRUE); +} +#endif + +/* * Called to update a window that contains an active terminal. * Returns FAIL when there is no terminal running in this window or in * Terminal-Normal mode. @@ -2218,6 +2872,10 @@ VTermScreen *screen; VTermState *state; VTermPos pos; + int rows, cols; + int newrows, newcols; + int minsize; + win_T *twp; if (term == NULL || term->tl_vterm == NULL || term->tl_normal_mode) return FAIL; @@ -2236,31 +2894,32 @@ * If the window was resized a redraw will be triggered and we get here. * Adjust the size of the vterm unless 'termsize' specifies a fixed size. */ - if ((!term->tl_rows_fixed && term->tl_rows != wp->w_height) - || (!term->tl_cols_fixed && term->tl_cols != wp->w_width)) + minsize = parse_termsize(wp, &rows, &cols); + + newrows = 99999; + newcols = 99999; + FOR_ALL_WINDOWS(twp) { - int rows = term->tl_rows_fixed ? term->tl_rows : wp->w_height; - int cols = term->tl_cols_fixed ? term->tl_cols : wp->w_width; - win_T *twp; - - FOR_ALL_WINDOWS(twp) - { - /* When more than one window shows the same terminal, use the - * smallest size. */ - if (twp->w_buffer == term->tl_buffer) - { - if (!term->tl_rows_fixed && rows > twp->w_height) - rows = twp->w_height; - if (!term->tl_cols_fixed && cols > twp->w_width) - cols = twp->w_width; - } + /* When more than one window shows the same terminal, use the + * smallest size. */ + if (twp->w_buffer == term->tl_buffer) + { + newrows = MIN(newrows, twp->w_height); + newcols = MIN(newcols, twp->w_width); } + } + newrows = rows == 0 ? newrows : minsize ? MAX(rows, newrows) : rows; + newcols = cols == 0 ? newcols : minsize ? MAX(cols, newcols) : cols; + + if (term->tl_rows != newrows || term->tl_cols != newcols) + { + term->tl_vterm_size_changed = TRUE; - vterm_set_size(vterm, rows, cols); + vterm_set_size(vterm, newrows, newcols); ch_log(term->tl_job->jv_channel, "Resizing terminal to %d lines", - rows); - term_report_winsize(term, rows, cols); + newrows); + term_report_winsize(term, newrows, newcols); } /* The cursor may have been moved when resizing. */ @@ -2270,96 +2929,20 @@ for (pos.row = term->tl_dirty_row_start; pos.row < term->tl_dirty_row_end && pos.row < wp->w_height; ++pos.row) { - int off = screen_get_current_line_off(); - int max_col = MIN(wp->w_width, term->tl_cols); - if (pos.row < term->tl_rows) { - for (pos.col = 0; pos.col < max_col; ) - { - VTermScreenCell cell; - int c; - - if (vterm_screen_get_cell(screen, pos, &cell) == 0) - vim_memset(&cell, 0, sizeof(cell)); - - c = cell.chars[0]; - if (c == NUL) - { - ScreenLines[off] = ' '; - if (enc_utf8) - ScreenLinesUC[off] = NUL; - } - else - { - if (enc_utf8) - { - int i; - - /* composing chars */ - for (i = 0; i < Screen_mco - && i + 1 < VTERM_MAX_CHARS_PER_CELL; ++i) - { - ScreenLinesC[i][off] = cell.chars[i + 1]; - if (cell.chars[i + 1] == 0) - break; - } - if (c >= 0x80 || (Screen_mco > 0 - && ScreenLinesC[0][off] != 0)) - { - ScreenLines[off] = ' '; - ScreenLinesUC[off] = c; - } - else - { - ScreenLines[off] = c; - ScreenLinesUC[off] = NUL; - } - } -#ifdef WIN3264 - else if (has_mbyte && c >= 0x80) - { - char_u mb[MB_MAXBYTES+1]; - WCHAR wc = c; - - if (WideCharToMultiByte(GetACP(), 0, &wc, 1, - (char*)mb, 2, 0, 0) > 1) - { - ScreenLines[off] = mb[0]; - ScreenLines[off + 1] = mb[1]; - cell.width = mb_ptr2cells(mb); - } - else - ScreenLines[off] = c; - } -#endif - else - ScreenLines[off] = c; - } - ScreenAttrs[off] = cell2attr(cell.attrs, cell.fg, cell.bg); - - ++pos.col; - ++off; - if (cell.width == 2) - { - if (enc_utf8) - ScreenLinesUC[off] = NUL; + int max_col = MIN(wp->w_width, term->tl_cols); - /* don't set the second byte to NUL for a DBCS encoding, it - * has been set above */ - if (enc_utf8 || !has_mbyte) - ScreenLines[off] = NUL; - - ++pos.col; - ++off; - } - } + term_line2screenline(screen, &pos, max_col); } else pos.col = 0; - screen_line(wp->w_winrow + pos.row, wp->w_wincol, - pos.col, wp->w_width, FALSE); + screen_line(wp->w_winrow + pos.row +#ifdef FEAT_MENU + + winbar_height(wp) +#endif + , wp->w_wincol, pos.col, wp->w_width, FALSE); } term->tl_dirty_row_start = MAX_ROW; term->tl_dirty_row_end = 0; @@ -2496,25 +3079,15 @@ } /* - * Create a new vterm and initialize it. + * Initialize term->tl_default_color from the environment. */ static void -create_vterm(term_T *term, int rows, int cols) +init_default_colors(term_T *term) { - VTerm *vterm; - VTermScreen *screen; - VTermValue value; VTermColor *fg, *bg; int fgval, bgval; int id; - vterm = vterm_new(rows, cols); - term->tl_vterm = vterm; - screen = vterm_obtain_screen(vterm); - vterm_screen_set_callbacks(screen, &screen_callbacks, term); - /* TODO: depends on 'encoding'. */ - vterm_set_utf8(vterm, 1); - vim_memset(&term->tl_default_color.attrs, 0, sizeof(VTermScreenCellAttrs)); term->tl_default_color.width = 1; fg = &term->tl_default_color.fg; @@ -2637,111 +3210,1281 @@ term_get_bg_color(&bg->red, &bg->green, &bg->blue); # endif } +} - vterm_state_set_default_colors(vterm_obtain_state(vterm), fg, bg); - - /* Required to initialize most things. */ - vterm_screen_reset(screen, 1 /* hard */); - - /* Allow using alternate screen. */ - vterm_screen_enable_altscreen(screen, 1); - - /* For unix do not use a blinking cursor. In an xterm this causes the - * cursor to blink if it's blinking in the xterm. - * For Windows we respect the system wide setting. */ -#ifdef WIN3264 - if (GetCaretBlinkTime() == INFINITE) - value.boolean = 0; - else - value.boolean = 1; -#else - value.boolean = 0; -#endif - vterm_state_set_termprop(vterm_obtain_state(vterm), - VTERM_PROP_CURSORBLINK, &value); +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) +/* + * Set the 16 ANSI colors from array of RGB values + */ + static void +set_vterm_palette(VTerm *vterm, long_u *rgb) +{ + int index = 0; + VTermState *state = vterm_obtain_state(vterm); + for (; index < 16; index++) + { + VTermColor color; + color.red = (unsigned)(rgb[index] >> 16); + color.green = (unsigned)(rgb[index] >> 8) & 255; + color.blue = (unsigned)rgb[index] & 255; + vterm_state_set_palette_color(state, index, &color); + } } /* - * Return the text to show for the buffer name and status. + * Set the ANSI color palette from a list of colors */ - char_u * -term_get_status_text(term_T *term) + static int +set_ansi_colors_list(VTerm *vterm, list_T *list) { - if (term->tl_status_text == NULL) + int n = 0; + long_u rgb[16]; + listitem_T *li = list->lv_first; + + for (; li != NULL && n < 16; li = li->li_next, n++) { - char_u *txt; - size_t len; + char_u *color_name; + guicolor_T guicolor; - if (term->tl_normal_mode) - { - if (term_job_running(term)) - txt = (char_u *)_("Terminal"); - else - txt = (char_u *)_("Terminal-finished"); - } - else if (term->tl_title != NULL) - txt = term->tl_title; - else if (term_none_open(term)) - txt = (char_u *)_("active"); - else if (term_job_running(term)) - txt = (char_u *)_("running"); - else - txt = (char_u *)_("finished"); - len = 9 + STRLEN(term->tl_buffer->b_fname) + STRLEN(txt); - term->tl_status_text = alloc((int)len); - if (term->tl_status_text != NULL) - vim_snprintf((char *)term->tl_status_text, len, "%s [%s]", - term->tl_buffer->b_fname, txt); + color_name = get_tv_string_chk(&li->li_tv); + if (color_name == NULL) + return FAIL; + + guicolor = GUI_GET_COLOR(color_name); + if (guicolor == INVALCOLOR) + return FAIL; + + rgb[n] = GUI_MCH_GET_RGB(guicolor); } - return term->tl_status_text; + + if (n != 16 || li != NULL) + return FAIL; + + set_vterm_palette(vterm, rgb); + + return OK; } /* - * Mark references in jobs of terminals. + * Initialize the ANSI color palette from g:terminal_ansi_colors[0:15] */ - int -set_ref_in_term(int copyID) + static void +init_vterm_ansi_colors(VTerm *vterm) { - int abort = FALSE; - term_T *term; - typval_T tv; + dictitem_T *var = find_var((char_u *)"g:terminal_ansi_colors", NULL, TRUE); - for (term = first_term; term != NULL; term = term->tl_next) - if (term->tl_job != NULL) + if (var != NULL + && (var->di_tv.v_type != VAR_LIST + || var->di_tv.vval.v_list == NULL + || set_ansi_colors_list(vterm, var->di_tv.vval.v_list) == FAIL)) + EMSG2(_(e_invarg2), "g:terminal_ansi_colors"); +} +#endif + +/* + * Handles a "drop" command from the job in the terminal. + * "item" is the file name, "item->li_next" may have options. + */ + static void +handle_drop_command(listitem_T *item) +{ + char_u *fname = get_tv_string(&item->li_tv); + listitem_T *opt_item = item->li_next; + int bufnr; + win_T *wp; + tabpage_T *tp; + exarg_T ea; + char_u *tofree = NULL; + + bufnr = buflist_add(fname, BLN_LISTED | BLN_NOOPT); + FOR_ALL_TAB_WINDOWS(tp, wp) + { + if (wp->w_buffer->b_fnum == bufnr) + { + /* buffer is in a window already, go there */ + goto_tabpage_win(tp, wp); + return; + } + } + + vim_memset(&ea, 0, sizeof(ea)); + + if (opt_item != NULL && opt_item->li_tv.v_type == VAR_DICT + && opt_item->li_tv.vval.v_dict != NULL) + { + dict_T *dict = opt_item->li_tv.vval.v_dict; + char_u *p; + + p = get_dict_string(dict, (char_u *)"ff", FALSE); + if (p == NULL) + p = get_dict_string(dict, (char_u *)"fileformat", FALSE); + if (p != NULL) + { + if (check_ff_value(p) == FAIL) + ch_log(NULL, "Invalid ff argument to drop: %s", p); + else + ea.force_ff = *p; + } + p = get_dict_string(dict, (char_u *)"enc", FALSE); + if (p == NULL) + p = get_dict_string(dict, (char_u *)"encoding", FALSE); + if (p != NULL) + { + ea.cmd = alloc((int)STRLEN(p) + 12); + if (ea.cmd != NULL) + { + sprintf((char *)ea.cmd, "sbuf ++enc=%s", p); + ea.force_enc = 11; + tofree = ea.cmd; + } + } + + p = get_dict_string(dict, (char_u *)"bad", FALSE); + if (p != NULL) + get_bad_opt(p, &ea); + + if (dict_find(dict, (char_u *)"bin", -1) != NULL) + ea.force_bin = FORCE_BIN; + if (dict_find(dict, (char_u *)"binary", -1) != NULL) + ea.force_bin = FORCE_BIN; + if (dict_find(dict, (char_u *)"nobin", -1) != NULL) + ea.force_bin = FORCE_NOBIN; + if (dict_find(dict, (char_u *)"nobinary", -1) != NULL) + ea.force_bin = FORCE_NOBIN; + } + + /* open in new window, like ":split fname" */ + if (ea.cmd == NULL) + ea.cmd = (char_u *)"split"; + ea.arg = fname; + ea.cmdidx = CMD_split; + ex_splitview(&ea); + + vim_free(tofree); +} + +/* + * Handles a function call from the job running in a terminal. + * "item" is the function name, "item->li_next" has the arguments. + */ + static void +handle_call_command(term_T *term, channel_T *channel, listitem_T *item) +{ + char_u *func; + typval_T argvars[2]; + typval_T rettv; + int doesrange; + + if (item->li_next == NULL) + { + ch_log(channel, "Missing function arguments for call"); + return; + } + func = get_tv_string(&item->li_tv); + + if (STRNCMP(func, "Tapi_", 5) != 0) + { + ch_log(channel, "Invalid function name: %s", func); + return; + } + + argvars[0].v_type = VAR_NUMBER; + argvars[0].vval.v_number = term->tl_buffer->b_fnum; + argvars[1] = item->li_next->li_tv; + if (call_func(func, (int)STRLEN(func), &rettv, + 2, argvars, /* argv_func */ NULL, + /* firstline */ 1, /* lastline */ 1, + &doesrange, /* evaluate */ TRUE, + /* partial */ NULL, /* selfdict */ NULL) == OK) + { + clear_tv(&rettv); + ch_log(channel, "Function %s called", func); + } + else + ch_log(channel, "Calling function %s failed", func); +} + +/* + * Called by libvterm when it cannot recognize an OSC sequence. + * We recognize a terminal API command. + */ + static int +parse_osc(const char *command, size_t cmdlen, void *user) +{ + term_T *term = (term_T *)user; + js_read_T reader; + typval_T tv; + channel_T *channel = term->tl_job == NULL ? NULL + : term->tl_job->jv_channel; + + /* We recognize only OSC 5 1 ; {command} */ + if (cmdlen < 3 || STRNCMP(command, "51;", 3) != 0) + return 0; /* not handled */ + + reader.js_buf = vim_strnsave((char_u *)command + 3, (int)(cmdlen - 3)); + if (reader.js_buf == NULL) + return 1; + reader.js_fill = NULL; + reader.js_used = 0; + if (json_decode(&reader, &tv, 0) == OK + && tv.v_type == VAR_LIST + && tv.vval.v_list != NULL) + { + listitem_T *item = tv.vval.v_list->lv_first; + + if (item == NULL) + ch_log(channel, "Missing command"); + else + { + char_u *cmd = get_tv_string(&item->li_tv); + + /* Make sure an invoked command doesn't delete the buffer (and the + * terminal) under our fingers. */ + ++term->tl_buffer->b_locked; + + item = item->li_next; + if (item == NULL) + ch_log(channel, "Missing argument for %s", cmd); + else if (STRCMP(cmd, "drop") == 0) + handle_drop_command(item); + else if (STRCMP(cmd, "call") == 0) + handle_call_command(term, channel, item); + else + ch_log(channel, "Invalid command received: %s", cmd); + --term->tl_buffer->b_locked; + } + } + else + ch_log(channel, "Invalid JSON received"); + + vim_free(reader.js_buf); + clear_tv(&tv); + return 1; +} + +static VTermParserCallbacks parser_fallbacks = { + NULL, /* text */ + NULL, /* control */ + NULL, /* escape */ + NULL, /* csi */ + parse_osc, /* osc */ + NULL, /* dcs */ + NULL /* resize */ +}; + +/* + * Use Vim's allocation functions for vterm so profiling works. + */ + static void * +vterm_malloc(size_t size, void *data UNUSED) +{ + return alloc_clear((unsigned) size); +} + + static void +vterm_memfree(void *ptr, void *data UNUSED) +{ + vim_free(ptr); +} + +static VTermAllocatorFunctions vterm_allocator = { + &vterm_malloc, + &vterm_memfree +}; + +/* + * Create a new vterm and initialize it. + */ + static void +create_vterm(term_T *term, int rows, int cols) +{ + VTerm *vterm; + VTermScreen *screen; + VTermState *state; + VTermValue value; + + vterm = vterm_new_with_allocator(rows, cols, &vterm_allocator, NULL); + term->tl_vterm = vterm; + screen = vterm_obtain_screen(vterm); + vterm_screen_set_callbacks(screen, &screen_callbacks, term); + /* TODO: depends on 'encoding'. */ + vterm_set_utf8(vterm, 1); + + init_default_colors(term); + + vterm_state_set_default_colors( + vterm_obtain_state(vterm), + &term->tl_default_color.fg, + &term->tl_default_color.bg); + + if (t_colors >= 16) + vterm_state_set_bold_highbright(vterm_obtain_state(vterm), 1); + + /* Required to initialize most things. */ + vterm_screen_reset(screen, 1 /* hard */); + + /* Allow using alternate screen. */ + vterm_screen_enable_altscreen(screen, 1); + + /* For unix do not use a blinking cursor. In an xterm this causes the + * cursor to blink if it's blinking in the xterm. + * For Windows we respect the system wide setting. */ +#ifdef WIN3264 + if (GetCaretBlinkTime() == INFINITE) + value.boolean = 0; + else + value.boolean = 1; +#else + value.boolean = 0; +#endif + state = vterm_obtain_state(vterm); + vterm_state_set_termprop(state, VTERM_PROP_CURSORBLINK, &value); + vterm_state_set_unrecognised_fallbacks(state, &parser_fallbacks, term); +} + +/* + * Return the text to show for the buffer name and status. + */ + char_u * +term_get_status_text(term_T *term) +{ + if (term->tl_status_text == NULL) + { + char_u *txt; + size_t len; + + if (term->tl_normal_mode) + { + if (term_job_running(term)) + txt = (char_u *)_("Terminal"); + else + txt = (char_u *)_("Terminal-finished"); + } + else if (term->tl_title != NULL) + txt = term->tl_title; + else if (term_none_open(term)) + txt = (char_u *)_("active"); + else if (term_job_running(term)) + txt = (char_u *)_("running"); + else + txt = (char_u *)_("finished"); + len = 9 + STRLEN(term->tl_buffer->b_fname) + STRLEN(txt); + term->tl_status_text = alloc((int)len); + if (term->tl_status_text != NULL) + vim_snprintf((char *)term->tl_status_text, len, "%s [%s]", + term->tl_buffer->b_fname, txt); + } + return term->tl_status_text; +} + +/* + * Mark references in jobs of terminals. + */ + int +set_ref_in_term(int copyID) +{ + int abort = FALSE; + term_T *term; + typval_T tv; + + for (term = first_term; term != NULL; term = term->tl_next) + if (term->tl_job != NULL) + { + tv.v_type = VAR_JOB; + tv.vval.v_job = term->tl_job; + abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL); + } + return abort; +} + +/* + * Cache "Terminal" highlight group colors. + */ + void +set_terminal_default_colors(int cterm_fg, int cterm_bg) +{ + term_default_cterm_fg = cterm_fg - 1; + term_default_cterm_bg = cterm_bg - 1; +} + +/* + * Get the buffer from the first argument in "argvars". + * Returns NULL when the buffer is not for a terminal window and logs a message + * with "where". + */ + static buf_T * +term_get_buf(typval_T *argvars, char *where) +{ + buf_T *buf; + + (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + ++emsg_off; + buf = get_buf_tv(&argvars[0], FALSE); + --emsg_off; + if (buf == NULL || buf->b_term == NULL) + { + ch_log(NULL, "%s: invalid buffer argument", where); + return NULL; + } + return buf; +} + + static int +same_color(VTermColor *a, VTermColor *b) +{ + return a->red == b->red + && a->green == b->green + && a->blue == b->blue + && a->ansi_index == b->ansi_index; +} + + static void +dump_term_color(FILE *fd, VTermColor *color) +{ + fprintf(fd, "%02x%02x%02x%d", + (int)color->red, (int)color->green, (int)color->blue, + (int)color->ansi_index); +} + +/* + * "term_dumpwrite(buf, filename, options)" function + * + * Each screen cell in full is: + * |{characters}+{attributes}#{fg-color}{color-idx}#{bg-color}{color-idx} + * {characters} is a space for an empty cell + * For a double-width character "+" is changed to "*" and the next cell is + * skipped. + * {attributes} is the decimal value of HL_BOLD + HL_UNDERLINE, etc. + * when "&" use the same as the previous cell. + * {fg-color} is hex RGB, when "&" use the same as the previous cell. + * {bg-color} is hex RGB, when "&" use the same as the previous cell. + * {color-idx} is a number from 0 to 255 + * + * Screen cell with same width, attributes and color as the previous one: + * |{characters} + * + * To use the color of the previous cell, use "&" instead of {color}-{idx}. + * + * Repeating the previous screen cell: + * @{count} + */ + void +f_term_dumpwrite(typval_T *argvars, typval_T *rettv UNUSED) +{ + buf_T *buf = term_get_buf(argvars, "term_dumpwrite()"); + term_T *term; + char_u *fname; + int max_height = 0; + int max_width = 0; + stat_T st; + FILE *fd; + VTermPos pos; + VTermScreen *screen; + VTermScreenCell prev_cell; + VTermState *state; + VTermPos cursor_pos; + + if (check_restricted() || check_secure()) + return; + if (buf == NULL) + return; + term = buf->b_term; + + if (argvars[2].v_type != VAR_UNKNOWN) + { + dict_T *d; + + if (argvars[2].v_type != VAR_DICT) + { + EMSG(_(e_dictreq)); + return; + } + d = argvars[2].vval.v_dict; + if (d != NULL) + { + max_height = get_dict_number(d, (char_u *)"rows"); + max_width = get_dict_number(d, (char_u *)"columns"); + } + } + + fname = get_tv_string_chk(&argvars[1]); + if (fname == NULL) + return; + if (mch_stat((char *)fname, &st) >= 0) + { + EMSG2(_("E953: File exists: %s"), fname); + return; + } + + if (*fname == NUL || (fd = mch_fopen((char *)fname, WRITEBIN)) == NULL) + { + EMSG2(_(e_notcreate), *fname == NUL ? (char_u *)_("") : fname); + return; + } + + vim_memset(&prev_cell, 0, sizeof(prev_cell)); + + screen = vterm_obtain_screen(term->tl_vterm); + state = vterm_obtain_state(term->tl_vterm); + vterm_state_get_cursorpos(state, &cursor_pos); + + for (pos.row = 0; (max_height == 0 || pos.row < max_height) + && pos.row < term->tl_rows; ++pos.row) + { + int repeat = 0; + + for (pos.col = 0; (max_width == 0 || pos.col < max_width) + && pos.col < term->tl_cols; ++pos.col) + { + VTermScreenCell cell; + int same_attr; + int same_chars = TRUE; + int i; + int is_cursor_pos = (pos.col == cursor_pos.col + && pos.row == cursor_pos.row); + + if (vterm_screen_get_cell(screen, pos, &cell) == 0) + vim_memset(&cell, 0, sizeof(cell)); + + for (i = 0; i < VTERM_MAX_CHARS_PER_CELL; ++i) + { + int c = cell.chars[i]; + int pc = prev_cell.chars[i]; + + /* For the first character NUL is the same as space. */ + if (i == 0) + { + c = (c == NUL) ? ' ' : c; + pc = (pc == NUL) ? ' ' : pc; + } + if (cell.chars[i] != prev_cell.chars[i]) + same_chars = FALSE; + if (cell.chars[i] == NUL || prev_cell.chars[i] == NUL) + break; + } + same_attr = vtermAttr2hl(cell.attrs) + == vtermAttr2hl(prev_cell.attrs) + && same_color(&cell.fg, &prev_cell.fg) + && same_color(&cell.bg, &prev_cell.bg); + if (same_chars && cell.width == prev_cell.width && same_attr + && !is_cursor_pos) + { + ++repeat; + } + else + { + if (repeat > 0) + { + fprintf(fd, "@%d", repeat); + repeat = 0; + } + fputs(is_cursor_pos ? ">" : "|", fd); + + if (cell.chars[0] == NUL) + fputs(" ", fd); + else + { + char_u charbuf[10]; + int len; + + for (i = 0; i < VTERM_MAX_CHARS_PER_CELL + && cell.chars[i] != NUL; ++i) + { + len = utf_char2bytes(cell.chars[i], charbuf); + fwrite(charbuf, len, 1, fd); + } + } + + /* When only the characters differ we don't write anything, the + * following "|", "@" or NL will indicate using the same + * attributes. */ + if (cell.width != prev_cell.width || !same_attr) + { + if (cell.width == 2) + { + fputs("*", fd); + ++pos.col; + } + else + fputs("+", fd); + + if (same_attr) + { + fputs("&", fd); + } + else + { + fprintf(fd, "%d", vtermAttr2hl(cell.attrs)); + if (same_color(&cell.fg, &prev_cell.fg)) + fputs("&", fd); + else + { + fputs("#", fd); + dump_term_color(fd, &cell.fg); + } + if (same_color(&cell.bg, &prev_cell.bg)) + fputs("&", fd); + else + { + fputs("#", fd); + dump_term_color(fd, &cell.bg); + } + } + } + + prev_cell = cell; + } + } + if (repeat > 0) + fprintf(fd, "@%d", repeat); + fputs("\n", fd); + } + + fclose(fd); +} + +/* + * Called when a dump is corrupted. Put a breakpoint here when debugging. + */ + static void +dump_is_corrupt(garray_T *gap) +{ + ga_concat(gap, (char_u *)"CORRUPT"); +} + + static void +append_cell(garray_T *gap, cellattr_T *cell) +{ + if (ga_grow(gap, 1) == OK) + { + *(((cellattr_T *)gap->ga_data) + gap->ga_len) = *cell; + ++gap->ga_len; + } +} + +/* + * Read the dump file from "fd" and append lines to the current buffer. + * Return the cell width of the longest line. + */ + static int +read_dump_file(FILE *fd, VTermPos *cursor_pos) +{ + int c; + garray_T ga_text; + garray_T ga_cell; + char_u *prev_char = NULL; + int attr = 0; + cellattr_T cell; + term_T *term = curbuf->b_term; + int max_cells = 0; + int start_row = term->tl_scrollback.ga_len; + + ga_init2(&ga_text, 1, 90); + ga_init2(&ga_cell, sizeof(cellattr_T), 90); + vim_memset(&cell, 0, sizeof(cell)); + cursor_pos->row = -1; + cursor_pos->col = -1; + + c = fgetc(fd); + for (;;) + { + if (c == EOF) + break; + if (c == '\n') + { + /* End of a line: append it to the buffer. */ + if (ga_text.ga_data == NULL) + dump_is_corrupt(&ga_text); + if (ga_grow(&term->tl_scrollback, 1) == OK) + { + sb_line_T *line = (sb_line_T *)term->tl_scrollback.ga_data + + term->tl_scrollback.ga_len; + + if (max_cells < ga_cell.ga_len) + max_cells = ga_cell.ga_len; + line->sb_cols = ga_cell.ga_len; + line->sb_cells = ga_cell.ga_data; + line->sb_fill_attr = term->tl_default_color; + ++term->tl_scrollback.ga_len; + ga_init(&ga_cell); + + ga_append(&ga_text, NUL); + ml_append(curbuf->b_ml.ml_line_count, ga_text.ga_data, + ga_text.ga_len, FALSE); + } + else + ga_clear(&ga_cell); + ga_text.ga_len = 0; + + c = fgetc(fd); + } + else if (c == '|' || c == '>') + { + int prev_len = ga_text.ga_len; + + if (c == '>') + { + if (cursor_pos->row != -1) + dump_is_corrupt(&ga_text); /* duplicate cursor */ + cursor_pos->row = term->tl_scrollback.ga_len - start_row; + cursor_pos->col = ga_cell.ga_len; + } + + /* normal character(s) followed by "+", "*", "|", "@" or NL */ + c = fgetc(fd); + if (c != EOF) + ga_append(&ga_text, c); + for (;;) + { + c = fgetc(fd); + if (c == '+' || c == '*' || c == '|' || c == '>' || c == '@' + || c == EOF || c == '\n') + break; + ga_append(&ga_text, c); + } + + /* save the character for repeating it */ + vim_free(prev_char); + if (ga_text.ga_data != NULL) + prev_char = vim_strnsave(((char_u *)ga_text.ga_data) + prev_len, + ga_text.ga_len - prev_len); + + if (c == '@' || c == '|' || c == '>' || c == '\n') + { + /* use all attributes from previous cell */ + } + else if (c == '+' || c == '*') + { + int is_bg; + + cell.width = c == '+' ? 1 : 2; + + c = fgetc(fd); + if (c == '&') + { + /* use same attr as previous cell */ + c = fgetc(fd); + } + else if (isdigit(c)) + { + /* get the decimal attribute */ + attr = 0; + while (isdigit(c)) + { + attr = attr * 10 + (c - '0'); + c = fgetc(fd); + } + hl2vtermAttr(attr, &cell); + } + else + dump_is_corrupt(&ga_text); + + /* is_bg == 0: fg, is_bg == 1: bg */ + for (is_bg = 0; is_bg <= 1; ++is_bg) + { + if (c == '&') + { + /* use same color as previous cell */ + c = fgetc(fd); + } + else if (c == '#') + { + int red, green, blue, index = 0; + + c = fgetc(fd); + red = hex2nr(c); + c = fgetc(fd); + red = (red << 4) + hex2nr(c); + c = fgetc(fd); + green = hex2nr(c); + c = fgetc(fd); + green = (green << 4) + hex2nr(c); + c = fgetc(fd); + blue = hex2nr(c); + c = fgetc(fd); + blue = (blue << 4) + hex2nr(c); + c = fgetc(fd); + if (!isdigit(c)) + dump_is_corrupt(&ga_text); + while (isdigit(c)) + { + index = index * 10 + (c - '0'); + c = fgetc(fd); + } + + if (is_bg) + { + cell.bg.red = red; + cell.bg.green = green; + cell.bg.blue = blue; + cell.bg.ansi_index = index; + } + else + { + cell.fg.red = red; + cell.fg.green = green; + cell.fg.blue = blue; + cell.fg.ansi_index = index; + } + } + else + dump_is_corrupt(&ga_text); + } + } + else + dump_is_corrupt(&ga_text); + + append_cell(&ga_cell, &cell); + } + else if (c == '@') + { + if (prev_char == NULL) + dump_is_corrupt(&ga_text); + else + { + int count = 0; + + /* repeat previous character, get the count */ + for (;;) + { + c = fgetc(fd); + if (!isdigit(c)) + break; + count = count * 10 + (c - '0'); + } + + while (count-- > 0) + { + ga_concat(&ga_text, prev_char); + append_cell(&ga_cell, &cell); + } + } + } + else + { + dump_is_corrupt(&ga_text); + c = fgetc(fd); + } + } + + if (ga_text.ga_len > 0) + { + /* trailing characters after last NL */ + dump_is_corrupt(&ga_text); + ga_append(&ga_text, NUL); + ml_append(curbuf->b_ml.ml_line_count, ga_text.ga_data, + ga_text.ga_len, FALSE); + } + + ga_clear(&ga_text); + vim_free(prev_char); + + return max_cells; +} + +/* + * Return an allocated string with at least "text_width" "=" characters and + * "fname" inserted in the middle. + */ + static char_u * +get_separator(int text_width, char_u *fname) +{ + int width = MAX(text_width, curwin->w_width); + char_u *textline; + int fname_size; + char_u *p = fname; + int i; + size_t off; + + textline = alloc(width + (int)STRLEN(fname) + 1); + if (textline == NULL) + return NULL; + + fname_size = vim_strsize(fname); + if (fname_size < width - 8) + { + /* enough room, don't use the full window width */ + width = MAX(text_width, fname_size + 8); + } + else if (fname_size > width - 8) + { + /* full name doesn't fit, use only the tail */ + p = gettail(fname); + fname_size = vim_strsize(p); + } + /* skip characters until the name fits */ + while (fname_size > width - 8) + { + p += (*mb_ptr2len)(p); + fname_size = vim_strsize(p); + } + + for (i = 0; i < (width - fname_size) / 2 - 1; ++i) + textline[i] = '='; + textline[i++] = ' '; + + STRCPY(textline + i, p); + off = STRLEN(textline); + textline[off] = ' '; + for (i = 1; i < (width - fname_size) / 2; ++i) + textline[off + i] = '='; + textline[off + i] = NUL; + + return textline; +} + +/* + * Common for "term_dumpdiff()" and "term_dumpload()". + */ + static void +term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff) +{ + jobopt_T opt; + buf_T *buf; + char_u buf1[NUMBUFLEN]; + char_u buf2[NUMBUFLEN]; + char_u *fname1; + char_u *fname2 = NULL; + char_u *fname_tofree = NULL; + FILE *fd1; + FILE *fd2 = NULL; + char_u *textline = NULL; + + /* First open the files. If this fails bail out. */ + fname1 = get_tv_string_buf_chk(&argvars[0], buf1); + if (do_diff) + fname2 = get_tv_string_buf_chk(&argvars[1], buf2); + if (fname1 == NULL || (do_diff && fname2 == NULL)) + { + EMSG(_(e_invarg)); + return; + } + fd1 = mch_fopen((char *)fname1, READBIN); + if (fd1 == NULL) + { + EMSG2(_(e_notread), fname1); + return; + } + if (do_diff) + { + fd2 = mch_fopen((char *)fname2, READBIN); + if (fd2 == NULL) { - tv.v_type = VAR_JOB; - tv.vval.v_job = term->tl_job; - abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL); + fclose(fd1); + EMSG2(_(e_notread), fname2); + return; } - return abort; + } + + init_job_options(&opt); + if (argvars[do_diff ? 2 : 1].v_type != VAR_UNKNOWN + && get_job_options(&argvars[do_diff ? 2 : 1], &opt, 0, + JO2_TERM_NAME + JO2_TERM_COLS + JO2_TERM_ROWS + + JO2_VERTICAL + JO2_CURWIN + JO2_NORESTORE) == FAIL) + goto theend; + + if (opt.jo_term_name == NULL) + { + size_t len = STRLEN(fname1) + 12; + + fname_tofree = alloc((int)len); + if (fname_tofree != NULL) + { + vim_snprintf((char *)fname_tofree, len, "dump diff %s", fname1); + opt.jo_term_name = fname_tofree; + } + } + + buf = term_start(&argvars[0], NULL, &opt, TERM_START_NOJOB); + if (buf != NULL && buf->b_term != NULL) + { + int i; + linenr_T bot_lnum; + linenr_T lnum; + term_T *term = buf->b_term; + int width; + int width2; + VTermPos cursor_pos1; + VTermPos cursor_pos2; + + init_default_colors(term); + + rettv->vval.v_number = buf->b_fnum; + + /* read the files, fill the buffer with the diff */ + width = read_dump_file(fd1, &cursor_pos1); + + /* position the cursor */ + if (cursor_pos1.row >= 0) + { + curwin->w_cursor.lnum = cursor_pos1.row + 1; + coladvance(cursor_pos1.col); + } + + /* Delete the empty line that was in the empty buffer. */ + ml_delete(1, FALSE); + + /* For term_dumpload() we are done here. */ + if (!do_diff) + goto theend; + + term->tl_top_diff_rows = curbuf->b_ml.ml_line_count; + + textline = get_separator(width, fname1); + if (textline == NULL) + goto theend; + if (add_empty_scrollback(term, &term->tl_default_color, 0) == OK) + ml_append(curbuf->b_ml.ml_line_count, textline, 0, FALSE); + vim_free(textline); + + textline = get_separator(width, fname2); + if (textline == NULL) + goto theend; + if (add_empty_scrollback(term, &term->tl_default_color, 0) == OK) + ml_append(curbuf->b_ml.ml_line_count, textline, 0, FALSE); + textline[width] = NUL; + + bot_lnum = curbuf->b_ml.ml_line_count; + width2 = read_dump_file(fd2, &cursor_pos2); + if (width2 > width) + { + vim_free(textline); + textline = alloc(width2 + 1); + if (textline == NULL) + goto theend; + width = width2; + textline[width] = NUL; + } + term->tl_bot_diff_rows = curbuf->b_ml.ml_line_count - bot_lnum; + + for (lnum = 1; lnum <= term->tl_top_diff_rows; ++lnum) + { + if (lnum + bot_lnum > curbuf->b_ml.ml_line_count) + { + /* bottom part has fewer rows, fill with "-" */ + for (i = 0; i < width; ++i) + textline[i] = '-'; + } + else + { + char_u *line1; + char_u *line2; + char_u *p1; + char_u *p2; + int col; + sb_line_T *sb_line = (sb_line_T *)term->tl_scrollback.ga_data; + cellattr_T *cellattr1 = (sb_line + lnum - 1)->sb_cells; + cellattr_T *cellattr2 = (sb_line + lnum + bot_lnum - 1) + ->sb_cells; + + /* Make a copy, getting the second line will invalidate it. */ + line1 = vim_strsave(ml_get(lnum)); + if (line1 == NULL) + break; + p1 = line1; + + line2 = ml_get(lnum + bot_lnum); + p2 = line2; + for (col = 0; col < width && *p1 != NUL && *p2 != NUL; ++col) + { + int len1 = utfc_ptr2len(p1); + int len2 = utfc_ptr2len(p2); + + textline[col] = ' '; + if (len1 != len2 || STRNCMP(p1, p2, len1) != 0) + /* text differs */ + textline[col] = 'X'; + else if (lnum == cursor_pos1.row + 1 + && col == cursor_pos1.col + && (cursor_pos1.row != cursor_pos2.row + || cursor_pos1.col != cursor_pos2.col)) + /* cursor in first but not in second */ + textline[col] = '>'; + else if (lnum == cursor_pos2.row + 1 + && col == cursor_pos2.col + && (cursor_pos1.row != cursor_pos2.row + || cursor_pos1.col != cursor_pos2.col)) + /* cursor in second but not in first */ + textline[col] = '<'; + else if (cellattr1 != NULL && cellattr2 != NULL) + { + if ((cellattr1 + col)->width + != (cellattr2 + col)->width) + textline[col] = 'w'; + else if (!same_color(&(cellattr1 + col)->fg, + &(cellattr2 + col)->fg)) + textline[col] = 'f'; + else if (!same_color(&(cellattr1 + col)->bg, + &(cellattr2 + col)->bg)) + textline[col] = 'b'; + else if (vtermAttr2hl((cellattr1 + col)->attrs) + != vtermAttr2hl(((cellattr2 + col)->attrs))) + textline[col] = 'a'; + } + p1 += len1; + p2 += len2; + /* TODO: handle different width */ + } + vim_free(line1); + + while (col < width) + { + if (*p1 == NUL && *p2 == NUL) + textline[col] = '?'; + else if (*p1 == NUL) + { + textline[col] = '+'; + p2 += utfc_ptr2len(p2); + } + else + { + textline[col] = '-'; + p1 += utfc_ptr2len(p1); + } + ++col; + } + } + if (add_empty_scrollback(term, &term->tl_default_color, + term->tl_top_diff_rows) == OK) + ml_append(term->tl_top_diff_rows + lnum, textline, 0, FALSE); + ++bot_lnum; + } + + while (lnum + bot_lnum <= curbuf->b_ml.ml_line_count) + { + /* bottom part has more rows, fill with "+" */ + for (i = 0; i < width; ++i) + textline[i] = '+'; + if (add_empty_scrollback(term, &term->tl_default_color, + term->tl_top_diff_rows) == OK) + ml_append(term->tl_top_diff_rows + lnum, textline, 0, FALSE); + ++lnum; + ++bot_lnum; + } + + term->tl_cols = width; + + /* looks better without wrapping */ + curwin->w_p_wrap = 0; + } + +theend: + vim_free(textline); + vim_free(fname_tofree); + fclose(fd1); + if (fd2 != NULL) + fclose(fd2); } /* - * Cache "Terminal" highlight group colors. + * If the current buffer shows the output of term_dumpdiff(), swap the top and + * bottom files. + * Return FAIL when this is not possible. */ - void -set_terminal_default_colors(int cterm_fg, int cterm_bg) + int +term_swap_diff() { - term_default_cterm_fg = cterm_fg - 1; - term_default_cterm_bg = cterm_bg - 1; + term_T *term = curbuf->b_term; + linenr_T line_count; + linenr_T top_rows; + linenr_T bot_rows; + linenr_T bot_start; + linenr_T lnum; + char_u *p; + sb_line_T *sb_line; + + if (term == NULL + || !term_is_finished(curbuf) + || term->tl_top_diff_rows == 0 + || term->tl_scrollback.ga_len == 0) + return FAIL; + + line_count = curbuf->b_ml.ml_line_count; + top_rows = term->tl_top_diff_rows; + bot_rows = term->tl_bot_diff_rows; + bot_start = line_count - bot_rows; + sb_line = (sb_line_T *)term->tl_scrollback.ga_data; + + /* move lines from top to above the bottom part */ + for (lnum = 1; lnum <= top_rows; ++lnum) + { + p = vim_strsave(ml_get(1)); + if (p == NULL) + return OK; + ml_append(bot_start, p, 0, FALSE); + ml_delete(1, FALSE); + vim_free(p); + } + + /* move lines from bottom to the top */ + for (lnum = 1; lnum <= bot_rows; ++lnum) + { + p = vim_strsave(ml_get(bot_start + lnum)); + if (p == NULL) + return OK; + ml_delete(bot_start + lnum, FALSE); + ml_append(lnum - 1, p, 0, FALSE); + vim_free(p); + } + + if (top_rows == bot_rows) + { + /* rows counts are equal, can swap cell properties */ + for (lnum = 0; lnum < top_rows; ++lnum) + { + sb_line_T temp; + + temp = *(sb_line + lnum); + *(sb_line + lnum) = *(sb_line + bot_start + lnum); + *(sb_line + bot_start + lnum) = temp; + } + } + else + { + size_t size = sizeof(sb_line_T) * term->tl_scrollback.ga_len; + sb_line_T *temp = (sb_line_T *)alloc((int)size); + + /* need to copy cell properties into temp memory */ + if (temp != NULL) + { + mch_memmove(temp, term->tl_scrollback.ga_data, size); + mch_memmove(term->tl_scrollback.ga_data, + temp + bot_start, + sizeof(sb_line_T) * bot_rows); + mch_memmove((sb_line_T *)term->tl_scrollback.ga_data + bot_rows, + temp + top_rows, + sizeof(sb_line_T) * (line_count - top_rows - bot_rows)); + mch_memmove((sb_line_T *)term->tl_scrollback.ga_data + + line_count - top_rows, + temp, + sizeof(sb_line_T) * top_rows); + vim_free(temp); + } + } + + term->tl_top_diff_rows = bot_rows; + term->tl_bot_diff_rows = top_rows; + + update_screen(NOT_VALID); + return OK; } /* - * Get the buffer from the first argument in "argvars". - * Returns NULL when the buffer is not for a terminal window. + * "term_dumpdiff(filename, filename, options)" function */ - static buf_T * -term_get_buf(typval_T *argvars) + void +f_term_dumpdiff(typval_T *argvars, typval_T *rettv) { - buf_T *buf; + term_load_dump(argvars, rettv, TRUE); +} - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ - ++emsg_off; - buf = get_buf_tv(&argvars[0], FALSE); - --emsg_off; - if (buf == NULL || buf->b_term == NULL) - return NULL; - return buf; +/* + * "term_dumpload(filename, options)" function + */ + void +f_term_dumpload(typval_T *argvars, typval_T *rettv) +{ + term_load_dump(argvars, rettv, FALSE); } /* @@ -2750,7 +4493,7 @@ void f_term_getaltscreen(typval_T *argvars, typval_T *rettv) { - buf_T *buf = term_get_buf(argvars); + buf_T *buf = term_get_buf(argvars, "term_getaltscreen()"); if (buf == NULL) return; @@ -2797,7 +4540,7 @@ void f_term_getcursor(typval_T *argvars, typval_T *rettv) { - buf_T *buf = term_get_buf(argvars); + buf_T *buf = term_get_buf(argvars, "term_getcursor()"); term_T *term; list_T *l; dict_T *d; @@ -2831,7 +4574,7 @@ void f_term_getjob(typval_T *argvars, typval_T *rettv) { - buf_T *buf = term_get_buf(argvars); + buf_T *buf = term_get_buf(argvars, "term_getjob()"); rettv->v_type = VAR_JOB; rettv->vval.v_job = NULL; @@ -2859,7 +4602,7 @@ void f_term_getline(typval_T *argvars, typval_T *rettv) { - buf_T *buf = term_get_buf(argvars); + buf_T *buf = term_get_buf(argvars, "term_getline()"); term_T *term; int row; @@ -2906,7 +4649,7 @@ void f_term_getscrolled(typval_T *argvars, typval_T *rettv) { - buf_T *buf = term_get_buf(argvars); + buf_T *buf = term_get_buf(argvars, "term_getscrolled()"); if (buf == NULL) return; @@ -2919,7 +4662,7 @@ void f_term_getsize(typval_T *argvars, typval_T *rettv) { - buf_T *buf = term_get_buf(argvars); + buf_T *buf = term_get_buf(argvars, "term_getsize()"); list_T *l; if (rettv_list_alloc(rettv) == FAIL) @@ -2933,12 +4676,42 @@ } /* + * "term_setsize(buf, rows, cols)" function + */ + void +f_term_setsize(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ + buf_T *buf = term_get_buf(argvars, "term_setsize()"); + term_T *term; + varnumber_T rows, cols; + + if (buf == NULL) + { + EMSG(_("E955: Not a terminal buffer")); + return; + } + if (buf->b_term->tl_vterm == NULL) + return; + term = buf->b_term; + rows = get_tv_number(&argvars[1]); + rows = rows <= 0 ? term->tl_rows : rows; + cols = get_tv_number(&argvars[2]); + cols = cols <= 0 ? term->tl_cols : cols; + vterm_set_size(term->tl_vterm, rows, cols); + /* handle_resize() will resize the windows */ + + /* Get and remember the size we ended up with. Update the pty. */ + vterm_get_size(term->tl_vterm, &term->tl_rows, &term->tl_cols); + term_report_winsize(term, term->tl_rows, term->tl_cols); +} + +/* * "term_getstatus(buf)" function */ void f_term_getstatus(typval_T *argvars, typval_T *rettv) { - buf_T *buf = term_get_buf(argvars); + buf_T *buf = term_get_buf(argvars, "term_getstatus()"); term_T *term; char_u val[100]; @@ -2962,7 +4735,7 @@ void f_term_gettitle(typval_T *argvars, typval_T *rettv) { - buf_T *buf = term_get_buf(argvars); + buf_T *buf = term_get_buf(argvars, "term_gettitle()"); rettv->v_type = VAR_STRING; if (buf == NULL) @@ -2978,7 +4751,7 @@ void f_term_gettty(typval_T *argvars, typval_T *rettv) { - buf_T *buf = term_get_buf(argvars); + buf_T *buf = term_get_buf(argvars, "term_gettty()"); char_u *p; int num = 0; @@ -3036,7 +4809,7 @@ void f_term_scrape(typval_T *argvars, typval_T *rettv) { - buf_T *buf = term_get_buf(argvars); + buf_T *buf = term_get_buf(argvars, "term_scrape()"); VTermScreen *screen = NULL; VTermPos pos; list_T *l; @@ -3116,6 +4889,8 @@ bg = cell.bg; } dcell = dict_alloc(); + if (dcell == NULL) + break; list_append_dict(l, dcell); dict_add_nr_str(dcell, "chars", 0, mbs); @@ -3143,7 +4918,7 @@ void f_term_sendkeys(typval_T *argvars, typval_T *rettv) { - buf_T *buf = term_get_buf(argvars); + buf_T *buf = term_get_buf(argvars, "term_sendkeys()"); char_u *msg; term_T *term; @@ -3165,6 +4940,112 @@ } } +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) +/* + * "term_getansicolors(buf)" function + */ + void +f_term_getansicolors(typval_T *argvars, typval_T *rettv) +{ + buf_T *buf = term_get_buf(argvars, "term_getansicolors()"); + term_T *term; + VTermState *state; + VTermColor color; + char_u hexbuf[10]; + int index; + list_T *list; + + if (rettv_list_alloc(rettv) == FAIL) + return; + + if (buf == NULL) + return; + term = buf->b_term; + if (term->tl_vterm == NULL) + return; + + list = rettv->vval.v_list; + state = vterm_obtain_state(term->tl_vterm); + for (index = 0; index < 16; index++) + { + vterm_state_get_palette_color(state, index, &color); + sprintf((char *)hexbuf, "#%02x%02x%02x", + color.red, color.green, color.blue); + if (list_append_string(list, hexbuf, 7) == FAIL) + return; + } +} + +/* + * "term_setansicolors(buf, list)" function + */ + void +f_term_setansicolors(typval_T *argvars, typval_T *rettv UNUSED) +{ + buf_T *buf = term_get_buf(argvars, "term_setansicolors()"); + term_T *term; + + if (buf == NULL) + return; + term = buf->b_term; + if (term->tl_vterm == NULL) + return; + + if (argvars[1].v_type != VAR_LIST || argvars[1].vval.v_list == NULL) + { + EMSG(_(e_listreq)); + return; + } + + if (set_ansi_colors_list(term->tl_vterm, argvars[1].vval.v_list) == FAIL) + EMSG(_(e_invarg)); +} +#endif + +/* + * "term_setrestore(buf, command)" function + */ + void +f_term_setrestore(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ +#if defined(FEAT_SESSION) + buf_T *buf = term_get_buf(argvars, "term_setrestore()"); + term_T *term; + char_u *cmd; + + if (buf == NULL) + return; + term = buf->b_term; + vim_free(term->tl_command); + cmd = get_tv_string_chk(&argvars[1]); + if (cmd != NULL) + term->tl_command = vim_strsave(cmd); + else + term->tl_command = NULL; +#endif +} + +/* + * "term_setkill(buf, how)" function + */ + void +f_term_setkill(typval_T *argvars UNUSED, typval_T *rettv UNUSED) +{ + buf_T *buf = term_get_buf(argvars, "term_setkill()"); + term_T *term; + char_u *how; + + if (buf == NULL) + return; + term = buf->b_term; + vim_free(term->tl_kill); + how = get_tv_string_chk(&argvars[1]); + if (how != NULL) + term->tl_kill = vim_strsave(how); + else + term->tl_kill = NULL; +} + /* * "term_start(command, options)" function */ @@ -3182,12 +5063,12 @@ + JO_EXIT_CB + JO_CLOSE_CALLBACK + JO_OUT_IO, JO2_TERM_NAME + JO2_TERM_FINISH + JO2_HIDDEN + JO2_TERM_OPENCMD + JO2_TERM_COLS + JO2_TERM_ROWS + JO2_VERTICAL + JO2_CURWIN - + JO2_CWD + JO2_ENV + JO2_EOF_CHARS) == FAIL) + + JO2_CWD + JO2_ENV + JO2_EOF_CHARS + + JO2_NORESTORE + JO2_TERM_KILL + + JO2_ANSI_COLORS) == FAIL) return; - if (opt.jo_vertical) - cmdmod.split = WSP_VERT; - buf = term_start(&argvars[0], &opt, FALSE); + buf = term_start(&argvars[0], NULL, &opt, 0); if (buf != NULL && buf->b_term != NULL) rettv->vval.v_number = buf->b_fnum; @@ -3199,13 +5080,10 @@ void f_term_wait(typval_T *argvars, typval_T *rettv UNUSED) { - buf_T *buf = term_get_buf(argvars); + buf_T *buf = term_get_buf(argvars, "term_wait()"); if (buf == NULL) - { - ch_log(NULL, "term_wait(): invalid argument"); return; - } if (buf->b_term->tl_job == NULL) { ch_log(NULL, "term_wait(): no job to wait for"); @@ -3216,8 +5094,7 @@ return; /* Get the job status, this will detect a job that finished. */ - if ((buf->b_term->tl_job->jv_channel == NULL - || !buf->b_term->tl_job->jv_channel->ch_keep_open) + if (!buf->b_term->tl_job->jv_channel->ch_keep_open && STRCMP(job_status(buf->b_term->tl_job), "dead") == 0) { /* The job is dead, keep reading channel I/O until the channel is @@ -3292,7 +5169,7 @@ #define WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN 1ul #define WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN 2ull -#define WINPTY_MOUSE_MODE_FORCE 2 +#define WINPTY_MOUSE_MODE_FORCE 2 void* (*winpty_config_new)(UINT64, void*); void* (*winpty_open)(void*, void*); @@ -3387,6 +5264,7 @@ term_and_job_init( term_T *term, typval_T *argvar, + char **argv UNUSED, jobopt_T *opt) { WCHAR *cmd_wchar = NULL; @@ -3434,14 +5312,6 @@ win32_build_env(opt->jo_env, &ga_env, TRUE); env_wchar = ga_env.ga_data; - job = job_alloc(); - if (job == NULL) - goto failed; - - channel = add_channel(); - if (channel == NULL) - goto failed; - term->tl_winpty_config = winpty_config_new(0, &winpty_err); if (term->tl_winpty_config == NULL) goto failed; @@ -3472,6 +5342,18 @@ job = job_alloc(); if (job == NULL) goto failed; + if (argvar->v_type == VAR_STRING) + { + int argc; + + build_argv_from_string(cmd, &job->jv_argv, &argc); + } + else + { + int argc; + + build_argv_from_list(argvar->vval.v_list, &job->jv_argv, &argc); + } if (opt->jo_set & JO_IN_BUF) job->jv_in_buf = buflist_findnr(opt->jo_io_buf[PART_IN]); @@ -3515,6 +5397,13 @@ create_vterm(term, term->tl_rows, term->tl_cols); +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + if (opt->jo_set2 & JO2_ANSI_COLORS) + set_vterm_palette(term->tl_vterm, opt->jo_ansi_colors); + else + init_vterm_ansi_colors(term->tl_vterm); +#endif + channel_set_job(channel, job, opt); job_set_options(job, opt); @@ -3650,7 +5539,7 @@ } /* - * Request size to terminal. + * Report the size to the terminal. */ static void term_report_winsize(term_T *term, int rows, int cols) @@ -3675,17 +5564,27 @@ * Create a new terminal of "rows" by "cols" cells. * Start job for "cmd". * Store the pointers in "term". + * When "argv" is not NULL then "argvar" is not used. * Return OK or FAIL. */ static int term_and_job_init( term_T *term, typval_T *argvar, + char **argv, jobopt_T *opt) { create_vterm(term, term->tl_rows, term->tl_cols); - term->tl_job = job_start(argvar, opt); +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + if (opt->jo_set2 & JO2_ANSI_COLORS) + set_vterm_palette(term->tl_vterm, opt->jo_ansi_colors); + else + init_vterm_ansi_colors(term->tl_vterm); +#endif + + /* This may change a string in "argvar". */ + term->tl_job = job_start(argvar, argv, opt); if (term->tl_job != NULL) ++term->tl_job->jv_refcount; @@ -3722,7 +5621,7 @@ } /* - * Request size to terminal. + * Report the size to the terminal. */ static void term_report_winsize(term_T *term, int rows, int cols) diff -Nru vim-8.0.1453/src/testdir/dumps/Test_popup_command_01.dump vim-8.0.1766/src/testdir/dumps/Test_popup_command_01.dump --- vim-8.0.1453/src/testdir/dumps/Test_popup_command_01.dump 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/dumps/Test_popup_command_01.dump 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,20 @@ +|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| @51 +|a|n|d| |o|n|e| |t|w|o| >X|t|h|r|e@1| |f|o|u|r| |f|i|v|e| @46 +|o|n|e| |m|o|r|e| |t|w| +0#0000001#ffd7ff255|U|n|d|o| @12| +0#0000000#ffffff0@45 +|~+0#4040ff13&| @9| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|P|a|s|t|e| @11| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |W|o|r|d| @5| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |S|e|n|t|e|n|c|e| @1| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |P|a|r|a|g|r|a|p|h| | +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |L|i|n|e| @5| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |B|l|o|c|k| @4| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |A|l@1| @6| +0#4040ff13#ffffff0@45 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|:+0#0000000&|p|o|p|u|p| |P|o|p|U|p| @62 diff -Nru vim-8.0.1453/src/testdir/dumps/Test_popup_command_02.dump vim-8.0.1766/src/testdir/dumps/Test_popup_command_02.dump --- vim-8.0.1453/src/testdir/dumps/Test_popup_command_02.dump 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/dumps/Test_popup_command_02.dump 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,20 @@ +|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| @51 +|a|n|d| |o|n|e| |t|w|o| >X|t|h|r|e@1| |f|o|u|r| |f|i|v|e| @46 +|o|n|e| |m|o|r|e| |t|w| +0#0000001#ffd7ff255|U|n|d|o| @12| +0#0000000#ffffff0@45 +|~+0#4040ff13&| @9| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#e0e0e08|P|a|s|t|e| @11| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |W|o|r|d| @5| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |S|e|n|t|e|n|c|e| @1| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |P|a|r|a|g|r|a|p|h| | +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |L|i|n|e| @5| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |B|l|o|c|k| @4| +0#4040ff13#ffffff0@45 +|~| @9| +0#0000001#ffd7ff255|S|e|l|e|c|t| |A|l@1| @6| +0#4040ff13#ffffff0@45 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|:+0#0000000&|p|o|p|u|p| |P|o|p|U|p| @62 diff -Nru vim-8.0.1453/src/testdir/dumps/Test_popup_command_03.dump vim-8.0.1766/src/testdir/dumps/Test_popup_command_03.dump --- vim-8.0.1453/src/testdir/dumps/Test_popup_command_03.dump 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/dumps/Test_popup_command_03.dump 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,20 @@ +|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| @51 +|a|n|d| |o|n|e| |t|w|o| |X+0&#e0e0e08|t|h|r|e@1> +0&#ffffff0|f|o|u|r| |f|i|v|e| @46 +|o|n|e| |m|o|r|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| @46 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|-+2#0000000&@1| |V|I|S|U|A|L| |-@1| +0&&@34|7| @8|2|,|1|9| @9|A|l@1| diff -Nru vim-8.0.1453/src/testdir/dumps/Test_popup_position_01.dump vim-8.0.1766/src/testdir/dumps/Test_popup_position_01.dump --- vim-8.0.1453/src/testdir/dumps/Test_popup_position_01.dump 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/dumps/Test_popup_position_01.dump 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,8 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @5||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @5 +|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @5||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @5 +@12|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5||+1&&| +0&&@11|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|6|7|8|9|_|a> @30||+1&&|6+0&&|7|8|9|_|a| @30 +|~+0#4040ff13&| @9| +0#0000001#e0e0e08|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| | +0#4040ff13#ffffff0@30 +|~| @9| +0#0000001#ffd7ff255|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| | +0#4040ff13#ffffff0@30 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 diff -Nru vim-8.0.1453/src/testdir/dumps/Test_popup_position_02.dump vim-8.0.1766/src/testdir/dumps/Test_popup_position_02.dump --- vim-8.0.1453/src/testdir/dumps/Test_popup_position_02.dump 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/dumps/Test_popup_position_02.dump 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,8 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @5||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @5 +|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @5||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @5 +@12|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5||+1&&| +0&&@11|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|6|7|8|9|_|a| @30||+1&&|6+0&&|7|8|9|_|a> @30 +|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @9| +0#0000001#e0e0e08|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @9| +0#0000001#ffd7ff255|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 diff -Nru vim-8.0.1453/src/testdir/dumps/Test_popup_position_03.dump vim-8.0.1766/src/testdir/dumps/Test_popup_position_03.dump --- vim-8.0.1453/src/testdir/dumps/Test_popup_position_03.dump 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/dumps/Test_popup_position_03.dump 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,8 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @5||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @5 +|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @5||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @5 +@12|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5||+1&&| +0&&@11|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|6|7|8|9|_|a| @30||+1&&|6+0&&|7|8|9|_|a> @30 +|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @4| +0#0000001#e0e0e08|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_ +|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @4| +0#0000001#ffd7ff255|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_ +|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 diff -Nru vim-8.0.1453/src/testdir/dumps/Test_popup_position_04.dump vim-8.0.1766/src/testdir/dumps/Test_popup_position_04.dump --- vim-8.0.1453/src/testdir/dumps/Test_popup_position_04.dump 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/dumps/Test_popup_position_04.dump 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,10 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7 +|8|9|_|a| @32||+1&&|8+0&&|9|_|a| @32 +|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7||+1&&|1+0&&|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7 +|8|9|_|b| @32||+1&&|8+0&&|9|_|b| @32 +@12|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5||+1&&| +0&&@11|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @20||+1&&|6+0&&|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a> @20 +|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @9| +0#0000001#e0e0e08|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @9| +0#0000001#ffd7ff255|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5 +|~+0#4040ff13#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 diff -Nru vim-8.0.1453/src/testdir/dumps/Test_syntax_c_01.dump vim-8.0.1766/src/testdir/dumps/Test_syntax_c_01.dump --- vim-8.0.1453/src/testdir/dumps/Test_syntax_c_01.dump 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/dumps/Test_syntax_c_01.dump 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,20 @@ +>/+0#0000e05#ffffff0|*| |c|o|m@1|e|n|t| |l|i|n|e| |a|t| |t|h|e| |t|o|p| |*|/| +0#0000000&@45 +| @1|i+0#00e0003&|n|t| +0#0000000&@69 +|m|a|i|n|(|i+0#00e0003&|n|t| +0#0000000&|a|r|g|c|,| |c+0#00e0003&|h|a|r| +0#0000000&|*@1|a|r|g|v|)|/+0#0000e05&@1| |a|n|o|t|h|e|r| |c|o|m@1|e|n|t| +0#0000000&@29 +|{| @73 +|#+0#e000e06&|i|f| |0| +0#0000000&@69 +| +0#0000e05&@2|i|n|t| @2|n|o|t|_|u|s|e|d|;| +0#0000000&@56 +|#+0#e000e06&|e|l|s|e| +0#0000000&@69 +| @2|i+0#00e0003&|n|t| +0#0000000&@2|u|s|e|d|;| @60 +|#+0#e000e06&|e|n|d|i|f| +0#0000000&@68 +| @2|p|r|i|n|t|f|(|"+0#e000002&|J|u|s|t| |a|n| |e|x|a|m|p|l|e| |p|i|e|c|e| |o|f| |C| |c|o|d|e|\+0#e000e06&|n|"+0#e000002&|)+0#0000000&|;| @27 +| @2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|0+0#e000002&|x|0|f@1|;+0#0000000&| @58 +|}| @73 +| @2|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@60 +|m|y|F|u|n|c|t|i|o|n|(|c+0#00e0003&|o|n|s|t| +0#0000000&|d+0#00e0003&|o|u|b|l|e| +0#0000000&|c|o|u|n|t|,| |s+0#00e0003&|t|r|u|c|t| +0#0000000&|n|o|t|h|i|n|g|,| |l+0#00e0003&|o|n|g| +0#0000000&|t|h|e|r|e|)| |{| @14 +| @1|/+0#0000e05&@1| |1+0#e000002&|2|3|:+0#0000e05&| |n|o|t|h|i|n|g| |t|o| |r|e|a|d| |h|e|r|e| +0#0000000&@44 +| @1|f+0#af5f00255&|o|r| +0#0000000&|(|i+0#00e0003&|n|t| +0#0000000&|i| |=| |0+0#e000002&|;+0#0000000&| |i| |<| |c|o|u|n|t|;| |+@1|i|)| |{| @39 +| @3|b+0#af5f00255&|r|e|a|k|;+0#0000000&| @64 +| @1|}| @71 +|}| @73 +|"|X|t|e|s|t|.|c|"| |1|9|L|,| |3|6|4|C| @37|1|,|1| @10|A|l@1| diff -Nru vim-8.0.1453/src/testdir/gen_opt_test.vim vim-8.0.1766/src/testdir/gen_opt_test.vim --- vim-8.0.1453/src/testdir/gen_opt_test.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/gen_opt_test.vim 2018-04-26 20:30:33.000000000 +0000 @@ -129,8 +129,10 @@ \ 'switchbuf': [['', 'useopen', 'split,newtab'], ['xxx']], \ 'tagcase': [['smart', 'match'], ['', 'xxx', 'smart,match']], \ 'term': [[], []], - \ 'termsize': [['', '24x80', '0x80', '32x0', '0x0'], ['xxx', '80', '8ax9', '24x80b']], + \ 'termguicolors': [[], []], \ 'termencoding': [has('gui_gtk') ? [] : ['', 'utf-8'], ['xxx']], + \ 'termsize': [['', '24x80', '0x80', '32x0', '0x0'], ['xxx', '80', '8ax9', '24x80b']], + \ 'termwinsize': [['', '24x80', '0x80', '32x0', '0x0'], ['xxx', '80', '8ax9', '24x80b']], \ 'toolbar': [['', 'icons', 'text'], ['xxx']], \ 'toolbariconsize': [['', 'tiny', 'huge'], ['xxx']], \ 'ttymouse': [['', 'xterm'], ['xxx']], diff -Nru vim-8.0.1453/src/testdir/Make_all.mak vim-8.0.1766/src/testdir/Make_all.mak --- vim-8.0.1453/src/testdir/Make_all.mak 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/Make_all.mak 2018-04-26 20:30:33.000000000 +0000 @@ -72,9 +72,11 @@ test_autocmd.res \ test_autoload.res \ test_backspace_opt.res \ + test_blockedit.res \ test_breakindent.res \ test_bufwintabinfo.res \ test_cdo.res \ + test_changelist.res \ test_channel.res \ test_charsearch.res \ test_cindent.res \ @@ -96,6 +98,7 @@ test_exec_while_if.res \ test_exists.res \ test_exists_autocmd.res \ + test_exit.res \ test_farsi.res \ test_file_size.res \ test_find_complete.res \ @@ -120,6 +123,7 @@ test_ins_complete.res \ test_job_fails.res \ test_json.res \ + test_jumplist.res \ test_langmap.res \ test_let.res \ test_lineending.res \ @@ -184,6 +188,7 @@ test_windows_home.res \ test_wordcount.res \ test_writefile.res \ + test_xxd.res \ test_alot_latin.res \ test_alot_utf8.res \ test_alot.res diff -Nru vim-8.0.1453/src/testdir/Makefile vim-8.0.1766/src/testdir/Makefile --- vim-8.0.1453/src/testdir/Makefile 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/Makefile 2018-04-26 20:30:33.000000000 +0000 @@ -4,6 +4,7 @@ # Use console or GUI. VIMPROG = ../vim +XXDPROG = ../xxd/xxd # VIMPROG = ../gvim SCRIPTSOURCE = ../../runtime @@ -145,3 +146,6 @@ opt_test.vim: ../option.c gen_opt_test.vim $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../option.c + +test_xxd.res: + XXD=$(XXDPROG); export XXD; $(RUN_VIMTEST) $(NO_INITS) -S runtest.vim test_xxd.vim diff -Nru vim-8.0.1453/src/testdir/README.txt vim-8.0.1766/src/testdir/README.txt --- vim-8.0.1453/src/testdir/README.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/README.txt 2018-04-26 20:30:33.000000000 +0000 @@ -35,6 +35,12 @@ - See the start of runtest.vim for more help. +TO ADD A SCREEN DUMP TEST: + +Mostly the same as writing a new style test. Additonally, see help on +"terminal-dumptest". Put the reference dump in "dumps/Test_func_name.dump". + + TO ADD AN OLD STYLE TEST: 1) Create test_.in and test_.ok files. diff -Nru vim-8.0.1453/src/testdir/runtest.vim vim-8.0.1766/src/testdir/runtest.vim --- vim-8.0.1453/src/testdir/runtest.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/runtest.vim 2018-04-26 20:30:33.000000000 +0000 @@ -199,7 +199,11 @@ write endif - let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test') + if s:done == 0 + let message = 'NO tests executed' + else + let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test') + endif echo message call add(s:messages, message) if s:fail > 0 @@ -248,6 +252,7 @@ \ 'Test_close_and_exit_cb()', \ 'Test_collapse_buffers()', \ 'Test_communicate()', + \ 'Test_cwd()', \ 'Test_exit_callback_interval()', \ 'Test_nb_basic()', \ 'Test_oneshot()', @@ -258,6 +263,7 @@ \ 'Test_quoteplus()', \ 'Test_quotestar()', \ 'Test_reltime()', + \ 'Test_repeat_three()', \ 'Test_terminal_composing_unicode()', \ 'Test_terminal_noblock()', \ 'Test_terminal_redir_file()', diff -Nru vim-8.0.1453/src/testdir/screendump.vim vim-8.0.1766/src/testdir/screendump.vim --- vim-8.0.1453/src/testdir/screendump.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/screendump.vim 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,106 @@ +" Functions shared by tests making screen dumps. + +" Only load this script once. +if exists('*CanRunVimInTerminal') + finish +endif + +" Need to be able to run terminal Vim with 256 colors. On MS-Windows the +" console only has 16 colors and the GUI can't run in a terminal. +if !has('terminal') || has('win32') + func CanRunVimInTerminal() + return 0 + endfunc + finish +endif + +func CanRunVimInTerminal() + return 1 +endfunc + +source shared.vim + +" Run Vim with "arguments" in a new terminal window. +" By default uses a size of 20 lines and 75 columns. +" Returns the buffer number of the terminal. +" +" Options is a dictionary, these items are recognized: +" "rows" - height of the terminal window (max. 20) +" "cols" - width of the terminal window (max. 78) +func RunVimInTerminal(arguments, options) + " If Vim doesn't exit a swap file remains, causing other tests to fail. + " Remove it here. + call delete(".swp") + + if exists('$COLORFGBG') + " Clear $COLORFGBG to avoid 'background' being set to "dark", which will + " only be corrected if the response to t_RB is received, which may be too + " late. + let $COLORFGBG = '' + endif + + " Make a horizontal and vertical split, so that we can get exactly the right + " size terminal window. Works only when the current window is full width. + call assert_equal(&columns, winwidth(0)) + split + vsplit + + " Always do this with 256 colors and a light background. + set t_Co=256 background=light + hi Normal ctermfg=NONE ctermbg=NONE + + " Make the window 20 lines high and 75 columns, unless told otherwise. + let rows = get(a:options, 'rows', 20) + let cols = get(a:options, 'cols', 75) + + let cmd = GetVimCommandClean() + " Add -v to have gvim run in the terminal (if possible) + let cmd .= ' -v ' . a:arguments + let buf = term_start(cmd, {'curwin': 1, 'term_rows': rows, 'term_cols': cols}) + if &termsize == '' + call assert_equal([rows, cols], term_getsize(buf)) + else + let rows = term_getsize(buf)[0] + let cols = term_getsize(buf)[1] + endif + + " Wait for "All" of the ruler in the status line to be shown. + " This can be quite slow (e.g. when using valgrind). + call WaitFor({-> len(term_getline(buf, rows)) >= cols - 1}) + + return buf +endfunc + +" Stop a Vim running in terminal buffer "buf". +func StopVimInTerminal(buf) + call assert_equal("running", term_getstatus(a:buf)) + call term_sendkeys(a:buf, "\\:qa!\") + call WaitFor('term_getstatus(' . a:buf . ') == "finished"') + only! +endfunc + +" Verify that Vim running in terminal buffer "buf" matches the screen dump. +" "options" is passed to term_dumpwrite(). +" The file name used is "dumps/{filename}.dump". +" Will wait for up to a second for the screen dump to match. +func VerifyScreenDump(buf, filename, options) + let reference = 'dumps/' . a:filename . '.dump' + let testfile = a:filename . '.dump.failed' + + let i = 0 + while 1 + call delete(testfile) + call term_dumpwrite(a:buf, testfile, a:options) + if readfile(reference) == readfile(testfile) + call delete(testfile) + break + endif + if i == 100 + " Leave the test file around for inspection. + call assert_report('See dump file difference: call term_dumpdiff("' . testfile . '", "' . reference . '")') + break + endif + sleep 10m + let i += 1 + endwhile +endfunc diff -Nru vim-8.0.1453/src/testdir/shared.vim vim-8.0.1766/src/testdir/shared.vim --- vim-8.0.1453/src/testdir/shared.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/shared.vim 2018-04-26 20:30:33.000000000 +0000 @@ -113,13 +113,14 @@ endif endfunc -" Wait for up to a second for "expr" to become true. "expr" can be a +" Wait for up to five seconds for "expr" to become true. "expr" can be a " stringified expression to evaluate, or a funcref without arguments. +" A second argument can be used to specify a different timeout in msec. " " Return time slept in milliseconds. With the +reltime feature this can be " more than the actual waiting time. Without +reltime it can also be less. func WaitFor(expr, ...) - let timeout = get(a:000, 0, 1000) + let timeout = get(a:000, 0, 5000) " using reltime() is more accurate, but not always available if has('reltime') let start = reltime() @@ -178,17 +179,20 @@ " The Makefile writes it as the first line in the "vimcmd" file. func GetVimProg() if !filereadable('vimcmd') - return '' + " Assume the script was sourced instead of running "make". + return '../vim' endif return readfile('vimcmd')[0] endfunc " Get the command to run Vim, with -u NONE and --not-a-term arguments. " If there is an argument use it instead of "NONE". -" Returns an empty string on error. func GetVimCommand(...) if !filereadable('vimcmd') - return '' + echo 'Cannot read the "vimcmd" file, falling back to ../vim.' + let lines = ['../vim'] + else + let lines = readfile('vimcmd') endif if a:0 == 0 let name = 'NONE' @@ -199,7 +203,6 @@ " "vimcmd" file, including environment options. " Other Makefiles just write the executable in the first line, so fall back " to that if there is no second line. - let lines = readfile('vimcmd') let cmd = get(lines, 1, lines[0]) let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '') if cmd !~ '-u '. name @@ -210,6 +213,14 @@ return cmd endfunc +" Get the command to run Vim, with --clean. +func GetVimCommandClean() + let cmd = GetVimCommand() + let cmd = substitute(cmd, '-u NONE', '--clean', '') + let cmd = substitute(cmd, '--not-a-term', '', '') + return cmd +endfunc + " Run Vim, using the "vimcmd" file and "-u NORC". " "before" is a list of Vim commands to be executed before loading plugins. " "after" is a list of Vim commands to be executed after loading plugins. @@ -248,3 +259,31 @@ func CanRunGui() return has('gui') && ($DISPLAY != "" || has('gui_running')) endfunc + +func WorkingClipboard() + if !has('clipboard') + return 0 + endif + if has('x11') + return $DISPLAY != "" + endif + return 1 +endfunc + +" Get line "lnum" as displayed on the screen. +" Trailing white space is trimmed. +func! Screenline(lnum) + let chars = [] + for c in range(1, winwidth(0)) + call add(chars, nr2char(screenchar(a:lnum, c))) + endfor + let line = join(chars, '') + return matchstr(line, '^.\{-}\ze\s*$') +endfunc + +" Stops the shell running in terminal "buf". +func Stop_shell_in_terminal(buf) + call term_sendkeys(a:buf, "exit\r") + let job = term_getjob(a:buf) + call WaitFor({-> job_status(job) == "dead"}) +endfunc diff -Nru vim-8.0.1453/src/testdir/test_arabic.vim vim-8.0.1766/src/testdir/test_arabic.vim --- vim-8.0.1453/src/testdir/test_arabic.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_arabic.vim 2018-04-26 20:30:33.000000000 +0000 @@ -16,9 +16,9 @@ let numchars = strchars(getline('.'), 1) for i in range(1, numchars) exe 'norm ' i . '|' - let c=execute('ascii') - let c=substitute(c, '\n\?<.\{-}Hex\s*', 'U+', 'g') - let c=substitute(c, ',\s*Octal\s*\d*', '', 'g') + let c = execute('ascii') + let c = substitute(c, '\n\?<.\{-}Hex\s*', 'U+', 'g') + let c = substitute(c, ',\s*Oct\(al\)\=\s\d*\(, Digr ..\)\=', '', 'g') call add(chars, c) endfor return chars diff -Nru vim-8.0.1453/src/testdir/test_arglist.vim vim-8.0.1766/src/testdir/test_arglist.vim --- vim-8.0.1453/src/testdir/test_arglist.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_arglist.vim 2018-04-26 20:30:33.000000000 +0000 @@ -122,9 +122,9 @@ call assert_equal(['d', 'c', 'b', 'a', 'c'], g:buffers) redir => result - ar + args redir END - call assert_true(result =~# 'a b \[c] d') + call assert_equal('a b [c] d', trim(result)) .argd call assert_equal(['a', 'b', 'd'], argv()) @@ -170,6 +170,34 @@ call assert_fails('argument', 'E163:') endfunc +func Test_list_arguments() + " Clean the argument list + arga a | %argd + + " four args half the screen width makes two lines with two columns + let aarg = repeat('a', &columns / 2 - 4) + let barg = repeat('b', &columns / 2 - 4) + let carg = repeat('c', &columns / 2 - 4) + let darg = repeat('d', &columns / 2 - 4) + exe 'argadd ' aarg barg carg darg + + redir => result + args + redir END + call assert_match('\[' . aarg . '] \+' . carg . '\n' . barg . ' \+' . darg, trim(result)) + + " if one arg is longer than half the screen make one column + exe 'argdel' aarg + let aarg = repeat('a', &columns / 2 + 2) + exe '0argadd' aarg + redir => result + args + redir END + call assert_match(aarg . '\n\[' . barg . ']\n' . carg . '\n' . darg, trim(result)) + + %argdelete +endfunc + " Test for 0argadd and 0argedit " Ported from the test_argument_0count.in test script func Test_zero_argadd() @@ -280,6 +308,18 @@ %argd bwipe! C bwipe! D + + " :argedit reuses the current buffer if it is empty + %argd + " make sure to use a new buffer number for x when it is loaded + bw! x + new + let a = bufnr('') + argedit x + call assert_equal(a, bufnr('')) + call assert_equal('x', bufname('')) + %argd + bw! x endfunc " Test for the :argdelete command diff -Nru vim-8.0.1453/src/testdir/test_assert.vim vim-8.0.1766/src/testdir/test_assert.vim --- vim-8.0.1453/src/testdir/test_assert.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_assert.vim 2018-04-26 20:30:33.000000000 +0000 @@ -25,6 +25,41 @@ call remove(v:errors, 0) endfunc +func Test_assert_equalfile() + call assert_equalfile('abcabc', 'xyzxyz') + call assert_match("E485: Can't read file abcabc", v:errors[0]) + call remove(v:errors, 0) + + let goodtext = ["one", "two", "three"] + call writefile(goodtext, 'Xone') + call assert_equalfile('Xone', 'xyzxyz') + call assert_match("E485: Can't read file xyzxyz", v:errors[0]) + call remove(v:errors, 0) + + call writefile(goodtext, 'Xtwo') + call assert_equalfile('Xone', 'Xtwo') + + call writefile([goodtext[0]], 'Xone') + call assert_equalfile('Xone', 'Xtwo') + call assert_match("first file is shorter", v:errors[0]) + call remove(v:errors, 0) + + call writefile(goodtext, 'Xone') + call writefile([goodtext[0]], 'Xtwo') + call assert_equalfile('Xone', 'Xtwo') + call assert_match("second file is shorter", v:errors[0]) + call remove(v:errors, 0) + + call writefile(['1234X89'], 'Xone') + call writefile(['1234Y89'], 'Xtwo') + call assert_equalfile('Xone', 'Xtwo') + call assert_match("difference at byte 4", v:errors[0]) + call remove(v:errors, 0) + + call delete('Xone') + call delete('Xtwo') +endfunc + func Test_assert_notequal() let n = 4 call assert_notequal('foo', n) @@ -111,6 +146,16 @@ call remove(v:errors, 0) endfunc +func Test_assert_beeps() + new + call assert_beeps('normal h') + + call assert_beeps('normal 0') + call assert_match("command did not beep: normal 0", v:errors[0]) + call remove(v:errors, 0) + bwipe +endfunc + func Test_assert_inrange() call assert_inrange(7, 7, 7) call assert_inrange(5, 7, 5) diff -Nru vim-8.0.1453/src/testdir/test_autocmd.vim vim-8.0.1766/src/testdir/test_autocmd.vim --- vim-8.0.1453/src/testdir/test_autocmd.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_autocmd.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,5 +1,7 @@ " Tests for autocommands +source shared.vim + func! s:cleanup_buffers() abort for bnr in range(1, bufnr('$')) if bufloaded(bnr) && bufnr('%') != bnr @@ -117,7 +119,9 @@ exe 'autocmd BufUnload ' . (lastbuf + 1) . 'bwipeout!' augroup END - call assert_fails('edit bb.txt', 'E937:') + " Todo: check for E937 generated first + " call assert_fails('edit bb.txt', 'E937:') + call assert_fails('edit bb.txt', 'E517:') autocmd! test_autocmd_bufunload augroup! test_autocmd_bufunload @@ -314,7 +318,7 @@ e Xtestje2 sp Xtestje1 call assert_fails('e', 'E937:') - call assert_equal('Xtestje2', expand('%')) + call assert_equal('Xtestje1', expand('%')) " Test changing buffers in a BufWipeout autocommand. If this goes wrong " there are ml_line errors and/or a Crash. @@ -336,7 +340,6 @@ au! enew - bwipe! Xtestje1 call delete('Xtestje1') call delete('Xtestje2') call delete('Xtestje3') @@ -834,6 +837,8 @@ au! CmdlineEnter au! CmdlineLeave + let save_shellslash = &shellslash + set noshellslash au! CmdlineEnter / let g:entered = expand('') au! CmdlineLeave / let g:left = expand('') let g:entered = 0 @@ -846,6 +851,7 @@ bwipe! au! CmdlineEnter au! CmdlineLeave + let &shellslash = save_shellslash endfunc " Test for BufWritePre autocommand that deletes or unloads the buffer. @@ -1179,7 +1185,9 @@ func Test_nocatch_wipe_all_buffers() " Real nasty autocommand: wipe all buffers on any event. au * * bwipe * - call assert_fails('next x', 'E93') + " Get E93 first? + " call assert_fails('next x', 'E93:') + call assert_fails('next x', 'E517:') bwipe au! endfunc @@ -1190,3 +1198,138 @@ call assert_fails('lv½ /x', 'E480') au! endfunc + +function s:Before_test_dirchanged() + augroup test_dirchanged + autocmd! + augroup END + let s:li = [] + let s:dir_this = getcwd() + let s:dir_other = s:dir_this . '/foo' + call mkdir(s:dir_other) +endfunc + +function s:After_test_dirchanged() + exe 'cd' s:dir_this + call delete(s:dir_other, 'd') + augroup test_dirchanged + autocmd! + augroup END +endfunc + +function Test_dirchanged_global() + call s:Before_test_dirchanged() + autocmd test_dirchanged DirChanged global call add(s:li, "cd:") + autocmd test_dirchanged DirChanged global call add(s:li, expand("")) + exe 'cd' s:dir_other + call assert_equal(["cd:", s:dir_other], s:li) + exe 'lcd' s:dir_other + call assert_equal(["cd:", s:dir_other], s:li) + call s:After_test_dirchanged() +endfunc + +function Test_dirchanged_local() + call s:Before_test_dirchanged() + autocmd test_dirchanged DirChanged window call add(s:li, "lcd:") + autocmd test_dirchanged DirChanged window call add(s:li, expand("")) + exe 'cd' s:dir_other + call assert_equal([], s:li) + exe 'lcd' s:dir_other + call assert_equal(["lcd:", s:dir_other], s:li) + call s:After_test_dirchanged() +endfunc + +function Test_dirchanged_auto() + if !exists('+autochdir') + return + endif + call s:Before_test_dirchanged() + call test_autochdir() + autocmd test_dirchanged DirChanged auto call add(s:li, "auto:") + autocmd test_dirchanged DirChanged auto call add(s:li, expand("")) + set acd + exe 'cd ..' + call assert_equal([], s:li) + exe 'edit ' . s:dir_other . '/Xfile' + call assert_equal(s:dir_other, getcwd()) + call assert_equal(["auto:", s:dir_other], s:li) + set noacd + bwipe! + call s:After_test_dirchanged() +endfunc + +" Test TextChangedI and TextChangedP +func Test_ChangedP() + new + call setline(1, ['foo', 'bar', 'foobar']) + call test_override("char_avail", 1) + set complete=. completeopt=menuone + + func! TextChangedAutocmd(char) + let g:autocmd .= a:char + endfunc + + au! TextChanged :call TextChangedAutocmd('N') + au! TextChangedI :call TextChangedAutocmd('I') + au! TextChangedP :call TextChangedAutocmd('P') + + call cursor(3, 1) + let g:autocmd = '' + call feedkeys("o\", 'tnix') + call assert_equal('I', g:autocmd) + + let g:autocmd = '' + call feedkeys("Sf", 'tnix') + call assert_equal('II', g:autocmd) + + let g:autocmd = '' + call feedkeys("Sf\", 'tnix') + call assert_equal('IIP', g:autocmd) + + let g:autocmd = '' + call feedkeys("Sf\\", 'tnix') + call assert_equal('IIPP', g:autocmd) + + let g:autocmd = '' + call feedkeys("Sf\\\", 'tnix') + call assert_equal('IIPPP', g:autocmd) + + let g:autocmd = '' + call feedkeys("Sf\\\\", 'tnix') + call assert_equal('IIPPPP', g:autocmd) + + call assert_equal(['foo', 'bar', 'foobar', 'foo'], getline(1, '$')) + " TODO: how should it handle completeopt=noinsert,noselect? + + " CleanUp + call test_override("char_avail", 0) + au! TextChanged + au! TextChangedI + au! TextChangedP + delfu TextChangedAutocmd + unlet! g:autocmd + set complete&vim completeopt&vim + + bw! +endfunc + +func Test_Changed_FirstTime() + if !has('terminal') || has('gui_running') + return + endif + " Prepare file for TextChanged event. + call writefile([''], 'Xchanged.txt') + let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3}) + call assert_equal('running', term_getstatus(buf)) + " Wait for the ruler (in the status line) to be shown. + call WaitFor({-> term_getline(buf, 3) =~# '\ call writefile(['No'], 'Xchanged.txt')\") + call term_sendkeys(buf, "\\:qa!\") + call WaitFor({-> term_getstatus(buf) == 'finished'}) + call assert_equal([''], readfile('Xchanged.txt')) + + " clean up + call delete('Xchanged.txt') + bwipe! +endfunc diff -Nru vim-8.0.1453/src/testdir/test_blockedit.vim vim-8.0.1766/src/testdir/test_blockedit.vim --- vim-8.0.1453/src/testdir/test_blockedit.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_blockedit.vim 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,20 @@ +" Test for block inserting +" +" TODO: rewrite test39.in into this new style test + +func Test_blockinsert_indent() + new + filetype plugin indent on + setlocal sw=2 et ft=vim + call setline(1, ['let a=[', ' ''eins'',', ' ''zwei'',', ' ''drei'']']) + call cursor(2, 3) + exe "norm! \2jI\\ \" + call assert_equal(['let a=[', ' \ ''eins'',', ' \ ''zwei'',', ' \ ''drei'']'], + \ getline(1,'$')) + " reset to sane state + filetype off + bwipe! +endfunc + + +" vim: shiftwidth=2 sts=2 expandtab diff -Nru vim-8.0.1453/src/testdir/test_changelist.vim vim-8.0.1766/src/testdir/test_changelist.vim --- vim-8.0.1453/src/testdir/test_changelist.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_changelist.vim 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,48 @@ +" Tests for the changelist functionality + +" Tests for the getchangelist() function +func Test_getchangelist() + if !has("jumplist") + return + endif + + bwipe! + enew + call assert_equal([], getchangelist(10)) + call assert_equal([[], 0], getchangelist('%')) + + call writefile(['line1', 'line2', 'line3'], 'Xfile1.txt') + call writefile(['line1', 'line2', 'line3'], 'Xfile2.txt') + + edit Xfile1.txt + exe "normal 1Goline\u1.1" + exe "normal 3Goline\u2.1" + exe "normal 5Goline\u3.1" + normal g; + call assert_equal([[ + \ {'lnum' : 2, 'col' : 4, 'coladd' : 0}, + \ {'lnum' : 4, 'col' : 4, 'coladd' : 0}, + \ {'lnum' : 6, 'col' : 4, 'coladd' : 0}], 2], + \ getchangelist('%')) + + hide edit Xfile2.txt + exe "normal 1GOline\u1.0" + exe "normal 2Goline\u2.0" + call assert_equal([[ + \ {'lnum' : 1, 'col' : 6, 'coladd' : 0}, + \ {'lnum' : 3, 'col' : 6, 'coladd' : 0}], 2], + \ getchangelist('%')) + hide enew + + call assert_equal([[ + \ {'lnum' : 2, 'col' : 4, 'coladd' : 0}, + \ {'lnum' : 4, 'col' : 4, 'coladd' : 0}, + \ {'lnum' : 6, 'col' : 4, 'coladd' : 0}], 3], getchangelist(2)) + call assert_equal([[ + \ {'lnum' : 1, 'col' : 6, 'coladd' : 0}, + \ {'lnum' : 3, 'col' : 6, 'coladd' : 0}], 2], getchangelist(3)) + + bwipe! + call delete('Xfile1.txt') + call delete('Xfile2.txt') +endfunc diff -Nru vim-8.0.1453/src/testdir/test_channel.py vim-8.0.1766/src/testdir/test_channel.py --- vim-8.0.1453/src/testdir/test_channel.py 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_channel.py 2018-04-26 20:30:33.000000000 +0000 @@ -62,6 +62,39 @@ if decoded[1] == 'hello!': # simply send back a string response = "got it" + elif decoded[1] == 'malformed1': + cmd = '["ex",":"]wrong!["ex","smi"]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + # Need to wait for Vim to give up, otherwise it + # sometimes fails on OS X. + time.sleep(0.2) + elif decoded[1] == 'malformed2': + cmd = '"unterminated string' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + # Need to wait for Vim to give up, otherwise the double + # quote in the "ok" response terminates the string. + time.sleep(0.2) + elif decoded[1] == 'malformed3': + cmd = '["ex","missing ]"' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + # Need to wait for Vim to give up, otherwise the ] + # in the "ok" response terminates the list. + time.sleep(0.2) + elif decoded[1] == 'split': + cmd = '["ex","let ' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + time.sleep(0.01) + cmd = 'g:split = 123"]' + print("sending: {0}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" elif decoded[1].startswith("echo "): # send back the argument response = decoded[1][5:] @@ -121,39 +154,6 @@ print("sending: {0}".format(cmd)) self.request.sendall(cmd.encode('utf-8')) response = "ok" - elif decoded[1] == 'malformed1': - cmd = '["ex",":"]wrong!["ex","smi"]' - print("sending: {0}".format(cmd)) - self.request.sendall(cmd.encode('utf-8')) - response = "ok" - # Need to wait for Vim to give up, otherwise it - # sometimes fails on OS X. - time.sleep(0.2) - elif decoded[1] == 'malformed2': - cmd = '"unterminated string' - print("sending: {0}".format(cmd)) - self.request.sendall(cmd.encode('utf-8')) - response = "ok" - # Need to wait for Vim to give up, otherwise the double - # quote in the "ok" response terminates the string. - time.sleep(0.2) - elif decoded[1] == 'malformed3': - cmd = '["ex","missing ]"' - print("sending: {0}".format(cmd)) - self.request.sendall(cmd.encode('utf-8')) - response = "ok" - # Need to wait for Vim to give up, otherwise the ] - # in the "ok" response terminates the list. - time.sleep(0.2) - elif decoded[1] == 'split': - cmd = '["ex","let ' - print("sending: {0}".format(cmd)) - self.request.sendall(cmd.encode('utf-8')) - time.sleep(0.01) - cmd = 'g:split = 123"]' - print("sending: {0}".format(cmd)) - self.request.sendall(cmd.encode('utf-8')) - response = "ok" elif decoded[1] == 'an expr': # Send an expr request. cmd = '["expr","setline(\\"$\\", [\\"one\\",\\"two\\",\\"three\\"])"]' diff -Nru vim-8.0.1453/src/testdir/test_channel.vim vim-8.0.1766/src/testdir/test_channel.vim --- vim-8.0.1453/src/testdir/test_channel.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_channel.vim 2018-04-26 20:30:33.000000000 +0000 @@ -23,6 +23,21 @@ call RunServer('test_channel.py', a:testfunc, a:000) endfunc +" Return a list of open files. +" Can be used to make sure no resources leaked. +" Returns an empty list on systems where this is not supported. +func s:get_resources() + let pid = getpid() + + if has('mac') + return systemlist('lsof -p ' . pid . ' | awk ''$4~/^[0-9]*[rwu]$/&&$5=="REG"{print$NF}''') + elseif isdirectory('/proc/' . pid . '/fd/') + return systemlist('readlink /proc/' . pid . '/fd/* | grep -v ''^/dev/''') + else + return [] + endif +endfunc + let g:Ch_responseMsg = '' func Ch_requestHandler(handle, msg) let g:Ch_responseHandle = a:handle @@ -493,6 +508,16 @@ let info = job_info(job) call assert_equal("dead", info.status) call assert_equal("term", info.stoponexit) + call assert_equal(2, len(info.cmd)) + call assert_equal("test_channel_pipe.py", info.cmd[1]) + + let found = 0 + for j in job_info() + if j == job + let found += 1 + endif + endfor + call assert_equal(1, found) endfunc func Test_nl_pipe() @@ -620,6 +645,7 @@ call assert_equal(['line one', 'line two', 'this', 'AND this'], readfile('Xoutput')) finally call Stop_g_job() + call assert_equal(-1, match(s:get_resources(), '\(^\|/\)Xoutput$')) call delete('Xoutput') endtry endfunc @@ -663,6 +689,7 @@ call assert_equal(['line one', 'line two', 'this', 'AND this', 'that', 'AND that'], readfile('Xoutput')) finally call Stop_g_job() + call assert_equal(-1, match(s:get_resources(), '\(^\|/\)Xoutput$')) call delete('Xoutput') endtry endfunc @@ -1126,7 +1153,7 @@ let job = job_start([s:python, '-c', \ 'import sys; [sys.stdout.write(".") and sys.stdout.flush() for _ in range(10000)]'], options) call assert_equal("run", job_status(job)) - call WaitFor('len(join(getline(1, "$"), "")) >= 10000', 3000) + call WaitFor('len(join(getline(1, "$"), "")) >= 10000') try let totlen = 0 for line in getline(1, '$') @@ -1489,7 +1516,7 @@ let g:exit_cb_val = {'start': reltime(), 'end': 0, 'process': 0} let job = job_start([s:python, '-c', 'import time;time.sleep(0.5)'], {'exit_cb': 'MyExitTimeCb'}) let g:exit_cb_val.process = job_info(job).process - call WaitFor('type(g:exit_cb_val.end) != v:t_number || g:exit_cb_val.end != 0', 2000) + call WaitFor('type(g:exit_cb_val.end) != v:t_number || g:exit_cb_val.end != 0') let elapsed = reltimefloat(g:exit_cb_val.end) call assert_true(elapsed > 0.5) call assert_true(elapsed < 1.0) @@ -1662,6 +1689,7 @@ call assert_equal("asdf\nasdf", getline(1)) call assert_equal("xxx\n", getline(2)) call assert_equal("\nyyy", getline(3)) + call assert_equal(-1, match(s:get_resources(), '\(^\|/\)Xtestwrite$')) call delete('Xtestwrite') bwipe! @@ -1702,10 +1730,12 @@ let g:envstr = '' if has('win32') - call job_start(['cmd', '/c', 'echo %FOO%'], {'callback': {ch,msg->execute(":let g:envstr .= msg")}, 'env':{'FOO': 'bar'}}) + let cmd = ['cmd', '/c', 'echo %FOO%'] else - call job_start([&shell, &shellcmdflag, 'echo $FOO'], {'callback': {ch,msg->execute(":let g:envstr .= msg")}, 'env':{'FOO': 'bar'}}) + let cmd = [&shell, &shellcmdflag, 'echo $FOO'] endif + call assert_fails('call job_start(cmd, {"env": 1})', 'E475:') + call job_start(cmd, {'callback': {ch,msg -> execute(":let g:envstr .= msg")}, 'env': {'FOO': 'bar'}}) call WaitFor('"" != g:envstr') call assert_equal("bar", g:envstr) unlet g:envstr @@ -1719,11 +1749,12 @@ let g:envstr = '' if has('win32') let expect = $TEMP - let job = job_start(['cmd', '/c', 'echo %CD%'], {'callback': {ch,msg->execute(":let g:envstr .= msg")}, 'cwd': expect}) + let cmd = ['cmd', '/c', 'echo %CD%'] else let expect = $HOME - let job = job_start(['pwd'], {'callback': {ch,msg->execute(":let g:envstr .= msg")}, 'cwd': expect}) + let cmd = ['pwd'] endif + let job = job_start(cmd, {'callback': {ch,msg -> execute(":let g:envstr .= msg")}, 'cwd': expect}) try call WaitFor('"" != g:envstr') let expect = substitute(expect, '[/\\]$', '', '') @@ -1805,3 +1836,26 @@ call s:test_list_args('print("hello\"world\"")', 'hello"world"', 1) call s:test_list_args('print("hello\tworld")', "hello\tworld", 1) endfunc + +" Do this last, it stops any channel log. +func Test_zz_ch_log() + call ch_logfile('Xlog', 'w') + call ch_log('hello there') + call ch_log('%s%s') + call ch_logfile('') + let text = readfile('Xlog') + call assert_match("hello there", text[1]) + call assert_match("%s%s", text[2]) + call delete('Xlog') +endfunc + +func Test_keep_pty_open() + if !has('unix') + return + endif + + let job = job_start(s:python . ' -c "import time;time.sleep(0.2)"', {'out_io': 'null', 'err_io': 'null', 'pty': 1}) + let elapsed = WaitFor({-> job_status(job) ==# 'dead'}) + call assert_inrange(200, 1000, elapsed) + call job_stop(job) +endfunc diff -Nru vim-8.0.1453/src/testdir/test_clientserver.vim vim-8.0.1766/src/testdir/test_clientserver.vim --- vim-8.0.1453/src/testdir/test_clientserver.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_clientserver.vim 2018-04-26 20:30:33.000000000 +0000 @@ -32,7 +32,7 @@ " Takes a short while for the server to be active. " When using valgrind it takes much longer. - call WaitFor('serverlist() =~ "' . name . '"', 5000) + call WaitFor('serverlist() =~ "' . name . '"') call assert_match(name, serverlist()) call remote_foreground(name) diff -Nru vim-8.0.1453/src/testdir/test_cmdline.vim vim-8.0.1766/src/testdir/test_cmdline.vim --- vim-8.0.1453/src/testdir/test_cmdline.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_cmdline.vim 2018-04-26 20:30:33.000000000 +0000 @@ -137,6 +137,11 @@ let l = getcompletion('v:notexists', 'var') call assert_equal([], l) + args a.c b.c + let l = getcompletion('', 'arglist') + call assert_equal(['a.c', 'b.c'], l) + %argdelete + let l = getcompletion('', 'augroup') call assert_true(index(l, 'END') >= 0) let l = getcompletion('blahblah', 'augroup') @@ -311,6 +316,17 @@ call feedkeys(":\etoupper(getline(1))\\\"\", 'tx') call assert_equal('"ASDF.X /TMP/SOME VERYLONGWORD A;B-C*D ', @:) bwipe! + + " Error while typing a command used to cause that it was not executed + " in the end. + new + try + call feedkeys(":file \%Xtestfile\", 'tx') + catch /^Vim\%((\a\+)\)\=:E32/ + " ignore error E32 + endtry + call assert_equal("Xtestfile", bufname("%")) + bwipe! endfunc func Test_remove_char_in_cmdline() diff -Nru vim-8.0.1453/src/testdir/test_command_count.vim vim-8.0.1766/src/testdir/test_command_count.vim --- vim-8.0.1453/src/testdir/test_command_count.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_command_count.vim 2018-04-26 20:30:33.000000000 +0000 @@ -173,7 +173,6 @@ only! exe bufnr . 'buf' - bnext let bufnr = bufnr('%') let buffers = [] .,$-bufdo call add(buffers, bufnr('%')) diff -Nru vim-8.0.1453/src/testdir/test_digraph.vim vim-8.0.1766/src/testdir/test_digraph.vim --- vim-8.0.1453/src/testdir/test_digraph.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_digraph.vim 2018-04-26 20:30:33.000000000 +0000 @@ -4,15 +4,15 @@ finish endif -func! Put_Dig(chars) +func Put_Dig(chars) exe "norm! o\".a:chars endfu -func! Put_Dig_BS(char1, char2) +func Put_Dig_BS(char1, char2) exe "norm! o".a:char1."\".a:char2 endfu -func! Test_digraphs() +func Test_digraphs() new call Put_Dig("00") call assert_equal("∞", getline('.')) @@ -214,7 +214,7 @@ bw! endfunc -func! Test_digraphs_option() +func Test_digraphs_option() " reset whichwrap option, so that testing A works, " without moving up a line set digraph ww= @@ -420,7 +420,7 @@ bw! endfunc -func! Test_digraphs_output() +func Test_digraphs_output() new let out = execute(':digraph') call assert_equal('Eu € 8364', matchstr(out, '\C\')) @@ -436,7 +436,7 @@ bw! endfunc -func! Test_loadkeymap() +func Test_loadkeymap() if !has('keymap') return endif @@ -450,7 +450,7 @@ bw! endfunc -func! Test_digraph_cmndline() +func Test_digraph_cmndline() " Create digraph on commandline " This is a hack, to let Vim create the digraph in commandline mode let s = '' @@ -458,4 +458,11 @@ call assert_equal("€", s) endfunc +func Test_show_digraph() + new + call Put_Dig("e=") + call assert_equal("\n<е> 1077, Hex 0435, Oct 2065, Digr e=", execute('ascii')) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff -Nru vim-8.0.1453/src/testdir/test_edit.vim vim-8.0.1766/src/testdir/test_edit.vim --- vim-8.0.1453/src/testdir/test_edit.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_edit.vim 2018-04-26 20:30:33.000000000 +0000 @@ -631,11 +631,11 @@ call feedkeys("cct\\\\", 'tnix') call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$')) call feedkeys("cct\\\\\", 'tnix') - call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$')) - call feedkeys("cct\\\\\\", 'tnix') call assert_equal(['one', 'two', 'three', 'two', '', '', ''], getline(1, '$')) - call feedkeys("cct\\\\\\\", 'tnix') + call feedkeys("cct\\\\\\", 'tnix') call assert_equal(['one', 'two', 'three', 'three', '', '', ''], getline(1, '$')) + call feedkeys("cct\\\\\\\", 'tnix') + call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$')) call feedkeys("cct\\\\", 'tnix') call assert_equal(['one', 'two', 'three', 'two', '', '', ''], getline(1, '$')) call feedkeys("cct\\\\\", 'tnix') @@ -1357,7 +1357,6 @@ let save_columns = &columns " Need at least about 1100 columns to reproduce the problem. set columns=2000 - call assert_equal(2000, &columns) set noswapfile let longfilename = longdirname . '/' . repeat('a', 255) diff -Nru vim-8.0.1453/src/testdir/test_eval_stuff.vim vim-8.0.1766/src/testdir/test_eval_stuff.vim --- vim-8.0.1453/src/testdir/test_eval_stuff.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_eval_stuff.vim 2018-04-26 20:30:33.000000000 +0000 @@ -11,3 +11,34 @@ func Test_catch_return_with_error() call assert_equal(1, s:foo()) endfunc + +func Test_nocatch_restore_silent_emsg() + silent! try + throw 1 + catch + endtry + echoerr 'wrong' + let c1 = nr2char(screenchar(&lines, 1)) + let c2 = nr2char(screenchar(&lines, 2)) + let c3 = nr2char(screenchar(&lines, 3)) + let c4 = nr2char(screenchar(&lines, 4)) + let c5 = nr2char(screenchar(&lines, 5)) + call assert_equal('wrong', c1 . c2 . c3 . c4 . c5) +endfunc + +func Test_mkdir_p() + call mkdir('Xmkdir/nested', 'p') + call assert_true(isdirectory('Xmkdir/nested')) + try + " Trying to make existing directories doesn't error + call mkdir('Xmkdir', 'p') + call mkdir('Xmkdir/nested', 'p') + catch /E739:/ + call assert_report('mkdir(..., "p") failed for an existing directory') + endtry + " 'p' doesn't suppress real errors + call writefile([], 'Xfile') + call assert_fails('call mkdir("Xfile", "p")', 'E739') + call delete('Xfile') + call delete('Xmkdir', 'rf') +endfunc diff -Nru vim-8.0.1453/src/testdir/test_exit.vim vim-8.0.1766/src/testdir/test_exit.vim --- vim-8.0.1453/src/testdir/test_exit.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_exit.vim 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,57 @@ +" Tests for exiting Vim. + +source shared.vim + +func Test_exiting() + let after = [ + \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', + \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', + \ 'quit', + \ ] + if RunVim([], after, '') + call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) + endif + call delete('Xtestout') + + let after = [ + \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', + \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', + \ 'help', + \ 'wincmd w', + \ 'quit', + \ ] + if RunVim([], after, '') + call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) + endif + call delete('Xtestout') + + let after = [ + \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', + \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', + \ 'split', + \ 'new', + \ 'qall', + \ ] + if RunVim([], after, '') + call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) + endif + call delete('Xtestout') + + let after = [ + \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")', + \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', + \ 'augroup nasty', + \ ' au ExitPre * split', + \ 'augroup END', + \ 'quit', + \ 'augroup nasty', + \ ' au! ExitPre', + \ 'augroup END', + \ 'quit', + \ ] + if RunVim([], after, '') + call assert_equal(['QuitPre', 'ExitPre', 'QuitPre', 'ExitPre'], + \ readfile('Xtestout')) + endif + call delete('Xtestout') +endfunc diff -Nru vim-8.0.1453/src/testdir/test_expr.vim vim-8.0.1766/src/testdir/test_expr.vim --- vim-8.0.1453/src/testdir/test_expr.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_expr.vim 2018-04-26 20:30:33.000000000 +0000 @@ -131,6 +131,9 @@ endfunc function Test_printf_misc() + call assert_equal('123', printf('123')) + call assert_fails("call printf('123', 3)", "E767:") + call assert_equal('123', printf('%d', 123)) call assert_equal('123', printf('%i', 123)) call assert_equal('123', printf('%D', 123)) diff -Nru vim-8.0.1453/src/testdir/test_filetype.vim vim-8.0.1766/src/testdir/test_filetype.vim --- vim-8.0.1453/src/testdir/test_filetype.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_filetype.vim 2018-04-26 20:30:33.000000000 +0000 @@ -542,6 +542,43 @@ \ 'strace': [['execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars */) = 0'], \ ['15:17:47 execve("/usr/bin/pstree", ["pstree"], ... "_=/usr/bin/strace"]) = 0'], \ ['__libc_start_main and something']], + \ 'clojure': [['#!/path/clojure']], + \ 'scala': [['#!/path/scala']], + \ 'tcsh': [['#!/path/tcsh']], + \ 'zsh': [['#!/path/zsh']], + \ 'tcl': [['#!/path/tclsh'], + \ ['#!/path/wish'], + \ ['#!/path/expectk'], + \ ['#!/path/itclsh'], + \ ['#!/path/itkwish']], + \ 'expect': [['#!/path/expect']], + \ 'gnuplot': [['#!/path/gnuplot']], + \ 'make': [['#!/path/make']], + \ 'pike': [['#!/path/pike'], + \ ['#!/path/pike0'], + \ ['#!/path/pike9']], + \ 'lua': [['#!/path/lua']], + \ 'perl6': [['#!/path/perl6']], + \ 'perl': [['#!/path/perl']], + \ 'php': [['#!/path/php']], + \ 'python': [['#!/path/python'], + \ ['#!/path/python2'], + \ ['#!/path/python3']], + \ 'groovy': [['#!/path/groovy']], + \ 'ruby': [['#!/path/ruby']], + \ 'javascript': [['#!/path/node'], + \ ['#!/path/js'], + \ ['#!/path/nodejs'], + \ ['#!/path/rhino']], + \ 'bc': [['#!/path/bc']], + \ 'sed': [['#!/path/sed']], + \ 'ocaml': [['#!/path/ocaml']], + \ 'awk': [['#!/path/awk']], + \ 'wml': [['#!/path/wml']], + \ 'scheme': [['#!/path/scheme']], + \ 'cfengine': [['#!/path/cfengine']], + \ 'erlang': [['#!/path/escript']], + \ 'haskell': [['#!/path/haskell']], \ } func Test_script_detection() diff -Nru vim-8.0.1453/src/testdir/test_find_complete.vim vim-8.0.1766/src/testdir/test_find_complete.vim --- vim-8.0.1453/src/testdir/test_find_complete.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_find_complete.vim 2018-04-26 20:30:33.000000000 +0000 @@ -86,6 +86,12 @@ call feedkeys(":find f\t\n", "xt") call assert_equal('Holy Grail', getline(1)) + " Test that find completion on directory appends a slash + call feedkeys(":find in/pa\tfile.txt\n", "xt") + call assert_equal('E.T.', getline(1)) + call feedkeys(":find ./i\tstuff.txt\n", "xt") + call assert_equal('Another Holy Grail', getline(1)) + " Test shortening of " " foo/x/bar/voyager.txt diff -Nru vim-8.0.1453/src/testdir/test_functions.vim vim-8.0.1766/src/testdir/test_functions.vim --- vim-8.0.1453/src/testdir/test_functions.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_functions.vim 2018-04-26 20:30:33.000000000 +0000 @@ -876,3 +876,26 @@ let &shell = save_shell endfunc + +func Test_trim() + call assert_equal("Testing", trim(" \t\r\r\x0BTesting \t\n\r\n\t\x0B\x0B")) + call assert_equal("Testing", trim(" \t \r\r\n\n\x0BTesting \t\n\r\n\t\x0B\x0B")) + call assert_equal("RESERVE", trim("xyz \twwRESERVEzyww \t\t", " wxyz\t")) + call assert_equal("wRE \tSERVEzyww", trim("wRE \tSERVEzyww")) + call assert_equal("abcd\t xxxx tail", trim(" \tabcd\t xxxx tail")) + call assert_equal("\tabcd\t xxxx tail", trim(" \tabcd\t xxxx tail", " ")) + call assert_equal(" \tabcd\t xxxx tail", trim(" \tabcd\t xxxx tail", "abx")) + call assert_equal("RESERVE", trim("ä½ RESERVE好", "你好")) + call assert_equal("您R E SER V Eæ—©", trim("你好您R E SER V E早好你你", "你好")) + call assert_equal("你好您R E SER V E早好你你", trim(" \n\r\r 你好您R E SER V E早好你你 \t \x0B", )) + call assert_equal("您R E SER V E早好你你 \t \x0B", trim(" 你好您R E SER V E早好你你 \t \x0B", " 你好")) + call assert_equal("您R E SER V E早好你你 \t \x0B", trim(" tteesstttt你好您R E SER V E早好你你 \t \x0B ttestt", " 你好tes")) + call assert_equal("您R E SER V E早好你你 \t \x0B", trim(" tteesstttt你好您R E SER V E早好你你 \t \x0B ttestt", " 你你你好好好tttsses")) + call assert_equal("留下", trim("这些些ä¸è¦è¿™äº›ç•™ä¸‹è¿™äº›", "这些ä¸è¦")) + call assert_equal("", trim("", "")) + call assert_equal("a", trim("a", "")) + call assert_equal("", trim("", "a")) + + let chars = join(map(range(1, 0x20) + [0xa0], {n -> nr2char(n)}), '') + call assert_equal("x", trim(chars . "x" . chars)) +endfunc diff -Nru vim-8.0.1453/src/testdir/test_ga.vim vim-8.0.1766/src/testdir/test_ga.vim --- vim-8.0.1453/src/testdir/test_ga.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_ga.vim 2018-04-26 20:30:33.000000000 +0000 @@ -11,13 +11,13 @@ new set display=uhex call assert_equal("\nNUL", Do_ga('')) - call assert_equal("\n<<01>> 1, Hex 01, Octal 001", Do_ga("\x01")) - call assert_equal("\n<<09>> 9, Hex 09, Octal 011", Do_ga("\t")) + call assert_equal("\n<<01>> 1, Hex 01, Oct 001, Digr SH", Do_ga("\x01")) + call assert_equal("\n<<09>> 9, Hex 09, Oct 011, Digr HT", Do_ga("\t")) set display= call assert_equal("\nNUL", Do_ga('')) - call assert_equal("\n<^A> 1, Hex 01, Octal 001", Do_ga("\x01")) - call assert_equal("\n<^I> 9, Hex 09, Octal 011", Do_ga("\t")) + call assert_equal("\n<^A> 1, Hex 01, Oct 001, Digr SH", Do_ga("\x01")) + call assert_equal("\n<^I> 9, Hex 09, Oct 011, Digr HT", Do_ga("\t")) call assert_equal("\n 101, Hex 65, Octal 145", Do_ga('e')) @@ -26,8 +26,8 @@ endif " Test a few multi-bytes characters. - call assert_equal("\n<é> 233, Hex 00e9, Octal 351", Do_ga('é')) - call assert_equal("\n<ẻ> 7867, Hex 1ebb, Octal 17273", Do_ga('ẻ')) + call assert_equal("\n<é> 233, Hex 00e9, Oct 351, Digr e'", Do_ga('é')) + call assert_equal("\n<ẻ> 7867, Hex 1ebb, Oct 17273, Digr e2", Do_ga('ẻ')) " Test with combining characters. call assert_equal("\n 101, Hex 65, Octal 145 < Ì> 769, Hex 0301, Octal 1401", Do_ga("e\u0301")) diff -Nru vim-8.0.1453/src/testdir/test_getcwd.vim vim-8.0.1766/src/testdir/test_getcwd.vim --- vim-8.0.1453/src/testdir/test_getcwd.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_getcwd.vim 2018-04-26 20:30:33.000000000 +0000 @@ -37,6 +37,7 @@ new call mkdir('Xtopdir') cd Xtopdir + let g:topdir = getcwd() call mkdir('Xdir1') call mkdir('Xdir2') call mkdir('Xdir3') @@ -56,36 +57,44 @@ 3wincmd w lcd Xdir1 call assert_equal("a Xdir1 1", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) wincmd W call assert_equal("b Xtopdir 0", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) wincmd W lcd Xdir3 call assert_equal("c Xdir3 1", GetCwdInfo(0, 0)) call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), 0)) call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), 0)) call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), 0)) + call assert_equal(g:topdir, getcwd(-1)) wincmd W call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), tabpagenr())) call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), tabpagenr())) call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), tabpagenr())) + call assert_equal(g:topdir, getcwd(-1)) tabnew x new y new z 3wincmd w call assert_equal("x Xtopdir 0", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) wincmd W lcd Xdir2 call assert_equal("y Xdir2 1", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) wincmd W lcd Xdir3 call assert_equal("z Xdir3 1", GetCwdInfo(0, 0)) call assert_equal("x Xtopdir 0", GetCwdInfo(bufwinnr("x"), 0)) call assert_equal("y Xdir2 1", GetCwdInfo(bufwinnr("y"), 0)) call assert_equal("z Xdir3 1", GetCwdInfo(bufwinnr("z"), 0)) + call assert_equal(g:topdir, getcwd(-1)) let tp_nr = tabpagenr() tabrewind call assert_equal("x Xtopdir 0", GetCwdInfo(3, tp_nr)) call assert_equal("y Xdir2 1", GetCwdInfo(2, tp_nr)) call assert_equal("z Xdir3 1", GetCwdInfo(1, tp_nr)) + call assert_equal(g:topdir, getcwd(-1)) endfunc diff -Nru vim-8.0.1453/src/testdir/test_gui_init.vim vim-8.0.1766/src/testdir/test_gui_init.vim --- vim-8.0.1453/src/testdir/test_gui_init.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_gui_init.vim 2018-04-26 20:30:33.000000000 +0000 @@ -17,7 +17,7 @@ endfunc " Ignore the "failed to create input context" error. -call test_ignore_error('E285') +call test_ignore_error('E285:') " Start the GUI now, in the foreground. gui -f diff -Nru vim-8.0.1453/src/testdir/test_gui.vim vim-8.0.1766/src/testdir/test_gui.vim --- vim-8.0.1453/src/testdir/test_gui.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_gui.vim 2018-04-26 20:30:33.000000000 +0000 @@ -16,7 +16,7 @@ endfunc " Test for resetting "secure" flag after GUI has started. -" Must be run first. +" Must be run first, since it starts the GUI on Unix. func Test_1_set_secure() set exrc secure gui -f diff -Nru vim-8.0.1453/src/testdir/test_highlight.vim vim-8.0.1766/src/testdir/test_highlight.vim --- vim-8.0.1453/src/testdir/test_highlight.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_highlight.vim 2018-04-26 20:30:33.000000000 +0000 @@ -514,3 +514,22 @@ bwipe! diffoff endfunc + +func Test_termguicolors() + if !exists('+termguicolors') + return + endif + if has('vtp') && !has('vcon') + " Win32: 'guicolors' doesn't work without virtual console. + call assert_fails('set termguicolors', 'E954:') + return + endif + + " Basic test that setting 'termguicolors' works with one color. + set termguicolors + redraw + set t_Co=1 + redraw + set t_Co=0 + redraw +endfunc diff -Nru vim-8.0.1453/src/testdir/test_ins_complete.vim vim-8.0.1766/src/testdir/test_ins_complete.vim --- vim-8.0.1453/src/testdir/test_ins_complete.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_ins_complete.vim 2018-04-26 20:30:33.000000000 +0000 @@ -116,3 +116,134 @@ delfunc Omni set omnifunc= endfunc + +function! s:CompleteDone_CompleteFuncDict( findstart, base ) + if a:findstart + return 0 + endif + + return { + \ 'words': [ + \ { + \ 'word': 'aword', + \ 'abbr': 'wrd', + \ 'menu': 'extra text', + \ 'info': 'words are cool', + \ 'kind': 'W', + \ 'user_data': 'test' + \ } + \ ] + \ } +endfunction + +function! s:CompleteDone_CheckCompletedItemDict() + call assert_equal( 'aword', v:completed_item[ 'word' ] ) + call assert_equal( 'wrd', v:completed_item[ 'abbr' ] ) + call assert_equal( 'extra text', v:completed_item[ 'menu' ] ) + call assert_equal( 'words are cool', v:completed_item[ 'info' ] ) + call assert_equal( 'W', v:completed_item[ 'kind' ] ) + call assert_equal( 'test', v:completed_item[ 'user_data' ] ) + + let s:called_completedone = 1 +endfunction + +function Test_CompleteDoneDict() + au CompleteDone * :call CompleteDone_CheckCompletedItemDict() + + set completefunc=CompleteDone_CompleteFuncDict + execute "normal a\\\" + set completefunc& + + call assert_equal( 'test', v:completed_item[ 'user_data' ] ) + call assert_true( s:called_completedone ) + + let s:called_completedone = 0 + au! CompleteDone +endfunc + +function! s:CompleteDone_CompleteFuncDictNoUserData( findstart, base ) + if a:findstart + return 0 + endif + + return { + \ 'words': [ + \ { + \ 'word': 'aword', + \ 'abbr': 'wrd', + \ 'menu': 'extra text', + \ 'info': 'words are cool', + \ 'kind': 'W' + \ } + \ ] + \ } +endfunction + +function! s:CompleteDone_CheckCompletedItemDictNoUserData() + call assert_equal( 'aword', v:completed_item[ 'word' ] ) + call assert_equal( 'wrd', v:completed_item[ 'abbr' ] ) + call assert_equal( 'extra text', v:completed_item[ 'menu' ] ) + call assert_equal( 'words are cool', v:completed_item[ 'info' ] ) + call assert_equal( 'W', v:completed_item[ 'kind' ] ) + call assert_equal( '', v:completed_item[ 'user_data' ] ) + + let s:called_completedone = 1 +endfunction + +function Test_CompleteDoneDictNoUserData() + au CompleteDone * :call CompleteDone_CheckCompletedItemDictNoUserData() + + set completefunc=CompleteDone_CompleteFuncDictNoUserData + execute "normal a\\\" + set completefunc& + + call assert_equal( '', v:completed_item[ 'user_data' ] ) + call assert_true( s:called_completedone ) + + let s:called_completedone = 0 + au! CompleteDone +endfunc + +function! s:CompleteDone_CompleteFuncList( findstart, base ) + if a:findstart + return 0 + endif + + return [ 'aword' ] +endfunction + +function! s:CompleteDone_CheckCompletedItemList() + call assert_equal( 'aword', v:completed_item[ 'word' ] ) + call assert_equal( '', v:completed_item[ 'abbr' ] ) + call assert_equal( '', v:completed_item[ 'menu' ] ) + call assert_equal( '', v:completed_item[ 'info' ] ) + call assert_equal( '', v:completed_item[ 'kind' ] ) + call assert_equal( '', v:completed_item[ 'user_data' ] ) + + let s:called_completedone = 1 +endfunction + +function Test_CompleteDoneList() + au CompleteDone * :call CompleteDone_CheckCompletedItemList() + + set completefunc=CompleteDone_CompleteFuncList + execute "normal a\\\" + set completefunc& + + call assert_equal( '', v:completed_item[ 'user_data' ] ) + call assert_true( s:called_completedone ) + + let s:called_completedone = 0 + au! CompleteDone +endfunc + +" Check that when using feedkeys() typeahead does not interrupt searching for +" completions. +func Test_compl_feedkeys() + new + set completeopt=menuone,noselect + call feedkeys("ajump ju\\\\", "tx") + call assert_equal("jump jump", getline(1)) + bwipe! + set completeopt& +endfunc diff -Nru vim-8.0.1453/src/testdir/test_json.vim vim-8.0.1766/src/testdir/test_json.vim --- vim-8.0.1453/src/testdir/test_json.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_json.vim 2018-04-26 20:30:33.000000000 +0000 @@ -179,6 +179,9 @@ call assert_fails('call json_decode("[1 2]")', "E474:") call assert_fails('call json_decode("[1,,2]")', "E474:") + + call assert_fails('call json_decode("{{}:42}")', "E474:") + call assert_fails('call json_decode("{[]:42}")', "E474:") endfunc let s:jsl5 = '[7,,,]' diff -Nru vim-8.0.1453/src/testdir/test_jumplist.vim vim-8.0.1766/src/testdir/test_jumplist.vim --- vim-8.0.1453/src/testdir/test_jumplist.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_jumplist.vim 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,62 @@ +" Tests for the jumplist functionality + +" Tests for the getjumplist() function +func Test_getjumplist() + if !has("jumplist") + return + endif + + %bwipe + clearjumps + call assert_equal([[], 0], getjumplist()) + call assert_equal([[], 0], getjumplist(1)) + call assert_equal([[], 0], getjumplist(1, 1)) + + call assert_equal([], getjumplist(100)) + call assert_equal([], getjumplist(1, 100)) + + let lines = [] + for i in range(1, 100) + call add(lines, "Line " . i) + endfor + call writefile(lines, "Xtest") + + " Jump around and create a jump list + edit Xtest + let bnr = bufnr('%') + normal 50% + normal G + normal gg + + call assert_equal([[ + \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0}, + \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0}, + \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 4], + \ getjumplist()) + + " Traverse the jump list and verify the results + 5 + exe "normal \" + call assert_equal(2, getjumplist(1)[1]) + exe "normal 2\" + call assert_equal(0, getjumplist(1, 1)[1]) + exe "normal 3\" + call assert_equal(3, getjumplist()[1]) + exe "normal \" + normal 20% + call assert_equal([[ + \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0}, + \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0}, + \ {'lnum': 5, 'bufnr': bnr, 'col': 0, 'coladd': 0}, + \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 5], + \ getjumplist()) + + let l = getjumplist() + call test_garbagecollect_now() + call assert_equal(4, l[1]) + clearjumps + call test_garbagecollect_now() + call assert_equal(4, l[1]) + + call delete("Xtest") +endfunc diff -Nru vim-8.0.1453/src/testdir/test_mapping.vim vim-8.0.1766/src/testdir/test_mapping.vim --- vim-8.0.1453/src/testdir/test_mapping.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_mapping.vim 2018-04-26 20:30:33.000000000 +0000 @@ -198,3 +198,19 @@ set timeoutlen& delfunc ExitInsert endfunc + +func Test_abbreviation_CR() + new + func Eatchar(pat) + let c = nr2char(getchar(0)) + return (c =~ a:pat) ? '' : c + endfunc + iabbrev ~~7 =repeat('~', 7)=Eatchar('\s') + call feedkeys("GA~~7 \", 'xt') + call assert_equal('~~~~~~~', getline('$')) + %d + call feedkeys("GA~~7\\", 'xt') + call assert_equal(['~~~~~~~', ''], getline(1,'$')) + delfunc Eatchar + bw! +endfunc diff -Nru vim-8.0.1453/src/testdir/test_matchadd_conceal.vim vim-8.0.1766/src/testdir/test_matchadd_conceal.vim --- vim-8.0.1453/src/testdir/test_matchadd_conceal.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_matchadd_conceal.vim 2018-04-26 20:30:33.000000000 +0000 @@ -7,17 +7,7 @@ set term=ansi endif -function! s:screenline(lnum) abort - let line = [] - for c in range(1, winwidth(0)) - call add(line, nr2char(screenchar(a:lnum, c))) - endfor - return s:trim(join(line, '')) -endfunction - -function! s:trim(str) abort - return matchstr(a:str,'^\s*\zs.\{-}\ze\s*$') -endfunction +source shared.vim function! Test_simple_matchadd() new @@ -30,7 +20,7 @@ call matchadd('Conceal', '\%2l ') redraw! let lnum = 2 - call assert_equal(expect, s:screenline(lnum)) + call assert_equal(expect, Screenline(lnum)) call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) @@ -53,7 +43,7 @@ call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'}) redraw! let lnum = 2 - call assert_equal(expect, s:screenline(lnum)) + call assert_equal(expect, Screenline(lnum)) call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) @@ -79,7 +69,7 @@ call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'}) redraw! let lnum = 2 - call assert_equal(expect, s:screenline(lnum)) + call assert_equal(expect, Screenline(lnum)) call assert_equal(screenattr(lnum, 1), screenattr(lnum, 2)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) @@ -92,7 +82,7 @@ call matchadd('ErrorMsg', '\%2l Test', 20, -1, {'conceal': 'X'}) redraw! - call assert_equal(expect, s:screenline(lnum)) + call assert_equal(expect, Screenline(lnum)) call assert_equal(screenattr(lnum, 1) , screenattr(lnum, 2)) call assert_equal(screenattr(lnum, 2) , screenattr(lnum, 7)) call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 10)) @@ -116,7 +106,7 @@ call matchadd('Conceal', '\%2l ', 10, -1, {}) redraw! let lnum = 2 - call assert_equal(expect, s:screenline(lnum)) + call assert_equal(expect, Screenline(lnum)) call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) @@ -129,7 +119,7 @@ set listchars=conceal:+ redraw! - call assert_equal(expect, s:screenline(lnum)) + call assert_equal(expect, Screenline(lnum)) call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) @@ -153,7 +143,7 @@ syntax match MyConceal /\%2l / conceal containedin=ALL cchar=* redraw! let lnum = 2 - call assert_equal(expect, s:screenline(lnum)) + call assert_equal(expect, Screenline(lnum)) call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) @@ -165,7 +155,7 @@ call clearmatches() redraw! - call assert_equal(expect, s:screenline(lnum)) + call assert_equal(expect, Screenline(lnum)) call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) @@ -191,7 +181,7 @@ redraw! let lnum = 2 - call assert_equal(expect, s:screenline(lnum)) + call assert_equal(expect, Screenline(lnum)) call assert_equal(screenattr(lnum, 1), screenattr(lnum, 2)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) @@ -204,7 +194,7 @@ call setmatches(a) redraw! - call assert_equal(expect, s:screenline(lnum)) + call assert_equal(expect, Screenline(lnum)) call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7)) call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) @@ -232,7 +222,7 @@ redraw! let lnum = 2 - call assert_equal(expect, s:screenline(lnum)) + call assert_equal(expect, Screenline(lnum)) call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 2)) call assert_notequal(screenattr(lnum, 2) , screenattr(lnum, 7)) call assert_equal(screenattr(lnum, 1) , screenattr(lnum, 7)) @@ -254,13 +244,13 @@ 1put ='TARGET_TARGETTARGET' call cursor(1, 1) redraw - call assert_equal('TARGET_TARGETTARGET', s:screenline(2)) + call assert_equal('TARGET_TARGETTARGET', Screenline(2)) setlocal conceallevel=2 call matchadd('Conceal', 'TARGET', 10, -1, {'conceal': 't'}) redraw - call assert_equal('t_tt', s:screenline(2)) + call assert_equal('t_tt', Screenline(2)) quit! endfunction @@ -276,13 +266,13 @@ syntax on syntax keyword coqKwd bool conceal cchar=- redraw! - call assert_equal(expect, s:screenline(1)) + call assert_equal(expect, Screenline(1)) call assert_notequal(screenattr(1, 10) , screenattr(1, 11)) call assert_notequal(screenattr(1, 11) , screenattr(1, 12)) call assert_equal(screenattr(1, 11) , screenattr(1, 32)) call matchadd('CheckedByCoq', '\%<2l\%>9c\%<16c') redraw! - call assert_equal(expect, s:screenline(1)) + call assert_equal(expect, Screenline(1)) call assert_notequal(screenattr(1, 10) , screenattr(1, 11)) call assert_notequal(screenattr(1, 11) , screenattr(1, 12)) call assert_equal(screenattr(1, 11) , screenattr(1, 32)) diff -Nru vim-8.0.1453/src/testdir/test_mksession.vim vim-8.0.1766/src/testdir/test_mksession.vim --- vim-8.0.1453/src/testdir/test_mksession.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_mksession.vim 2018-04-26 20:30:33.000000000 +0000 @@ -7,6 +7,8 @@ finish endif +source shared.vim + func Test_mksession() tabnew let wrap_save = &wrap @@ -99,6 +101,7 @@ call delete('Xtest_mks.out') call delete(tmpfile) let &wrap = wrap_save + set sessionoptions& endfunc func Test_mksession_winheight() @@ -150,6 +153,107 @@ call delete('Xtest_mks.out') endfunc +if has('terminal') + +func Test_mksession_terminal_shell() + terminal + mksession! Xtest_mks.out + let lines = readfile('Xtest_mks.out') + let term_cmd = '' + for line in lines + if line =~ '^terminal' + let term_cmd = line + elseif line =~ 'badd.*' . &shell + call assert_report('unexpected shell line: ' . line) + endif + endfor + call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+\s*$', term_cmd) + + call Stop_shell_in_terminal(bufnr('%')) + call delete('Xtest_mks.out') +endfunc + +func Test_mksession_terminal_no_restore_cmdarg() + terminal ++norestore + mksession! Xtest_mks.out + let lines = readfile('Xtest_mks.out') + let term_cmd = '' + for line in lines + if line =~ '^terminal' + call assert_report('session must not restore teminal') + endif + endfor + + call Stop_shell_in_terminal(bufnr('%')) + call delete('Xtest_mks.out') +endfunc + +func Test_mksession_terminal_no_restore_funcarg() + call term_start(&shell, {'norestore': 1}) + mksession! Xtest_mks.out + let lines = readfile('Xtest_mks.out') + let term_cmd = '' + for line in lines + if line =~ '^terminal' + call assert_report('session must not restore teminal') + endif + endfor + + call Stop_shell_in_terminal(bufnr('%')) + call delete('Xtest_mks.out') +endfunc + +func Test_mksession_terminal_no_restore_func() + terminal + call term_setrestore(bufnr('%'), 'NONE') + mksession! Xtest_mks.out + let lines = readfile('Xtest_mks.out') + let term_cmd = '' + for line in lines + if line =~ '^terminal' + call assert_report('session must not restore teminal') + endif + endfor + + call Stop_shell_in_terminal(bufnr('%')) + call delete('Xtest_mks.out') +endfunc + +func Test_mksession_terminal_no_ssop() + terminal + set sessionoptions-=terminal + mksession! Xtest_mks.out + let lines = readfile('Xtest_mks.out') + let term_cmd = '' + for line in lines + if line =~ '^terminal' + call assert_report('session must not restore teminal') + endif + endfor + + call Stop_shell_in_terminal(bufnr('%')) + call delete('Xtest_mks.out') + set sessionoptions& +endfunc + +func Test_mksession_terminal_restore_other() + terminal + call term_setrestore(bufnr('%'), 'other') + mksession! Xtest_mks.out + let lines = readfile('Xtest_mks.out') + let term_cmd = '' + for line in lines + if line =~ '^terminal' + let term_cmd = line + endif + endfor + call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+ other', term_cmd) + + call Stop_shell_in_terminal(bufnr('%')) + call delete('Xtest_mks.out') +endfunc + +endif " has('terminal') " vim: shiftwidth=2 sts=2 expandtab diff -Nru vim-8.0.1453/src/testdir/test_normal.vim vim-8.0.1766/src/testdir/test_normal.vim --- vim-8.0.1453/src/testdir/test_normal.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_normal.vim 2018-04-26 20:30:33.000000000 +0000 @@ -2176,10 +2176,13 @@ endfunc func! Test_normal45_drop() - if !has("dnd") + if !has('dnd') + " The ~ register does not exist + call assert_beeps('norm! "~') return endif - " basic test for :drop command + + " basic test for drag-n-drop " unfortunately, without a gui, we can't really test much here, " so simply test that ~p fails (which uses the drop register) new diff -Nru vim-8.0.1453/src/testdir/test_options.vim vim-8.0.1766/src/testdir/test_options.vim --- vim-8.0.1453/src/testdir/test_options.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_options.vim 2018-04-26 20:30:33.000000000 +0000 @@ -332,3 +332,19 @@ call assert_equal('', &indentexpr) bwipe! endfunc + +func Test_backupskip() + if has("mac") + call assert_match('/private/tmp/\*', &bsk) + elseif has("unix") + call assert_match('/tmp/\*', &bsk) + endif + + let bskvalue = substitute(&bsk, '\\', '/', 'g') + for var in ['$TEMPDIR', '$TMP', '$TEMP'] + if exists(var) + let varvalue = substitute(expand(var), '\\', '/', 'g') + call assert_match(varvalue . '.\*', bskvalue) + endif + endfor +endfunc diff -Nru vim-8.0.1453/src/testdir/test_packadd.vim vim-8.0.1766/src/testdir/test_packadd.vim --- vim-8.0.1453/src/testdir/test_packadd.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_packadd.vim 2018-04-26 20:30:33.000000000 +0000 @@ -37,8 +37,17 @@ call assert_equal(77, g:plugin_also_works) call assert_equal(17, g:ftdetect_works) call assert_true(len(&rtp) > len(rtp)) - call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/opt/mytest\($\|,\)') - call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/opt/mytest/after$') + call assert_match('/testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp) + call assert_match('/testdir/Xdir/pack/mine/opt/mytest/after$', &rtp) + + " NOTE: '/.../opt/myte' forwardly matches with '/.../opt/mytest' + call mkdir(fnamemodify(s:plugdir, ':h') . '/myte', 'p') + let rtp = &rtp + packadd myte + + " Check the path of 'myte' is added + call assert_true(len(&rtp) > len(rtp)) + call assert_match('/testdir/Xdir/pack/mine/opt/myte\($\|,\)', &rtp) " Check exception call assert_fails("packadd directorynotfound", 'E919:') @@ -60,7 +69,7 @@ call assert_equal(24, g:plugin_works) call assert_true(len(&rtp) > len(rtp)) - call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/start/other\($\|,\)') + call assert_match('/testdir/Xdir/pack/mine/start/other\($\|,\)', &rtp) endfunc func Test_packadd_noload() @@ -77,7 +86,7 @@ packadd! mytest call assert_true(len(&rtp) > len(rtp)) - call assert_true(&rtp =~ 'testdir/Xdir/pack/mine/opt/mytest\($\|,\)') + call assert_match('testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp) call assert_equal(0, g:plugin_works) " check the path is not added twice @@ -108,7 +117,7 @@ packadd mytest " Must have been inserted in the middle, not at the end - call assert_true(&rtp =~ '/pack/mine/opt/mytest,') + call assert_match('/pack/mine/opt/mytest,', &rtp) call assert_equal(44, g:plugin_works) " No change when doing it again. @@ -121,6 +130,43 @@ exec "silent !rm" top2_dir endfunc +func Test_packadd_symlink_dir2() + if !has('unix') + return + endif + let top2_dir = s:topdir . '/Xdir2' + let real_dir = s:topdir . '/Xsym/pack' + call mkdir(top2_dir, 'p') + call mkdir(real_dir, 'p') + let &rtp = top2_dir . ',' . top2_dir . '/after' + let &packpath = &rtp + + exec "silent !ln -s ../Xsym/pack" top2_dir . '/pack' + let s:plugdir = top2_dir . '/pack/mine/opt/mytest' + call mkdir(s:plugdir . '/plugin', 'p') + + exe 'split ' . s:plugdir . '/plugin/test.vim' + call setline(1, 'let g:plugin_works = 48') + wq + let g:plugin_works = 0 + + packadd mytest + + " Must have been inserted in the middle, not at the end + call assert_match('/Xdir2/pack/mine/opt/mytest,', &rtp) + call assert_equal(48, g:plugin_works) + + " No change when doing it again. + let rtp_before = &rtp + packadd mytest + call assert_equal(rtp_before, &rtp) + + set rtp& + let rtp = &rtp + exec "silent !rm" top2_dir . '/pack' + exec "silent !rmdir" top2_dir +endfunc + " Check command-line completion for 'packadd' func Test_packadd_completion() let optdir1 = &packpath . '/pack/mine/opt' @@ -196,9 +242,9 @@ helptags ALL let tags1 = readfile(docdir1 . '/tags') - call assert_true(tags1[0] =~ 'look-here') + call assert_match('look-here', tags1[0]) let tags2 = readfile(docdir2 . '/tags') - call assert_true(tags2[0] =~ 'look-away') + call assert_match('look-away', tags2[0]) endfunc func Test_colorscheme() diff -Nru vim-8.0.1453/src/testdir/test_paste.vim vim-8.0.1766/src/testdir/test_paste.vim --- vim-8.0.1453/src/testdir/test_paste.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_paste.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -" Tests for bracketed paste. +" Tests for bracketed paste and other forms of pasting. " Bracketed paste only works with "xterm". Not in GUI. if has('gui_running') @@ -6,6 +6,8 @@ endif set term=xterm +source shared.vim + func Test_paste_normal_mode() new " In first column text is inserted @@ -66,6 +68,17 @@ bwipe! endfunc +func Test_paste_clipboard() + if !WorkingClipboard() + return + endif + let @+ = "nasty\:!ls\command" + new + exe "normal i\+\" + call assert_equal("nasty\:!ls\command", getline(1)) + bwipe! +endfunc + func Test_paste_cmdline() call feedkeys(":a\[200~foo\bar\[201~b\\"\", 'xt') call assert_equal("\"afoo\barb", getreg(':')) diff -Nru vim-8.0.1453/src/testdir/test_popup.vim vim-8.0.1766/src/testdir/test_popup.vim --- vim-8.0.1453/src/testdir/test_popup.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_popup.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,6 +1,7 @@ " Test for completion menu source shared.vim +source screendump.vim let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] let g:setting = '' @@ -693,7 +694,7 @@ norm! gt call assert_equal(0, &previewwindow) norm! gT - call assert_equal(12, tabpagenr('$')) + call assert_equal(10, tabpagenr('$')) tabonly pclose augroup MyBufAdd @@ -743,4 +744,94 @@ \ 'struct = 0x234 {long = 2343 "\\"some long string that will be wrapped in two\\"", next = 123}')) endfunc +func Test_popup_position() + if !CanRunVimInTerminal() + return + endif + call writefile([ + \ '123456789_123456789_123456789_a', + \ '123456789_123456789_123456789_b', + \ ' 123', + \ ], 'Xtest') + let buf = RunVimInTerminal('Xtest', {}) + call term_sendkeys(buf, ":vsplit\") + + " default pumwidth in left window: overlap in right window + call term_sendkeys(buf, "GA\") + call VerifyScreenDump(buf, 'Test_popup_position_01', {'rows': 8}) + call term_sendkeys(buf, "\u") + + " default pumwidth: fill until right of window + call term_sendkeys(buf, "\l") + call term_sendkeys(buf, "GA\") + call VerifyScreenDump(buf, 'Test_popup_position_02', {'rows': 8}) + + " larger pumwidth: used as minimum width + call term_sendkeys(buf, "\u") + call term_sendkeys(buf, ":set pumwidth=30\") + call term_sendkeys(buf, "GA\") + call VerifyScreenDump(buf, 'Test_popup_position_03', {'rows': 8}) + + " completed text wider than the window and 'pumwidth' smaller than available + " space + call term_sendkeys(buf, "\u") + call term_sendkeys(buf, ":set pumwidth=20\") + call term_sendkeys(buf, "ggI123456789_\") + call term_sendkeys(buf, "jI123456789_\") + call term_sendkeys(buf, "GA\") + call VerifyScreenDump(buf, 'Test_popup_position_04', {'rows': 10}) + + call term_sendkeys(buf, "\u") + call StopVimInTerminal(buf) + call delete('Xtest') +endfunc + +func Test_popup_command() + if !CanRunVimInTerminal() || !has('menu') + return + endif + + call writefile([ + \ 'one two three four five', + \ 'and one two Xthree four five', + \ 'one more two three four five', + \ ], 'Xtest') + let buf = RunVimInTerminal('Xtest', {}) + call term_sendkeys(buf, ":source $VIMRUNTIME/menu.vim\") + call term_sendkeys(buf, "/X\:popup PopUp\") + call VerifyScreenDump(buf, 'Test_popup_command_01', {}) + + " Select a word + call term_sendkeys(buf, "jj") + call VerifyScreenDump(buf, 'Test_popup_command_02', {}) + + " Select a word + call term_sendkeys(buf, "j\") + call VerifyScreenDump(buf, 'Test_popup_command_03', {}) + + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) + call delete('Xtest') +endfunc + +func Test_popup_complete_backwards() + new + call setline(1, ['Post', 'Port', 'Po']) + let expected=['Post', 'Port', 'Port'] + call cursor(3,2) + call feedkeys("A\". repeat("\", 3). "rt\", 'tx') + call assert_equal(expected, getline(1,'$')) + bwipe! +endfunc + +func Test_popup_complete_backwards_ctrl_p() + new + call setline(1, ['Post', 'Port', 'Po']) + let expected=['Post', 'Port', 'Port'] + call cursor(3,2) + call feedkeys("A\\rt\", 'tx') + call assert_equal(expected, getline(1,'$')) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff -Nru vim-8.0.1453/src/testdir/test_quickfix.vim vim-8.0.1766/src/testdir/test_quickfix.vim --- vim-8.0.1453/src/testdir/test_quickfix.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_quickfix.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1795,6 +1795,9 @@ call assert_equal(0, s) let d = g:Xgetlist({"title":1}) call assert_equal('Sample', d.title) + " Try setting title to a non-string value + call assert_equal(-1, g:Xsetlist([], 'a', {'title' : ['Test']})) + call assert_equal('Sample', g:Xgetlist({"title":1}).title) Xopen call assert_equal('Sample', w:quickfix_title) @@ -1943,6 +1946,9 @@ call g:Xsetlist([], 'a', {'items' : [{'filename':'F1', 'lnum':10}]}) call assert_equal(10, g:Xgetlist({'items':1}).items[0].lnum) + " Try setting the items using a string + call assert_equal(-1, g:Xsetlist([], ' ', {'items' : 'Test'})) + " Save and restore the quickfix stack call g:Xsetlist([], 'f') call assert_equal(0, g:Xgetlist({'nr':'$'}).nr) @@ -2296,6 +2302,12 @@ call assert_equal('Xtestfile2', bufname('')) call assert_equal('Editor:Emacs EmAcS', l[0].text) + " Test for unloading a buffer after vimgrep searched the buffer + %bwipe + Xvimgrep /Editor/j Xtestfile* + call assert_equal(0, getbufinfo('Xtestfile1')[0].loaded) + call assert_equal([], getbufinfo('Xtestfile2')) + call delete('Xtestfile1') call delete('Xtestfile2') endfunc @@ -2582,6 +2594,29 @@ call assert_equal(3, l1.items[1].lnum) call assert_equal('two.txt', bufname(l2.items[1].bufnr)) call assert_equal(5, l2.items[1].lnum) + + " Test for start of a new error line in the same line where a previous + " error line ends with a file stack. + let efm_val = 'Error\ l%l\ in\ %f,' + let efm_val .= '%-P%>(%f%r,Error\ l%l\ in\ %m,%-Q)%r' + let l = g:Xgetlist({'lines' : [ + \ '(one.txt', + \ 'Error l4 in one.txt', + \ ') (two.txt', + \ 'Error l6 in two.txt', + \ ')', + \ 'Error l8 in one.txt' + \ ], 'efm' : efm_val}) + call assert_equal(3, len(l.items)) + call assert_equal('one.txt', bufname(l.items[0].bufnr)) + call assert_equal(4, l.items[0].lnum) + call assert_equal('one.txt', l.items[0].text) + call assert_equal('two.txt', bufname(l.items[1].bufnr)) + call assert_equal(6, l.items[1].lnum) + call assert_equal('two.txt', l.items[1].text) + call assert_equal('one.txt', bufname(l.items[2].bufnr)) + call assert_equal(8, l.items[2].lnum) + call assert_equal('', l.items[2].text) endfunc func Test_multifilestack() @@ -3111,3 +3146,58 @@ call assert_equal(3, winnr()) close endfunc + +" Tests for quickfix/location lists changed by autocommands when +" :vimgrep/:lvimgrep commands are running. +func Test_vimgrep_autocmd() + call setqflist([], 'f') + call writefile(['stars'], 'Xtest1.txt') + call writefile(['stars'], 'Xtest2.txt') + + " Test 1: + " When searching for a pattern using :vimgrep, if the quickfix list is + " changed by an autocmd, the results should be added to the correct quickfix + " list. + autocmd BufRead Xtest2.txt cexpr '' | cexpr '' + silent vimgrep stars Xtest*.txt + call assert_equal(1, getqflist({'nr' : 0}).nr) + call assert_equal(3, getqflist({'nr' : '$'}).nr) + call assert_equal('Xtest2.txt', bufname(getqflist()[1].bufnr)) + au! BufRead Xtest2.txt + + " Test 2: + " When searching for a pattern using :vimgrep, if the quickfix list is + " freed, then a error should be given. + silent! %bwipe! + call setqflist([], 'f') + autocmd BufRead Xtest2.txt for i in range(10) | cexpr '' | endfor + call assert_fails('vimgrep stars Xtest*.txt', 'E925:') + au! BufRead Xtest2.txt + + " Test 3: + " When searching for a pattern using :lvimgrep, if the location list is + " freed, then the command should error out. + silent! %bwipe! + let g:save_winid = win_getid() + autocmd BufRead Xtest2.txt call setloclist(g:save_winid, [], 'f') + call assert_fails('lvimgrep stars Xtest*.txt', 'E926:') + au! BufRead Xtest2.txt + + call delete('Xtest1.txt') + call delete('Xtest2.txt') + call setqflist([], 'f') +endfunc + +" The following test used to crash Vim +func Test_lhelpgrep_autocmd() + lhelpgrep quickfix + autocmd QuickFixCmdPost * call setloclist(0, [], 'f') + lhelpgrep buffer + call assert_equal('help', &filetype) + call assert_equal(0, getloclist(0, {'nr' : '$'}).nr) + lhelpgrep tabpage + call assert_equal('help', &filetype) + call assert_equal(1, getloclist(0, {'nr' : '$'}).nr) + au! QuickFixCmdPost + new | only +endfunc diff -Nru vim-8.0.1453/src/testdir/test_quotestar.vim vim-8.0.1766/src/testdir/test_quotestar.vim --- vim-8.0.1453/src/testdir/test_quotestar.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_quotestar.vim 2018-04-26 20:30:33.000000000 +0000 @@ -65,30 +65,29 @@ " Takes a short while for the server to be active. call WaitFor('serverlist() =~ "' . name . '"') - call assert_match(name, serverlist()) " Wait for the server to be up and answering requests. One second is not " always sufficient. call WaitFor('remote_expr("' . name . '", "v:version", "", 2) != ""') - " Clear the *-register of this vim instance. - let @* = '' - - " Try to change the *-register of the server. + " Clear the *-register of this vim instance and wait for it to be picked up + " by the server. + let @* = 'no' call remote_foreground(name) + call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "no"') + + " Set the * register on the server. call remote_send(name, ":let @* = 'yes'\") call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "yes"') - call assert_equal('yes', remote_expr(name, "@*", "", 2)) " Check that the *-register of this vim instance is changed as expected. call WaitFor('@* == "yes"') - call assert_equal('yes', @*) " Handle the large selection over 262040 byte. let length = 262044 let sample = 'a' . repeat('b', length - 2) . 'c' let @* = sample - call WaitFor('remote_expr("' . name . '", "len(@*) >= ' . length . '", "", 1)', 3000) + call WaitFor('remote_expr("' . name . '", "len(@*) >= ' . length . '", "", 1)') let res = remote_expr(name, "@*", "", 2) call assert_equal(length, len(res)) " Check length to prevent a large amount of output at assertion failure. diff -Nru vim-8.0.1453/src/testdir/test_startup.vim vim-8.0.1766/src/testdir/test_startup.vim --- vim-8.0.1453/src/testdir/test_startup.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_startup.vim 2018-04-26 20:30:33.000000000 +0000 @@ -226,6 +226,20 @@ call delete('Xtestout') endfunc +func Test_set_shell() + let after = [ + \ 'call writefile([&shell], "Xtestout")', + \ 'quit!', + \ ] + let $SHELL = '/bin/with space/sh' + if RunVimPiped([], after, '', '') + let lines = readfile('Xtestout') + " MS-Windows adds a space after the word + call assert_equal('/bin/with\ space/sh', lines[0]) + endif + call delete('Xtestout') +endfunc + func Test_progpath() " Tests normally run with "./vim" or "../vim", these must have been expanded " to a full path. diff -Nru vim-8.0.1453/src/testdir/test_syntax.vim vim-8.0.1766/src/testdir/test_syntax.vim --- vim-8.0.1453/src/testdir/test_syntax.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_syntax.vim 2018-04-26 20:30:33.000000000 +0000 @@ -5,6 +5,7 @@ endif source view_util.vim +source screendump.vim func GetSyntaxItem(pat) let c = '' @@ -425,6 +426,8 @@ set bg=dark hi Normal ctermbg=12 call assert_equal('dark', &bg) + + hi Normal ctermbg=NONE endfunc func Test_syntax_hangs() @@ -497,7 +500,7 @@ bw! endfunc -fun Test_synstack_synIDtrans() +func Test_synstack_synIDtrans() new setfiletype c syntax on @@ -520,3 +523,42 @@ syn clear bw! endfunc + +" Check highlighting for a small piece of C code with a screen dump. +func Test_syntax_c() + if !CanRunVimInTerminal() + return + endif + call writefile([ + \ '/* comment line at the top */', + \ ' int', + \ 'main(int argc, char **argv)// another comment', + \ '{', + \ '#if 0', + \ ' int not_used;', + \ '#else', + \ ' int used;', + \ '#endif', + \ ' printf("Just an example piece of C code\n");', + \ ' return 0x0ff;', + \ '}', + \ ' static void', + \ 'myFunction(const double count, struct nothing, long there) {', + \ ' // 123: nothing to read here', + \ ' for (int i = 0; i < count; ++i) {', + \ ' break;', + \ ' }', + \ '}', + \ ], 'Xtest.c') + + " This makes the default for 'background' use "dark", check that the + " response to t_RB corrects it to "light". + let $COLORFGBG = '15;0' + + let buf = RunVimInTerminal('Xtest.c', {}) + call VerifyScreenDump(buf, 'Test_syntax_c_01', {}) + call StopVimInTerminal(buf) + + let $COLORFGBG = '' + call delete('Xtest.c') +endfun diff -Nru vim-8.0.1453/src/testdir/test_tabpage.vim vim-8.0.1766/src/testdir/test_tabpage.vim --- vim-8.0.1453/src/testdir/test_tabpage.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_tabpage.vim 2018-04-26 20:30:33.000000000 +0000 @@ -41,40 +41,38 @@ call assert_true(t:val_num == 100 && t:val_str == 'SetTabVar test' && t:val_list == ['red', 'blue', 'green']) tabclose - if has('gui') || has('clientserver') - " Test for ":tab drop exist-file" to keep current window. - sp test1 - tab drop test1 - call assert_true(tabpagenr('$') == 1 && winnr('$') == 2 && winnr() == 1) - close - " - " - " Test for ":tab drop new-file" to keep current window of tabpage 1. - split - tab drop newfile - call assert_true(tabpagenr('$') == 2 && tabpagewinnr(1, '$') == 2 && tabpagewinnr(1) == 1) - tabclose - q - " - " - " Test for ":tab drop multi-opend-file" to keep current tabpage and window. - new test1 - tabnew - new test1 - tab drop test1 - call assert_true(tabpagenr() == 2 && tabpagewinnr(2, '$') == 2 && tabpagewinnr(2) == 1) - tabclose - q - " - " - " Test for ":tab drop vertical-split-window" to jump test1 buffer - tabedit test1 - vnew - tabfirst - tab drop test1 - call assert_equal([2, 2, 2, 2], [tabpagenr('$'), tabpagenr(), tabpagewinnr(2, '$'), tabpagewinnr(2)]) - 1tabonly - endif + " Test for ":tab drop exist-file" to keep current window. + sp test1 + tab drop test1 + call assert_true(tabpagenr('$') == 1 && winnr('$') == 2 && winnr() == 1) + close + " + " + " Test for ":tab drop new-file" to keep current window of tabpage 1. + split + tab drop newfile + call assert_true(tabpagenr('$') == 2 && tabpagewinnr(1, '$') == 2 && tabpagewinnr(1) == 1) + tabclose + q + " + " + " Test for ":tab drop multi-opend-file" to keep current tabpage and window. + new test1 + tabnew + new test1 + tab drop test1 + call assert_true(tabpagenr() == 2 && tabpagewinnr(2, '$') == 2 && tabpagewinnr(2) == 1) + tabclose + q + " + " + " Test for ":tab drop vertical-split-window" to jump test1 buffer + tabedit test1 + vnew + tabfirst + tab drop test1 + call assert_equal([2, 2, 2, 2], [tabpagenr('$'), tabpagenr(), tabpagewinnr(2, '$'), tabpagewinnr(2)]) + 1tabonly " " for i in range(9) | tabnew | endfor diff -Nru vim-8.0.1453/src/testdir/test_tagjump.vim vim-8.0.1766/src/testdir/test_tagjump.vim --- vim-8.0.1453/src/testdir/test_tagjump.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_tagjump.vim 2018-04-26 20:30:33.000000000 +0000 @@ -229,4 +229,32 @@ call delete('Xtags1') endfunc +func Test_tagjump_etags() + if !has('emacs_tags') + return + endif + call writefile([ + \ "void foo() {}", + \ "int main(int argc, char **argv)", + \ "{", + \ "\tfoo();", + \ "\treturn 0;", + \ "}", + \ ], 'Xmain.c') + + call writefile([ + \ "\x0c", + \ "Xmain.c,64", + \ "void foo() {}\x7ffoo\x011,0", + \ "int main(int argc, char **argv)\x7fmain\x012,14", + \ ], 'Xtags') + set tags=Xtags + ta foo + call assert_equal('void foo() {}', getline('.')) + + call delete('Xtags') + call delete('Xmain.c') + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff -Nru vim-8.0.1453/src/testdir/test_terminal.vim vim-8.0.1766/src/testdir/test_terminal.vim --- vim-8.0.1453/src/testdir/test_terminal.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_terminal.vim 2018-04-26 20:30:33.000000000 +0000 @@ -5,6 +5,7 @@ endif source shared.vim +source screendump.vim let s:python = PythonProg() @@ -30,13 +31,6 @@ return buf endfunc -" Stops the shell started by Run_shell_in_terminal(). -func Stop_shell_in_terminal(buf) - call term_sendkeys(a:buf, "exit\r") - call WaitFor('job_status(g:job) == "dead"') - call assert_equal('dead', job_status(g:job)) -endfunc - func Test_terminal_basic() au BufWinEnter * if &buftype == 'terminal' | let b:done = 'yes' | endif let buf = Run_shell_in_terminal({}) @@ -51,11 +45,17 @@ call assert_equal('t', mode()) call assert_equal('yes', b:done) call assert_match('%aR[^\n]*running]', execute('ls')) + call assert_match('%aR[^\n]*running]', execute('ls R')) + call assert_notmatch('%[^\n]*running]', execute('ls F')) + call assert_notmatch('%[^\n]*running]', execute('ls ?')) call Stop_shell_in_terminal(buf) call term_wait(buf) call assert_equal('n', mode()) call assert_match('%aF[^\n]*finished]', execute('ls')) + call assert_match('%aF[^\n]*finished]', execute('ls F')) + call assert_notmatch('%[^\n]*finished]', execute('ls R')) + call assert_notmatch('%[^\n]*finished]', execute('ls ?')) " closing window wipes out the terminal buffer a with finished job close @@ -271,6 +271,27 @@ call delete('Xtext') endfunc +func Test_terminal_scrollback() + let buf = Run_shell_in_terminal({}) + set termwinscroll=100 + call writefile(range(150), 'Xtext') + if has('win32') + call term_sendkeys(buf, "type Xtext\") + else + call term_sendkeys(buf, "cat Xtext\") + endif + let rows = term_getsize(buf)[0] + " On MS-Windows there is an empty line, check both last line and above it. + call WaitFor({-> term_getline(buf, rows - 1) . term_getline(buf, rows - 2) =~ '149'}) + let lines = line('$') + call assert_inrange(91, 100, lines) + + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + set termwinscroll& +endfunc + func Test_terminal_size() let cmd = Get_cat_123_cmd() @@ -286,9 +307,19 @@ vsplit exe 'terminal ++rows=5 ++cols=33 ' . cmd - let size = term_getsize('') + call assert_equal([5, 33], term_getsize('')) + + call term_setsize('', 6, 0) + call assert_equal([6, 33], term_getsize('')) + + call term_setsize('', 0, 35) + call assert_equal([6, 35], term_getsize('')) + + call term_setsize('', 7, 30) + call assert_equal([7, 30], term_getsize('')) + bwipe! - call assert_equal([5, 33], size) + call assert_fails("call term_setsize('', 7, 30)", "E955:") call term_start(cmd, {'term_rows': 6, 'term_cols': 36}) let size = term_getsize('') @@ -373,6 +404,26 @@ let [cmd, waittime] = s:get_sleep_cmd() + " shell terminal closes automatically + terminal + let buf = bufnr('%') + call assert_equal(2, winnr('$')) + " Wait for the shell to display a prompt + call WaitFor({-> term_getline(buf, 1) != ""}) + call Stop_shell_in_terminal(buf) + call WaitFor("winnr('$') == 1", waittime) + + " shell terminal that does not close automatically + terminal ++noclose + let buf = bufnr('%') + call assert_equal(2, winnr('$')) + " Wait for the shell to display a prompt + call WaitFor({-> term_getline(buf, 1) != ""}) + call Stop_shell_in_terminal(buf) + call assert_equal(2, winnr('$')) + quit + call assert_equal(1, winnr('$')) + exe 'terminal ++close ' . cmd call assert_equal(2, winnr('$')) wincmd p @@ -438,39 +489,38 @@ if !has('clientserver') return endif - let g:buf = Run_shell_in_terminal({}) + let buf = Run_shell_in_terminal({}) " Wait for the shell to display a prompt - call WaitFor('term_getline(g:buf, 1) != ""') + call WaitFor({-> term_getline(buf, 1) != ""}) if has('win32') - call term_sendkeys(g:buf, "echo %VIM_SERVERNAME%\r") + call term_sendkeys(buf, "echo %VIM_SERVERNAME%\r") else - call term_sendkeys(g:buf, "echo $VIM_SERVERNAME\r") + call term_sendkeys(buf, "echo $VIM_SERVERNAME\r") endif - call term_wait(g:buf) - call Stop_shell_in_terminal(g:buf) + call term_wait(buf) + call Stop_shell_in_terminal(buf) call WaitFor('getline(2) == v:servername') call assert_equal(v:servername, getline(2)) - exe g:buf . 'bwipe' - unlet g:buf + exe buf . 'bwipe' + unlet buf endfunc func Test_terminal_env() - let g:buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}}) + let buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}}) " Wait for the shell to display a prompt - call WaitFor('term_getline(g:buf, 1) != ""') + call WaitFor({-> term_getline(buf, 1) != ""}) if has('win32') - call term_sendkeys(g:buf, "echo %TESTENV%\r") + call term_sendkeys(buf, "echo %TESTENV%\r") else - call term_sendkeys(g:buf, "echo $TESTENV\r") + call term_sendkeys(buf, "echo $TESTENV\r") endif - call term_wait(g:buf) - call Stop_shell_in_terminal(g:buf) + call term_wait(buf) + call Stop_shell_in_terminal(buf) call WaitFor('getline(2) == "correct"') call assert_equal('correct', getline(2)) - exe g:buf . 'bwipe' - unlet g:buf + exe buf . 'bwipe' endfunc " must be last, we can't go back from GUI to terminal @@ -597,8 +647,7 @@ else call system('echo "look here" > ' . pty) endif - let g:buf = buf - call WaitFor('term_getline(g:buf, 1) =~ "look here"') + call WaitFor({-> term_getline(buf, 1) =~ "look here"}) call assert_match('look here', term_getline(buf, 1)) bwipe! @@ -678,8 +727,7 @@ call assert_equal('456', maparg('123', 't')) call assert_equal('abxde', maparg('456', 't')) call feedkeys("123", 'tx') - let g:buf = buf - call WaitFor("term_getline(g:buf,term_getcursor(g:buf)[0]) =~ 'abxde\\|456'") + call WaitFor({-> term_getline(buf, term_getcursor(buf)[0]) =~ 'abxde\|456'}) let lnum = term_getcursor(buf)[0] if a:remap call assert_match('abxde', term_getline(buf, lnum)) @@ -712,6 +760,15 @@ unlet g:job endfunc +func Test_terminal_wqall() + let buf = Run_shell_in_terminal({}) + call assert_fails('wqall', 'E948') + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + unlet g:job +endfunc + func Test_terminal_composing_unicode() let save_enc = &encoding set encoding=utf-8 @@ -729,6 +786,12 @@ let g:job = term_getjob(buf) call term_wait(buf, 50) + if has('win32') + call assert_equal('cmd', job_info(g:job).cmd[0]) + else + call assert_equal(&shell, job_info(g:job).cmd[0]) + endif + " ascii + composing let txt = "a\u0308bc" call term_sendkeys(buf, "echo " . txt . "\r") @@ -813,27 +876,612 @@ endif let buf = Run_shell_in_terminal({}) - call term_wait(buf) + call WaitFor({-> term_getline(buf, 1) != ''}) - new - call setline(1, "\x1b[6n") - write! Xescape + call term_sendkeys(buf, "cat\") + call WaitFor({-> term_getline(buf, 1) =~ 'cat'}) + + " Request the cursor position. + call term_sendkeys(buf, "\x1b[6n\") + + " Wait for output from tty to display, below an empty line. + call WaitFor({-> term_getline(buf, 4) =~ '3;1R'}) + + " End "cat" gently. + call term_sendkeys(buf, "\\") + + call Stop_shell_in_terminal(buf) + exe buf . 'bwipe' + unlet g:job +endfunc + +" Run Vim, start a terminal in that Vim with the kill argument, +" :qall works. +func Run_terminal_qall_kill(line1, line2) + " 1. Open a terminal window and wait for the prompt to appear + " 2. set kill using term_setkill() + " 3. make Vim exit, it will kill the shell + let after = [ + \ a:line1, + \ 'let buf = bufnr("%")', + \ 'while term_getline(buf, 1) =~ "^\\s*$"', + \ ' sleep 10m', + \ 'endwhile', + \ a:line2, + \ 'au VimLeavePre * call writefile(["done"], "Xdone")', + \ 'qall', + \ ] + if !RunVim([], after, '') + return + endif + call assert_equal("done", readfile("Xdone")[0]) + call delete("Xdone") +endfunc + +" Run Vim in a terminal, then start a terminal in that Vim with a kill +" argument, check that :qall works. +func Test_terminal_qall_kill_arg() + call Run_terminal_qall_kill('term ++kill=kill', '') +endfunc + +" Run Vim, start a terminal in that Vim, set the kill argument with +" term_setkill(), check that :qall works. +func Test_terminal_qall_kill_func() + call Run_terminal_qall_kill('term', 'call term_setkill(buf, "kill")') +endfunc + +" Run Vim, start a terminal in that Vim without the kill argument, +" check that :qall does not exit, :qall! does. +func Test_terminal_qall_exit() + let after = [ + \ 'term', + \ 'let buf = bufnr("%")', + \ 'while term_getline(buf, 1) =~ "^\\s*$"', + \ ' sleep 10m', + \ 'endwhile', + \ 'set nomore', + \ 'au VimLeavePre * call writefile(["too early"], "Xdone")', + \ 'qall', + \ 'au! VimLeavePre * exe buf . "bwipe!" | call writefile(["done"], "Xdone")', + \ 'cquit', + \ ] + if !RunVim([], after, '') + return + endif + call assert_equal("done", readfile("Xdone")[0]) + call delete("Xdone") +endfunc + +" Run Vim in a terminal, then start a terminal in that Vim without a kill +" argument, check that :confirm qall works. +func Test_terminal_qall_prompt() + if !CanRunVimInTerminal() + return + endif + let buf = RunVimInTerminal('', {}) + + " Open a terminal window and wait for the prompt to appear + call term_sendkeys(buf, ":term\") + call WaitFor({-> term_getline(buf, 10) =~ '\[running]'}) + call WaitFor({-> term_getline(buf, 1) !~ '^\s*$'}) + + " make Vim exit, it will prompt to kill the shell + call term_sendkeys(buf, "\:confirm qall\") + call WaitFor({-> term_getline(buf, 20) =~ 'ancel:'}) + call term_sendkeys(buf, "y") + call WaitFor({-> term_getstatus(buf) == "finished"}) + + " close the terminal window where Vim was running + quit +endfunc + +func Test_terminal_open_autocmd() + augroup repro + au! + au TerminalOpen * let s:called += 1 + augroup END + + let s:called = 0 + + " Open a terminal window with :terminal + terminal + call assert_equal(1, s:called) + bwipe! + + " Open a terminal window with term_start() + call term_start(&shell) + call assert_equal(2, s:called) + bwipe! + + " Open a hidden terminal buffer with :terminal + terminal ++hidden + call assert_equal(3, s:called) + for buf in term_list() + exe buf . "bwipe!" + endfor + + " Open a hidden terminal buffer with term_start() + let buf = term_start(&shell, {'hidden': 1}) + call assert_equal(4, s:called) + exe buf . "bwipe!" + + unlet s:called + au! repro +endfunction + +func Check_dump01(off) + call assert_equal('one two three four five', trim(getline(a:off + 1))) + call assert_equal('~ Select Word', trim(getline(a:off + 7))) + call assert_equal(':popup PopUp', trim(getline(a:off + 20))) +endfunc + +func Test_terminal_dumpwrite_composing() + if !CanRunVimInTerminal() + return + endif + let save_enc = &encoding + set encoding=utf-8 + call assert_equal(1, winnr('$')) + + let text = " a\u0300 e\u0302 o\u0308" + call writefile([text], 'Xcomposing') + let buf = RunVimInTerminal('Xcomposing', {}) + call WaitFor({-> term_getline(buf, 1) =~ text}) + call term_dumpwrite(buf, 'Xdump') + let dumpline = readfile('Xdump')[0] + call assert_match('|aÌ€| |eÌ‚| |ö', dumpline) + + call StopVimInTerminal(buf) + call delete('Xcomposing') + call delete('Xdump') + let &encoding = save_enc +endfunc + +" just testing basic functionality. +func Test_terminal_dumpload() + call assert_equal(1, winnr('$')) + call term_dumpload('dumps/Test_popup_command_01.dump') + call assert_equal(2, winnr('$')) + call assert_equal(20, line('$')) + call Check_dump01(0) + quit +endfunc + +func Test_terminal_dumpdiff() + call assert_equal(1, winnr('$')) + call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump') + call assert_equal(2, winnr('$')) + call assert_equal(62, line('$')) + call Check_dump01(0) + call Check_dump01(42) + call assert_equal(' bbbbbbbbbbbbbbbbbb ', getline(26)[0:29]) + quit +endfunc + +func Test_terminal_dumpdiff_options() + set laststatus=0 + call assert_equal(1, winnr('$')) + let height = winheight(0) + call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'vertical': 1, 'term_cols': 33}) + call assert_equal(2, winnr('$')) + call assert_equal(height, winheight(winnr())) + call assert_equal(33, winwidth(winnr())) + call assert_equal('dump diff dumps/Test_popup_command_01.dump', bufname('%')) + quit + + call assert_equal(1, winnr('$')) + let width = winwidth(0) + call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'vertical': 0, 'term_rows': 13, 'term_name': 'something else'}) + call assert_equal(2, winnr('$')) + call assert_equal(width, winwidth(winnr())) + call assert_equal(13, winheight(winnr())) + call assert_equal('something else', bufname('%')) + quit + + call assert_equal(1, winnr('$')) + call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'curwin': 1}) + call assert_equal(1, winnr('$')) bwipe - call term_sendkeys(buf, "cat Xescape\") - " wait for the response of control sequence from libvterm (and send it to tty) - sleep 200m + set laststatus& +endfunc + +func Api_drop_common(options) + call assert_equal(1, winnr('$')) + + " Use the title termcap entries to output the escape sequence. + call writefile([ + \ 'set title', + \ 'exe "set t_ts=\]51; t_fs=\x07"', + \ 'let &titlestring = ''["drop","Xtextfile"' . a:options . ']''', + \ 'redraw', + \ "set t_ts=", + \ ], 'Xscript') + let buf = RunVimInTerminal('-S Xscript', {}) + call WaitFor({-> bufnr('Xtextfile') > 0}) + call assert_equal('Xtextfile', expand('%:t')) + call assert_true(winnr('$') >= 3) + return buf +endfunc + +func Test_terminal_api_drop_newwin() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common('') + call assert_equal(0, &bin) + call assert_equal('', &fenc) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_newwin_bin() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common(',{"bin":1}') + call assert_equal(1, &bin) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_newwin_binary() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common(',{"binary":1}') + call assert_equal(1, &bin) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_newwin_nobin() + if !CanRunVimInTerminal() + return + endif + set binary + let buf = Api_drop_common(',{"nobin":1}') + call assert_equal(0, &bin) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile + set nobinary +endfunc + +func Test_terminal_api_drop_newwin_nobinary() + if !CanRunVimInTerminal() + return + endif + set binary + let buf = Api_drop_common(',{"nobinary":1}') + call assert_equal(0, &bin) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile + set nobinary +endfunc + +func Test_terminal_api_drop_newwin_ff() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common(',{"ff":"dos"}') + call assert_equal("dos", &ff) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_newwin_fileformat() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common(',{"fileformat":"dos"}') + call assert_equal("dos", &ff) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_newwin_enc() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common(',{"enc":"utf-16"}') + call assert_equal("utf-16", &fenc) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_newwin_encoding() + if !CanRunVimInTerminal() + return + endif + let buf = Api_drop_common(',{"encoding":"utf-16"}') + call assert_equal("utf-16", &fenc) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Test_terminal_api_drop_oldwin() + if !CanRunVimInTerminal() + return + endif + let firstwinid = win_getid() + split Xtextfile + let textfile_winid = win_getid() + call assert_equal(2, winnr('$')) + call win_gotoid(firstwinid) + + " Use the title termcap entries to output the escape sequence. + call writefile([ + \ 'set title', + \ 'exe "set t_ts=\]51; t_fs=\x07"', + \ 'let &titlestring = ''["drop","Xtextfile"]''', + \ 'redraw', + \ "set t_ts=", + \ ], 'Xscript') + let buf = RunVimInTerminal('-S Xscript', {'rows': 10}) + call WaitFor({-> expand('%:t') =='Xtextfile'}) + call assert_equal(textfile_winid, win_getid()) + + call StopVimInTerminal(buf) + call delete('Xscript') + bwipe Xtextfile +endfunc + +func Tapi_TryThis(bufnum, arg) + let g:called_bufnum = a:bufnum + let g:called_arg = a:arg +endfunc + +func WriteApiCall(funcname) + " Use the title termcap entries to output the escape sequence. + call writefile([ + \ 'set title', + \ 'exe "set t_ts=\]51; t_fs=\x07"', + \ 'let &titlestring = ''["call","' . a:funcname . '",["hello",123]]''', + \ 'redraw', + \ "set t_ts=", + \ ], 'Xscript') +endfunc + +func Test_terminal_api_call() + if !CanRunVimInTerminal() + return + endif + + call WriteApiCall('Tapi_TryThis') + let buf = RunVimInTerminal('-S Xscript', {}) + call WaitFor({-> exists('g:called_bufnum')}) + call assert_equal(buf, g:called_bufnum) + call assert_equal(['hello', 123], g:called_arg) + + call StopVimInTerminal(buf) + call delete('Xscript') + unlet g:called_bufnum + unlet g:called_arg +endfunc + +func Test_terminal_api_call_fails() + if !CanRunVimInTerminal() + return + endif + + call WriteApiCall('TryThis') + call ch_logfile('Xlog', 'w') + let buf = RunVimInTerminal('-S Xscript', {}) + call WaitFor({-> string(readfile('Xlog')) =~ 'Invalid function name: TryThis'}) + + call StopVimInTerminal(buf) + call delete('Xscript') + call ch_logfile('', '') + call delete('Xlog') +endfunc + +let s:caught_e937 = 0 + +func Tapi_Delete(bufnum, arg) + try + execute 'bdelete!' a:bufnum + catch /E937:/ + let s:caught_e937 = 1 + endtry +endfunc + +func Test_terminal_api_call_fail_delete() + if !CanRunVimInTerminal() + return + endif + + call WriteApiCall('Tapi_Delete') + let buf = RunVimInTerminal('-S Xscript', {}) + call WaitFor({-> s:caught_e937 == 1}) + + call StopVimInTerminal(buf) + call delete('Xscript') + call ch_logfile('', '') +endfunc + +func Test_terminal_ansicolors_default() + let colors = [ + \ '#000000', '#e00000', + \ '#00e000', '#e0e000', + \ '#0000e0', '#e000e0', + \ '#00e0e0', '#e0e0e0', + \ '#808080', '#ff4040', + \ '#40ff40', '#ffff40', + \ '#4040ff', '#ff40ff', + \ '#40ffff', '#ffffff', + \] + + let buf = Run_shell_in_terminal({}) + call assert_equal(colors, term_getansicolors(buf)) + call Stop_shell_in_terminal(buf) call term_wait(buf) - " Wait for output from tty to display, below an empty line. - " It should show \e3;1R, but only 1R may show up - call assert_match('\<\d\+R', term_getline(buf, 3)) + exe buf . 'bwipe' +endfunc + +let s:test_colors = [ + \ '#616e64', '#0d0a79', + \ '#6d610d', '#0a7373', + \ '#690d0a', '#6d696e', + \ '#0d0a6f', '#616e0d', + \ '#0a6479', '#6d0d0a', + \ '#617373', '#0d0a69', + \ '#6d690d', '#0a6e6f', + \ '#610d0a', '#6e6479', + \] + +func Test_terminal_ansicolors_global() + let g:terminal_ansi_colors = reverse(copy(s:test_colors)) + let buf = Run_shell_in_terminal({}) + call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) + call Stop_shell_in_terminal(buf) + call term_wait(buf) + + exe buf . 'bwipe' + unlet g:terminal_ansi_colors +endfunc + +func Test_terminal_ansicolors_func() + let g:terminal_ansi_colors = reverse(copy(s:test_colors)) + let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors}) + call assert_equal(s:test_colors, term_getansicolors(buf)) + + call term_setansicolors(buf, g:terminal_ansi_colors) + call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) + + let colors = [ + \ 'ivory', 'AliceBlue', + \ 'grey67', 'dark goldenrod', + \ 'SteelBlue3', 'PaleVioletRed4', + \ 'MediumPurple2', 'yellow2', + \ 'RosyBrown3', 'OrangeRed2', + \ 'white smoke', 'navy blue', + \ 'grey47', 'gray97', + \ 'MistyRose2', 'DodgerBlue4', + \] + call term_setansicolors(buf, colors) + + let colors[4] = 'Invalid' + call assert_fails('call term_setansicolors(buf, colors)', 'E474:') + + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' +endfunc + +func Test_terminal_termwinsize_option_fixed() + if !CanRunVimInTerminal() + return + endif + set termwinsize=6x40 + let text = [] + for n in range(10) + call add(text, repeat(n, 50)) + endfor + call writefile(text, 'Xwinsize') + let buf = RunVimInTerminal('Xwinsize', {}) + let win = bufwinid(buf) + call assert_equal([6, 40], term_getsize(buf)) + call assert_equal(6, winheight(win)) + call assert_equal(40, winwidth(win)) + + " resizing the window doesn't resize the terminal. + resize 10 + vertical resize 60 + call assert_equal([6, 40], term_getsize(buf)) + call assert_equal(10, winheight(win)) + call assert_equal(60, winwidth(win)) + + call StopVimInTerminal(buf) + call delete('Xwinsize') + + call assert_fails('set termwinsize=40', 'E474') + call assert_fails('set termwinsize=10+40', 'E474') + call assert_fails('set termwinsize=abc', 'E474') + + set termwinsize= +endfunc - call term_sendkeys(buf, "\") +func Test_terminal_termwinsize_option_zero() + set termwinsize=0x0 + let buf = Run_shell_in_terminal({}) + let win = bufwinid(buf) + call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) + call Stop_shell_in_terminal(buf) call term_wait(buf) + exe buf . 'bwipe' + + set termwinsize=7x0 + let buf = Run_shell_in_terminal({}) + let win = bufwinid(buf) + call assert_equal([7, winwidth(win)], term_getsize(buf)) call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + set termwinsize=0x33 + let buf = Run_shell_in_terminal({}) + let win = bufwinid(buf) + call assert_equal([winheight(win), 33], term_getsize(buf)) + call Stop_shell_in_terminal(buf) + call term_wait(buf) exe buf . 'bwipe' - call delete('Xescape') - unlet g:job + + set termwinsize= +endfunc + +func Test_terminal_termwinsize_mininmum() + set termwinsize=10*50 + vsplit + let buf = Run_shell_in_terminal({}) + let win = bufwinid(buf) + call assert_inrange(10, 1000, winheight(win)) + call assert_inrange(50, 1000, winwidth(win)) + call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) + + resize 15 + vertical resize 60 + redraw + call assert_equal([15, 60], term_getsize(buf)) + call assert_equal(15, winheight(win)) + call assert_equal(60, winwidth(win)) + + resize 7 + vertical resize 30 + redraw + call assert_equal([10, 50], term_getsize(buf)) + call assert_equal(7, winheight(win)) + call assert_equal(30, winwidth(win)) + + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + + set termwinsize=0*0 + let buf = Run_shell_in_terminal({}) + let win = bufwinid(buf) + call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + + set termwinsize= endfunc diff -Nru vim-8.0.1453/src/testdir/test_textobjects.vim vim-8.0.1766/src/testdir/test_textobjects.vim --- vim-8.0.1453/src/testdir/test_textobjects.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_textobjects.vim 2018-04-26 20:30:33.000000000 +0000 @@ -152,3 +152,16 @@ call assert_equal(3 , match('abc', '\zs', 3, 1)) call assert_equal(-1, match('abc', '\zs', 4, 1)) endfunc + +" This was causing an illegal memory access +func Test_inner_tag() + new + norm ixxx + call feedkeys("v", 'xt') + insert +x +x +. + norm it + q! +endfunc diff -Nru vim-8.0.1453/src/testdir/test_timers.vim vim-8.0.1766/src/testdir/test_timers.vim --- vim-8.0.1453/src/testdir/test_timers.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_timers.vim 2018-04-26 20:30:33.000000000 +0000 @@ -124,7 +124,7 @@ if has('reltime') if has('mac') " The travis Mac machines appear to be very busy. - call assert_inrange(0, 40, slept) + call assert_inrange(0, 50, slept) else call assert_inrange(0, 30, slept) endif diff -Nru vim-8.0.1453/src/testdir/test_undo.vim vim-8.0.1766/src/testdir/test_undo.vim --- vim-8.0.1453/src/testdir/test_undo.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_undo.vim 2018-04-26 20:30:33.000000000 +0000 @@ -403,3 +403,10 @@ bwipe! endfunc + +func Test_redo_empty_line() + new + exe "norm\x16r\x160" + exe "norm." + bwipe! +endfunc diff -Nru vim-8.0.1453/src/testdir/test_vimscript.vim vim-8.0.1766/src/testdir/test_vimscript.vim --- vim-8.0.1453/src/testdir/test_vimscript.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_vimscript.vim 2018-04-26 20:30:33.000000000 +0000 @@ -1,4 +1,4 @@ -" Test various aspects of the Vim language. +" Test various aspects of the Vim script language. " Most of this was formerly in test49. "------------------------------------------------------------------------------- diff -Nru vim-8.0.1453/src/testdir/test_virtualedit.vim vim-8.0.1766/src/testdir/test_virtualedit.vim --- vim-8.0.1453/src/testdir/test_virtualedit.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_virtualedit.vim 2018-04-26 20:30:33.000000000 +0000 @@ -41,3 +41,21 @@ bwipe! set virtualedit= endfunc + +func Test_edit_CTRL_G() + new + set virtualedit=insert + call setline(1, ['123', '1', '12']) + exe "normal! ggA\jx\jx" + call assert_equal(['123', '1 x', '12 x'], getline(1,'$')) + + set virtualedit=all + %d_ + call setline(1, ['1', '12']) + exe "normal! ggllix\jx" + call assert_equal(['1 x', '12x'], getline(1,'$')) + + + bwipe! + set virtualedit= +endfunc diff -Nru vim-8.0.1453/src/testdir/test_visual.vim vim-8.0.1766/src/testdir/test_visual.vim --- vim-8.0.1453/src/testdir/test_visual.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_visual.vim 2018-04-26 20:30:33.000000000 +0000 @@ -70,13 +70,13 @@ exe "normal \" catch /^Vim\%((\a\+)\)\=:E315/ echom 'Snap! E315 error!' - let g:msg='Snap! E315 error!' + let g:msg = 'Snap! E315 error!' endtry endfunc func Test_visual_mode_reset() enew - let g:msg="Everything's fine." + let g:msg = "Everything's fine." enew setl buftype=nofile call append(line('$'), 'Delete this line.') @@ -157,6 +157,12 @@ " Test Virtual replace mode. func Test_virtual_replace() + if exists('&t_kD') + let save_t_kD = &t_kD + endif + if exists('&t_kb') + let save_t_kb = &t_kb + endif exe "set t_kD=\x7f t_kb=\x08" enew! exe "normal a\nabcdefghi\njk\tlmn\n opq rst\n\uvwxyz" @@ -186,4 +192,65 @@ call assert_equal(['AB......CDEFGHI.Jkl', \ 'AB IJKLMNO QRst'], getline(12, 13)) enew! + set noai bs&vim + if exists('save_t_kD') + let &t_kD = save_t_kD + endif + if exists('save_t_kb') + let &t_kb = save_t_kb + endif +endfunc + +" Test Virtual replace mode. +func Test_virtual_replace2() + enew! + set bs=2 + exe "normal a\nabcdefghi\njk\tlmn\n opq rst\n\uvwxyz" + call cursor(1,1) + " Test 1: Test that del deletes the newline + exe "normal gR0\ 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR" + call assert_equal(['0 1', + \ 'A', + \ 'BCDEFGHIJ', + \ ' KL', + \ 'MNO', + \ 'PQR', + \ ], getline(1, 6)) + " Test 2: + " a newline is not deleted, if no newline has been added in virtual replace mode + %d_ + call setline(1, ['abcd', 'efgh', 'ijkl']) + call cursor(2,1) + exe "norm! gR1234\5\\\" + call assert_equal(['abcd', + \ '123h', + \ 'ijkl'], getline(1, '$')) + " Test 3: + " a newline is deleted, if a newline has been inserted before in virtual replace mode + %d_ + call setline(1, ['abcd', 'efgh', 'ijkl']) + call cursor(2,1) + exe "norm! gR1234\\56\\\" + call assert_equal(['abcd', + \ '1234', + \ 'ijkl'], getline(1, '$')) + " Test 4: + " delete add a newline, delete it, add it again and check undo + %d_ + call setline(1, ['abcd', 'efgh', 'ijkl']) + call cursor(2,1) + " break undo sequence explicitly + let &ul = &ul + exe "norm! gR1234\\\56\" + let &ul = &ul + call assert_equal(['abcd', + \ '123456', + \ ''], getline(1, '$')) + norm! u + call assert_equal(['abcd', + \ 'efgh', + \ 'ijkl'], getline(1, '$')) + " clean up + %d_ + set bs&vim endfunc diff -Nru vim-8.0.1453/src/testdir/test_window_cmd.vim vim-8.0.1766/src/testdir/test_window_cmd.vim --- vim-8.0.1453/src/testdir/test_window_cmd.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_window_cmd.vim 2018-04-26 20:30:33.000000000 +0000 @@ -483,4 +483,28 @@ bwipe xxx endfunc +func Test_visual_cleared_after_window_split() + new | only! + let smd_save = &showmode + set showmode + let ls_save = &laststatus + set laststatus=1 + call setline(1, ['a', 'b', 'c', 'd', '']) + norm! G + exe "norm! kkvk" + redraw + exe "norm! \v" + redraw + " check if '-- VISUAL --' disappeared from command line + let columns = range(1, &columns) + let cmdlinechars = map(columns, 'nr2char(screenchar(&lines, v:val))') + let cmdline = join(cmdlinechars, '') + let cmdline_ltrim = substitute(cmdline, '^\s*', "", "") + let mode_shown = substitute(cmdline_ltrim, '\s*$', "", "") + call assert_equal('', mode_shown) + let &showmode = smd_save + let &laststatus = ls_save + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff -Nru vim-8.0.1453/src/testdir/test_writefile.vim vim-8.0.1766/src/testdir/test_writefile.vim --- vim-8.0.1453/src/testdir/test_writefile.vim 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_writefile.vim 2018-04-26 20:30:33.000000000 +0000 @@ -105,6 +105,10 @@ if !has('unix') return endif - " Just check that this doesn't cause an error. - call writefile(['one'], '/dev/stdout') + if filewritable('/dev/stdout') + " Just check that this doesn't cause an error. + call writefile(['one'], '/dev/stdout') + else + throw 'Skipped: /dev/stdout is not writable' + endif endfunc diff -Nru vim-8.0.1453/src/testdir/test_xxd.vim vim-8.0.1766/src/testdir/test_xxd.vim --- vim-8.0.1453/src/testdir/test_xxd.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-8.0.1766/src/testdir/test_xxd.vim 2018-04-26 20:30:33.000000000 +0000 @@ -0,0 +1,111 @@ +" Test for the xxd command +if empty($XXD) && executable('..\xxd\xxd.exe') + let s:xxd_cmd = '..\xxd\xxd.exe' +elseif empty($XXD) || !executable($XXD) + finish +else + let s:xxd_cmd = $XXD +endif + +func! PrepareBuffer(lines) + new + call append(0, a:lines) + $d +endfunc + +func! s:Mess(counter) + return printf("Failed xxd test %d:", a:counter) +endfunc + +func! Test_xxd() + call PrepareBuffer(range(1,30)) + set ff=unix + w XXDfile + + " Test 1: simple, filter the result through xxd + let s:test = 1 + exe '%!' . s:xxd_cmd . ' %' + let expected = [ + \ '00000000: 310a 320a 330a 340a 350a 360a 370a 380a 1.2.3.4.5.6.7.8.', + \ '00000010: 390a 3130 0a31 310a 3132 0a31 330a 3134 9.10.11.12.13.14', + \ '00000020: 0a31 350a 3136 0a31 370a 3138 0a31 390a .15.16.17.18.19.', + \ '00000030: 3230 0a32 310a 3232 0a32 330a 3234 0a32 20.21.22.23.24.2', + \ '00000040: 350a 3236 0a32 370a 3238 0a32 390a 3330 5.26.27.28.29.30', + \ '00000050: 0a .'] + call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) + + " Test 2: reverse the result + let s:test += 1 + exe '%!' . s:xxd_cmd . ' -r' + call assert_equal(map(range(1,30), {v,c -> string(c)}), getline(1,'$'), s:Mess(s:test)) + + " Test 3: Skip the first 30 bytes + let s:test += 1 + exe '%!' . s:xxd_cmd . ' -s 0x30 %' + call assert_equal(expected[3:], getline(1,'$'), s:Mess(s:test)) + + " Test 4: Skip the first 30 bytes + let s:test += 1 + exe '%!' . s:xxd_cmd . ' -s -0x31 %' + call assert_equal(expected[2:], getline(1,'$'), s:Mess(s:test)) + + " Test 5: Print 120 bytes as continuous hexdump with 20 octets per line + let s:test += 1 + %d + exe '0r! ' . s:xxd_cmd . ' -l 120 -ps -c 20 ../../runtime/doc/xxd.1' + $d + let expected = [ + \ '2e54482058584420312022417567757374203139', + \ '39362220224d616e75616c207061676520666f72', + \ '20787864220a2e5c220a2e5c222032317374204d', + \ '617920313939360a2e5c22204d616e2070616765', + \ '20617574686f723a0a2e5c2220202020546f6e79', + \ '204e7567656e74203c746f6e79407363746e7567'] + call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) + + " Test 6: Print the date from xxd.1 + let s:test += 1 + %d + exe '0r! ' . s:xxd_cmd . ' -s 0x36 -l 13 -c 13 ../../runtime/doc/xxd.1' + $d + call assert_equal('00000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996', getline(1), s:Mess(s:test)) + + " Test 7: Print C include + let s:test += 1 + call writefile(['TESTabcd09'], 'XXDfile') + %d + exe '0r! ' . s:xxd_cmd . ' -i XXDfile' + $d + let expected = ['unsigned char XXDfile[] = {', + \ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};', + \ 'unsigned int XXDfile_len = 11;'] + call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) + + " Test 8: Print C include capitalized + let s:test += 1 + call writefile(['TESTabcd09'], 'XXDfile') + %d + exe '0r! ' . s:xxd_cmd . ' -i -C XXDfile' + $d + let expected = ['unsigned char XXDFILE[] = {', + \ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};', + \ 'unsigned int XXDFILE_LEN = 11;'] + call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) + + " Test 9: Create a file with containing a single 'A' + let s:test += 1 + call delete('XXDfile') + bwipe! XXDfile + if has('unix') + call system('echo "010000: 41"|' . s:xxd_cmd . ' -r -s -0x10000 > XXDfile') + else + call writefile(['010000: 41'], 'Xinput') + silent exe '!' . s:xxd_cmd . ' -r -s -0x10000 < Xinput > XXDfile' + call delete('Xinput') + endif + call PrepareBuffer(readfile('XXDfile')[0]) + call assert_equal('A', getline(1), s:Mess(s:test)) + call delete('XXDfile') + %d + bw! +endfunc diff -Nru vim-8.0.1453/src/ui.c vim-8.0.1766/src/ui.c --- vim-8.0.1453/src/ui.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/ui.c 2018-04-26 20:30:33.000000000 +0000 @@ -130,8 +130,7 @@ if (maxlen >= ta_len - ta_off) { mch_memmove(buf, ta_str + ta_off, (size_t)ta_len); - vim_free(ta_str); - ta_str = NULL; + VIM_CLEAR(ta_str); return ta_len; } mch_memmove(buf, ta_str + ta_off, (size_t)maxlen); @@ -1840,10 +1839,7 @@ unconverted = restlen; mch_memmove(inbuf + inbufcount, rest, unconverted); if (unconverted == restlen) - { - vim_free(rest); - rest = NULL; - } + VIM_CLEAR(rest); else { restlen -= unconverted; @@ -1858,18 +1854,15 @@ len = 0; /* to avoid gcc warning */ for (try = 0; try < 100; ++try) { -# ifdef VMS - len = vms_read( -# else - len = read(read_cmd_fd, -# endif - (char *)inbuf + inbufcount, (size_t)((INBUFLEN - inbufcount) + size_t readlen = (size_t)((INBUFLEN - inbufcount) # ifdef FEAT_MBYTE - / input_conv.vc_factor + / input_conv.vc_factor # endif - )); -# if 0 - ) /* avoid syntax highlight error */ + ); +# ifdef VMS + len = vms_read((char *)inbuf + inbufcount, readlen); +# else + len = read(read_cmd_fd, (char *)inbuf + inbufcount, readlen); # endif if (len > 0 || got_int) @@ -2831,11 +2824,18 @@ * (MOUSE_FOCUS was set above if we dragged first). */ if (dragwin == NULL || (flags & MOUSE_RELEASED)) win_enter(wp, TRUE); /* can make wp invalid! */ -#ifdef CHECK_DOUBLE_CLICK - /* set topline, to be able to check for double click ourselves */ + if (curwin != old_curwin) + { +#ifdef CHECK_DOUBLE_CLICK + /* set topline, to be able to check for double click ourselves */ set_mouse_topline(curwin); #endif +#ifdef FEAT_TERMINAL + /* when entering a terminal window may change state */ + term_win_entered(); +#endif + } if (on_status_line) /* In (or below) status line */ { /* Don't use start_arrow() if we're in the same window */ @@ -3203,7 +3203,8 @@ #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MAC) \ || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \ - || defined(FEAT_GUI_PHOTON) || defined(PROTO) + || defined(FEAT_GUI_PHOTON) || defined(FEAT_TERM_POPUP_MENU) \ + || defined(PROTO) /* * Translate window coordinates to buffer position without any side effects */ @@ -3249,7 +3250,8 @@ #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MAC) \ || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \ - || defined(FEAT_GUI_PHOTON) || defined(FEAT_BEVAL) || defined(PROTO) + || defined(FEAT_GUI_PHOTON) || defined(FEAT_BEVAL) \ + || defined(FEAT_TERM_POPUP_MENU) || defined(PROTO) /* * Convert a virtual (screen) column to a character column. * The first column is one. @@ -3301,13 +3303,11 @@ last_time = time(NULL); } -#ifdef FEAT_AUTOCMD /* * Fire the focus gained/lost autocommand. */ need_redraw |= apply_autocmds(in_focus ? EVENT_FOCUSGAINED : EVENT_FOCUSLOST, NULL, NULL, FALSE, curbuf); -#endif if (need_redraw) { @@ -3341,7 +3341,7 @@ } #endif -#if defined(FEAT_MBYTE) || defined(PROTO) +#if defined(HAVE_INPUT_METHOD) || defined(PROTO) /* * Save current Input Method status to specified place. */ diff -Nru vim-8.0.1453/src/undo.c vim-8.0.1766/src/undo.c --- vim-8.0.1453/src/undo.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/undo.c 2018-04-26 20:30:33.000000000 +0000 @@ -424,7 +424,6 @@ term_change_in_curbuf(); #endif -#ifdef FEAT_AUTOCMD /* * Saving text for undo means we are going to make a change. Give a * warning for a read-only file before making the change, so that the @@ -439,7 +438,6 @@ EMSG(_("E881: Line count changed unexpectedly")); return FAIL; } -#endif } #ifdef U_DEBUG @@ -849,8 +847,7 @@ if (undo_file_name != NULL && (!reading || mch_stat((char *)undo_file_name, &st) >= 0)) break; - vim_free(undo_file_name); - undo_file_name = NULL; + VIM_CLEAR(undo_file_name); } vim_free(munged_name); @@ -2632,11 +2629,9 @@ int empty_buffer; /* buffer became empty */ u_header_T *curhead = curbuf->b_u_curhead; -#ifdef FEAT_AUTOCMD /* Don't want autocommands using the undo structures here, they are * invalid till the end. */ block_autocmds(); -#endif #ifdef U_DEBUG u_check(FALSE); @@ -2665,9 +2660,7 @@ if (top > curbuf->b_ml.ml_line_count || top >= bot || bot > curbuf->b_ml.ml_line_count + 1) { -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif IEMSG(_("E438: u_undo: line numbers wrong")); changed(); /* don't want UNCHANGED now */ return; @@ -2892,9 +2885,7 @@ * the undone/redone change. */ curbuf->b_u_time_cur = curhead->uh_time; -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif #ifdef U_DEBUG u_check(FALSE); #endif @@ -3038,7 +3029,7 @@ { if (ga_grow(&ga, 1) == FAIL) break; - vim_snprintf((char *)IObuff, IOSIZE, "%6ld %7ld ", + vim_snprintf((char *)IObuff, IOSIZE, "%6ld %7d ", uhp->uh_seq, changes); u_add_time(IObuff + STRLEN(IObuff), IOSIZE - STRLEN(IObuff), uhp->uh_time); @@ -3454,8 +3445,7 @@ { if (curbuf->b_u_line_ptr != NULL) { - vim_free(curbuf->b_u_line_ptr); - curbuf->b_u_line_ptr = NULL; + VIM_CLEAR(curbuf->b_u_line_ptr); curbuf->b_u_line_lnum = 0; } } diff -Nru vim-8.0.1453/src/userfunc.c vim-8.0.1766/src/userfunc.c --- vim-8.0.1453/src/userfunc.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/userfunc.c 2018-04-26 20:30:33.000000000 +0000 @@ -1372,7 +1372,6 @@ else fp = find_func(rfname); -#ifdef FEAT_AUTOCMD /* Trigger FuncUndefined event, may load the function. */ if (fp == NULL && apply_autocmds(EVENT_FUNCUNDEFINED, @@ -1382,7 +1381,6 @@ /* executed an autocommand, search for the function again */ fp = find_func(rfname); } -#endif /* Try loading a package. */ if (fp == NULL && script_autoload(rfname, TRUE) && !aborting()) { @@ -2122,10 +2120,7 @@ /* between ":append" and "." and between ":python <uf_args)); ga_clear_strings(&(fp->uf_lines)); - vim_free(name); - name = NULL; + VIM_CLEAR(name); } } } @@ -3089,6 +3083,8 @@ failed = TRUE; break; } + if (has_watchexpr()) + dbg_check_breakpoint(eap); /* Handle a function returning a Funcref, Dictionary or List. */ if (handle_subscript(&arg, &rettv, !eap->skip, TRUE) == FAIL) diff -Nru vim-8.0.1453/src/version.c vim-8.0.1766/src/version.c --- vim-8.0.1453/src/version.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/version.c 2018-04-26 20:30:33.000000000 +0000 @@ -57,7 +57,6 @@ #endif static void list_features(void); -static void version_msg(char *s); static char *(features[]) = { @@ -78,11 +77,7 @@ #else "-arabic", #endif -#ifdef FEAT_AUTOCMD "+autocmd", -#else - "-autocmd", -#endif #ifdef FEAT_AUTOSERVERNAME "+autoservername", #else @@ -172,11 +167,7 @@ #else "-cscope", #endif -#ifdef FEAT_CURSORBIND "+cursorbind", -#else - "-cursorbind", -#endif #ifdef CURSOR_SHAPE "+cursorshape", #else @@ -340,11 +331,7 @@ #else "-lispindent", #endif -#ifdef FEAT_LISTCMDS "+listcmds", -#else - "-listcmds", -#endif #ifdef FEAT_LOCALMAP "+localmap", #else @@ -560,11 +547,7 @@ #else "-ruby", #endif -#ifdef FEAT_SCROLLBIND "+scrollbind", -#else - "-scrollbind", -#endif #ifdef FEAT_SIGNS "+signs", #else @@ -699,6 +682,13 @@ #else "-vreplace", #endif +#ifdef WIN3264 +# ifdef FEAT_VTP + "+vtp", +# else + "-vtp", +# endif +#endif #ifdef FEAT_WILDIGN "+wildignore", #else @@ -772,6 +762,632 @@ static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1766, +/**/ + 1765, +/**/ + 1764, +/**/ + 1763, +/**/ + 1762, +/**/ + 1761, +/**/ + 1760, +/**/ + 1759, +/**/ + 1758, +/**/ + 1757, +/**/ + 1756, +/**/ + 1755, +/**/ + 1754, +/**/ + 1753, +/**/ + 1752, +/**/ + 1751, +/**/ + 1750, +/**/ + 1749, +/**/ + 1748, +/**/ + 1747, +/**/ + 1746, +/**/ + 1745, +/**/ + 1744, +/**/ + 1743, +/**/ + 1742, +/**/ + 1741, +/**/ + 1740, +/**/ + 1739, +/**/ + 1738, +/**/ + 1737, +/**/ + 1736, +/**/ + 1735, +/**/ + 1734, +/**/ + 1733, +/**/ + 1732, +/**/ + 1731, +/**/ + 1730, +/**/ + 1729, +/**/ + 1728, +/**/ + 1727, +/**/ + 1726, +/**/ + 1725, +/**/ + 1724, +/**/ + 1723, +/**/ + 1722, +/**/ + 1721, +/**/ + 1720, +/**/ + 1719, +/**/ + 1718, +/**/ + 1717, +/**/ + 1716, +/**/ + 1715, +/**/ + 1714, +/**/ + 1713, +/**/ + 1712, +/**/ + 1711, +/**/ + 1710, +/**/ + 1709, +/**/ + 1708, +/**/ + 1707, +/**/ + 1706, +/**/ + 1705, +/**/ + 1704, +/**/ + 1703, +/**/ + 1702, +/**/ + 1701, +/**/ + 1700, +/**/ + 1699, +/**/ + 1698, +/**/ + 1697, +/**/ + 1696, +/**/ + 1695, +/**/ + 1694, +/**/ + 1693, +/**/ + 1692, +/**/ + 1691, +/**/ + 1690, +/**/ + 1689, +/**/ + 1688, +/**/ + 1687, +/**/ + 1686, +/**/ + 1685, +/**/ + 1684, +/**/ + 1683, +/**/ + 1682, +/**/ + 1681, +/**/ + 1680, +/**/ + 1679, +/**/ + 1678, +/**/ + 1677, +/**/ + 1676, +/**/ + 1675, +/**/ + 1674, +/**/ + 1673, +/**/ + 1672, +/**/ + 1671, +/**/ + 1670, +/**/ + 1669, +/**/ + 1668, +/**/ + 1667, +/**/ + 1666, +/**/ + 1665, +/**/ + 1664, +/**/ + 1663, +/**/ + 1662, +/**/ + 1661, +/**/ + 1660, +/**/ + 1659, +/**/ + 1658, +/**/ + 1657, +/**/ + 1656, +/**/ + 1655, +/**/ + 1654, +/**/ + 1653, +/**/ + 1652, +/**/ + 1651, +/**/ + 1650, +/**/ + 1649, +/**/ + 1648, +/**/ + 1647, +/**/ + 1646, +/**/ + 1645, +/**/ + 1644, +/**/ + 1643, +/**/ + 1642, +/**/ + 1641, +/**/ + 1640, +/**/ + 1639, +/**/ + 1638, +/**/ + 1637, +/**/ + 1636, +/**/ + 1635, +/**/ + 1634, +/**/ + 1633, +/**/ + 1632, +/**/ + 1631, +/**/ + 1630, +/**/ + 1629, +/**/ + 1628, +/**/ + 1627, +/**/ + 1626, +/**/ + 1625, +/**/ + 1624, +/**/ + 1623, +/**/ + 1622, +/**/ + 1621, +/**/ + 1620, +/**/ + 1619, +/**/ + 1618, +/**/ + 1617, +/**/ + 1616, +/**/ + 1615, +/**/ + 1614, +/**/ + 1613, +/**/ + 1612, +/**/ + 1611, +/**/ + 1610, +/**/ + 1609, +/**/ + 1608, +/**/ + 1607, +/**/ + 1606, +/**/ + 1605, +/**/ + 1604, +/**/ + 1603, +/**/ + 1602, +/**/ + 1601, +/**/ + 1600, +/**/ + 1599, +/**/ + 1598, +/**/ + 1597, +/**/ + 1596, +/**/ + 1595, +/**/ + 1594, +/**/ + 1593, +/**/ + 1592, +/**/ + 1591, +/**/ + 1590, +/**/ + 1589, +/**/ + 1588, +/**/ + 1587, +/**/ + 1586, +/**/ + 1585, +/**/ + 1584, +/**/ + 1583, +/**/ + 1582, +/**/ + 1581, +/**/ + 1580, +/**/ + 1579, +/**/ + 1578, +/**/ + 1577, +/**/ + 1576, +/**/ + 1575, +/**/ + 1574, +/**/ + 1573, +/**/ + 1572, +/**/ + 1571, +/**/ + 1570, +/**/ + 1569, +/**/ + 1568, +/**/ + 1567, +/**/ + 1566, +/**/ + 1565, +/**/ + 1564, +/**/ + 1563, +/**/ + 1562, +/**/ + 1561, +/**/ + 1560, +/**/ + 1559, +/**/ + 1558, +/**/ + 1557, +/**/ + 1556, +/**/ + 1555, +/**/ + 1554, +/**/ + 1553, +/**/ + 1552, +/**/ + 1551, +/**/ + 1550, +/**/ + 1549, +/**/ + 1548, +/**/ + 1547, +/**/ + 1546, +/**/ + 1545, +/**/ + 1544, +/**/ + 1543, +/**/ + 1542, +/**/ + 1541, +/**/ + 1540, +/**/ + 1539, +/**/ + 1538, +/**/ + 1537, +/**/ + 1536, +/**/ + 1535, +/**/ + 1534, +/**/ + 1533, +/**/ + 1532, +/**/ + 1531, +/**/ + 1530, +/**/ + 1529, +/**/ + 1528, +/**/ + 1527, +/**/ + 1526, +/**/ + 1525, +/**/ + 1524, +/**/ + 1523, +/**/ + 1522, +/**/ + 1521, +/**/ + 1520, +/**/ + 1519, +/**/ + 1518, +/**/ + 1517, +/**/ + 1516, +/**/ + 1515, +/**/ + 1514, +/**/ + 1513, +/**/ + 1512, +/**/ + 1511, +/**/ + 1510, +/**/ + 1509, +/**/ + 1508, +/**/ + 1507, +/**/ + 1506, +/**/ + 1505, +/**/ + 1504, +/**/ + 1503, +/**/ + 1502, +/**/ + 1501, +/**/ + 1500, +/**/ + 1499, +/**/ + 1498, +/**/ + 1497, +/**/ + 1496, +/**/ + 1495, +/**/ + 1494, +/**/ + 1493, +/**/ + 1492, +/**/ + 1491, +/**/ + 1490, +/**/ + 1489, +/**/ + 1488, +/**/ + 1487, +/**/ + 1486, +/**/ + 1485, +/**/ + 1484, +/**/ + 1483, +/**/ + 1482, +/**/ + 1481, +/**/ + 1480, +/**/ + 1479, +/**/ + 1478, +/**/ + 1477, +/**/ + 1476, +/**/ + 1475, +/**/ + 1474, +/**/ + 1473, +/**/ + 1472, +/**/ + 1471, +/**/ + 1470, +/**/ + 1469, +/**/ + 1468, +/**/ + 1467, +/**/ + 1466, +/**/ + 1465, +/**/ + 1464, +/**/ + 1463, +/**/ + 1462, +/**/ + 1461, +/**/ + 1460, +/**/ + 1459, +/**/ + 1458, +/**/ + 1457, +/**/ + 1456, +/**/ + 1455, +/**/ + 1454, +/**/ 1453, /**/ 1452, @@ -3736,35 +4352,75 @@ } /* + * 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) +{ + int len = (int)vim_strsize(s) + (wrap ? 2 : 0); + + if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns + && *s != '\n') + msg_putchar('\n'); + if (!got_int) + { + if (wrap) + MSG_PUTS("["); + MSG_PUTS(s); + if (wrap) + MSG_PUTS("]"); + } +} + + static void +version_msg(char *s) +{ + version_msg_wrap((char_u *)s, FALSE); +} + +/* * List all features aligned in columns, dictionary style. */ static void list_features(void) { + 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) +{ int i; int ncol; int nrow; - int nfeat = 0; + int item_count = 0; int width = 0; - /* Find the length of the longest feature name, use that + 1 as the column - * width */ - for (i = 0; features[i] != NULL; ++i) + /* Find the length of the longest item, use that + 1 as the column + * width. */ + for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i) { - int l = (int)STRLEN(features[i]); + int l = (int)vim_strsize(items[i]) + (i == current ? 2 : 0); if (l > width) width = l; - ++nfeat; + ++item_count; } width += 1; if (Columns < width) { /* Not enough screen columns - show one per line */ - for (i = 0; features[i] != NULL; ++i) + for (i = 0; items[i] != NULL; ++i) { - version_msg(features[i]); + version_msg_wrap(items[i], i == current); if (msg_col > 0) msg_putchar('\n'); } @@ -3774,18 +4430,22 @@ /* The rightmost column doesn't need a separator. * Sacrifice it to fit in one more column if possible. */ ncol = (int) (Columns + 1) / width; - nrow = nfeat / ncol + (nfeat % ncol ? 1 : 0); + nrow = item_count / ncol + (item_count % ncol ? 1 : 0); /* i counts columns then rows. idx counts rows then columns. */ for (i = 0; !got_int && i < nrow * ncol; ++i) { int idx = (i / ncol) + (i % ncol) * nrow; - if (idx < nfeat) + if (idx < item_count) { int last_col = (i + 1) % ncol == 0; - msg_puts((char_u *)features[idx]); + if (idx == current) + msg_putchar('['); + msg_puts(items[idx]); + if (idx == current) + msg_putchar(']'); if (last_col) { if (msg_col > 0) @@ -4077,22 +4737,6 @@ #endif } -/* - * 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. - */ - static void -version_msg(char *s) -{ - int len = (int)STRLEN(s); - - if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns - && *s != '\n') - msg_putchar('\n'); - if (!got_int) - MSG_PUTS(s); -} - static void do_intro_line(int row, char_u *mesg, int add_version, int attr); /* diff -Nru vim-8.0.1453/src/vim.h vim-8.0.1766/src/vim.h --- vim-8.0.1453/src/vim.h 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/vim.h 2018-04-26 20:30:33.000000000 +0000 @@ -781,6 +781,7 @@ #define EXPAND_PACKADD 45 #define EXPAND_MESSAGES 46 #define EXPAND_MAPCLEAR 47 +#define EXPAND_ARGLIST 48 /* Values for exmode_active (0 is no exmode) */ #define EXMODE_NORMAL 1 @@ -1251,65 +1252,92 @@ enum auto_event { EVENT_BUFADD = 0, /* after adding a buffer to the buffer list */ - EVENT_BUFNEW, /* after creating any buffer */ EVENT_BUFDELETE, /* deleting a buffer from the buffer list */ - EVENT_BUFWIPEOUT, /* just before really deleting a buffer */ EVENT_BUFENTER, /* after entering a buffer */ EVENT_BUFFILEPOST, /* after renaming a buffer */ EVENT_BUFFILEPRE, /* before renaming a buffer */ + EVENT_BUFHIDDEN, /* just after buffer becomes hidden */ EVENT_BUFLEAVE, /* before leaving a buffer */ + EVENT_BUFNEW, /* after creating any buffer */ EVENT_BUFNEWFILE, /* when creating a buffer for a new file */ + EVENT_BUFREADCMD, /* read buffer using command */ EVENT_BUFREADPOST, /* after reading a buffer */ EVENT_BUFREADPRE, /* before reading a buffer */ - EVENT_BUFREADCMD, /* read buffer using command */ EVENT_BUFUNLOAD, /* just before unloading a buffer */ - EVENT_BUFHIDDEN, /* just after buffer becomes hidden */ EVENT_BUFWINENTER, /* after showing a buffer in a window */ EVENT_BUFWINLEAVE, /* just after buffer removed from window */ + EVENT_BUFWIPEOUT, /* just before really deleting a buffer */ + EVENT_BUFWRITECMD, /* write buffer using command */ EVENT_BUFWRITEPOST, /* after writing a buffer */ EVENT_BUFWRITEPRE, /* before writing a buffer */ - EVENT_BUFWRITECMD, /* write buffer using command */ EVENT_CMDLINECHANGED, /* command line was modified*/ EVENT_CMDLINEENTER, /* after entering the command line */ EVENT_CMDLINELEAVE, /* before leaving the command line */ + EVENT_CMDUNDEFINED, /* command undefined */ EVENT_CMDWINENTER, /* after entering the cmdline window */ EVENT_CMDWINLEAVE, /* before leaving the cmdline window */ EVENT_COLORSCHEME, /* after loading a colorscheme */ EVENT_COMPLETEDONE, /* after finishing insert complete */ + EVENT_CURSORHOLD, /* cursor in same position for a while */ + EVENT_CURSORHOLDI, /* idem, in Insert mode */ + EVENT_CURSORMOVED, /* cursor was moved */ + EVENT_CURSORMOVEDI, /* cursor was moved in Insert mode */ + EVENT_DIRCHANGED, /* after user changed directory */ + EVENT_ENCODINGCHANGED, /* after changing the 'encoding' option */ + EVENT_EXITPRE, /* before exiting */ + EVENT_FILEAPPENDCMD, /* append to a file using command */ EVENT_FILEAPPENDPOST, /* after appending to a file */ EVENT_FILEAPPENDPRE, /* before appending to a file */ - EVENT_FILEAPPENDCMD, /* append to a file using command */ + EVENT_FILECHANGEDRO, /* before first change to read-only file */ EVENT_FILECHANGEDSHELL, /* after shell command that changed file */ EVENT_FILECHANGEDSHELLPOST, /* after (not) reloading changed file */ - EVENT_FILECHANGEDRO, /* before first change to read-only file */ + EVENT_FILEREADCMD, /* read from a file using command */ EVENT_FILEREADPOST, /* after reading a file */ EVENT_FILEREADPRE, /* before reading a file */ - EVENT_FILEREADCMD, /* read from a file using command */ EVENT_FILETYPE, /* new file type detected (user defined) */ + EVENT_FILEWRITECMD, /* write to a file using command */ EVENT_FILEWRITEPOST, /* after writing a file */ EVENT_FILEWRITEPRE, /* before writing a file */ - EVENT_FILEWRITECMD, /* write to a file using command */ EVENT_FILTERREADPOST, /* after reading from a filter */ EVENT_FILTERREADPRE, /* before reading from a filter */ EVENT_FILTERWRITEPOST, /* after writing to a filter */ EVENT_FILTERWRITEPRE, /* before writing to a filter */ EVENT_FOCUSGAINED, /* got the focus */ EVENT_FOCUSLOST, /* lost the focus to another app */ + EVENT_FUNCUNDEFINED, /* if calling a function which doesn't exist */ EVENT_GUIENTER, /* after starting the GUI */ EVENT_GUIFAILED, /* after starting the GUI failed */ EVENT_INSERTCHANGE, /* when changing Insert/Replace mode */ + EVENT_INSERTCHARPRE, /* before inserting a char */ EVENT_INSERTENTER, /* when entering Insert mode */ EVENT_INSERTLEAVE, /* when leaving Insert mode */ EVENT_MENUPOPUP, /* just before popup menu is displayed */ + EVENT_OPTIONSET, /* option was set */ EVENT_QUICKFIXCMDPOST, /* after :make, :grep etc. */ EVENT_QUICKFIXCMDPRE, /* before :make, :grep etc. */ EVENT_QUITPRE, /* before :quit */ + EVENT_REMOTEREPLY, /* upon string reception from a remote vim */ EVENT_SESSIONLOADPOST, /* after loading a session file */ + EVENT_SHELLCMDPOST, /* after ":!cmd" */ + EVENT_SHELLFILTERPOST, /* after ":1,2!cmd", ":w !cmd", ":r !cmd". */ + EVENT_SOURCECMD, /* sourcing a Vim script using command */ + EVENT_SOURCEPRE, /* before sourcing a Vim script */ + EVENT_SPELLFILEMISSING, /* spell file missing */ EVENT_STDINREADPOST, /* after reading from stdin */ EVENT_STDINREADPRE, /* before reading from stdin */ + EVENT_SWAPEXISTS, /* found existing swap file */ EVENT_SYNTAX, /* syntax selected */ + EVENT_TABCLOSED, /* after closing a tab page */ + EVENT_TABENTER, /* after entering a tab page */ + EVENT_TABLEAVE, /* before leaving a tab page */ + EVENT_TABNEW, /* when entering a new tab page */ EVENT_TERMCHANGED, /* after changing 'term' */ + EVENT_TERMINALOPEN, /* after a terminal buffer was created */ EVENT_TERMRESPONSE, /* after setting "v:termresponse" */ + EVENT_TEXTCHANGED, /* text was modified not in Insert mode */ + EVENT_TEXTCHANGEDI, /* text was modified in Insert mode */ + EVENT_TEXTCHANGEDP, /* TextChangedI with popup menu visible */ + EVENT_TEXTYANKPOST, /* after some text was yanked */ EVENT_USER, /* user defined autocommand */ EVENT_VIMENTER, /* after starting Vim */ EVENT_VIMLEAVE, /* before exiting Vim */ @@ -1318,29 +1346,7 @@ EVENT_WINENTER, /* after entering a window */ EVENT_WINLEAVE, /* before leaving a window */ EVENT_WINNEW, /* when entering a new window */ - EVENT_ENCODINGCHANGED, /* after changing the 'encoding' option */ - EVENT_INSERTCHARPRE, /* before inserting a char */ - EVENT_CURSORHOLD, /* cursor in same position for a while */ - EVENT_CURSORHOLDI, /* idem, in Insert mode */ - EVENT_FUNCUNDEFINED, /* if calling a function which doesn't exist */ - EVENT_REMOTEREPLY, /* upon string reception from a remote vim */ - EVENT_SWAPEXISTS, /* found existing swap file */ - EVENT_SOURCEPRE, /* before sourcing a Vim script */ - EVENT_SOURCECMD, /* sourcing a Vim script using command */ - EVENT_SPELLFILEMISSING, /* spell file missing */ - EVENT_CURSORMOVED, /* cursor was moved */ - EVENT_CURSORMOVEDI, /* cursor was moved in Insert mode */ - EVENT_TABENTER, /* after entering a tab page */ - EVENT_TABLEAVE, /* before leaving a tab page */ - EVENT_TABNEW, /* when entering a new tab page */ - EVENT_TABCLOSED, /* after closing a tab page */ - EVENT_SHELLCMDPOST, /* after ":!cmd" */ - EVENT_SHELLFILTERPOST, /* after ":1,2!cmd", ":w !cmd", ":r !cmd". */ - EVENT_TEXTCHANGED, /* text was modified */ - EVENT_TEXTCHANGEDI, /* text was modified in Insert mode*/ - EVENT_CMDUNDEFINED, /* command undefined */ - EVENT_OPTIONSET, /* option was set */ - EVENT_TEXTYANKPOST, /* after some text was yanked */ + NUM_EVENTS /* MUST be the last one */ }; @@ -2079,6 +2085,10 @@ typedef struct stat stat_T; #endif +#if defined(__GNUC__) && !defined(__MINGW32__) +# define USE_PRINTF_FORMAT_ATTRIBUTE +#endif + typedef enum { ASSERT_EQUAL, @@ -2114,6 +2124,26 @@ # define USE_MCH_ERRMSG #endif +# if defined(FEAT_MBYTE) && defined(FEAT_EVAL) \ + && (!defined(FEAT_GUI_W32) \ + || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \ + && !(defined(FEAT_GUI_MAC) && defined(MACOS_CONVERT)) +/* Whether IME is supported by im_get_status() defined in mbyte.c. + * For Win32 GUI it's in gui_w32.c when FEAT_MBYTE_IME or GLOBAL_IME is defined. + * for Mac it is in gui_mac.c for the GUI or in os_mac_conv.c when + * MACOS_CONVERT is defined. */ +# define IME_WITHOUT_XIM +#endif + +#if defined(FEAT_MBYTE) && (defined(FEAT_XIM) \ + || defined(IME_WITHOUT_XIM) \ + || (defined(FEAT_GUI_W32) \ + && (defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \ + || defined(FEAT_GUI_MAC)) +/* im_set_active() is available */ +# define HAVE_INPUT_METHOD +#endif + #ifndef FEAT_MBYTE # define after_pathsep(b, p) vim_ispathsep(*((p) - 1)) # define transchar_byte(c) transchar(c) @@ -2124,8 +2154,9 @@ # define number_width(x) 7 #endif -/* This must come after including proto.h */ -#if !(defined(FEAT_MBYTE) && defined(WIN3264)) +/* This must come after including proto.h. + * For VMS this is defined in macros.h. */ +#if !(defined(FEAT_MBYTE) && defined(WIN3264)) && !defined(VMS) # define mch_open(n, m, p) open((n), (m), (p)) # define mch_fopen(n, p) fopen((n), (p)) #endif @@ -2514,4 +2545,13 @@ # endif #endif +/* Replacement for nchar used by nv_replace(). */ +#define REPLACE_CR_NCHAR -1 +#define REPLACE_NL_NCHAR -2 + +/* flags for term_start() */ +#define TERM_START_NOJOB 1 +#define TERM_START_FORCEIT 2 +#define TERM_START_SYSTEM 4 + #endif /* VIM__H */ diff -Nru vim-8.0.1453/src/vimrun.c vim-8.0.1766/src/vimrun.c --- vim-8.0.1453/src/vimrun.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/vimrun.c 2018-04-26 20:30:33.000000000 +0000 @@ -55,7 +55,7 @@ ++p; } while (*p == L' ') - ++p; + ++p; /* * "-s" argument: don't wait for a key hit. diff -Nru vim-8.0.1453/src/vimtutor vim-8.0.1766/src/vimtutor --- vim-8.0.1453/src/vimtutor 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/vimtutor 2018-04-26 20:30:33.000000000 +0000 @@ -70,5 +70,5 @@ # The script tutor.vim tells Vim which file to copy $VIM -f -u NONE -c 'so $VIMRUNTIME/tutor/tutor.vim' -# Start vim without any .vimrc, set 'nocompatible' -$VIM -f -u NONE -c "set nocp" $TUTORCOPY +# Start vim without any .vimrc, set 'nocompatible' and 'showcmd' +$VIM -f -u NONE -c "set nocp showcmd" $TUTORCOPY diff -Nru vim-8.0.1453/src/window.c vim-8.0.1766/src/window.c --- vim-8.0.1453/src/window.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/window.c 2018-04-26 20:30:33.000000000 +0000 @@ -99,9 +99,16 @@ Prenum1 = Prenum; #ifdef FEAT_CMDWIN -# define CHECK_CMDWIN if (cmdwin_type != 0) { EMSG(_(e_cmdwin)); break; } +# define CHECK_CMDWIN \ + do { \ + if (cmdwin_type != 0) \ + { \ + EMSG(_(e_cmdwin)); \ + return; \ + } \ + } while (0) #else -# define CHECK_CMDWIN +# define CHECK_CMDWIN do { /**/ } while (0) #endif switch (nchar) @@ -110,7 +117,7 @@ case 'S': case Ctrl_S: case 's': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ #ifdef FEAT_QUICKFIX /* When splitting the quickfix window open a new buffer in it, @@ -127,7 +134,7 @@ /* split current window in two parts, vertically */ case Ctrl_V: case 'v': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ #ifdef FEAT_QUICKFIX /* When splitting the quickfix window open a new buffer in it, @@ -144,7 +151,7 @@ /* split current window and edit alternate file */ case Ctrl_HAT: case '^': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ cmd_with_count("split #", cbuf, sizeof(cbuf), Prenum); do_cmdline_cmd(cbuf); @@ -153,7 +160,7 @@ /* open new window */ case Ctrl_N: case 'n': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ #ifdef FEAT_QUICKFIX newwindow: @@ -191,7 +198,7 @@ /* close preview window */ case Ctrl_Z: case 'z': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ do_cmdline_cmd((char_u *)"pclose"); break; @@ -211,7 +218,7 @@ /* close all but current window */ case Ctrl_O: case 'o': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ cmd_with_count("only", cbuf, sizeof(cbuf), Prenum); do_cmdline_cmd(cbuf); @@ -222,7 +229,7 @@ case 'w': /* cursor to previous window with wrap around */ case 'W': - CHECK_CMDWIN + CHECK_CMDWIN; if (ONE_WINDOW && Prenum != 1) /* just one window */ beep_flush(); else @@ -260,7 +267,7 @@ case 'j': case K_DOWN: case Ctrl_J: - CHECK_CMDWIN + CHECK_CMDWIN; win_goto_ver(FALSE, Prenum1); break; @@ -268,7 +275,7 @@ case 'k': case K_UP: case Ctrl_K: - CHECK_CMDWIN + CHECK_CMDWIN; win_goto_ver(TRUE, Prenum1); break; @@ -277,7 +284,7 @@ case K_LEFT: case Ctrl_H: case K_BS: - CHECK_CMDWIN + CHECK_CMDWIN; win_goto_hor(TRUE, Prenum1); break; @@ -285,7 +292,7 @@ case 'l': case K_RIGHT: case Ctrl_L: - CHECK_CMDWIN + CHECK_CMDWIN; win_goto_hor(FALSE, Prenum1); break; @@ -338,21 +345,21 @@ /* exchange current and next window */ case 'x': case Ctrl_X: - CHECK_CMDWIN + CHECK_CMDWIN; win_exchange(Prenum); break; /* rotate windows downwards */ case Ctrl_R: case 'r': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ win_rotate(FALSE, (int)Prenum1); /* downwards */ break; /* rotate windows upwards */ case 'R': - CHECK_CMDWIN + CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ win_rotate(TRUE, (int)Prenum1); /* upwards */ break; @@ -362,7 +369,7 @@ case 'J': case 'H': case 'L': - CHECK_CMDWIN + CHECK_CMDWIN; win_totop((int)Prenum, ((nchar == 'H' || nchar == 'L') ? WSP_VERT : 0) | ((nchar == 'H' || nchar == 'K') ? WSP_TOP : WSP_BOT)); @@ -428,7 +435,7 @@ /* jump to tag and split window if tag exists (in preview window) */ #if defined(FEAT_QUICKFIX) case '}': - CHECK_CMDWIN + CHECK_CMDWIN; if (Prenum) g_do_tagpreview = Prenum; else @@ -437,7 +444,7 @@ /* FALLTHROUGH */ case ']': case Ctrl_RSB: - CHECK_CMDWIN + CHECK_CMDWIN; /* keep Visual mode, can select words to use as a tag */ if (Prenum) postponed_split = Prenum; @@ -459,7 +466,7 @@ case 'F': case Ctrl_F: wingotofile: - CHECK_CMDWIN + CHECK_CMDWIN; ptr = grab_file_name(Prenum1, &lnum); if (ptr != NULL) @@ -503,7 +510,7 @@ /* FALLTHROUGH */ case 'd': /* Go to definition, using 'define' */ case Ctrl_D: - CHECK_CMDWIN + CHECK_CMDWIN; if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0) break; find_pattern_in_path(ptr, 0, len, TRUE, @@ -534,7 +541,7 @@ /* CTRL-W g extended commands */ case 'g': case Ctrl_G: - CHECK_CMDWIN + CHECK_CMDWIN; #ifdef USE_ON_FLY_SCROLL dont_scroll = TRUE; /* disallow scrolling here */ #endif @@ -771,6 +778,7 @@ int before; int minheight; int wmh1; + int did_set_fraction = FALSE; if (flags & WSP_TOP) oldwin = firstwin; @@ -952,6 +960,11 @@ * instead, if possible. */ if (oldwin->w_p_wfh) { + /* Set w_fraction now so that the cursor keeps the same relative + * vertical position using the old height. */ + set_fraction(oldwin); + did_set_fraction = TRUE; + win_setheight_win(oldwin->w_height + new_size + STATUS_HEIGHT, oldwin); oldwin_height = oldwin->w_height; @@ -1081,7 +1094,8 @@ /* Set w_fraction now so that the cursor keeps the same relative * vertical position. */ - set_fraction(oldwin); + if (!did_set_fraction) + set_fraction(oldwin); wp->w_fraction = oldwin->w_fraction; if (flags & WSP_VERT) @@ -1437,13 +1451,11 @@ if (count > 1) last_status(TRUE); -#ifdef FEAT_AUTOCMD /* * Don't execute autocommands while creating the windows. Must do that * when putting the buffers in the windows. */ block_autocmds(); -#endif /* todo is number of windows left to create */ for (todo = count - 1; todo > 0; --todo) @@ -1461,9 +1473,7 @@ break; } -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif /* return actual number of windows */ return (count - todo); @@ -1899,7 +1909,6 @@ for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) { - n = m = 0; wincount = 1; if (fr->fr_next == NULL) /* last frame gets all that remains (avoid roundoff error) */ @@ -2041,7 +2050,6 @@ for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) { - n = m = 0; wincount = 1; if (fr->fr_next == NULL) /* last frame gets all that remains (avoid roundoff error) */ @@ -2106,19 +2114,14 @@ win_T *wp; tabpage_T *tp, *nexttp; int h = tabline_height(); -#ifdef FEAT_AUTOCMD int count = tabpage_index(NULL); -#endif ++RedrawingDisabled; for (wp = firstwin; wp != NULL && !ONE_WINDOW; ) { if (wp->w_buffer == buf && (!keep_curwin || wp != curwin) -#ifdef FEAT_AUTOCMD - && !(wp->w_closing || wp->w_buffer->b_locked > 0) -#endif - ) + && !(wp->w_closing || wp->w_buffer->b_locked > 0)) { if (win_close(wp, FALSE) == FAIL) /* If closing the window fails give up, to avoid looping @@ -2139,10 +2142,7 @@ if (tp != curtab) for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) if (wp->w_buffer == buf -#ifdef FEAT_AUTOCMD - && !(wp->w_closing || wp->w_buffer->b_locked > 0) -#endif - ) + && !(wp->w_closing || wp->w_buffer->b_locked > 0)) { win_close_othertab(wp, FALSE, tp); @@ -2155,10 +2155,8 @@ --RedrawingDisabled; -#ifdef FEAT_AUTOCMD if (count != tabpage_index(NULL)) apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf); -#endif redraw_tabline = TRUE; if (h != tabline_height()) @@ -2183,7 +2181,6 @@ int one_window(void) { -#ifdef FEAT_AUTOCMD win_T *wp; int seen_one = FALSE; @@ -2197,9 +2194,6 @@ } } return TRUE; -#else - return ONE_WINDOW; -#endif } /* @@ -2214,9 +2208,7 @@ { if (ONE_WINDOW) { -#ifdef FEAT_AUTOCMD buf_T *old_curbuf = curbuf; -#endif /* * Closing the last window in a tab page. First go to another tab @@ -2241,13 +2233,11 @@ } /* Since goto_tabpage_tp above did not trigger *Enter autocommands, do * that now. */ -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf); if (old_curbuf != curbuf) apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); -#endif return TRUE; } return FALSE; @@ -2264,9 +2254,7 @@ win_close(win_T *win, int free_buf) { win_T *wp; -#ifdef FEAT_AUTOCMD int other_buffer = FALSE; -#endif int close_curwin = FALSE; int dir; int help_window = FALSE; @@ -2279,7 +2267,6 @@ return FAIL; } -#ifdef FEAT_AUTOCMD if (win->w_closing || (win->w_buffer != NULL && win->w_buffer->b_locked > 0)) return FAIL; /* window is already being closed */ @@ -2293,7 +2280,6 @@ EMSG(_("E814: Cannot close window, only autocmd window would remain")); return FAIL; } -#endif /* When closing the last window in a tab page first go to another tab page * and then close the window and the tab page to avoid that curwin and @@ -2308,7 +2294,6 @@ else clear_snapshot(curtab, SNAP_HELP_IDX); -#ifdef FEAT_AUTOCMD if (win == curwin) { /* @@ -2339,13 +2324,12 @@ win->w_closing = FALSE; if (last_window()) return FAIL; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL /* autocmds may abort script processing */ if (aborting()) return FAIL; -# endif - } #endif + } #ifdef FEAT_GUI /* Avoid trouble with scrollbars that are going to be deleted in @@ -2368,14 +2352,10 @@ bufref_T bufref; set_bufref(&bufref, curbuf); -#ifdef FEAT_AUTOCMD win->w_closing = TRUE; -#endif close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, TRUE); -#ifdef FEAT_AUTOCMD if (win_valid_any_tab(win)) win->w_closing = FALSE; -#endif /* Make sure curbuf is valid. It can become invalid if 'bufhidden' is * "wipe". */ if (!bufref_valid(&bufref)) @@ -2457,11 +2437,9 @@ if (close_curwin) { win_enter_ext(wp, FALSE, TRUE, FALSE, TRUE, TRUE); -#ifdef FEAT_AUTOCMD if (other_buffer) /* careful: after this wp and win may be invalid! */ apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); -#endif } /* @@ -2500,13 +2478,11 @@ tabpage_T *ptp = NULL; int free_tp = FALSE; -#ifdef FEAT_AUTOCMD /* Get here with win->w_buffer == NULL when win_close() detects the tab * page changed. */ if (win->w_closing || (win->w_buffer != NULL && win->w_buffer->b_locked > 0)) return; /* window is already being closed */ -#endif if (win->w_buffer != NULL) /* Close the link to the buffer. */ @@ -2588,13 +2564,11 @@ while (first_tabpage->tp_next != NULL) tabpage_close(TRUE); -# ifdef FEAT_AUTOCMD if (aucmd_win != NULL) { (void)win_free_mem(aucmd_win, &dummy, NULL); aucmd_win = NULL; } -# endif while (firstwin != NULL) (void)win_free_mem(firstwin, &dummy, NULL); @@ -3333,11 +3307,7 @@ if (one_window()) { - if (message -#ifdef FEAT_AUTOCMD - && !autocmd_busy -#endif - ) + if (message && !autocmd_busy) MSG(_(m_onlyone)); return; } @@ -3351,26 +3321,22 @@ /* Check if it's allowed to abandon this window */ r = can_abandon(wp->w_buffer, forceit); -#ifdef FEAT_AUTOCMD if (!win_valid(wp)) /* autocommands messed wp up */ { nextwp = firstwin; continue; } -#endif if (!r) { #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if (message && (p_confirm || cmdmod.confirm) && p_write) { dialog_changed(wp->w_buffer, FALSE); -# ifdef FEAT_AUTOCMD if (!win_valid(wp)) /* autocommands messed wp up */ { nextwp = firstwin; continue; } -# endif } if (bufIsChanged(wp->w_buffer)) #endif @@ -3445,7 +3411,6 @@ return OK; } -#if defined(FEAT_AUTOCMD) || defined(PROTO) /* * Init "aucmd_win". This can only be done after the first * window is fully initialized, thus it can't be in win_alloc_first(). @@ -3461,7 +3426,6 @@ new_frame(aucmd_win); } } -#endif /* * Allocate the first window or the first window in a new tab page. @@ -3665,12 +3629,10 @@ #endif redraw_all_later(CLEAR); -#ifdef FEAT_AUTOCMD apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_TABNEW, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf); -#endif return OK; } @@ -3712,21 +3674,17 @@ if (count > p_tpm) count = p_tpm; -#ifdef FEAT_AUTOCMD /* * Don't execute autocommands while creating the tab pages. Must do that * when putting the buffers in the windows. */ block_autocmds(); -#endif for (todo = count - 1; todo > 0; --todo) if (win_new_tabpage(0) == FAIL) break; -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif /* return actual number of tab pages */ return (count - todo); @@ -3843,7 +3801,6 @@ tabpage_T *tp = curtab; reset_VIsual_and_resel(); /* stop Visual mode */ -#ifdef FEAT_AUTOCMD if (trigger_leave_autocmds) { if (new_curbuf != curbuf) @@ -3859,7 +3816,6 @@ if (curtab != tp) return FAIL; } -#endif #if defined(FEAT_GUI) /* Remove the scrollbars. They may be added back later. */ if (gui.in_use) @@ -3931,7 +3887,6 @@ gui_may_update_scrollbars(); #endif -#ifdef FEAT_AUTOCMD /* Apply autocommands after updating the display, when 'rows' and * 'columns' have been set correctly. */ if (trigger_enter_autocmds) @@ -3940,7 +3895,6 @@ if (old_curbuf != curbuf) apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); } -#endif redraw_all_later(CLEAR); } @@ -4133,10 +4087,8 @@ text_locked_msg(); return; } -#ifdef FEAT_AUTOCMD if (curbuf_locked()) return; -#endif if (wp->w_buffer != curbuf) reset_VIsual_and_resel(); @@ -4335,18 +4287,15 @@ win_T *wp, int undo_sync, int curwin_invalid, - int trigger_new_autocmds UNUSED, - int trigger_enter_autocmds UNUSED, - int trigger_leave_autocmds UNUSED) + int trigger_new_autocmds, + int trigger_enter_autocmds, + int trigger_leave_autocmds) { -#ifdef FEAT_AUTOCMD int other_buffer = FALSE; -#endif if (wp == curwin && !curwin_invalid) /* nothing to do */ return; -#ifdef FEAT_AUTOCMD if (!curwin_invalid && trigger_leave_autocmds) { /* @@ -4362,13 +4311,12 @@ apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf); if (!win_valid(wp)) return; -# ifdef FEAT_EVAL +#ifdef FEAT_EVAL /* autocmds may abort script processing */ if (aborting()) return; -# endif - } #endif + } /* sync undo before leaving the current buffer */ if (undo_sync && curbuf != wp->w_buffer) @@ -4415,12 +4363,10 @@ /* Window doesn't have a local directory and we are not in the global * directory: Change to the global directory. */ ignored = mch_chdir((char *)globaldir); - vim_free(globaldir); - globaldir = NULL; + VIM_CLEAR(globaldir); shorten_fnames(TRUE); } -#ifdef FEAT_AUTOCMD if (trigger_new_autocmds) apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf); if (trigger_enter_autocmds) @@ -4429,7 +4375,6 @@ if (other_buffer) apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); } -#endif #ifdef FEAT_TITLE maketitle(); @@ -4454,7 +4399,7 @@ #endif /* Change directories when the 'acd' option is set. */ - DO_AUTOCHDIR + DO_AUTOCHDIR; } @@ -4547,12 +4492,11 @@ init_var_dict(new_wp->w_vars, &new_wp->w_winvar, VAR_SCOPE); #endif -#ifdef FEAT_AUTOCMD /* Don't execute autocommands while the window is not properly * initialized yet. gui_create_scrollbar() may trigger a FocusGained * event. */ block_autocmds(); -#endif + /* * link the window in the window list */ @@ -4568,9 +4512,7 @@ #endif new_wp->w_botline = 2; new_wp->w_cursor.lnum = 1; -#ifdef FEAT_SCROLLBIND new_wp->w_scbind_pos = 1; -#endif /* We won't calculate w_fraction until resizing the window */ new_wp->w_fraction = 0; @@ -4588,9 +4530,7 @@ #ifdef FEAT_FOLDING foldInitWin(new_wp); #endif -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif #ifdef FEAT_SEARCH_EXTRA new_wp->w_match_head = NULL; new_wp->w_next_match_id = 4; @@ -4617,11 +4557,9 @@ /* reduce the reference count to the argument list. */ alist_unlink(wp->w_alist); -#ifdef FEAT_AUTOCMD /* Don't execute autocommands while the window is halfway being deleted. * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */ block_autocmds(); -#endif #ifdef FEAT_LUA lua_window_free(wp); @@ -4711,23 +4649,17 @@ vim_free(wp->w_p_cc_cols); #endif -#ifdef FEAT_AUTOCMD if (wp != aucmd_win) -#endif win_remove(wp, tp); -#ifdef FEAT_AUTOCMD if (autocmd_busy) { wp->w_next = au_pending_free_win; au_pending_free_win = wp; } else -#endif vim_free(wp); -#ifdef FEAT_AUTOCMD unblock_autocmds(); -#endif } /* @@ -4847,10 +4779,7 @@ { /* TODO: why would wp be NULL here? */ if (wp != NULL) - { - vim_free(wp->w_lines); - wp->w_lines = NULL; - } + VIM_CLEAR(wp->w_lines); } /* @@ -5742,11 +5671,7 @@ /* Don't change w_topline when height is zero. Don't set w_topline when * 'scrollbind' is set and this isn't the current window. */ - if (height > 0 -#ifdef FEAT_SCROLLBIND - && (!wp->w_p_scb || wp == curwin) -#endif - ) + if (height > 0 && (!wp->w_p_scb || wp == curwin)) { /* * Find a value for w_topline that shows the cursor at the same @@ -6432,11 +6357,7 @@ # ifdef FEAT_QUICKFIX || wp->w_p_pvw # endif - ) || wp == curwin) -# ifdef FEAT_AUTOCMD - && wp != aucmd_win -# endif - ) + ) || wp == curwin) && wp != aucmd_win) ++count; return (count <= 1); } @@ -6619,9 +6540,7 @@ tabpage_T *tp, int no_display) { -# ifdef FEAT_AUTOCMD block_autocmds(); -# endif *save_curwin = curwin; if (tp != NULL) { @@ -6673,9 +6592,7 @@ curwin = save_curwin; curbuf = curwin->w_buffer; } -# ifdef FEAT_AUTOCMD unblock_autocmds(); -# endif } /* @@ -6685,9 +6602,7 @@ void switch_buffer(bufref_T *save_curbuf, buf_T *buf) { -# ifdef FEAT_AUTOCMD block_autocmds(); -# endif set_bufref(save_curbuf, curbuf); --curbuf->b_nwindows; curbuf = buf; @@ -6701,9 +6616,7 @@ void restore_buffer(bufref_T *save_curbuf) { -# ifdef FEAT_AUTOCMD unblock_autocmds(); -# endif /* Check for valid buffer, just in case. */ if (bufref_valid(save_curbuf)) { diff -Nru vim-8.0.1453/src/xxd/xxd.c vim-8.0.1766/src/xxd/xxd.c --- vim-8.0.1453/src/xxd/xxd.c 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/src/xxd/xxd.c 2018-04-26 20:30:33.000000000 +0000 @@ -215,6 +215,8 @@ #define HEX_BITS 3 /* not hex a dump, but bits: 01111001 */ #define HEX_LITTLEENDIAN 4 +#define CONDITIONAL_CAPITALIZE(c) (capitalize ? toupper((int)c) : c) + static char *pname; static void @@ -225,6 +227,7 @@ fprintf(stderr, "Options:\n"); fprintf(stderr, " -a toggle autoskip: A single '*' replaces nul-lines. Default off.\n"); fprintf(stderr, " -b binary digit dump (incompatible with -ps,-i,-r). Default hex.\n"); + fprintf(stderr, " -C capitalize variable names in C include file style (-i).\n"); fprintf(stderr, " -c cols format octets per line. Default 16 (-i: 12, -ps: 30).\n"); fprintf(stderr, " -E show characters in EBCDIC. Default ASCII.\n"); fprintf(stderr, " -e little-endian dump (incompatible with -ps,-i,-r).\n"); @@ -459,7 +462,7 @@ { FILE *fp, *fpo; int c, e, p = 0, relseek = 1, negseek = 0, revert = 0; - int cols = 0, nonzero = 0, autoskip = 0, hextype = HEX_NORMAL; + int cols = 0, nonzero = 0, autoskip = 0, hextype = HEX_NORMAL, capitalize = 0; int ebcdic = 0; int octspergrp = -1; /* number of octets grouped in output */ int grplen; /* total chars per octet group */ @@ -495,6 +498,7 @@ else if (!STRNCMP(pp, "-u", 2)) hexx = hexxa + 16; else if (!STRNCMP(pp, "-p", 2)) hextype = HEX_POSTSCRIPT; else if (!STRNCMP(pp, "-i", 2)) hextype = HEX_CINCLUDE; + else if (!STRNCMP(pp, "-C", 2)) capitalize = 1; else if (!STRNCMP(pp, "-r", 2)) revert++; else if (!STRNCMP(pp, "-E", 2)) ebcdic++; else if (!STRNCMP(pp, "-v", 2)) @@ -506,6 +510,8 @@ { if (pp[2] && STRNCMP("ols", pp + 2, 3)) cols = (int)strtol(pp + 2, NULL, 0); + else if (pp[2] && STRNCMP("apitalize", pp + 2, 9)) + capitalize = 1; else { if (!argv[2]) @@ -722,7 +728,7 @@ if (fprintf(fpo, "unsigned char %s", isdigit((int)argv[1][0]) ? "__" : "") < 0) die(3); for (e = 0; (c = argv[1][e]) != 0; e++) - if (putc(isalnum(c) ? c : '_', fpo) == EOF) + if (putc(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo) == EOF) die(3); if (fputs("[] = {\n", fpo) == EOF) die(3); @@ -750,9 +756,9 @@ if (fprintf(fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : "") < 0) die(3); for (e = 0; (c = argv[1][e]) != 0; e++) - if (putc(isalnum(c) ? c : '_', fpo) == EOF) + if (putc(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo) == EOF) die(3); - if (fprintf(fpo, "_len = %d;\n", p) < 0) + if (fprintf(fpo, "_%s = %d;\n", capitalize ? "LEN" : "len", p) < 0) die(3); } @@ -827,6 +833,8 @@ for (i = 7; i >= 0; i--) l[++c] = (e & (1 << i)) ? '1' : '0'; } + if (e) + nonzero++; if (ebcdic) e = (e < 64) ? '.' : etoa64[e-64]; /* When changing this update definition of LLEN above. */ @@ -837,8 +845,6 @@ (e > 31 && e < 127) #endif ? e : '.'; - if (e) - nonzero++; n++; if (++p == cols) { diff -Nru vim-8.0.1453/.travis.yml vim-8.0.1766/.travis.yml --- vim-8.0.1453/.travis.yml 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/.travis.yml 2018-04-26 20:30:33.000000000 +0000 @@ -108,7 +108,7 @@ - if [ -n "$err" ]; then exit 1; fi after_success: - - if [ "$COVERAGE" = "yes" ]; then ~/.local/bin/coveralls -b $SRCDIR -x .xs -e ${SRCDIR}/xxd -e ${SRCDIR}/if_perl.c --encodings utf-8 latin-1 EUC-KR; fi - - if [ "$COVERAGE" = "yes" ]; then cd $SRCDIR && bash <(curl -s https://codecov.io/bash) ; fi + - if [ "$COVERAGE" = "yes" ]; then ~/.local/bin/coveralls -b ${SRCDIR} -x .xs -e ${SRCDIR}/xxd -e ${SRCDIR}/if_perl.c --encodings utf-8 latin-1 EUC-KR; fi + - if [ "$COVERAGE" = "yes" ]; then cd ${SRCDIR} && bash <(curl -s https://codecov.io/bash) ; fi # vim:set sts=2 sw=2 tw=0 et: diff -Nru vim-8.0.1453/uninstal.txt vim-8.0.1766/uninstal.txt --- vim-8.0.1453/uninstal.txt 2018-02-02 17:30:36.000000000 +0000 +++ vim-8.0.1766/uninstal.txt 2018-04-26 20:30:33.000000000 +0000 @@ -5,7 +5,7 @@ 1. With the GUI uninstaller. This is only available when Vim was installed with the self-installing executable. This has a minimal number of questions. It can delete - everything that was installed. This also unregisters the VisVim.dll + everything that was installed. This also unregisters the VisVim.dll. 2. With uninstal.exe. This removes most installed items, but does not delete the files you