ide: Incremental find/replace from cursor improved

git-svn-id: svn://ultimatepp.org/upp/trunk@7523 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-07-18 13:26:02 +00:00
parent df36abbddf
commit 5e8fbcfab3
6 changed files with 22 additions and 16 deletions

View file

@ -213,9 +213,9 @@ void CSyntax::InitKeywords()
"RLOG", "RLOGF", "RDUMP", "RDUMPC", "RDUMPCC", "RDUMPCCC", "RDUMPM",
"LOGBEGIN", "LOGEND", "LOGBLOCK", "LOGHEXDUMP", "LOGSRCPOS",
"RLOGBEGIN", "RLOGEND", "RLOGBLOCK", "RLOGHEXDUMP", "RLOGSRCPOS", "RQUOTE",
"RTIMING", "TIMING", "LTIMING", "DTIMING",
"RTIMING", "TIMING", "LTIMING", "DTIMING", "RTIMESTOP", "TIMESTOP", "LTIMESTOP",
"LOGHEX", "DUMPHEX", "DLOGHEX", "DDUMPHEX", "RLOGHEX", "RDUMPHEX", "LLOGHEX", "LDUMPHEX",
"DEBUGCODE",
"DEBUGCODE",
NULL
};
static const char *sql_base[] = {

View file

@ -27,7 +27,7 @@ INITBLOCK {
RegisterCSyntax("cs", CSyntax::HIGHLIGHT_CS, "*.cs", "C#");
RegisterCSyntax("json", CSyntax::HIGHLIGHT_JSON, "*.json", "JSON");
RegisterCSyntax("css", CSyntax::HIGHLIGHT_CSS, "*.css", "Cascading Style Sheet");
RegisterCSyntax("sql", CSyntax::HIGHLIGHT_SQL, "*.sql", "SQL script");
RegisterCSyntax("sql", CSyntax::HIGHLIGHT_SQL, "*.sql *.ddl", "SQL script");
RegisterCSyntax("lay", CSyntax::HIGHLIGHT_LAY, "*.lay", "U++ layout (.lay)");
RegisterCSyntax("sch", CSyntax::HIGHLIGHT_SCH, "*.sch", "U++ SQL schema (.sch)");
RegisterCSyntax("t", CSyntax::HIGHLIGHT_T, "*.t *.jt", "U++ translation (.t)");

View file

@ -235,7 +235,7 @@ protected:
bool persistent_find_replace;
bool do_ff_restore_pos;
int ff_restore_pos;
int ff_start_pos;
FindReplaceDlg findreplace;

View file

@ -18,7 +18,7 @@ void CodeEditor::InitFindReplace()
findreplace.find <<= findreplace.wholeword <<= findreplace.wildcards
<<= findreplace.incremental <<= findreplace.regexp
<<= findreplace.ignorecase <<= THISBACK(IncrementalFind);
ff_restore_pos = -1;
ff_start_pos = -1;
}
FindReplaceDlg::FindReplaceDlg()
@ -538,7 +538,7 @@ void CodeEditor::FindReplace(bool pick_selection, bool pick_text, bool replace)
if(findreplace.IsOpen())
CloseFindReplace();
ff_restore_pos = GetCursor();
ff_start_pos = GetCursor();
replacei = 0;
WString find_text;
@ -693,9 +693,9 @@ void CodeEditor::CloseFindReplace()
void CodeEditor::EscapeFindReplace()
{
CloseFindReplace();
if(ff_restore_pos >= 0 && ff_restore_pos < GetLength() && findreplace.incremental && do_ff_restore_pos) {
SetCursor(ff_restore_pos);
ff_restore_pos = -1;
if(ff_start_pos >= 0 && ff_start_pos < GetLength() && findreplace.incremental && do_ff_restore_pos) {
SetCursor(ff_start_pos);
ff_start_pos = -1;
}
}
@ -705,13 +705,8 @@ void CodeEditor::IncrementalFind()
findreplace.Sync();
if(!findreplace.incremental || findreplace.GetTopCtrl() == &findreplace) // || we are block replace
return;
int pos = 0;
if(findreplace.incremental_from_cursor) {
int l, h;
if(GetSelection(l, h))
pos = l;
}
if(!FindFrom(pos, false, false))
if(!FindFrom(ff_start_pos >= 0 && ff_start_pos < GetLength()
&& findreplace.incremental_from_cursor ? ff_start_pos : 0, false, false))
NotFound();
}

View file

@ -69,6 +69,7 @@ void __LOGF__(const char *format, ...);
#define HITCOUNT(x) RHITCOUNT(x)
#define ACTIVATE_TIMING() UPP::TimingInspector::Activate(true);
#define DEACTIVATE_TIMING() UPP::TimingInspector::Activate(false);
#define TIMESTOP(x) RTIMESTOP(x)
#define DLOG(x) LOG(x)
#define DDUMP(x) DUMP(x)

View file

@ -23,6 +23,16 @@ public:
TimeStop();
};
struct TimeStopper {
const char *name;
TimeStop tm;
TimeStopper(const char *name) : name(name) {}
~TimeStopper() { RLOG(name << " " << tm); }
};
#define RTIMESTOP(name) TimeStopper COMBINE(sTmStop, __LINE__)(name);
void SetAssertFailedHook(void (*h)(const char *));
void ReloadIniFile();