diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/fileio.c | 20 | ||||
| -rw-r--r-- | src/nvim/memfile.c | 24 | ||||
| -rw-r--r-- | src/nvim/normal.c | 33 | ||||
| -rw-r--r-- | src/nvim/normal.h | 41 | ||||
| -rw-r--r-- | src/nvim/ops.c | 144 | ||||
| -rw-r--r-- | src/nvim/option_defs.h | 40 | ||||
| -rw-r--r-- | src/nvim/options.lua | 1 | ||||
| -rw-r--r-- | src/nvim/os/fs.c | 13 | ||||
| -rw-r--r-- | src/nvim/path.c | 6 | ||||
| -rw-r--r-- | src/nvim/shada.c | 4 | ||||
| -rw-r--r-- | src/nvim/ui.c | 27 | ||||
| -rw-r--r-- | src/nvim/version.c | 102 | 
12 files changed, 268 insertions, 187 deletions
| diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 687e06a5b6..23292ff4ac 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -3368,16 +3368,16 @@ restore_backup:      nchars += len;    } -#if defined(UNIX) && defined(HAVE_FSYNC) -  /* On many journalling file systems there is a bug that causes both the -   * original and the backup file to be lost when halting the system right -   * after writing the file.  That's because only the meta-data is -   * journalled.  Syncing the file slows down the system, but assures it has -   * been written to disk and we don't lose it. -   * For a device do try the fsync() but don't complain if it does not work -   * (could be a pipe). -   * If the 'fsync' option is FALSE, don't fsync().  Useful for laptops. */ -  if (p_fs && fsync(fd) != 0 && !device) { +#if defined(UNIX) +  // On many journalling file systems there is a bug that causes both the +  // original and the backup file to be lost when halting the system right +  // after writing the file.  That's because only the meta-data is +  // journalled.  Syncing the file slows down the system, but assures it has +  // been written to disk and we don't lose it. +  // For a device do try the fsync() but don't complain if it does not work +  // (could be a pipe). +  // If the 'fsync' option is FALSE, don't fsync().  Useful for laptops. +  if (p_fs && os_fsync(fd) != 0 && !device) {      errmsg = (char_u *)_("E667: Fsync failed");      end = 0;    } diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c index 3df4cbc4a3..9f5e4247b5 100644 --- a/src/nvim/memfile.c +++ b/src/nvim/memfile.c @@ -460,31 +460,11 @@ int mf_sync(memfile_T *mfp, int flags)      mfp->mf_dirty = false;    if ((flags & MFS_FLUSH) && *p_sws != NUL) { -#if defined(UNIX) -# ifdef HAVE_FSYNC      if (STRCMP(p_sws, "fsync") == 0) { -      if (fsync(mfp->mf_fd)) +      if (os_fsync(mfp->mf_fd)) {          status = FAIL; -    } else { -# endif -    // OpenNT is strictly POSIX (Benzinger). -    // Tandem/Himalaya NSK-OSS doesn't have sync() -# if defined(__OPENNT) || defined(__TANDEM) -    fflush(NULL); -# else -    sync(); -# endif -# ifdef HAVE_FSYNC +      }      } -# endif -#endif -# ifdef SYNC_DUP_CLOSE -    // Win32 is a bit more work: Duplicate the file handle and close it. -    // This should flush the file to disk. -    int fd; -    if ((fd = dup(mfp->mf_fd)) >= 0) -      close(fd); -# endif    }    got_int |= got_int_save; diff --git a/src/nvim/normal.c b/src/nvim/normal.c index a2e473fcb8..d4bf1c2e90 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1601,7 +1601,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)        if (VIsual_mode == Ctrl_V) {      /* block mode */          colnr_T start, end; -        oap->block_mode = true; +        oap->motion_type = MBLOCK;          getvvcol(curwin, &(oap->start),              &oap->start_vcol, NULL, &oap->end_vcol); @@ -1711,11 +1711,11 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)         */        if (oap->motion_force == NUL || oap->motion_type == MLINE)          oap->inclusive = true; -      if (VIsual_mode == 'V') +      if (VIsual_mode == 'V') {          oap->motion_type = MLINE; -      else { +      } else if (VIsual_mode == 'v') {          oap->motion_type = MCHAR; -        if (VIsual_mode != Ctrl_V && *ml_get_pos(&(oap->end)) == NUL +        if (*ml_get_pos(&(oap->end)) == NUL              && (include_line_break || !virtual_op)              ) {            oap->inclusive = false; @@ -1780,7 +1780,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)       * oap->empty is set when start and end are the same.  The inclusive       * flag affects this too, unless yanking and the end is on a NUL.       */ -    oap->empty = (oap->motion_type == MCHAR +    oap->empty = (oap->motion_type != MLINE                    && (!oap->inclusive                        || (oap->op_type == OP_YANK                            && gchar_pos(&oap->end) == NUL)) @@ -1810,14 +1810,13 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)       * first non-blank in the line, the operator becomes linewise       * (strange, but that's the way vi does it).       */ -    if (       oap->motion_type == MCHAR -               && oap->inclusive == false -               && !(cap->retval & CA_NO_ADJ_OP_END) -               && oap->end.col == 0 -               && (!oap->is_VIsual || *p_sel == 'o') -               && !oap->block_mode -               && oap->line_count > 1) { -      oap->end_adjusted = true;             /* remember that we did this */ +    if (oap->motion_type == MCHAR +        && oap->inclusive == false +        && !(cap->retval & CA_NO_ADJ_OP_END) +        && oap->end.col == 0 +        && (!oap->is_VIsual || *p_sel == 'o') +        && oap->line_count > 1) { +      oap->end_adjusted = true;  // remember that we did this        --oap->line_count;        --oap->end.lnum;        if (inindent(0)) @@ -2044,7 +2043,6 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)      } else {        curwin->w_cursor = old_cursor;      } -    oap->block_mode = false;      clearop(oap);    }    curwin->w_p_lbr = lbr_saved; @@ -2115,12 +2113,13 @@ static void op_function(oparg_T *oap)        /* Exclude the end position. */        decl(&curbuf->b_op_end); -    if (oap->block_mode) +    if (oap->motion_type == MBLOCK) {        argv[0] = (char_u *)"block"; -    else if (oap->motion_type == MLINE) +    } else if (oap->motion_type == MLINE) {        argv[0] = (char_u *)"line"; -    else +    } else {        argv[0] = (char_u *)"char"; +    }      /* Reset virtual_op so that 'virtualedit' can be changed in the       * function. */ diff --git a/src/nvim/normal.h b/src/nvim/normal.h index 01259de6cd..95619c7ef6 100644 --- a/src/nvim/normal.h +++ b/src/nvim/normal.h @@ -14,28 +14,27 @@   * Arguments for operators.   */  typedef struct oparg_S { -  int op_type;                  /* current pending operator type */ -  int regname;                  /* register to use for the operator */ -  int motion_type;              /* type of the current cursor motion */ -  int motion_force;             /* force motion type: 'v', 'V' or CTRL-V */ -  bool use_reg_one;             /* true if delete uses reg 1 even when not -                                   linewise */ -  bool inclusive;               /* true if char motion is inclusive (only -                                   valid when motion_type is MCHAR */ -  bool end_adjusted;            /* backuped b_op_end one char (only used by -                                   do_format()) */ -  pos_T start;                  /* start of the operator */ -  pos_T end;                    /* end of the operator */ -  pos_T cursor_start;           /* cursor position before motion for "gw" */ +  int op_type;                  // current pending operator type +  int regname;                  // register to use for the operator +  int motion_type;              // type of the current cursor motion +  int motion_force;             // force motion type: 'v', 'V' or CTRL-V +  bool use_reg_one;             // true if delete uses reg 1 even when not +                                // linewise +  bool inclusive;               // true if char motion is inclusive (only +                                // valid when motion_type is MCHAR) +  bool end_adjusted;            // backuped b_op_end one char (only used by +                                // do_format()) +  pos_T start;                  // start of the operator +  pos_T end;                    // end of the operator +  pos_T cursor_start;           // cursor position before motion for "gw" -  long line_count;              /* number of lines from op_start to op_end -                                   (inclusive) */ -  bool empty;                   /* op_start and op_end the same (only used by -                                   op_change()) */ -  bool is_VIsual;               /* operator on Visual area */ -  bool block_mode;              /* current operator is Visual block mode */ -  colnr_T start_vcol;           /* start col for block mode operator */ -  colnr_T end_vcol;             /* end col for block mode operator */ +  long line_count;              // number of lines from op_start to op_end +                                // (inclusive) +  bool empty;                   // op_start and op_end the same (only used by +                                // op_change()) +  bool is_VIsual;               // operator on Visual area +  colnr_T start_vcol;           // start col for block mode operator +  colnr_T end_vcol;             // end col for block mode operator    long prev_opcount;            // ca.opcount saved for K_EVENT    long prev_count0;             // ca.count0 saved for K_EVENT  } oparg_T; diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 2b1056e90e..c3d968ca51 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -174,20 +174,20 @@ void op_shift(oparg_T *oap, int curs_top, int amount)            (linenr_T)(oap->end.lnum + 1)) == FAIL)      return; -  if (oap->block_mode) +  if (oap->motion_type == MBLOCK) {      block_col = curwin->w_cursor.col; +  }    for (i = oap->line_count - 1; i >= 0; i--) {      first_char = *get_cursor_line_ptr(); -    if (first_char == NUL)                              /* empty line */ +    if (first_char == NUL) {  // empty line        curwin->w_cursor.col = 0; -    else if (oap->block_mode) +    } else if (oap->motion_type == MBLOCK) {        shift_block(oap, amount); -    else -    /* Move the line right if it doesn't start with '#', 'smartindent' -     * isn't set or 'cindent' isn't set or '#' isn't in 'cino'. */ -    if (first_char != '#' || !preprocs_left()) { -      shift_line(oap->op_type == OP_LSHIFT, p_sr, amount, FALSE); +    } else if (first_char != '#' || !preprocs_left()) { +      // Move the line right if it doesn't start with '#', 'smartindent' +      // isn't set or 'cindent' isn't set or '#' isn't in 'cino'. +      shift_line(oap->op_type == OP_LSHIFT, p_sr, amount, false);      }      ++curwin->w_cursor.lnum;    } @@ -196,7 +196,7 @@ void op_shift(oparg_T *oap, int curs_top, int amount)    /* The cursor line is not in a closed fold */    foldOpenCursor(); -  if (oap->block_mode) { +  if (oap->motion_type == MBLOCK) {      curwin->w_cursor.lnum = oap->start.lnum;      curwin->w_cursor.col = block_col;    } else if (curs_top) { /* put cursor on first line, for ">>" */ @@ -1274,8 +1274,9 @@ cmdline_paste_reg (          || (i < reg->y_size - 1              && !(remcr                   && i == reg->y_size - 2 -                 && *reg->y_array[i + 1] == NUL))) +                 && *reg->y_array[i + 1] == NUL))) {        cmdline_paste_str((char_u *)"\r", literally); +    }      /* Check for CTRL-C, in case someone tries to paste a few thousand       * lines and gets bored. */ @@ -1320,12 +1321,11 @@ int op_delete(oparg_T *oap)     * line and motion_type == MCHAR and the result is a blank line, make the     * delete linewise.  Don't do this for the change command or Visual mode.     */ -  if (       oap->motion_type == MCHAR -             && !oap->is_VIsual -             && !oap->block_mode -             && oap->line_count > 1 -             && oap->motion_force == NUL -             && oap->op_type == OP_DELETE) { +  if (oap->motion_type == MCHAR +      && !oap->is_VIsual +      && oap->line_count > 1 +      && oap->motion_force == NUL +      && oap->op_type == OP_DELETE) {      ptr = ml_get(oap->end.lnum) + oap->end.col;      if (*ptr != NUL)        ptr += oap->inclusive; @@ -1338,20 +1338,20 @@ int op_delete(oparg_T *oap)     * Check for trying to delete (e.g. "D") in an empty line.     * Note: For the change operator it is ok.     */ -  if (       oap->motion_type == MCHAR -             && oap->line_count == 1 -             && oap->op_type == OP_DELETE -             && *ml_get(oap->start.lnum) == NUL) { -    /* -     * It's an error to operate on an empty region, when 'E' included in -     * 'cpoptions' (Vi compatible). -     */ -    if (virtual_op) -      /* Virtual editing: Nothing gets deleted, but we set the '[ and '] -       * marks as if it happened. */ +  if (oap->motion_type != MLINE +      && oap->line_count == 1 +      && oap->op_type == OP_DELETE +      && *ml_get(oap->start.lnum) == NUL) { +    // It's an error to operate on an empty region, when 'E' included in +    // 'cpoptions' (Vi compatible). +    if (virtual_op) { +      // Virtual editing: Nothing gets deleted, but we set the '[ and '] +      // marks as if it happened.        goto setmarks; -    if (vim_strchr(p_cpo, CPO_EMPTYREGION) != NULL) +    } +    if (vim_strchr(p_cpo, CPO_EMPTYREGION) != NULL) {        beep_flush(); +    }      return OK;    } @@ -1402,10 +1402,11 @@ int op_delete(oparg_T *oap)    /*     * block mode delete     */ -  if (oap->block_mode) { +  if (oap->motion_type == MBLOCK) {      if (u_save((linenr_T)(oap->start.lnum - 1), -            (linenr_T)(oap->end.lnum + 1)) == FAIL) +               (linenr_T)(oap->end.lnum + 1)) == FAIL) {        return FAIL; +    }      for (lnum = curwin->w_cursor.lnum; lnum <= oap->end.lnum; ++lnum) {        block_prep(oap, &bd, lnum, TRUE); @@ -1593,7 +1594,7 @@ int op_delete(oparg_T *oap)    msgmore(curbuf->b_ml.ml_line_count - old_lcount);  setmarks: -  if (oap->block_mode) { +  if (oap->motion_type == MBLOCK) {      curbuf->b_op_end.lnum = oap->end.lnum;      curbuf->b_op_end.col = oap->start.col;    } else @@ -1654,7 +1655,7 @@ int op_replace(oparg_T *oap, int c)    /*     * block mode replace     */ -  if (oap->block_mode) { +  if (oap->motion_type == MBLOCK) {      bd.is_MAX = (curwin->w_curswant == MAXCOL);      for (; curwin->w_cursor.lnum <= oap->end.lnum; ++curwin->w_cursor.lnum) {        curwin->w_cursor.col = 0;        /* make sure cursor position is valid */ @@ -1836,7 +1837,7 @@ void op_tilde(oparg_T *oap)      return;    pos = oap->start; -  if (oap->block_mode) {                    /* Visual block mode */ +  if (oap->motion_type == MBLOCK) {  // Visual block mode      for (; pos.lnum <= oap->end.lnum; ++pos.lnum) {        int one_change; @@ -1998,11 +1999,11 @@ void op_insert(oparg_T *oap, long count1)    curwin->w_cursor.lnum = oap->start.lnum;    update_screen(INVERTED); -  if (oap->block_mode) { -    /* When 'virtualedit' is used, need to insert the extra spaces before -     * doing block_prep().  When only "block" is used, virtual edit is -     * already disabled, but still need it when calling -     * coladvance_force(). */ +  if (oap->motion_type == MBLOCK) { +    // When 'virtualedit' is used, need to insert the extra spaces before +    // doing block_prep().  When only "block" is used, virtual edit is +    // already disabled, but still need it when calling +    // coladvance_force().      if (curwin->w_cursor.coladd > 0) {        int old_ve_flags = ve_flags; @@ -2024,7 +2025,7 @@ void op_insert(oparg_T *oap, long count1)    }    if (oap->op_type == OP_APPEND) { -    if (oap->block_mode +    if (oap->motion_type == MBLOCK          && curwin->w_cursor.coladd == 0          ) {        /* Move the cursor to the character right of the block. */ @@ -2060,7 +2061,7 @@ void op_insert(oparg_T *oap, long count1)    if (curwin->w_cursor.lnum != oap->start.lnum || got_int)      return; -  if (oap->block_mode) { +  if (oap->motion_type == MBLOCK) {      struct block_def bd2;      /* The user may have moved the cursor before inserting something, try @@ -2165,13 +2166,14 @@ int op_change(oparg_T *oap)        && !virtual_op)      inc_cursor(); -  /* check for still on same line (<CR> in inserted text meaningless) */ -  /* skip blank lines too */ -  if (oap->block_mode) { -    /* Add spaces before getting the current line length. */ +  // check for still on same line (<CR> in inserted text meaningless) +  // skip blank lines too +  if (oap->motion_type == MBLOCK) { +    // Add spaces before getting the current line length.      if (virtual_op && (curwin->w_cursor.coladd > 0 -                       || gchar_cursor() == NUL)) +                       || gchar_cursor() == NUL)) {        coladvance_force(getviscol()); +    }      firstline = ml_get(oap->start.lnum);      pre_textlen = (long)STRLEN(firstline);      pre_indent = (long)(skipwhite(firstline) - firstline); @@ -2188,9 +2190,10 @@ int op_change(oparg_T *oap)     * block.     * Don't repeat the insert when Insert mode ended with CTRL-C.     */ -  if (oap->block_mode && oap->start.lnum != oap->end.lnum && !got_int) { -    /* Auto-indenting may have changed the indent.  If the cursor was past -     * the indent, exclude that indent change from the inserted text. */ +  if (oap->motion_type == MBLOCK +      && oap->start.lnum != oap->end.lnum && !got_int) { +    // Auto-indenting may have changed the indent.  If the cursor was past +    // the indent, exclude that indent change from the inserted text.      firstline = ml_get(oap->start.lnum);      if (bd.textcol > (colnr_T)pre_indent) {        long new_indent = (long)(skipwhite(firstline) - firstline); @@ -2331,13 +2334,12 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)     * If the cursor was in column 1 before and after the movement, and the     * operator is not inclusive, the yank is always linewise.     */ -  if (       oap->motion_type == MCHAR -             && oap->start.col == 0 -             && !oap->inclusive -             && (!oap->is_VIsual || *p_sel == 'o') -             && !oap->block_mode -             && oap->end.col == 0 -             && yanklines > 1) { +  if (oap->motion_type == MCHAR +      && oap->start.col == 0 +      && !oap->inclusive +      && (!oap->is_VIsual || *p_sel == 'o') +      && oap->end.col == 0 +      && yanklines > 1) {      yanktype = MLINE;      --yankendlnum;      --yanklines; @@ -2353,9 +2355,8 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)    y_idx = 0;    lnum = oap->start.lnum; -  if (oap->block_mode) { -    /* Visual block mode */ -    reg->y_type = MBLOCK;             /* set the yank register type */ +  if (yanktype == MBLOCK) { +    // Visual block mode      reg->y_width = oap->end_vcol - oap->start_vcol;      if (curwin->w_curswant == MAXCOL && reg->y_width > 0) @@ -2469,25 +2470,26 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)    if (curwin->w_p_rnu) {      redraw_later(SOME_VALID);  // cursor moved to start    } -  if (message) {                   /* Display message about yank? */ -    if (yanktype == MCHAR -        && !oap->block_mode -        && yanklines == 1) +  if (message) {  // Display message about yank? +    if (yanktype == MCHAR && yanklines == 1) {        yanklines = 0; -    /* Some versions of Vi use ">=" here, some don't...  */ +    } +    // Some versions of Vi use ">=" here, some don't...      if (yanklines > p_report) { -      /* redisplay now, so message is not deleted */ +      // redisplay now, so message is not deleted        update_topline_redraw();        if (yanklines == 1) { -        if (oap->block_mode) +        if (yanktype == MBLOCK) {            MSG(_("block of 1 line yanked")); -        else +        } else {            MSG(_("1 line yanked")); -      } else if (oap->block_mode) +        } +      } else if (yanktype == MBLOCK) {          smsg(_("block of %" PRId64 " lines yanked"),               (int64_t)yanklines); -      else +      } else {          smsg(_("%" PRId64 " lines yanked"), (int64_t)yanklines); +      }      }    } @@ -2496,9 +2498,7 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)     */    curbuf->b_op_start = oap->start;    curbuf->b_op_end = oap->end; -  if (yanktype == MLINE -      && !oap->block_mode -      ) { +  if (yanktype == MLINE) {      curbuf->b_op_start.col = 0;      curbuf->b_op_end.col = MAXCOL;    } @@ -4923,7 +4923,7 @@ void cursor_pos_info(void)          /* Make 'sbr' empty for a moment to get the correct size. */          p_sbr = empty_option;          oparg.is_VIsual = true; -        oparg.block_mode = true; +        oparg.motion_type = MBLOCK;          oparg.op_type = OP_NOP;          getvcols(curwin, &min_pos, &max_pos,              &oparg.start_vcol, &oparg.end_vcol); diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index c72e1cf0bb..938aa9bc83 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -405,27 +405,25 @@ static char *(p_fdo_values[]) = {"all", "block", "hor", "mark", "percent",  # define FDO_INSERT             0x100  # define FDO_UNDO               0x200  # define FDO_JUMP               0x400 -EXTERN char_u   *p_fp;          /* 'formatprg' */ -#ifdef HAVE_FSYNC -EXTERN int p_fs;                /* 'fsync' */ -#endif -EXTERN int p_gd;                /* 'gdefault' */ -EXTERN char_u   *p_pdev;        /* 'printdevice' */ -EXTERN char_u   *p_penc;        /* 'printencoding' */ -EXTERN char_u   *p_pexpr;       /* 'printexpr' */ -EXTERN char_u   *p_pmfn;        /* 'printmbfont' */ -EXTERN char_u   *p_pmcs;        /* 'printmbcharset' */ -EXTERN char_u   *p_pfn;         /* 'printfont' */ -EXTERN char_u   *p_popt;        /* 'printoptions' */ -EXTERN char_u   *p_header;      /* 'printheader' */ -EXTERN int p_prompt;            /* 'prompt' */ -EXTERN char_u   *p_guicursor;   /* 'guicursor' */ -EXTERN char_u   *p_hf;          /* 'helpfile' */ -EXTERN long p_hh;               /* 'helpheight' */ -EXTERN char_u   *p_hlg;         /* 'helplang' */ -EXTERN int p_hid;               /* 'hidden' */ -/* Use P_HID to check if a buffer is to be hidden when it is no longer - * visible in a window. */ +EXTERN char_u   *p_fp;          // 'formatprg' +EXTERN int p_fs;                // 'fsync' +EXTERN int p_gd;                // 'gdefault' +EXTERN char_u   *p_pdev;        // 'printdevice' +EXTERN char_u   *p_penc;        // 'printencoding' +EXTERN char_u   *p_pexpr;       // 'printexpr' +EXTERN char_u   *p_pmfn;        // 'printmbfont' +EXTERN char_u   *p_pmcs;        // 'printmbcharset' +EXTERN char_u   *p_pfn;         // 'printfont' +EXTERN char_u   *p_popt;        // 'printoptions' +EXTERN char_u   *p_header;      // 'printheader' +EXTERN int p_prompt;            // 'prompt' +EXTERN char_u   *p_guicursor;   // 'guicursor' +EXTERN char_u   *p_hf;          // 'helpfile' +EXTERN long p_hh;               // 'helpheight' +EXTERN char_u   *p_hlg;         // 'helplang' +EXTERN int p_hid;               // 'hidden' +// Use P_HID to check if a buffer is to be hidden when it is no longer +// visible in a window.  # define P_HID(buf) (buf_hide(buf))  EXTERN char_u   *p_hl;          /* 'highlight' */  EXTERN int p_hls;               /* 'hlsearch' */ diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 5187340629..e485b90394 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -959,7 +959,6 @@ return {        type='bool', scope={'global'},        secure=true,        vi_def=true, -      enable_if='HAVE_FSYNC',        varname='p_fs',        defaults={if_true={vi=true}}      }, diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index d59b66e773..1a4c3495f2 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -202,6 +202,19 @@ int os_open(const char* path, int flags, int mode)    return r;  } +/// Flushes file modifications to disk. +/// +/// @param fd the file descriptor of the file to flush to disk. +/// +/// @return `0` on success, a libuv error code on failure. +int os_fsync(int fd) +{ +  uv_fs_t fsync_req; +  int r = uv_fs_fsync(&fs_loop, &fsync_req, fd, NULL); +  uv_fs_req_cleanup(&fsync_req); +  return r; +} +  /// Get stat information for a file.  ///  /// @return libuv return code. diff --git a/src/nvim/path.c b/src/nvim/path.c index 253035ed99..d689eaf8cb 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -579,9 +579,13 @@ static size_t do_path_expand(garray_T *gap, const char_u *path,        s = p + 1;      } else if (path_end >= path + wildoff                 && (vim_strchr((char_u *)"*?[{~$", *path_end) != NULL +#ifndef WIN32                     || (!p_fic && (flags & EW_ICASE) -                       && isalpha(PTR2CHAR(path_end))))) +                       && isalpha(PTR2CHAR(path_end)))) +#endif +    ) {        e = p; +    }      if (has_mbyte) {        len = (*mb_ptr2len)(path_end);        STRNCPY(p, path_end, len); diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 42e514aa95..6a30472a7c 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -761,9 +761,9 @@ static void close_sd_writer(ShaDaWriteDef *const sd_writer)    FUNC_ATTR_NONNULL_ALL  {    const int fd = (int)(intptr_t) sd_writer->cookie; -  if (fsync(fd) < 0) { +  if (os_fsync(fd) < 0) {      emsg2(_(SERR "System error while synchronizing ShaDa file: %s"), -          strerror(errno)); +          os_strerror(errno));      errno = 0;    }    close_file(fd); diff --git a/src/nvim/ui.c b/src/nvim/ui.c index 786f6026de..d32969f149 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -55,14 +55,25 @@ static int height, width;  //  // See http://stackoverflow.com/a/11172679 for a better explanation of how it  // works. -#define UI_CALL(...)                                              \ -  do {                                                            \ -    flush_cursor_update();                                        \ -    for (size_t i = 0; i < ui_count; i++) {                       \ -      UI *ui = uis[i];                                            \ -      UI_CALL_HELPER(CNT(__VA_ARGS__), __VA_ARGS__);              \ -    }                                                             \ -  } while (0) +#ifdef _MSC_VER +  #define UI_CALL(funname, ...)                                     \ +    do {                                                            \ +      flush_cursor_update();                                        \ +      for (size_t i = 0; i < ui_count; i++) {                       \ +        UI *ui = uis[i];                                            \ +        UI_CALL_MORE(funname, __VA_ARGS__);                         \ +      }                                                             \ +    } while (0) +#else +  #define UI_CALL(...)                                              \ +    do {                                                            \ +      flush_cursor_update();                                        \ +      for (size_t i = 0; i < ui_count; i++) {                       \ +        UI *ui = uis[i];                                            \ +        UI_CALL_HELPER(CNT(__VA_ARGS__), __VA_ARGS__);              \ +      }                                                             \ +    } while (0) +#endif  #define CNT(...) SELECT_NTH(__VA_ARGS__, MORE, MORE, MORE, MORE, ZERO, ignore)  #define SELECT_NTH(a1, a2, a3, a4, a5, a6, ...) a6  #define UI_CALL_HELPER(c, ...) UI_CALL_HELPER2(c, __VA_ARGS__) diff --git a/src/nvim/version.c b/src/nvim/version.c index 93222ae143..0d8afc4e53 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -71,6 +71,84 @@ static char *features[] = {  // clang-format off  static int included_patches[] = { +  // 1000, +  // 999 NA +  // 998, +  // 997 NA +  // 996 NA +  // 995 NA +  // 994 NA +  // 993, +  // 992 NA +  // 991, +  // 990 NA +  // 989, +  // 988 NA +  // 987 NA +  // 986 NA +  // 985 NA +  // 984, +  // 983, +  // 982, +  // 981, +  // 980, +  // 979 NA +  // 978, +  // 977, +  // 976 NA +  // 975, +  // 974, +  // 973, +  // 972, +  // 971, +  // 970, +  // 969, +  // 968, +  // 967 NA +  // 966 NA +  // 965 NA +  // 964, +  // 963, +  // 962 NA +  // 961, +  // 960 NA +  // 959 NA +  // 958, +  // 957, +  // 956, +  // 955, +  // 954 NA +  // 953, +  // 952, +  // 951, +  // 950, +  // 949, +  // 948 NA +  // 947, +  // 946, +  // 945, +  // 944, +  // 943, +  // 942, +  // 941, +  // 940 NA +  // 939, +  // 938 NA +  // 937, +  // 936, +  // 935, +  // 934 NA +  // 933, +  // 932, +  // 931, +  // 930 NA +  // 929, +  // 928 NA +  // 927 NA +  // 926, +  // 925, +  // 924 NA +  // 923 NA    // 922,    // 921 NA    // 920 NA @@ -129,8 +207,8 @@ static int included_patches[] = {    // 867 NA    // 866,    // 865, -  // 864, -  // 863, +  // 864 NA +  // 863 NA    // 862 NA    // 861 NA    // 860, @@ -139,7 +217,7 @@ static int included_patches[] = {    // 857,    // 856,    // 855 NA -  // 854, +  // 854 NA    // 853,    // 852 NA    // 851 NA @@ -151,8 +229,8 @@ static int included_patches[] = {    // 845,    // 844,    // 843, -  // 842, -  // 841, +  // 842 NA +  // 841 NA    // 840 NA    // 839,    // 838, @@ -185,7 +263,7 @@ static int included_patches[] = {    // 811,    // 810,    809, -  // 808, +  // 808 NA    // 807,    // 806,    // 805, @@ -332,7 +410,7 @@ static int included_patches[] = {    // 664 NA    // 663 NA    // 662, -  // 661, +  // 661 NA    660,    659,    658, @@ -352,7 +430,7 @@ static int included_patches[] = {    // 644 NA    // 643,    // 642, -  // 641, +  // 641 NA    640,    // 639,    // 638 NA @@ -365,15 +443,15 @@ static int included_patches[] = {    631,    630,    629, -  // 628, +  // 628 NA    // 627 NA    // 626 NA    // 625 NA -  // 624, +  // 624 NA    623,    // 622 NA    // 621 NA -  // 620, +  // 620 NA    // 619 NA    // 618 NA    617, @@ -386,7 +464,7 @@ static int included_patches[] = {    // 610 NA    609,    608, -  // 607, +  // 607 NA    606,    605,    604, | 
