aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mark.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/mark.c')
-rw-r--r--src/nvim/mark.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index b057f8d0e4..b98935e93d 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -653,29 +653,31 @@ fmark_T *getnextmark(pos_T *startpos, int dir, int begin_line)
// until the mark is used to avoid a long startup delay.
static void fname2fnum(xfmark_T *fm)
{
- if (fm->fname != NULL) {
- // First expand "~/" in the file name to the home directory.
- // Don't expand the whole name, it may contain other '~' chars.
+ if (fm->fname == NULL) {
+ return;
+ }
+
+ // First expand "~/" in the file name to the home directory.
+ // Don't expand the whole name, it may contain other '~' chars.
#ifdef BACKSLASH_IN_FILENAME
- if (fm->fname[0] == '~' && (fm->fname[1] == '/' || fm->fname[1] == '\\')) {
+ if (fm->fname[0] == '~' && (fm->fname[1] == '/' || fm->fname[1] == '\\')) {
#else
- if (fm->fname[0] == '~' && (fm->fname[1] == '/')) {
+ if (fm->fname[0] == '~' && (fm->fname[1] == '/')) {
#endif
- expand_env("~/", NameBuff, MAXPATHL);
- int len = (int)strlen(NameBuff);
- xstrlcpy(NameBuff + len, fm->fname + 2, (size_t)(MAXPATHL - len));
- } else {
- xstrlcpy(NameBuff, fm->fname, MAXPATHL);
- }
+ expand_env("~/", NameBuff, MAXPATHL);
+ int len = (int)strlen(NameBuff);
+ xstrlcpy(NameBuff + len, fm->fname + 2, (size_t)(MAXPATHL - len));
+ } else {
+ xstrlcpy(NameBuff, fm->fname, MAXPATHL);
+ }
- // Try to shorten the file name.
- os_dirname(IObuff, IOSIZE);
- char *p = path_shorten_fname(NameBuff, IObuff);
+ // Try to shorten the file name.
+ os_dirname(IObuff, IOSIZE);
+ char *p = path_shorten_fname(NameBuff, IObuff);
- // buflist_new() will call fmarks_check_names()
- (void)buflist_new(NameBuff, p, (linenr_T)1, 0);
- }
+ // buflist_new() will call fmarks_check_names()
+ (void)buflist_new(NameBuff, p, (linenr_T)1, 0);
}
// Check all file marks for a name that matches the file name in buf.
@@ -833,7 +835,7 @@ void ex_marks(exarg_T *eap)
}
for (i = 0; i < NGLOBALMARKS; i++) {
if (namedfm[i].fmark.fnum != 0) {
- name = (char *)fm_getname(&namedfm[i].fmark, 15);
+ name = fm_getname(&namedfm[i].fmark, 15);
} else {
name = namedfm[i].fname;
}
@@ -915,7 +917,7 @@ static void show_one_mark(int c, char *arg, pos_T *p, char *name_arg, int curren
// ":delmarks[!] [marks]"
void ex_delmarks(exarg_T *eap)
{
- char_u *p;
+ char *p;
int from, to;
int i;
int lower;
@@ -931,14 +933,14 @@ void ex_delmarks(exarg_T *eap)
emsg(_(e_argreq));
} else {
// clear specified marks only
- for (p = (char_u *)eap->arg; *p != NUL; p++) {
+ for (p = eap->arg; *p != NUL; p++) {
lower = ASCII_ISLOWER(*p);
digit = ascii_isdigit(*p);
if (lower || digit || ASCII_ISUPPER(*p)) {
if (p[1] == '-') {
// clear range of marks
- from = *p;
- to = p[2];
+ from = (uint8_t)(*p);
+ to = (uint8_t)p[2];
if (!(lower ? ASCII_ISLOWER(p[2])
: (digit ? ascii_isdigit(p[2])
: ASCII_ISUPPER(p[2])))
@@ -949,7 +951,7 @@ void ex_delmarks(exarg_T *eap)
p += 2;
} else {
// clear one lower case mark
- from = to = *p;
+ from = to = (uint8_t)(*p);
}
for (i = from; i <= to; i++) {
@@ -1004,7 +1006,7 @@ void ex_jumps(exarg_T *eap)
msg_puts_title(_("\n jump line col file/text"));
for (i = 0; i < curwin->w_jumplistlen && !got_int; i++) {
if (curwin->w_jumplist[i].fmark.mark.lnum != 0) {
- name = (char *)fm_getname(&curwin->w_jumplist[i].fmark, 16);
+ name = fm_getname(&curwin->w_jumplist[i].fmark, 16);
// Make sure to output the current indicator, even when on an wiped
// out buffer. ":filter" may still skip it.