#NEWLINE# def comment_visual_selection( ) : #NEWLINE# #INDENT# b = vim . current . buffer #NEWLINE# ( start_row , start_col ) = b . mark ( '<' ) #NEWLINE# ( end_row , end_col ) = b . mark ( '>' ) #NEWLINE# if ( start_row == end_row ) : #NEWLINE# #INDENT# l = b [ ( start_row - 1 ) ] #NEWLINE# c = str ( Comment ( l [ start_col : ( end_col + 1 ) ] ) ) #NEWLINE# b [ ( start_row - 1 ) ] = ( ( l [ : start_col ] + c ) + l [ ( end_col + 1 ) : ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# lines = b [ start_row : ( end_row - 1 ) ] #NEWLINE# lines . insert ( 0 , b [ ( start_row - 1 ) ] [ start_col : ] ) #NEWLINE# lines . append ( b [ ( end_row - 1 ) ] [ : ( end_col + 1 ) ] ) #NEWLINE# newlines = xml_format ( Comment ( '\n' . join ( lines ) ) ) . split ( '\n' ) #NEWLINE# b [ ( start_row - 1 ) ] = ( b [ ( start_row - 1 ) ] [ : start_col ] + newlines [ 0 ] ) #NEWLINE# b [ start_row : ( end_row - 1 ) ] = newlines [ 1 : ( - 1 ) ] #NEWLINE# b [ ( end_row - 1 ) ] = ( newlines [ ( - 1 ) ] + b [ ( end_row - 1 ) ] [ ( end_col + 1 ) : ] )