Bram Moolenaar wrote:
> Yukihiro Nakadaira wrote:
> 
>> I found some unexpected behavior of text formatting.
> 
> Thanks for the examples and the patch.  I'll look into it soon.
> 
> Since you have examples that fail, could you turn these into a test in
> src/testdir ?

Sure, please check the attached patch testdir.diff.  test68 is for
single-byte text and test69 is for multi-byte text.  I only tested
testdir/Makefile on Linux.

I found another issue.  Please check 11.diff too.

11) :set tw=2 fo=cq1 comments=:#

       [input]           [result]        [expected]
       1|#a b|     ->    1|#a|           1|#a b|
                  gqgq   2|#b|


-- 
Yukihiro Nakadaira - [email protected]





--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

=== modified file 'src/edit.c'
*** src/edit.c	2009-07-10 03:04:52 +0000
--- src/edit.c	2009-09-28 15:00:34 +0000
***************
*** 5871,5877 ****
  		    /* do not break after one-letter words */
  		    if (curwin->w_cursor.col == 0)
  			break;	/* one-letter word at begin */
! 
  		    col = curwin->w_cursor.col;
  		    dec_cursor();
  		    cc = gchar_cursor();
--- 5871,5880 ----
  		    /* do not break after one-letter words */
  		    if (curwin->w_cursor.col == 0)
  			break;	/* one-letter word at begin */
! #ifdef FEAT_COMMENTS
! 		    if (curwin->w_cursor.col == leader_len)
! 			break;
! #endif
  		    col = curwin->w_cursor.col;
  		    dec_cursor();
  		    cc = gchar_cursor();


=== modified file 'src/testdir/Make_amiga.mak'
*** src/testdir/Make_amiga.mak	2009-09-20 07:16:10 +0000
--- src/testdir/Make_amiga.mak	2009-09-28 16:57:42 +0000
***************
*** 26,32 ****
  		test48.out test51.out test53.out test54.out test55.out \
  		test56.out test57.out test58.out test59.out test60.out \
  		test61.out test62.out test63.out test64.out test65.out \
! 		test66.out test67.out
  
  .SUFFIXES: .in .out
  
--- 26,32 ----
  		test48.out test51.out test53.out test54.out test55.out \
  		test56.out test57.out test58.out test59.out test60.out \
  		test61.out test62.out test63.out test64.out test65.out \
! 		test66.out test67.out test68.out test69.out
  
  .SUFFIXES: .in .out
  

=== modified file 'src/testdir/Make_dos.mak'
*** src/testdir/Make_dos.mak	2009-09-20 07:16:10 +0000
--- src/testdir/Make_dos.mak	2009-09-28 16:57:42 +0000
***************
*** 19,25 ****
  		test44.out test45.out test46.out test47.out \
  		test48.out test51.out test53.out test54.out \
  		test55.out test56.out test57.out test58.out test59.out \
! 		test60.out test61.out test62.out test63.out test64.out
  
  SCRIPTS =	test3.out test4.out test5.out test6.out test7.out \
  		test8.out test9.out test11.out test13.out test14.out \
--- 19,26 ----
  		test44.out test45.out test46.out test47.out \
  		test48.out test51.out test53.out test54.out \
  		test55.out test56.out test57.out test58.out test59.out \
! 		test60.out test61.out test62.out test63.out test64.out \
! 		test68.out test69.out
  
  SCRIPTS =	test3.out test4.out test5.out test6.out test7.out \
  		test8.out test9.out test11.out test13.out test14.out \

=== modified file 'src/testdir/Make_ming.mak'
*** src/testdir/Make_ming.mak	2009-09-20 07:16:10 +0000
--- src/testdir/Make_ming.mak	2009-09-28 16:57:42 +0000
***************
*** 35,41 ****
  		test44.out test45.out test46.out test47.out \
  		test48.out test51.out test53.out            \
  		test55.out test56.out test57.out test58.out test59.out \
! 		test60.out test61.out test62.out test63.out test64.out
  
  # Had to remove test54 which doesn't work yet.
  #		                                 test54.out
--- 35,42 ----
  		test44.out test45.out test46.out test47.out \
  		test48.out test51.out test53.out            \
  		test55.out test56.out test57.out test58.out test59.out \
! 		test60.out test61.out test62.out test63.out test64.out \
! 		test68.out test69.out
  
  # Had to remove test54 which doesn't work yet.
  #		                                 test54.out

=== modified file 'src/testdir/Make_os2.mak'
*** src/testdir/Make_os2.mak	2009-09-20 07:16:10 +0000
--- src/testdir/Make_os2.mak	2009-09-28 16:57:42 +0000
***************
*** 26,32 ****
  		test48.out test51.out test53.out test54.out test55.out \
  		test56.out test57.out test58.out test59.out test60.out \
  		test61.out test62.out test63.out test64.out test65.out \
! 		test66.out test67.out
  
  .SUFFIXES: .in .out
  
--- 26,32 ----
  		test48.out test51.out test53.out test54.out test55.out \
  		test56.out test57.out test58.out test59.out test60.out \
  		test61.out test62.out test63.out test64.out test65.out \
! 		test66.out test67.out test68.out test69.out
  
  .SUFFIXES: .in .out
  

=== modified file 'src/testdir/Make_vms.mms'
*** src/testdir/Make_vms.mms	2009-09-20 07:16:10 +0000
--- src/testdir/Make_vms.mms	2009-09-28 16:57:42 +0000
***************
*** 69,75 ****
  	 test48.out test51.out test53.out test54.out test55.out \
  	 test56.out test57.out test60.out \
  	 test61.out test62.out test63.out test64.out test65.out \
! 	 test66.out test67.out
  
  .IFDEF WANT_GUI
  SCRIPT_GUI = test16.out
--- 69,75 ----
  	 test48.out test51.out test53.out test54.out test55.out \
  	 test56.out test57.out test60.out \
  	 test61.out test62.out test63.out test64.out test65.out \
! 	 test66.out test67.out test68.out test69.out
  
  .IFDEF WANT_GUI
  SCRIPT_GUI = test16.out

=== modified file 'src/testdir/Makefile'
*** src/testdir/Makefile	2009-09-12 06:03:21 +0000
--- src/testdir/Makefile	2009-09-28 16:57:42 +0000
***************
*** 22,28 ****
  		test48.out test49.out test51.out test52.out test53.out \
  		test54.out test55.out test56.out test57.out test58.out \
  		test59.out test60.out test61.out test62.out test63.out \
! 		test64.out test65.out test66.out test67.out
  
  SCRIPTS_GUI = test16.out
  
--- 22,29 ----
  		test48.out test49.out test51.out test52.out test53.out \
  		test54.out test55.out test56.out test57.out test58.out \
  		test59.out test60.out test61.out test62.out test63.out \
! 		test64.out test65.out test66.out test67.out test68.out \
! 		test69.out
  
  SCRIPTS_GUI = test16.out
  

=== added file 'src/testdir/test68.in'
*** src/testdir/test68.in	1970-01-01 00:00:00 +0000
--- src/testdir/test68.in	2009-09-28 16:57:42 +0000
***************
*** 0 ****
--- 1,55 ----
+ Test for text formatting.
+ 
+ Results of test68:
+ 
+ STARTTEST
+ /^{/+1
+ :set noai tw=2 fo=t
+ gRa b
+ ENDTEST
+ 
+ {
+     
+ 
+ }
+ 
+ STARTTEST
+ /^{/+1
+ :set ai tw=2 fo=tw
+ gqgqjjllab
+ ENDTEST
+ 
+ {
+ a  b  
+ 
+ a    
+ }
+ 
+ STARTTEST
+ /^{/+1
+ :set tw=3 fo=t
+ gqgqo
+ a 
+ ENDTEST
+ 
+ {
+ a 
+ }
+ 
+ STARTTEST
+ /^{/+1
+ :set tw=2 fo=tcq1 comments=:#
+ gqgqjgqgqo
+ a b
+ #a b
+ ENDTEST
+ 
+ {
+ a b
+ #a b
+ }
+ 
+ STARTTEST
+ :g/^STARTTEST/.,/^ENDTEST/d
+ :1;/^Results/,$wq! test.out
+ ENDTEST

=== added file 'src/testdir/test68.ok'
*** src/testdir/test68.ok	1970-01-01 00:00:00 +0000
--- src/testdir/test68.ok	2009-09-28 16:57:42 +0000
***************
*** 0 ****
--- 1,35 ----
+ Results of test68:
+ 
+ 
+ {
+ a
+ b
+ }
+ 
+ 
+ {
+ a  
+ b  
+ 
+ a  
+ b
+ }
+ 
+ 
+ {
+ a
+ 
+ 
+ a
+ 
+ }
+ 
+ 
+ {
+ a b
+ #a b
+ 
+ a b
+ #a b
+ }
+ 

=== added file 'src/testdir/test69.in'
*** src/testdir/test69.in	1970-01-01 00:00:00 +0000
--- src/testdir/test69.in	2009-09-28 16:57:42 +0000
***************
*** 0 ****
--- 1,139 ----
+ Test for multi-byte text formatting.
+ 
+ STARTTEST
+ :so mbyte.vim
+ :set encoding=utf-8
+ ENDTEST
+ 
+ Results of test69:
+ 
+ STARTTEST
+ /^{/+1
+ :set tw=2 fo=t
+ gqgqjgqgqo
+ XYZ
+ abc XYZ
+ ENDTEST
+ 
+ {
+ XYZ
+ abc XYZ
+ }
+ 
+ STARTTEST
+ /^{/+1
+ :set tw=1 fo=tm
+ gqgqjgqgqjgqgqjgqgqjgqgqo
+ X
+ Xa
+ X a
+ XY
+ X Y
+ ENDTEST
+ 
+ {
+ X
+ Xa
+ X a
+ XY
+ X Y
+ }
+ 
+ STARTTEST
+ /^{/+1
+ :set tw=2 fo=tm
+ gqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqo
+ X
+ Xa
+ X a
+ XY
+ X Y
+ aX
+ abX
+ abcX
+ abX c
+ abXY
+ ENDTEST
+ 
+ {
+ X
+ Xa
+ X a
+ XY
+ X Y
+ aX
+ abX
+ abcX
+ abX c
+ abXY
+ }
+ 
+ STARTTEST
+ /^{/+1
+ :set ai tw=2 fo=tm
+ gqgqjgqgqo
+ X
+ Xa
+ ENDTEST
+ 
+ {
+   X
+   Xa
+ }
+ 
+ STARTTEST
+ /^{/+1
+ :set noai tw=2 fo=tm
+ gqgqjgqgqo
+   X
+   Xa
+ ENDTEST
+ 
+ {
+   X
+   Xa
+ }
+ 
+ STARTTEST
+ /^{/+1
+ :set tw=2 fo=cqm comments=n:X
+ gqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqo
+ X
+ Xa
+ XaY
+ XY
+ XYZ
+ X Y
+ X YZ
+ XX
+ XXa
+ XXY
+ ENDTEST
+ 
+ {
+ X
+ Xa
+ XaY
+ XY
+ XYZ
+ X Y
+ X YZ
+ XX
+ XXa
+ XXY
+ }
+ 
+ STARTTEST
+ /^{/+1
+ :set tw=2 fo=tm
+ RXa
+ ENDTEST
+ 
+ {
+ 
+ }
+ 
+ STARTTEST
+ :g/^STARTTEST/.,/^ENDTEST/d
+ :1;/^Results/,$wq! test.out
+ ENDTEST

=== added file 'src/testdir/test69.ok'
*** src/testdir/test69.ok	1970-01-01 00:00:00 +0000
--- src/testdir/test69.ok	2009-09-28 16:57:42 +0000
***************
*** 0 ****
--- 1,142 ----
+ Results of test69:
+ 
+ 
+ {
+ XYZ
+ abc
+ XYZ
+ 
+ XYZ
+ abc
+ XYZ
+ }
+ 
+ 
+ {
+ X
+ X
+ a
+ X
+ a
+ X
+ ï¼¹
+ X
+ ï¼¹
+ 
+ X
+ X
+ a
+ X
+ a
+ X
+ ï¼¹
+ X
+ ï¼¹
+ }
+ 
+ 
+ {
+ X
+ X
+ a
+ X
+ a
+ X
+ ï¼¹
+ X
+ ï¼¹
+ a
+ X
+ ab
+ X
+ abc
+ X
+ ab
+ X
+ c
+ ab
+ X
+ ï¼¹
+ 
+ X
+ X
+ a
+ X
+ a
+ X
+ ï¼¹
+ X
+ ï¼¹
+ a
+ X
+ ab
+ X
+ abc
+ X
+ ab
+ X
+ c
+ ab
+ X
+ ï¼¹
+ }
+ 
+ 
+ {
+   X
+   X
+   a
+ 
+   X
+   X
+   a
+ }
+ 
+ 
+ {
+   X
+   X
+ a
+ 
+   X
+   X
+ a
+ }
+ 
+ 
+ {
+ X
+ Xa
+ Xa
+ XY
+ XY
+ XY
+ XZ
+ X Y
+ X Y
+ X Z
+ XX
+ XXa
+ XXY
+ 
+ X
+ Xa
+ Xa
+ XY
+ XY
+ XY
+ XZ
+ X Y
+ X Y
+ X Z
+ XX
+ XXa
+ XXY
+ }
+ 
+ 
+ {
+ X
+ a
+ }
+ 


Raspunde prin e-mail lui