From kdevelop-bugs Tue Apr 26 18:46:27 2005 From: kdevelop-bugs-admin () barney ! cs ! uni-potsdam ! de Date: Tue, 26 Apr 2005 18:46:27 +0000 To: kdevelop-bugs Subject: [Bug 104510] ctags part does not work well if comments are part of the tag line Message-Id: <20050426184627.26996.qmail () ktown ! kde ! org> X-MARC-Message: https://marc.info/?l=kdevelop-bugs&m=118306936407014 ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. http://bugs.kde.org/show_bug.cgi?id=104510 jens.dagerbo swipnet se changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED ------- Additional Comments From jens.dagerbo swipnet se 2005-04-26 20:46 ------- CVS commit by dagerbo: Fix case where the Ctags lookup wouldn't work if there was a comment on the same line. BUG: 104510 M +8 -6 ctags2_part.cpp 1.14 --- kdevelop/parts/ctags2/ctags2_part.cpp #1.13:1.14 @ -243,4 +243,8 @ int CTags2Part::getFileLineFromStream( Q if ( pattern.isEmpty() ) return -1; + // ctags interestingly escapes "/", but apparently nothing else. lets revert that + QString unescaped = pattern; + unescaped.replace( "\\/", "/" ); + // most of the time, the ctags pattern has the form /^foo$/ // but this isn't true for some macro definitions @ -249,8 +253,7 @ int CTags2Part::getFileLineFromStream( Q QString reduced, escaped, re_string; - if ( pattern.endsWith( "$/" ) ) + if ( unescaped.endsWith( "$/" ) ) { - - reduced = pattern.mid( 2, pattern.length() -4 ); + reduced = unescaped.mid( 2, unescaped.length() -4 ); escaped = QRegExp::escape( reduced ); re_string = QString( "^" + escaped + "$" ); @ -258,5 +261,5 @ int CTags2Part::getFileLineFromStream( Q else { - reduced = pattern.mid( 2, pattern.length() -3 ); + reduced = unescaped.mid( 2, unescaped.length() -3 ); escaped = QRegExp::escape( reduced ); re_string = QString( "^" + escaped ); @ -268,5 +271,4 @ int CTags2Part::getFileLineFromStream( Q while ( !istream.atEnd() ) { -// if ( re.exactMatch( istream.readLine() ) ) if ( re.search( istream.readLine() ) > -1 ) {