@@ -8,7 +8,6 @@ impl TextFormat {
88 tab_width : 2 ,
99 max_wrap : 3 ,
1010 max_indent_retain : 4 ,
11- wrap_indicator : "." . into ( ) ,
1211 wrap_indicator_highlight : None ,
1312 // use a prime number to allow lining up too often with repeat
1413 viewport_width : 17 ,
@@ -59,11 +58,11 @@ fn softwrap_text(text: &str) -> String {
5958fn basic_softwrap ( ) {
6059 assert_eq ! (
6160 softwrap_text( & "foo " . repeat( 10 ) ) ,
62- "foo foo foo foo \n .foo foo foo foo \n .foo foo "
61+ "foo foo foo foo \n foo foo foo foo \n foo foo "
6362 ) ;
6463 assert_eq ! (
6564 softwrap_text( & "fooo " . repeat( 10 ) ) ,
66- "fooo fooo fooo \n .fooo fooo fooo \n .fooo fooo fooo \n .fooo "
65+ "fooo fooo fooo \n fooo fooo fooo \n fooo fooo fooo \n fooo "
6766 ) ;
6867
6968 // check that we don't wrap unnecessarily
@@ -74,39 +73,39 @@ fn basic_softwrap() {
7473fn softwrap_indentation ( ) {
7574 assert_eq ! (
7675 softwrap_text( "\t \t foo1 foo2 foo3 foo4 foo5 foo6\n " ) ,
77- " foo1 foo2 \n ..... foo3 foo4 \n . ....foo5 foo6 \n "
76+ " foo1 foo2 \n ....foo3 foo4 \n ....foo5 foo6 \n "
7877 ) ;
7978 assert_eq ! (
8079 softwrap_text( "\t \t \t foo1 foo2 foo3 foo4 foo5 foo6\n " ) ,
81- " foo1 foo2 \n .foo3 foo4 foo5 \n .foo6 \n "
80+ " foo1 foo2 \n foo3 foo4 foo5 \n foo6 \n "
8281 ) ;
8382}
8483
8584#[ test]
8685fn long_word_softwrap ( ) {
8786 assert_eq ! (
88- softwrap_text( "\t \t xxxx1xxxx2xxxx3xxxx4xxxx5xxxx6xxxx7xxxx8xxxx9xxx \n " ) ,
89- " xxxx1xxxx2xxx\n .....x3xxxx4xxxx5 \n .....xxxx6xxxx7xx \n .....xx8xxxx9xxx \n "
87+ softwrap_text( "\t \t xxxx1xxxx2xxxx3xxxx4xxxxx5xxxx6xxxx7xxx8xxxx9xxx \n " ) ,
88+ " xxxx1xxxx2xxx\n ....x3xxxx4xxxxx5 \n ....xxxx6xxxx7xxx \n ....8xxxx9xxx \n "
9089 ) ;
9190 assert_eq ! (
9291 softwrap_text( "xxxxxxxx1xxxx2xxx\n " ) ,
93- "xxxxxxxx1xxxx2xxx\n . \n "
92+ "xxxxxxxx1xxxx2xxx\n \n "
9493 ) ;
9594 assert_eq ! (
96- softwrap_text( "\t \t xxxx1xxxx 2xxxx3xxxx4xxxx5xxxx6xxxx7xxxx8xxxx9xxx \n " ) ,
97- " xxxx1xxxx \n .....2xxxx3xxxx4x \n .....xxx5xxxx6xxx \n .....x7xxxx8xxxx9 \n . ....xxx \n "
95+ softwrap_text( "\t \t xxxx1xxxx 2xxxx3xxxx4xxxx5xxxx6xxxx7xxxx8xxxxxxx9xxx \n " ) ,
96+ " xxxx1xxxx \n ....2xxxx3xxxx4xx \n ....xx5xxxx6xxxx7 \n ....xxxx8xxxxxxx9 \n ....xxx \n "
9897 ) ;
9998 assert_eq ! (
100- softwrap_text( "\t \t xxxx1xxx 2xxxx3xxxx4xxxx5xxxx6xxxx7xxxx8xxxx9xxx \n " ) ,
101- " xxxx1xxx 2xxx\n .....x3xxxx4xxxx5 \n .....xxxx6xxxx7xx \n .....xx8xxxx9xxx \n "
99+ softwrap_text( "\t \t xxxx1xxx 2xxxx3xxxx4xxxxx5xxxx6xxxx7xxxxx8xxxx9xx \n " ) ,
100+ " xxxx1xxx 2xxx\n ....x3xxxx4xxxxx5 \n ....xxxx6xxxx7xxx \n ....xx8xxxx9xx \n "
102101 ) ;
103102}
104103
105104#[ test]
106105fn softwrap_multichar_grapheme ( ) {
107106 assert_eq ! (
108107 softwrap_text( "xxxx xxxx xxx a\u{0301} bc\n " ) ,
109- "xxxx xxxx xxx \n .ábc \n "
108+ "xxxx xxxx xxx \n ábc \n "
110109 )
111110}
112111
@@ -158,7 +157,7 @@ fn overlay() {
158157 Overlay :: new( 16 , "X" ) ,
159158 ]
160159 ) ,
161- "fo f o foo \n .foo Xoo foo foo \n .foo foo foo "
160+ "fo f o foo \n foo Xoo foo foo \n foo foo foo "
162161 ) ;
163162}
164163
@@ -184,7 +183,7 @@ fn annotation() {
184183 true ,
185184 & [ InlineAnnotation :: new( 0 , "foo " ) ]
186185 ) ,
187- "foo foo foo foo \n .foo foo foo foo \n .foo foo foo "
186+ "foo foo foo foo \n foo foo foo foo \n foo foo foo "
188187 ) ;
189188}
190189
0 commit comments