aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/CMakeLists.txt7
-rw-r--r--src/nvim/os/stdpaths.c4
-rw-r--r--src/nvim/quickfix.c40
-rw-r--r--src/nvim/syntax.c12
-rw-r--r--test/functional/helpers.lua12
5 files changed, 62 insertions, 13 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 06957dd77d..39240823f6 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -1,15 +1,16 @@
option(USE_GCOV "Enable gcov support" OFF)
-if(NOT CLANG_TSAN)
-# GCOV and TSAN results in false data race reports
if(USE_GCOV)
+ if(CLANG_TSAN)
+ # GCOV and TSAN results in false data race reports
+ message(FATAL_ERROR "USE_GCOV cannot be used with CLANG_TSAN")
+ endif()
message(STATUS "Enabling gcov support")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
add_definitions(-DUSE_GCOV)
endif()
-endif()
if(WIN32)
# tell MinGW compiler to enable wmain
diff --git a/src/nvim/os/stdpaths.c b/src/nvim/os/stdpaths.c
index 91ee45d3a9..66bc990402 100644
--- a/src/nvim/os/stdpaths.c
+++ b/src/nvim/os/stdpaths.c
@@ -68,6 +68,10 @@ char *stdpaths_get_xdg_var(const XDGVarType idx)
if (env_val == NULL && xdg_defaults_env_vars[idx] != NULL) {
env_val = os_getenv(xdg_defaults_env_vars[idx]);
}
+#else
+ if (env_val == NULL && os_env_exists(env)) {
+ env_val = "";
+ }
#endif
char *ret = NULL;
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 26687f14f0..e24ccc38b0 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -40,6 +40,7 @@
#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/strings.h"
+#include "nvim/syntax.h"
#include "nvim/ui.h"
#include "nvim/window.h"
#include "nvim/os/os.h"
@@ -2481,8 +2482,11 @@ void qf_list(exarg_T *eap)
int idx1 = 1;
int idx2 = -1;
char_u *arg = eap->arg;
- int all = eap->forceit; /* if not :cl!, only show
- recognised errors */
+ int qfFileAttr;
+ int qfSepAttr;
+ int qfLineAttr;
+ int all = eap->forceit; // if not :cl!, only show
+ // recognised errors
qf_info_T *qi = &ql_info;
if (eap->cmdidx == CMD_llist) {
@@ -2525,6 +2529,21 @@ void qf_list(exarg_T *eap)
// Shorten all the file names, so that it is easy to read.
shorten_fnames(false);
+ // Get the attributes for the different quickfix highlight items. Note
+ // that this depends on syntax items defined in the qf.vim syntax file
+ qfFileAttr = syn_name2attr((char_u *)"qfFileName");
+ if (qfFileAttr == 0) {
+ qfFileAttr = HL_ATTR(HLF_D);
+ }
+ qfSepAttr = syn_name2attr((char_u *)"qfSeparator");
+ if (qfSepAttr == 0) {
+ qfSepAttr = HL_ATTR(HLF_D);
+ }
+ qfLineAttr = syn_name2attr((char_u *)"qfLineNr");
+ if (qfLineAttr == 0) {
+ qfLineAttr = HL_ATTR(HLF_N);
+ }
+
if (qi->qf_lists[qi->qf_curlist].qf_nonevalid) {
all = true;
}
@@ -2574,22 +2593,27 @@ void qf_list(exarg_T *eap)
}
msg_putchar('\n');
msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index
- ? HL_ATTR(HLF_QFL) : HL_ATTR(HLF_D));
+ ? HL_ATTR(HLF_QFL) : qfFileAttr);
+
+ if (qfp->qf_lnum != 0) {
+ msg_puts_attr(":", qfSepAttr);
+ }
if (qfp->qf_lnum == 0) {
IObuff[0] = NUL;
} else if (qfp->qf_col == 0) {
- vim_snprintf((char *)IObuff, IOSIZE, ":%" PRIdLINENR, qfp->qf_lnum);
+ vim_snprintf((char *)IObuff, IOSIZE, "%" PRIdLINENR, qfp->qf_lnum);
} else {
- vim_snprintf((char *)IObuff, IOSIZE, ":%" PRIdLINENR " col %d",
+ vim_snprintf((char *)IObuff, IOSIZE, "%" PRIdLINENR " col %d",
qfp->qf_lnum, qfp->qf_col);
}
- vim_snprintf((char *)IObuff + STRLEN(IObuff), IOSIZE, "%s:",
+ vim_snprintf((char *)IObuff + STRLEN(IObuff), IOSIZE, "%s",
(char *)qf_types(qfp->qf_type, qfp->qf_nr));
- msg_puts_attr((const char *)IObuff, HL_ATTR(HLF_N));
+ msg_puts_attr((const char *)IObuff, qfLineAttr);
+ msg_puts_attr(":", qfSepAttr);
if (qfp->qf_pattern != NULL) {
qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE);
- xstrlcat((char *)IObuff, ":", IOSIZE);
msg_puts((const char *)IObuff);
+ msg_puts_attr(":", qfSepAttr);
}
msg_puts(" ");
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index f7de5f00d0..281ea7c4a3 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -7341,6 +7341,18 @@ int syn_name2id(const char_u *name)
return i + 1;
}
+/// Lookup a highlight group name and return its attributes.
+/// Return zero if not found.
+int syn_name2attr(char_u *name)
+{
+ int id = syn_name2id(name);
+
+ if (id != 0) {
+ return syn_id2attr(syn_get_final_id(id));
+ }
+ return 0;
+}
+
/*
* Return TRUE if highlight group "name" exists.
*/
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index cf9f5f9858..5ec28dd0c7 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -577,8 +577,16 @@ function module.assert_alive()
end
local function do_rmdir(path)
- if lfs.attributes(path, 'mode') ~= 'directory' then
- return -- Don't complain.
+ local mode, errmsg, errcode = lfs.attributes(path, 'mode')
+ if mode == nil then
+ if errcode == 2 then
+ -- "No such file or directory", don't complain.
+ return
+ end
+ error(string.format('rmdir: %s (%d)', errmsg, errcode))
+ end
+ if mode ~= 'directory' then
+ error(string.format('rmdir: not a directory: %s', path))
end
for file in lfs.dir(path) do
if file ~= '.' and file ~= '..' then