ide: Refining find&replace

git-svn-id: svn://ultimatepp.org/upp/trunk@7484 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-07-03 13:43:49 +00:00
parent 610034ad10
commit 755d38cba8
5 changed files with 26 additions and 16 deletions

View file

@ -215,7 +215,8 @@ void CodeEditor::SelectionChanged()
{
int l, h;
WString nselword;
if(GetSelection(l, h) && h - l < 128 &&
bool sel = GetSelection(l, h);
if(sel && h - l < 128 &&
(l == 0 || !iscid(GetChar(l - 1))) &&
(h >= GetLength() || !iscid(GetChar(h)))) {
for(int i = l; i < h; i++) {

View file

@ -21,7 +21,7 @@ void CodeEditor::InitFindReplace()
FindReplaceDlg::FindReplaceDlg()
{
ignorecase <<= THISBACK(Sync);
find.NoUpDownKeys();
samecase <<= true;
close.Cancel();
prev.SetImage(CtrlImg::SmallUp());
@ -54,7 +54,7 @@ bool FindReplaceDlg::Key(dword key, int cnt) {
next.WhenAction();
return true;
}
if(findarg(key, K_TAB, K_SHIFT_TAB, K_UP, K_DOWN) >= 0 && replace.IsShown()) {
if(findarg(key, K_TAB, K_SHIFT_TAB) >= 0 && replace.IsShown()) {
if(find.HasFocus())
replace.SetFocus();
else
@ -641,6 +641,7 @@ void CodeEditor::CloseFindReplace()
void CodeEditor::IncrementalFind()
{
findreplace.Sync();
if(!findreplace.incremental || findreplace.GetTopCtrl() == &findreplace) // || we are block replace
return;
int l, h;

View file

@ -12,6 +12,7 @@ DropChoice::DropChoice() {
EnableDrop(false);
dropwidth = 0;
appending = false;
updownkeys = true;
}
void DropChoice::EnableDrop(bool b)
@ -83,6 +84,8 @@ bool DropChoice::DoKey(dword key) {
PseudoPush();
return true;
case K_DOWN:
if(!updownkeys)
return false;
if(appending)
PseudoPush();
else {
@ -91,6 +94,8 @@ bool DropChoice::DoKey(dword key) {
}
return true;
case K_UP:
if(!updownkeys)
return false;
if(appending)
PseudoPush();
else {

View file

@ -160,6 +160,7 @@ protected:
bool appending;
bool dropfocus;
bool always_drop;
bool updownkeys;
void Select();
void Drop();
@ -203,7 +204,7 @@ public:
DropChoice& DropWidth(int w) { dropwidth = w; return *this; }
DropChoice& DropWidthZ(int w) { dropwidth = HorzLayoutZoom(w); return *this; }
DropChoice& UpDownKeys(bool b = true) { updownkeys = b; return *this; }
DropChoice& SetScrollBarStyle(const ScrollBar::Style& s) { list.SetScrollBarStyle(s); return *this; }
@ -265,9 +266,10 @@ public:
WithDropChoice& AlwaysDrop(bool b = true) { select.AlwaysDrop(b); return *this; }
WithDropChoice& WithWheel(bool b = true) { withwheel = b; return *this; }
WithDropChoice& NoWithWheel() { return WithWheel(false); }
WithDropChoice& DropWidth(int w) { select.DropWidth(w); return *this; }
WithDropChoice& DropWidthZ(int w) { select.DropWidthZ(w); return *this; }
WithDropChoice& UpDownKeys(bool b = true) { select.UpDownKeys(b); return *this; }
WithDropChoice& NoUpDownKeys() { return UpDownKeys(false); }
WithDropChoice();
};

View file

@ -18,17 +18,7 @@ topic "WithDropChoice";
[s0;%% &]
[s2;%%
@@image:1350&331
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
х<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><EFBFBD>ǔ<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>妿
<EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>Л<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
(A9gANQAAAMv/AAAAAHic7ZyxTttAGIDzSjxH36EP0KFrK8YGhi6gMmUoZUFCLJ0oyogKQUItIkIIVVUpDjE1hEilhbaj+0MU1707J2fHds7o+/QNtrGTIH3c5SCmf/mpj4iIQ5++fItYssYOQ4ASoUMogg+frxvvzmyUM0M6hGKQwM77f2yUM0M6hGKQuvyr3zbad1gbMqXvCaqH1NXt/bLRssN4fvmmaP9o/AhUDqnr7PLWxgwd5gsdPmDuO7wZ+Ojxs2hbPzJhh8pkHd9VJvGkaT3p8viTGh8Q3Efq6lzciJLcwMGufmSS94f69oiEjFcZL0l6NCKsHFKXF/wcGIWnbA/MsF62Lyf8fygzDon6YKiPkPrTQSW47/BHZJTfMMJ/Xyqtw6SXOjozOqw0Utfpt+u4UYTK8UnWy8zLMBqp6+v5d0WJUD844e8PR68slI2khYblOiUkxaph7NAof0+B4rjrsHthIx1Ccdx16Hk20iEUB5+3gSqS1CFiyeod1gBKx9jhzJMWYmnSIbrg2A6V95NTf8H4ILUcD9MWSLGYSjpEF5TkvJN9v9MO/KNecGzfoTJTKxtM4phKSW5vt3l4sHX65aOkaNlhfDcKz7iLaKMkt7baaG6uS4pdr23fob54MQ6PiDZKcosLdUlRRkWZoDOMh/GDdIjZlOTm52ZXlpda2xsyNTMv41SU5Oovnr95/WrnfYoOZ8atU4yXICZp2SFiodIhumBSh+k/QQaQHToEF6BDcAE6BBegQ3CBsR3WuJMdiofxEFyADsEF6BBcgA7BBVingAswHoIL0CG4QFKHACWjd6jonezv7TbXVhuLC/X5uVk5HzF39ftTFP1O+/Bgq7m5LqetLC9JtIi5q9+vpxj4RzJUygnSamt7Q0ZOxNzV719W7AXH8iWpVAZMOQ2xCOP/z+EvcWfmOg==)
&]
[s0;%% &]
[s9;%% This template class adds a list of choices, with drop down
@ -158,6 +148,17 @@ hoice][@(0.0.255) `&]_[* SetDisplay]([@(0.0.255) const]_[_^Display^ Display][@(0
zooming [%-*@3 w] in accordance with font scaling.&]
[s3;%% &]
[s4; &]
[s5;:WithDropChoice`:`:UpDownKeys`(bool`): [_^WithDropChoice^ WithDropChoice][@(0.0.255) `&
]_[* UpDownKeys]([@(0.0.255) bool]_[*@3 b]_`=_[@(0.0.255) true])&]
[s2;%% If active, Up and Down keys cycle through the history. Default
is active..&]
[s3;%% &]
[s4; &]
[s5;:WithDropChoice`:`:NoUpDownKeys`(`): [_^WithDropChoice^ WithDropChoice][@(0.0.255) `&
]_[* NoUpDownKeys]()&]
[s2;%% Same as UpDownKeys(false).&]
[s3;%% &]
[s4; &]
[s5;:WithDropChoice`:`:GetCount`(`)const: [@(0.0.255) int]_[* GetCount]()_[@(0.0.255) const
]&]
[s2;%% Returns the number of items in the drop down list.&]