aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-08-02 04:37:32 +0000
committerMike Buland <eichlan@xagasoft.com>2010-08-02 04:37:32 +0000
commitb5fea4de7f2e20fbb768aef2ed72249c80b1bf9d (patch)
tree92d179fda245cbe59d0b32d32b8fb8b65559f201 /src/tools
parent31bae0662ad7b579af22912df420571c26c2f0b8 (diff)
downloadlibbu++-b5fea4de7f2e20fbb768aef2ed72249c80b1bf9d.tar.gz
libbu++-b5fea4de7f2e20fbb768aef2ed72249c80b1bf9d.tar.bz2
libbu++-b5fea4de7f2e20fbb768aef2ed72249c80b1bf9d.tar.xz
libbu++-b5fea4de7f2e20fbb768aef2ed72249c80b1bf9d.zip
ViewCSV search is now regex based :)
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/viewcsv.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tools/viewcsv.cpp b/src/tools/viewcsv.cpp
index 176f25e..d81525e 100644
--- a/src/tools/viewcsv.cpp
+++ b/src/tools/viewcsv.cpp
@@ -5,6 +5,7 @@
5#include <bu/newline.h> 5#include <bu/newline.h>
6#include <bu/buffer.h> 6#include <bu/buffer.h>
7#include <bu/util.h> 7#include <bu/util.h>
8#include <bu/regex.h>
8#include <ncurses.h> 9#include <ncurses.h>
9 10
10using namespace Bu; 11using namespace Bu;
@@ -249,6 +250,8 @@ public:
249 int maxx, maxy; 250 int maxx, maxy;
250 Bu::FString sStr; 251 Bu::FString sStr;
251 252
253 RegEx re( sPrompt );
254
252 curs_set( 1 ); 255 curs_set( 1 );
253 for(;;) 256 for(;;)
254 { 257 {
@@ -273,7 +276,7 @@ public:
273 276
274 case KEY_BACKSPACE: 277 case KEY_BACKSPACE:
275 if( sStr.getSize() > 0 ) 278 if( sStr.getSize() > 0 )
276 sStr.setSize( sStr.getSize()-1 ); 279 sStr.resize( sStr.getSize()-1 );
277 break; 280 break;
278 281
279 default: 282 default:
@@ -291,6 +294,8 @@ public:
291 294
292 void findNext( const Bu::FString &sTerm ) 295 void findNext( const Bu::FString &sTerm )
293 { 296 {
297 RegEx re( sTerm );
298
294 int y = sysCaret.iRow; 299 int y = sysCaret.iRow;
295 if( y < 0 ) 300 if( y < 0 )
296 y = 0; 301 y = 0;
@@ -300,7 +305,7 @@ public:
300 StrArray &aRow = doc.sgData[y]; 305 StrArray &aRow = doc.sgData[y];
301 for( ; x < aRow.getSize(); x++ ) 306 for( ; x < aRow.getSize(); x++ )
302 { 307 {
303 if( aRow[x].find( sTerm ) ) 308 if( re.execute( aRow[x] ) ) //aRow[x].find( sTerm ) )
304 { 309 {
305 sysCaret.iRow = y; 310 sysCaret.iRow = y;
306 sysCaret.iCol = x; 311 sysCaret.iCol = x;