@ -60,7 +60,7 @@ fn find_line_comment(
pub fn toggle_line_comments ( doc : & Rope , selection : & Selection , token : Option < & str > ) -> Transaction {
pub fn toggle_line_comments ( doc : & Rope , selection : & Selection , token : Option < & str > ) -> Transaction {
let text = doc . slice ( .. ) ;
let text = doc . slice ( .. ) ;
let token = token . unwrap_or ( " // ") ;
let token = token . unwrap_or ( " # ") ;
let comment = Tendril ::from ( format! ( "{} " , token ) ) ;
let comment = Tendril ::from ( format! ( "{} " , token ) ) ;
let mut lines : Vec < usize > = Vec ::with_capacity ( selection . len ( ) ) ;
let mut lines : Vec < usize > = Vec ::with_capacity ( selection . len ( ) ) ;
@ -116,7 +116,7 @@ mod test {
transaction . apply ( & mut doc ) ;
transaction . apply ( & mut doc ) ;
selection = selection . map ( transaction . changes ( ) ) ;
selection = selection . map ( transaction . changes ( ) ) ;
assert_eq! ( doc , " // 1\n\n // 2\n // 3") ;
assert_eq! ( doc , " # 1\n\n # 2\n # 3") ;
// uncomment
// uncomment
let transaction = toggle_line_comments ( & doc , & selection , None ) ;
let transaction = toggle_line_comments ( & doc , & selection , None ) ;
@ -126,7 +126,7 @@ mod test {
assert! ( selection . len ( ) = = 1 ) ; // to ignore the selection unused warning
assert! ( selection . len ( ) = = 1 ) ; // to ignore the selection unused warning
// 0 margin comments
// 0 margin comments
doc = Rope ::from ( " //1\n\n //2\n // 3") ;
doc = Rope ::from ( " #1\n\n #2\n # 3") ;
// reset the selection.
// reset the selection.
selection = Selection ::single ( 0 , doc . len_chars ( ) - 1 ) ;
selection = Selection ::single ( 0 , doc . len_chars ( ) - 1 ) ;
@ -137,7 +137,7 @@ mod test {
assert! ( selection . len ( ) = = 1 ) ; // to ignore the selection unused warning
assert! ( selection . len ( ) = = 1 ) ; // to ignore the selection unused warning
// 0 margin comments, with no space
// 0 margin comments, with no space
doc = Rope ::from ( " // ") ;
doc = Rope ::from ( " # ") ;
// reset the selection.
// reset the selection.
selection = Selection ::single ( 0 , doc . len_chars ( ) - 1 ) ;
selection = Selection ::single ( 0 , doc . len_chars ( ) - 1 ) ;