comparison src/fold.c @ 11148:87779062d706 v8.0.0461

patch 8.0.0461: test 45 hangs on MS-Windows commit https://github.com/vim/vim/commit/4a5a8dd6e5fa5581bd24b584a71b5fce9ba34bb8 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 16 13:54:10 2017 +0100 patch 8.0.0461: test 45 hangs on MS-Windows Problem: Test 45 hangs on MS-Windows. Solution: Reset 'shiftwidth'. Also remove redundent function.
author Christian Brabandt <cb@256bit.org>
date Thu, 16 Mar 2017 14:00:05 +0100
parents 6b26e044b6f5
children 80241603dd50
comparison
equal deleted inserted replaced
11147:e6281b7c5883 11148:87779062d706
62 static void foldAddMarker(linenr_T lnum, char_u *marker, int markerlen); 62 static void foldAddMarker(linenr_T lnum, char_u *marker, int markerlen);
63 static void deleteFoldMarkers(fold_T *fp, int recursive, linenr_T lnum_off); 63 static void deleteFoldMarkers(fold_T *fp, int recursive, linenr_T lnum_off);
64 static void foldDelMarker(linenr_T lnum, char_u *marker, int markerlen); 64 static void foldDelMarker(linenr_T lnum, char_u *marker, int markerlen);
65 static void foldUpdateIEMS(win_T *wp, linenr_T top, linenr_T bot); 65 static void foldUpdateIEMS(win_T *wp, linenr_T top, linenr_T bot);
66 static void parseMarker(win_T *wp); 66 static void parseMarker(win_T *wp);
67 static void foldMoveRange_int(garray_T *gap, linenr_T line1, linenr_T line2, linenr_T dest);
68 67
69 static char *e_nofold = N_("E490: No fold found"); 68 static char *e_nofold = N_("E490: No fold found");
70 69
71 /* 70 /*
72 * While updating the folds lines between invalid_top and invalid_bot have an 71 * While updating the folds lines between invalid_top and invalid_bot have an
1074 foldAdjustCursor(void) 1073 foldAdjustCursor(void)
1075 { 1074 {
1076 (void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL); 1075 (void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL);
1077 } 1076 }
1078 1077
1079 /* foldMoveRange() {{{2 */
1080 void
1081 foldMoveRange(garray_T *gap, linenr_T line1, linenr_T line2, linenr_T dest)
1082 {
1083 foldMoveRange_int(gap, line1, line2, dest);
1084 }
1085 /* Internal functions for "fold_T" {{{1 */ 1078 /* Internal functions for "fold_T" {{{1 */
1086 /* cloneFoldGrowArray() {{{2 */ 1079 /* cloneFoldGrowArray() {{{2 */
1087 /* 1080 /*
1088 * Will "clone" (i.e deep copy) a garray_T of folds. 1081 * Will "clone" (i.e deep copy) a garray_T of folds.
1089 * 1082 *
2990 *left = *right; 2983 *left = *right;
2991 *right = tmp; 2984 *right = tmp;
2992 } 2985 }
2993 } 2986 }
2994 2987
2995 /* foldMoveRange_int() {{{2 */ 2988 /* foldMoveRange() {{{2 */
2996 /* 2989 /*
2997 * Move folds within the inclusive range "line1" to "line2" to after "dest" 2990 * Move folds within the inclusive range "line1" to "line2" to after "dest"
2998 * requires "line1" <= "line2" <= "dest" 2991 * requires "line1" <= "line2" <= "dest"
2999 * 2992 *
3000 * There are the following situations for the first fold at or below line1 - 1. 2993 * There are the following situations for the first fold at or below line1 - 1.
3034 3027
3035 #define fold_end(fp) ((fp)->fd_top + (fp)->fd_len - 1) 3028 #define fold_end(fp) ((fp)->fd_top + (fp)->fd_len - 1)
3036 #define valid_fold(fp, gap) ((fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len)) 3029 #define valid_fold(fp, gap) ((fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len))
3037 #define fold_index(fp, gap) ((size_t)(fp - ((fold_T *)(gap)->ga_data))) 3030 #define fold_index(fp, gap) ((size_t)(fp - ((fold_T *)(gap)->ga_data)))
3038 3031
3039 static void 3032 void
3040 foldMoveRange_int(garray_T *gap, linenr_T line1, linenr_T line2, linenr_T dest) 3033 foldMoveRange(garray_T *gap, linenr_T line1, linenr_T line2, linenr_T dest)
3041 { 3034 {
3042 fold_T *fp; 3035 fold_T *fp;
3043 linenr_T range_len = line2 - line1 + 1; 3036 linenr_T range_len = line2 - line1 + 1;
3044 linenr_T move_len = dest - line2; 3037 linenr_T move_len = dest - line2;
3045 int at_start = foldFind(gap, line1 - 1, &fp); 3038 int at_start = foldFind(gap, line1 - 1, &fp);
3106 fp->fd_top += move_len; 3099 fp->fd_top += move_len;
3107 return; 3100 return;
3108 } 3101 }
3109 3102
3110 /* Case 5 or 6 3103 /* Case 5 or 6
3111 * changes rely on whether there are folds between the end of 3104 * changes rely on whether there are folds between the end of
3112 * this fold and "dest". 3105 * this fold and "dest".
3113 */ 3106 */
3114 move_start = fold_index(fp, gap); 3107 move_start = fold_index(fp, gap);
3115 3108
3116 for (; valid_fold(fp, gap) && fp->fd_top <= dest; fp++) 3109 for (; valid_fold(fp, gap) && fp->fd_top <= dest; fp++)