diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/nvim/api/buffer.c | 4 | ||||
-rw-r--r-- | src/nvim/api/vim.c | 6 | ||||
-rw-r--r-- | src/nvim/option.c | 3 | ||||
-rw-r--r-- | src/nvim/os/lang.c | 40 | ||||
-rw-r--r-- | src/nvim/os/lang.h | 7 | ||||
-rw-r--r-- | src/nvim/testdir/Makefile | 20 | ||||
-rw-r--r-- | src/nvim/testdir/unix.vim | 6 | ||||
-rw-r--r-- | src/nvim/tui/tui.c | 2 | ||||
-rw-r--r-- | src/nvim/version.c | 4 | ||||
-rw-r--r-- | src/nvim/window.c | 29 |
11 files changed, 114 insertions, 10 deletions
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/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/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 /// 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 <CoreFoundation/CFLocale.h> +# include <CoreFoundation/CFString.h> +# undef Boolean +#endif + +#ifdef HAVE_LOCALE_H +# include <locale.h> +#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 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 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"); 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, diff --git a/src/nvim/window.c b/src/nvim/window.c index 4c996aea79..28cb9449d1 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. |