³ò ¢õEc@sdZd„Zd„ZdS(sú This module implements functions that indent line(s) in a gtksourceview buffer. @author: Lateef Alabi-Oki @organization: The Scribes Project @copyright: Copyright © 2005 Lateef Alabi-Oki @license: GNU GPLv2 or Later @contact: mystilleef@gmail.com c Cs¬|idtƒ|idƒ}|i|iƒƒ}g}|iƒ}y|iƒ\}}|iƒ|iƒjo8|iƒt||iƒƒ|i ƒ|i |ƒn¨t}|iƒ}|iƒ} | |djo t }nddk l } |iƒxGt|| dƒD]2} |o | ƒnt|| ƒ|i | ƒqW|i ƒWnAtj o5|iƒt||ƒ|i ƒ|i |ƒnX|idt ƒ|S(s Indent line(s) in a text buffer. @param sourceview: A container for the text buffer. @type textbuffer: A gtksourceview.SoureView object. teditabletbufferièiÿÿÿÿ(tresponsei(t set_propertytFalset get_propertytget_iter_at_markt get_inserttget_linetget_selection_boundstbegin_user_actiont indent_linetend_user_actiontappendtTruet SCRIBES.utilsRtranget ValueError( t sourceviewt sourcebuffertcursor_iteratortlines_indentedt line_numbertbegin_selectiont end_selectiont use_responset begining_linetend_lineRtline((splugins/Indent/indent.pytindentsB            cCsÐ|idƒ}|idƒ}|idƒ}|i|ƒ}|iƒ}g}g}x_toW|iƒdjo|idƒn&|iƒdjo|idƒnP|iƒqWW|i|ƒo7|o|i|d|ƒn|i|dƒdSnt |ƒ} t |ƒ} |oég} | o˜d| jo |jno| id|ƒqÒ| |o?| id|ƒ| |} | o| id| |ƒq½qÒ|id|ƒ|} n| id|ƒ| o| id| |ƒndi | ƒ} n™| p|idƒnrd| jo |jno|idƒnC| |o|idƒn| |} | o|id| ƒndi |ƒ} |i ||ƒ|i|ƒ}|i|| ƒdS( sõ Indent a line in the a text buffer. This indentation algorithm is based on tab stops. That is a line is indented to the nearest tab stop. During the indentation process all spaces are converted to tab characters. If spaces is used for indentation, then all tab characters are converted to spaces. @param sourceview: The container of the text buffer. @type sourceview: A gtksourceview.SoureView object. @param line_number: A line in the text buffer. @type line_number: An Integer object. Rsinsert-spaces-instead-of-tabss tabs-widtht s Nit( Rtget_iter_at_linetcopyRtget_charR t forward_chartequaltinserttlentjointdelete(RRRt use_spacest tab_widthtbegin_positionttransition_positiont space_listttab_listtnumber_of_spacestnumber_of_tabst new_spacest tab_stopststring((splugins/Indent/indent.pyR Hsf         N(t__doc__RR (((splugins/Indent/indent.pyss )