aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval.c43
-rw-r--r--src/nvim/fileio.c20
-rw-r--r--src/nvim/message.c23
-rw-r--r--src/nvim/os/win_defs.h2
-rw-r--r--src/nvim/path.c23
-rw-r--r--src/nvim/screen.c8
-rw-r--r--src/nvim/version.c10
7 files changed, 87 insertions, 42 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index b5bf87bff4..7e1ebaf7d4 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -8338,6 +8338,7 @@ static void f_cursor(typval_T *argvars, typval_T *rettv)
{
long line, col;
long coladd = 0;
+ bool set_curswant = true;
rettv->vval.v_number = -1;
if (argvars[1].v_type == VAR_UNKNOWN) {
@@ -8354,30 +8355,35 @@ static void f_cursor(typval_T *argvars, typval_T *rettv)
coladd = pos.coladd;
if (curswant >= 0) {
curwin->w_curswant = curswant - 1;
+ set_curswant = false;
}
} else {
line = get_tv_lnum(argvars);
col = get_tv_number_chk(&argvars[1], NULL);
- if (argvars[2].v_type != VAR_UNKNOWN)
+ if (argvars[2].v_type != VAR_UNKNOWN) {
coladd = get_tv_number_chk(&argvars[2], NULL);
+ }
}
if (line < 0 || col < 0
- || coladd < 0
- )
- return; /* type error; errmsg already given */
- if (line > 0)
+ || coladd < 0) {
+ return; // type error; errmsg already given
+ }
+ if (line > 0) {
curwin->w_cursor.lnum = line;
- if (col > 0)
+ }
+ if (col > 0) {
curwin->w_cursor.col = col - 1;
+ }
curwin->w_cursor.coladd = coladd;
- /* Make sure the cursor is in a valid position. */
+ // Make sure the cursor is in a valid position.
check_cursor();
- /* Correct cursor for multi-byte character. */
- if (has_mbyte)
+ // Correct cursor for multi-byte character.
+ if (has_mbyte) {
mb_adjust_cursor();
+ }
- curwin->w_set_curswant = TRUE;
+ curwin->w_set_curswant = set_curswant;
rettv->vval.v_number = 0;
}
@@ -14683,25 +14689,30 @@ static void f_setpos(typval_T *argvars, typval_T *rettv)
name = get_tv_string_chk(argvars);
if (name != NULL) {
if (list2fpos(&argvars[1], &pos, &fnum, &curswant) == OK) {
- if (--pos.col < 0)
+ if (--pos.col < 0) {
pos.col = 0;
+ }
if (name[0] == '.' && name[1] == NUL) {
- /* set cursor */
+ // set cursor
if (fnum == curbuf->b_fnum) {
curwin->w_cursor = pos;
if (curswant >= 0) {
curwin->w_curswant = curswant - 1;
+ curwin->w_set_curswant = false;
}
check_cursor();
rettv->vval.v_number = 0;
- } else
+ } else {
EMSG(_(e_invarg));
+ }
} else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL) {
- /* set mark */
- if (setmark_pos(name[1], &pos, fnum) == OK)
+ // set mark
+ if (setmark_pos(name[1], &pos, fnum) == OK) {
rettv->vval.v_number = 0;
- } else
+ }
+ } else {
EMSG(_(e_invarg));
+ }
}
}
}
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 6c0bc59d93..db1469db97 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -5097,19 +5097,23 @@ void write_lnum_adjust(linenr_T offset)
}
#if defined(BACKSLASH_IN_FILENAME)
-/*
- * Convert all backslashes in fname to forward slashes in-place.
- */
+/// Convert all backslashes in fname to forward slashes in-place,
+/// unless when it looks like a URL.
void forward_slash(char_u *fname)
{
char_u *p;
- for (p = fname; *p != NUL; ++p)
- /* The Big5 encoding can have '\' in the trail byte. */
- if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1)
- ++p;
- else if (*p == '\\')
+ if (path_with_url(fname)) {
+ return;
+ }
+ for (p = fname; *p != NUL; p++) {
+ // The Big5 encoding can have '\' in the trail byte.
+ if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1) {
+ p++;
+ } else if (*p == '\\') {
*p = '/';
+ }
+ }
}
#endif
diff --git a/src/nvim/message.c b/src/nvim/message.c
index f60b128712..265f8c00c0 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -467,22 +467,23 @@ int emsg(char_u *s)
{
int attr;
char_u *p;
- int ignore = FALSE;
+ int ignore = false;
int severe;
- /* Skip this if not giving error messages at the moment. */
- if (emsg_not_now())
- return TRUE;
+ // Skip this if not giving error messages at the moment.
+ if (emsg_not_now()) {
+ return true;
+ }
- called_emsg = TRUE;
- ex_exitval = 1;
+ called_emsg = true;
+ if (emsg_silent == 0) {
+ ex_exitval = 1;
+ }
- /*
- * If "emsg_severe" is TRUE: When an error exception is to be thrown,
- * prefer this message over previous messages for the same command.
- */
+ // If "emsg_severe" is TRUE: When an error exception is to be thrown,
+ // prefer this message over previous messages for the same command.
severe = emsg_severe;
- emsg_severe = FALSE;
+ emsg_severe = false;
if (!emsg_off || vim_strchr(p_debug, 't') != NULL) {
/*
diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h
index 55894e4d12..6a29f86e79 100644
--- a/src/nvim/os/win_defs.h
+++ b/src/nvim/os/win_defs.h
@@ -46,6 +46,8 @@
# endif
#endif
+#define BACKSLASH_IN_FILENAME
+
#ifdef _MSC_VER
typedef SSIZE_T ssize_t;
#endif
diff --git a/src/nvim/path.c b/src/nvim/path.c
index aff0ee2d48..41fd69f238 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -1284,6 +1284,29 @@ static int expand_backtick(
return cnt;
}
+#ifdef BACKSLASH_IN_FILENAME
+/// Replace all slashes by backslashes.
+/// This used to be the other way around, but MS-DOS sometimes has problems
+/// with slashes (e.g. in a command name). We can't have mixed slashes and
+/// backslashes, because comparing file names will not work correctly. The
+/// commands that use a file name should try to avoid the need to type a
+/// backslash twice.
+/// When 'shellslash' set do it the other way around.
+/// When the path looks like a URL leave it unmodified.
+void slash_adjust(char_u *p)
+{
+ if (path_with_url(p)) {
+ return;
+ }
+ while (*p) {
+ if (*p == psepcN) {
+ *p = psepc;
+ }
+ mb_ptr_adv(p);
+ }
+}
+#endif
+
// Add a file to a file list. Accepted flags:
// EW_DIR add directories
// EW_FILE add files
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 59168b29a0..10b5b6bba4 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -3693,9 +3693,13 @@ win_line (
&& wp == curwin && lnum == wp->w_cursor.lnum
&& conceal_cursor_line(wp)
&& (int)wp->w_virtcol <= vcol + n_skip) {
- wp->w_wcol = col - boguscols;
+ if (wp->w_p_rl) {
+ wp->w_wcol = wp->w_width - col + boguscols - 1;
+ } else {
+ wp->w_wcol = col - boguscols;
+ }
wp->w_wrow = row;
- did_wcol = TRUE;
+ did_wcol = true;
}
/* Don't override visual selection highlighting. */
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 77ff6dcf97..b0c93533cf 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -116,7 +116,7 @@ static int included_patches[] = {
// 1565,
// 1564,
// 1563,
- // 1562,
+ // 1562 NA
// 1561 NA
// 1560,
// 1559,
@@ -331,7 +331,7 @@ static int included_patches[] = {
// 1350 NA
// 1349 NA
// 1348 NA
- // 1347,
+ 1347,
1346,
// 1345 NA
// 1344 NA
@@ -577,7 +577,7 @@ static int included_patches[] = {
// 1104 NA
// 1103 NA
// 1102,
- // 1101,
+ 1101,
// 1100 NA
// 1099 NA
// 1098 NA
@@ -663,7 +663,7 @@ static int included_patches[] = {
// 1018,
// 1017,
// 1016 NA
- // 1015,
+ 1015,
// 1014 NA
1013,
// 1012 NA
@@ -782,7 +782,7 @@ static int included_patches[] = {
// 899 NA
898,
// 897 NA
- // 896,
+ 896,
895,
// 894 NA
893,