@@ -1714,7 +1714,7 @@ script_do_profile(scriptitem_T *si)
17141714}
17151715
17161716/*
1717- * save time when starting to invoke another script or function.
1717+ * Save time when starting to invoke another script or function.
17181718 */
17191719 void
17201720script_prof_save (
@@ -1805,12 +1805,14 @@ script_dump_profile(FILE *fd)
18051805 fprintf (fd , "Cannot open file!\n" );
18061806 else
18071807 {
1808- for (i = 0 ; i < si -> sn_prl_ga .ga_len ; ++ i )
1808+ /* Keep going till the end of file, so that trailing
1809+ * continuation lines are listed. */
1810+ for (i = 0 ; ; ++ i )
18091811 {
18101812 if (vim_fgets (IObuff , IOSIZE , sfd ))
18111813 break ;
1812- pp = & PRL_ITEM ( si , i );
1813- if (pp -> snp_count > 0 )
1814+ if ( i < si -> sn_prl_ga . ga_len
1815+ && (pp = & PRL_ITEM ( si , i )) -> snp_count > 0 )
18141816 {
18151817 fprintf (fd , "%5d " , pp -> snp_count );
18161818 if (profile_equal (& pp -> sn_prl_total , & pp -> sn_prl_self ))
@@ -4307,27 +4309,6 @@ do_source(
43074309 save_sourcing_lnum = sourcing_lnum ;
43084310 sourcing_lnum = 0 ;
43094311
4310- #ifdef FEAT_MBYTE
4311- cookie .conv .vc_type = CONV_NONE ; /* no conversion */
4312-
4313- /* Read the first line so we can check for a UTF-8 BOM. */
4314- firstline = getsourceline (0 , (void * )& cookie , 0 );
4315- if (firstline != NULL && STRLEN (firstline ) >= 3 && firstline [0 ] == 0xef
4316- && firstline [1 ] == 0xbb && firstline [2 ] == 0xbf )
4317- {
4318- /* Found BOM; setup conversion, skip over BOM and recode the line. */
4319- convert_setup (& cookie .conv , (char_u * )"utf-8" , p_enc );
4320- p = string_convert (& cookie .conv , firstline + 3 , NULL );
4321- if (p == NULL )
4322- p = vim_strsave (firstline + 3 );
4323- if (p != NULL )
4324- {
4325- vim_free (firstline );
4326- firstline = p ;
4327- }
4328- }
4329- #endif
4330-
43314312#ifdef STARTUPTIME
43324313 if (time_fd != NULL )
43334314 time_push (& tv_rel , & tv_start );
@@ -4420,6 +4401,27 @@ do_source(
44204401# endif
44214402#endif
44224403
4404+ #ifdef FEAT_MBYTE
4405+ cookie .conv .vc_type = CONV_NONE ; /* no conversion */
4406+
4407+ /* Read the first line so we can check for a UTF-8 BOM. */
4408+ firstline = getsourceline (0 , (void * )& cookie , 0 );
4409+ if (firstline != NULL && STRLEN (firstline ) >= 3 && firstline [0 ] == 0xef
4410+ && firstline [1 ] == 0xbb && firstline [2 ] == 0xbf )
4411+ {
4412+ /* Found BOM; setup conversion, skip over BOM and recode the line. */
4413+ convert_setup (& cookie .conv , (char_u * )"utf-8" , p_enc );
4414+ p = string_convert (& cookie .conv , firstline + 3 , NULL );
4415+ if (p == NULL )
4416+ p = vim_strsave (firstline + 3 );
4417+ if (p != NULL )
4418+ {
4419+ vim_free (firstline );
4420+ firstline = p ;
4421+ }
4422+ }
4423+ #endif
4424+
44234425 /*
44244426 * Call do_cmdline, which will call getsourceline() to get the lines.
44254427 */
@@ -4902,7 +4904,8 @@ script_line_start(void)
49024904 {
49034905 /* Grow the array before starting the timer, so that the time spent
49044906 * here isn't counted. */
4905- (void )ga_grow (& si -> sn_prl_ga , (int )(sourcing_lnum - si -> sn_prl_ga .ga_len ));
4907+ (void )ga_grow (& si -> sn_prl_ga ,
4908+ (int )(sourcing_lnum - si -> sn_prl_ga .ga_len ));
49064909 si -> sn_prl_idx = sourcing_lnum - 1 ;
49074910 while (si -> sn_prl_ga .ga_len <= si -> sn_prl_idx
49084911 && si -> sn_prl_ga .ga_len < si -> sn_prl_ga .ga_maxlen )
@@ -4937,7 +4940,7 @@ script_line_exec(void)
49374940}
49384941
49394942/*
4940- * Called when done with a function line.
4943+ * Called when done with a script line.
49414944 */
49424945 void
49434946script_line_end (void )
0 commit comments