mirror of
https://github.com/neovim/neovim.git
synced 2025-11-17 15:51:32 +00:00
vim-patch:partial:9.0.1196: code is indented more than necessary (#21796)
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes vim/vim#11813)
e857598896
Partial port as this depends on some previous eval and 'smoothscroll'
patches.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
// 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);
|
||||
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);
|
||||
|
||||
// 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.
|
||||
|
||||
Reference in New Issue
Block a user