@ -108,8 +108,8 @@ void EditorExtension::insertTag(const KileAction::TagData& data, Kate::View *vie
bool wrap = ( ( ! data . tagEnd . isNull ( ) ) & & doc - > hasSelection ( ) ) ;
//%C before or after the selection
bool before = data . tagBegin . tq contains( " %C " ) ;
bool after = data . tagEnd . tq contains( " %C " ) ;
bool before = data . tagBegin . contains( " %C " ) ;
bool after = data . tagEnd . contains( " %C " ) ;
//save current cursor position
int para = view - > cursorLine ( ) ;
@ -123,7 +123,7 @@ void EditorExtension::insertTag(const KileAction::TagData& data, Kate::View *vie
int dxIndentEnv = 0 ;
// environment tag
bool envtag = data . tagBegin . tq contains( " %E " ) | | data . tagEnd . tq contains( " %E " ) ;
bool envtag = data . tagBegin . contains( " %E " ) | | data . tagEnd . contains( " %E " ) ;
TQString whitespace = getWhiteSpace ( doc - > textLine ( para ) . left ( index ) ) ;
//if there is a selection act as if cursor is at the beginning of selection
@ -157,7 +157,7 @@ void EditorExtension::insertTag(const KileAction::TagData& data, Kate::View *vie
// strip one of two consecutive line ends
int len = sel . length ( ) ;
if ( tagEnd . at ( 0 ) = = ' \n ' & & len > 0 & & sel . tq find( ' \n ' , - 1 ) = = len - 1 )
if ( tagEnd . at ( 0 ) = = ' \n ' & & len > 0 & & sel . find( ' \n ' , - 1 ) = = len - 1 )
sel . truncate ( len - 1 ) ;
// now add the selection
@ -172,19 +172,19 @@ void EditorExtension::insertTag(const KileAction::TagData& data, Kate::View *vie
}
else if ( envtag )
{
ins . tq replace( " %E " , whitespace + m_envAutoIndent ) ;
tagEnd . tq replace( " %E " , whitespace + m_envAutoIndent ) ;
ins . replace( " %E " , whitespace + m_envAutoIndent ) ;
tagEnd . replace( " %E " , whitespace + m_envAutoIndent ) ;
if ( data . dy > 0 )
dxIndentEnv = whitespace . length ( ) + m_envAutoIndent . length ( ) ;
}
tagEnd . tq replace( " \\ end{ " , whitespace + " \\ end{ " ) ;
tagEnd . replace( " \\ end{ " , whitespace + " \\ end{ " ) ;
ins + = tagEnd + trailing ;
//do some replacements
TQFileInfo fi ( doc - > url ( ) . path ( ) ) ;
ins . tq replace( " %S " , fi . baseName ( true ) ) ;
ins . tq replace( " %B " , s_bullet ) ;
ins . replace( " %S " , fi . baseName ( true ) ) ;
ins . replace( " %B " , s_bullet ) ;
//insert first part of tag at cursor position
doc - > insertText ( para , index , ins ) ;
@ -192,13 +192,13 @@ void EditorExtension::insertTag(const KileAction::TagData& data, Kate::View *vie
//move cursor to the new position
if ( before | | after )
{
int n = data . tagBegin . tq contains( " \n " ) + data . tagEnd . tq contains( " \n " ) ;
int n = data . tagBegin . contains( " \n " ) + data . tagEnd . contains( " \n " ) ;
if ( wrap ) n + = para_end > para ? para_end - para : para - para_end ;
for ( int line = para_begin ; line < = para_begin + n ; + + line )
{
if ( doc - > textLine ( line ) . tq contains( " %C " ) )
if ( doc - > textLine ( line ) . contains( " %C " ) )
{
int i = doc - > textLine ( line ) . tq find( " %C " ) ;
int i = doc - > textLine ( line ) . find( " %C " ) ;
para_cursor = line ; index_cursor = i ;
doc - > removeText ( line , i , line , i + 2 ) ;
break ;
@ -1348,7 +1348,7 @@ bool EditorExtension::isEnvironmentPosition(Kate::Document *doc, uint row, uint
int startcol = ( textline [ col ] = = ' \\ ' ) ? col - 1 : col ;
if ( startcol > = 1 )
{
int pos = textline . tq findRev( m_reg , startcol ) ;
int pos = textline . findRev( m_reg , startcol ) ;
env . len = m_reg . matchedLength ( ) ;
if ( pos ! = - 1 & & ( uint ) pos < col & & col < = ( uint ) pos + env . len )
{
@ -1375,7 +1375,7 @@ bool EditorExtension::isEnvironmentPosition(Kate::Document *doc, uint row, uint
}
// check if there is a match in this line from the current position to the right
if ( textline [ col ] = = ' \\ ' & & col = = ( uint ) textline . tq find( m_reg , col ) )
if ( textline [ col ] = = ' \\ ' & & col = = ( uint ) textline . find( m_reg , col ) )
{
envright . row = row ;
envright . col = col ;
@ -2004,7 +2004,7 @@ bool EditorExtension::getCurrentWord(Kate::Document *doc, uint row, uint col, Ed
if ( col > 0 )
{
reg . setPattern ( pattern1 ) ;
pos = textline . tq findRev( reg , col - 1 ) ;
pos = textline . findRev( reg , col - 1 ) ;
if ( pos ! = - 1 ) { // found an illegal character
x1 = pos + 1 ;
if ( mode = = smTex ) {
@ -2019,7 +2019,7 @@ bool EditorExtension::getCurrentWord(Kate::Document *doc, uint row, uint col, Ed
// search at the current position
reg . setPattern ( pattern2 ) ;
pos = textline . tq find( reg , col ) ;
pos = textline . find( reg , col ) ;
if ( pos ! = - 1 & & ( uint ) pos = = col )
{
x2 = pos + reg . matchedLength ( ) ;
@ -2365,7 +2365,7 @@ bool EditorExtension::insertDoubleQuotes()
bool openfound = false ;
if ( iface - > searchText ( row , col , reg , & r , & c , & l , true ) )
{
openfound = ( doc - > textLine ( r ) . tq find( m_leftDblQuote , c ) = = ( int ) c ) ;
openfound = ( doc - > textLine ( r ) . find( m_leftDblQuote , c ) = = ( int ) c ) ;
//KILE_DEBUG() << "pattern=" << reg.pattern() << " " << reg.cap(1) << " r=" << r << " c=" << c << " open=" << openfound<< endl;
}
@ -2378,7 +2378,7 @@ bool EditorExtension::insertDoubleQuotes()
// insert a language specific doublequote close
int startcol = col - m_leftDblQuote . length ( ) ;
//KILE_DEBUG() << "startcol=" << startcol << " col=" << col << endl;
if ( startcol > = 0 & & textline . tq find( m_leftDblQuote , startcol ) = = ( int ) startcol )
if ( startcol > = 0 & & textline . find( m_leftDblQuote , startcol ) = = ( int ) startcol )
{
doc - > removeText ( row , startcol , row , startcol + m_leftDblQuote . length ( ) ) ;
doc - > insertText ( row , startcol , " \" " ) ;
@ -2395,7 +2395,7 @@ bool EditorExtension::insertDoubleQuotes()
// insert a language specific doublequote open
int startcol = col - m_rightDblQuote . length ( ) ;
//KILE_DEBUG() << "startcol=" << startcol << " col=" << col << endl;
if ( startcol > = 0 & & textline . tq find( m_rightDblQuote , startcol ) = = ( int ) startcol )
if ( startcol > = 0 & & textline . find( m_rightDblQuote , startcol ) = = ( int ) startcol )
{
doc - > removeText ( row , startcol , row , startcol + m_rightDblQuote . length ( ) ) ;
doc - > insertText ( row , startcol , " \" " ) ;
@ -2428,7 +2428,7 @@ void EditorExtension::insertIntelligentTabulator()
// try to align tabulator with textline above
if ( currentRow > = 1 )
{
int tabpos = view - > getDoc ( ) - > textLine ( currentRow - 1 ) . tq find( ' & ' , currentCol ) ;
int tabpos = view - > getDoc ( ) - > textLine ( currentRow - 1 ) . find( ' & ' , currentCol ) ;
if ( tabpos > = 0 )
{
currentCol = tabpos ;
@ -2476,7 +2476,7 @@ bool EditorExtension::eventInsertEnvironment(Kate::View *view)
else
{
envname = m_regexpEnter . cap ( 4 ) ;
endenv = m_regexpEnter . cap ( 2 ) . tq replace( " \\ begin " , " \\ end " ) + ' \n ' ;
endenv = m_regexpEnter . cap ( 2 ) . replace( " \\ begin " , " \\ end " ) + ' \n ' ;
}
if ( shouldCompleteEnv ( envname , view ) )
@ -2515,8 +2515,8 @@ bool EditorExtension::shouldCompleteEnv(const TQString &env, Kate::View *view)
view - > cursorPositionReal ( & realLine , & realColumn ) ;
for ( int i = realLine ; i < num ; + + i )
{
numBeginsFound + = view - > getDoc ( ) - > textLine ( i ) . tq contains( reTestBegin ) ;
numEndsFound + = view - > getDoc ( ) - > textLine ( i ) . tq contains( reTestEnd ) ;
numBeginsFound + = view - > getDoc ( ) - > textLine ( i ) . contains( reTestBegin ) ;
numEndsFound + = view - > getDoc ( ) - > textLine ( i ) . contains( reTestEnd ) ;
KILE_DEBUG ( ) < < " line is " < < i < < " numBeginsFound = " < < numBeginsFound < < " , " < < " numEndsFound = " < < numEndsFound < < endl ;
if ( numEndsFound > = numBeginsFound )
return false ;
@ -2570,11 +2570,11 @@ bool EditorExtension::insideVerb(Kate::View *view)
TQRegExp reg ( " \\ \\ verb( \\ *?) ( . ) " ) ;
while ( true )
{
int pos = textline . tq find( reg , startpos ) ;
int pos = textline . find( reg , startpos ) ;
if ( pos < 0 | | col < ( uint ) pos + 6 + reg . cap ( 1 ) . length ( ) )
return false ;
pos = textline . tq find( reg . cap ( 2 ) , pos + 6 + reg . cap ( 1 ) . length ( ) ) ;
pos = textline . find( reg . cap ( 2 ) , pos + 6 + reg . cap ( 1 ) . length ( ) ) ;
if ( pos < 0 | | col < = ( uint ) pos )
return true ;
@ -2711,7 +2711,7 @@ bool EditorExtension::findEndOfDocument(Kate::Document *doc, uint row, uint col,
while ( iface - > searchText ( row , col , " \\ end{document} " , & rowFound , & colFound , & lenFound ) )
{
textline = getTextLineReal ( doc , rowFound ) ;
if ( textline . tq find( " \\ end{document} " , colFound ) = = ( int ) colFound )
if ( textline . find( " \\ end{document} " , colFound ) = = ( int ) colFound )
return true ;
row = rowFound ;