Merge branch 'master' into hide-container-impl

This commit is contained in:
ZyX
2017-12-12 00:44:25 +03:00
24 changed files with 300 additions and 100 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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
///

View File

@@ -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'

40
src/nvim/os/lang.c Normal file
View File

@@ -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
}

7
src/nvim/os/lang.h Normal file
View File

@@ -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

View File

@@ -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 ?= \

View File

@@ -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

View File

@@ -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");

View File

@@ -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,

View File

@@ -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.