From 4a5bc6275d09056ff0ccf5a29a878d48bbe58655 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 8 Dec 2017 10:42:30 -0500 Subject: ci: run oldtests in Appveyor #7705 --- src/nvim/testdir/Makefile | 20 +++++++++++++++----- src/nvim/testdir/unix.vim | 6 ++++++ 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 111bd172ef..e1faaccb84 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -2,7 +2,11 @@ # Makefile to run all tests for Vim # -NVIM_PRG ?= ../../../build/bin/nvim +ifeq ($(OS),Windows_NT) + NVIM_PRG ?= ../../../build/bin/nvim.exe +else + NVIM_PRG ?= ../../../build/bin/nvim +endif TMPDIR ?= Xtest-tmpdir SCRIPTSOURCE := ../../../runtime @@ -10,12 +14,9 @@ export SHELL := sh export NVIM_PRG := $(NVIM_PRG) export TMPDIR -SCRIPTS ?= \ - test13.out \ +SCRIPTS_DEFAULT = \ test14.out \ - test17.out \ test24.out \ - test32.out \ test37.out \ test40.out \ test42.out \ @@ -27,6 +28,15 @@ SCRIPTS ?= \ test73.out \ test79.out \ +ifneq ($(OS),Windows_NT) + SCRIPTS_DEFAULTS := $(SCRIPTS_DEFAULT) \ + test17.out \ + test32.out \ + +endif + +SCRIPTS ?= $(SCRIPTS_DEFAULT) + # Tests using runtest.vim. # Keep test_alot*.res as the last one, sort the others. NEW_TESTS ?= \ diff --git a/src/nvim/testdir/unix.vim b/src/nvim/testdir/unix.vim index a7daacf8cf..ce2beff7fe 100644 --- a/src/nvim/testdir/unix.vim +++ b/src/nvim/testdir/unix.vim @@ -2,6 +2,12 @@ " Always use "sh", don't use the value of "$SHELL". set shell=sh +if has('win32') + set shellcmdflag=-c shellxquote= shellxescape= shellquote= + let &shellredir = '>%s 2>&1' + set shellslash +endif + " Don't depend on system locale, always use utf-8 set encoding=utf-8 -- cgit From 1f2b35860f755513a58c1d010f082d946c889b47 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 7 Dec 2017 20:53:02 -0500 Subject: mac: Set $LANG based on the system locale Unix's typical locale-related environment variables aren't always set appropriately on a Mac. Instead of relying on them, query the locale information using Mac specific APIs and then set $LANG appropriately for the rest of nvim. Closes #5873 --- src/nvim/CMakeLists.txt | 3 +++ src/nvim/option.c | 3 +++ src/nvim/os/lang.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/nvim/os/lang.h | 7 +++++++ 4 files changed, 53 insertions(+) create mode 100644 src/nvim/os/lang.c create mode 100644 src/nvim/os/lang.h (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index d3e07326bf..7eb1afa135 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -13,6 +13,9 @@ endif() if(WIN32) # tell MinGW compiler to enable wmain set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -municode") +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreFoundation") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -framework CoreFoundation") endif() set(TOUCHES_DIR ${PROJECT_BINARY_DIR}/touches) diff --git a/src/nvim/option.c b/src/nvim/option.c index 37c4233142..f8a05f133d 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -75,6 +75,7 @@ #include "nvim/window.h" #include "nvim/os/os.h" #include "nvim/os/input.h" +#include "nvim/os/lang.h" /* * The options that are local to a window or buffer have "indir" set to one of @@ -784,6 +785,8 @@ void set_init_1(void) didset_options2(); + lang_init(); + // enc_locale() will try to find the encoding of the current locale. // This will be used when 'default' is used as encoding specifier // in 'fileencodings' diff --git a/src/nvim/os/lang.c b/src/nvim/os/lang.c new file mode 100644 index 0000000000..f0bbf4b1cb --- /dev/null +++ b/src/nvim/os/lang.c @@ -0,0 +1,40 @@ +#ifdef __APPLE__ +# define Boolean CFBoolean // Avoid conflict with API's Boolean +# include +# include +# undef Boolean +#endif + +#ifdef HAVE_LOCALE_H +# include +#endif +#include "nvim/os/os.h" + +void lang_init(void) +{ +#ifdef __APPLE__ + if (os_getenv("LANG") == NULL) { + CFLocaleRef cf_locale = CFLocaleCopyCurrent(); + CFTypeRef cf_lang_region = CFLocaleGetValue(cf_locale, + kCFLocaleIdentifier); + CFRetain(cf_lang_region); + CFRelease(cf_locale); + + const char *lang_region = CFStringGetCStringPtr(cf_lang_region, + kCFStringEncodingUTF8); + if (lang_region) { + os_setenv("LANG", lang_region, true); + } else { + char buf[20] = { 0 }; + if (CFStringGetCString(cf_lang_region, buf, 20, + kCFStringEncodingUTF8)) { + os_setenv("LANG", lang_region, true); + } + } + CFRelease(cf_lang_region); +# ifdef HAVE_LOCALE_H + setlocale(LC_ALL, ""); +# endif + } +#endif +} diff --git a/src/nvim/os/lang.h b/src/nvim/os/lang.h new file mode 100644 index 0000000000..f60e064f57 --- /dev/null +++ b/src/nvim/os/lang.h @@ -0,0 +1,7 @@ +#ifndef NVIM_OS_LANG_H +#define NVIM_OS_LANG_H + +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "os/lang.h.generated.h" +#endif +#endif // NVIM_OS_LANG_H -- cgit From abe38f7d26d68d7032ea391c039c56c8b87675a5 Mon Sep 17 00:00:00 2001 From: glacambre Date: Sun, 26 Nov 2017 13:29:32 +0100 Subject: window.c: do BufEnter in correct window after closing help #7431 closes #7429 Problem: after a help window was closed, a window was selected and its autocommands triggered. After that, restore_snapshot was called and the focused window changed, confusing the user. Solution: Add function get_snapshot_focus() that returns the window that holds the cursor in a snapshot. Use this function in win_close to make sure the right window is selected before any autocommand is triggered. --- src/nvim/window.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src') diff --git a/src/nvim/window.c b/src/nvim/window.c index 4e4eb297aa..e39569321e 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -1991,6 +1991,14 @@ int win_close(win_T *win, int free_buf) * the screen space. */ wp = win_free_mem(win, &dir, NULL); + if (help_window) { + // Closing the help window moves the cursor back to the original window. + win_T *tmpwp = get_snapshot_focus(SNAP_HELP_IDX); + if (tmpwp != NULL) { + wp = tmpwp; + } + } + /* Make sure curwin isn't invalid. It can cause severe trouble when * printing an error message. For win_equal() curbuf needs to be valid * too. */ @@ -5421,6 +5429,27 @@ static win_T *restore_snapshot_rec(frame_T *sn, frame_T *fr) return wp; } +/// Gets the focused window (the one holding the cursor) of the snapshot. +static win_T *get_snapshot_focus(int idx) +{ + if (curtab->tp_snapshot[idx] == NULL) { + return NULL; + } + + frame_T *sn = curtab->tp_snapshot[idx]; + // This should be equivalent to the recursive algorithm found in + // restore_snapshot as far as traveling nodes go. + while (sn->fr_child != NULL || sn->fr_next != NULL) { + while (sn->fr_child != NULL) { + sn = sn->fr_child; + } + if (sn->fr_next != NULL) { + sn = sn->fr_next; + } + } + + return sn->fr_win; +} /* * Set "win" to be the curwin and "tp" to be the current tab page. -- cgit From dc232b74fb1a7927d6c13bd8c80bb42fc18a859f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 10 Dec 2017 01:24:54 +0100 Subject: doc: hack to avoid doxygen bug Use `@cond ` to obscure a section from doxygen. doxygen thinks kvec_withinit_t() is a function. That adds noise to the generated API documentation, and also prevents the following function from being noticed. --- src/nvim/api/vim.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 416e7d22d2..f0db391abe 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -789,6 +789,10 @@ ArrayOf(Dictionary) nvim_get_keymap(String mode) return keymap_array(mode, NULL); } +/// Returns a 2-tuple (Array), where item 0 is the current channel id and item +/// 1 is the |api-metadata| map (Dictionary). +/// +/// @returns 2-tuple [{channel-id}, {api-metadata}] Array nvim_get_api_info(uint64_t channel_id) FUNC_API_SINCE(1) FUNC_API_ASYNC FUNC_API_REMOTE_ONLY { @@ -896,7 +900,9 @@ typedef struct { Object *ret_node_p; } ExprASTConvStackItem; +///@cond DOXYGEN_NOT_A_FUNCTION typedef kvec_withinit_t(ExprASTConvStackItem, 16) ExprASTConvStack; +///@endcond /// Parse a VimL expression /// -- cgit From ad9c2d3cb97bbc4ba83ce7d23c9df23f9d3d11db Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 14 Nov 2017 10:47:49 +0100 Subject: doc closes #7622 --- src/nvim/api/buffer.c | 4 ++-- src/nvim/tui/tui.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 4b6a88e5fa..fdde28f2bb 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -763,8 +763,8 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err) /// or -1 for ungrouped highlight /// @param hl_group Name of the highlight group to use /// @param line Line to highlight (zero-indexed) -/// @param col_start Start of range of columns to highlight -/// @param col_end End of range of columns to highlight, +/// @param col_start Start of (byte-indexed) column range to highlight +/// @param col_end End of (byte-indexed) column range to highlight, /// or -1 to highlight to end of line /// @param[out] err Error details, if any /// @return The src_id that was used diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 6e2a5cbe67..9ff1acf64a 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -1529,7 +1529,7 @@ static void patch_terminfo_bugs(TUIData *data, const char *term, || iterm || iterm_pretending_xterm || teraterm // per TeraTerm "Supported Control Functions" doco // Some linux-type terminals (such as console-terminal-emulator - // from the nosh toolset) implement implement the xterm extension. + // from the nosh toolset) implement the xterm extension. || (linuxvt && (xterm_version || (vte_version > 0) || colorterm)))) { data->unibi_ext.set_cursor_style = (int)unibi_add_ext_str(ut, "Ss", "\x1b[%p1%d q"); -- cgit From e9504b7fd8cbf781aa9e68c48a4f3d59c633f269 Mon Sep 17 00:00:00 2001 From: ckelsel Date: Fri, 10 Nov 2017 22:51:03 +0800 Subject: vim-patch: NA vim-patch:8.0.0299 NA vim-patch:8.0.0309 NA vim-patch:8.0.0310 NA vim-patch:8.0.0215 NA Problem: When a Cscope line contains CTRL-L a NULL pointer may be used. (Coverity) Solution: Don't check for an emacs tag in a cscope line. https://github.com/vim/vim/commit/e362c3d2c34f2b7ff38b4c3d2a7ff127d2290e09 vim-patch:8.0.0244 NA Problem: When the user sets t_BE empty after startup to disable bracketed paste, this has no direct effect. Solution: When t_BE is made empty write t_BD. When t_BE is made non-empty write the new value. https://github.com/vim/vim/commit/d9c60648e50a82dcb85b8dffb47f6416c3d56972 Some patches were not properly marked in the commit logs. So they are marked here: vim-patch:8.0.1230 vim-patch:8.0.1229 vim-patch:8.0.0618 vim-patch:8.0.0104 vim-patch:8.0.0405 vim-patch:8.0.0400 vim-patch:8.0.0302 vim-patch:8.0.0288 vim-patch:8.0.0285 vim-patch:8.0.0284 vim-patch:8.0.0281 vim-patch:8.0.0279 vim-patch:8.0.0278 vim-patch:8.0.0277 vim-patch:8.0.0276 vim-patch:8.0.0273 vim-patch:8.0.0272 vim-patch:8.0.0271 vim-patch:8.0.0270 vim-patch:8.0.0269 vim-patch:8.0.0268 vim-patch:8.0.0267 vim-patch:8.0.0260 vim-patch:8.0.0257 vim-patch:8.0.0249 vim-patch:8.0.0248 vim-patch:8.0.0246 vim-patch:8.0.0244 vim-patch:8.0.0241 vim-patch:8.0.0240 vim-patch:8.0.0239 vim-patch:8.0.0232 vim-patch:8.0.0221 vim-patch:8.0.0217 vim-patch:8.0.0215 vim-patch:8.0.0213 vim-patch:8.0.0211 vim-patch:8.0.0203 vim-patch:8.0.0199 vim-patch:8.0.0193 vim-patch:8.0.0192 vim-patch:8.0.0191 vim-patch:8.0.0187 vim-patch:8.0.0183 vim-patch:8.0.0180 vim-patch:8.0.0173 vim-patch:8.0.0171 vim-patch:8.0.0170 vim-patch:8.0.0169 vim-patch:8.0.0166 vim-patch:8.0.0163 vim-patch:8.0.0162 vim-patch:8.0.0161 vim-patch:8.0.0152 vim-patch:8.0.0145 vim-patch:8.0.0144 vim-patch:8.0.0141 vim-patch:8.0.0139 vim-patch:8.0.0138 vim-patch:8.0.0130 vim-patch:8.0.0129 vim-patch:8.0.0123 vim-patch:8.0.0122 vim-patch:8.0.0120 vim-patch:8.0.0117 vim-patch:8.0.0115 vim-patch:8.0.0114 vim-patch:8.0.0113 vim-patch:8.0.0109 vim-patch:8.0.0108 vim-patch:8.0.0107 vim-patch:8.0.0105 vim-patch:8.0.0103 vim-patch:8.0.0098 vim-patch:8.0.0097 vim-patch:8.0.0095 vim-patch:8.0.0094 vim-patch:8.0.0093 vim-patch:8.0.0089 vim-patch:8.0.0087 vim-patch:8.0.0082 vim-patch:8.0.0080 vim-patch:8.0.0077 vim-patch:8.0.0076 vim-patch:8.0.0072 vim-patch:8.0.0071 vim-patch:8.0.0070 vim-patch:8.0.0067 vim-patch:8.0.0065 vim-patch:8.0.0063 vim-patch:8.0.0061 vim-patch:8.0.0059 vim-patch:8.0.0055 vim-patch:8.0.0054 vim-patch:8.0.0051 vim-patch:8.0.0050 vim-patch:8.0.0048 vim-patch:8.0.0045 vim-patch:8.0.0039 vim-patch:8.0.0036 vim-patch:8.0.0030 vim-patch:8.0.0029 vim-patch:8.0.0028 vim-patch:8.0.0027 vim-patch:8.0.0024 vim-patch:8.0.0022 vim-patch:8.0.0021 vim-patch:8.0.0018 vim-patch:8.0.0016 vim-patch:8.0.0015 vim-patch:8.0.0014 vim-patch:8.0.0013 vim-patch:8.0.0011 vim-patch:8.0.0010 vim-patch:8.0.0009 vim-patch:8.0.0007 vim-patch:8.0.0005 --- src/nvim/version.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/version.c b/src/nvim/version.c index 1a9c9d73e5..e8cf1d0f0b 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -1012,7 +1012,7 @@ static const int included_patches[] = { 247, // 246 NA 245, - // 244, + // 244 NA 243, 242, // 241 NA @@ -1041,7 +1041,7 @@ static const int included_patches[] = { 218, // 217 NA // 216, - // 215, + // 215 NA // 214, // 213 NA // 212, -- cgit