mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
theide: Fixed highlighting of searched words in help
git-svn-id: svn://ultimatepp.org/upp/trunk@1913 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
04102f0676
commit
7a502d6450
5 changed files with 34 additions and 21 deletions
|
|
@ -1,4 +1,4 @@
|
|||
topic "";
|
||||
topic "XmlNode";
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
|
||||
[l288;2 $$2,2#27521748481378242620020725143825:desc]
|
||||
|
|
@ -235,12 +235,12 @@ ser][@(0.0.255) `&]_[*@3 p], [_^dword^ dword]_[*@3 style]_`=_XML`_IGNORE`_DECLS[
|
|||
[s2;%% Creates XmlNode parsing XML document supplied either as string
|
||||
or XmlParser. [%-*@3 style] can be a combination of&]
|
||||
[s2;%% &]
|
||||
[ {{3581:6419<288; [s2;l32;%% XML`_IGNORE`_DECLS]
|
||||
:: [s2;l64;%% Declaration elements are ignored.]
|
||||
:: [s2;l32;%% XML`_IGNORE`_PIS]
|
||||
:: [s2;l64;%% Processing info elements are ignored.]
|
||||
:: [s2;l32;%% XML`_IGNORE`_COMMENTS]
|
||||
:: [s2;l64;%% Comments are ignored.]}}&]
|
||||
[ {{3581:6419<288;^ [s2;l32;%% XML`_IGNORE`_DECLS]
|
||||
::= [s2;l64;%% Declaration elements are ignored.]
|
||||
::^ [s2;l32;%% XML`_IGNORE`_PIS]
|
||||
::= [s2;l64;%% Processing info elements are ignored.]
|
||||
::^ [s2;l32;%% XML`_IGNORE`_COMMENTS]
|
||||
::= [s2;l64;%% Comments are ignored.]}}&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:AsXML`(const XmlNode`&`,dword`): [_^String^ String]_[* AsXML]([@(0.0.255) const]_[_^XmlNode^ X
|
||||
|
|
@ -249,11 +249,12 @@ ML`_DOCTYPE)&]
|
|||
[s2;%% Creates a XML document from XmlNode [%-*@3 n]. [%-*@3 style] can
|
||||
be a combination &]
|
||||
[s2;%% &]
|
||||
[ {{3581:6419<288; [s2;l32; XML`_HEADER]
|
||||
:: [s2;l64;%% Adds standard XML header at the beginning of the document.]
|
||||
:: [s2;l32; XML`_DOCTYPE]
|
||||
:: [s2;l64;%% Adds DOCTYPE declaration at the beginning of the document
|
||||
with type taken as id of first XML`_TAG sub`-node.]}}&]
|
||||
[ {{3581:6419<288;^ [s2;l32; XML`_HEADER]
|
||||
::= [s2;l64;%% Adds standard XML header at the beginning of the document.]
|
||||
::^ [s2;l32; XML`_DOCTYPE]
|
||||
::= [s2;l64;%% Adds DOCTYPE declaration at the beginning of the document
|
||||
with type taken as id of first XML`_TAG sub`-node (which represents
|
||||
the root element).]}}&]
|
||||
[s2;%% &]
|
||||
[s3;%% &]
|
||||
[s0; ]
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
topic "";
|
||||
topic "XML output";
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
|
||||
[l288;2 $$2,2#27521748481378242620020725143825:desc]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
topic "";
|
||||
topic "XmlParser";
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
|
||||
[l288;2 $$2,2#27521748481378242620020725143825:desc]
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@ public:
|
|||
void FinishTree();
|
||||
void OpenDeep(int id = 0);
|
||||
void CurrentOrHome();
|
||||
void ClearCurrentLink() { current_link.Clear(); }
|
||||
|
||||
String GetCurrent() const { return topic; }
|
||||
String GetCurrentLabel() const { return label; }
|
||||
|
|
|
|||
|
|
@ -293,27 +293,37 @@ Topic TopicCtrl::AcquireTopic(const String& t)
|
|||
return Topic();
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct HighlightWords : RichText::Iterator {
|
||||
Index<String> words;
|
||||
Vector<String> words;
|
||||
struct Pos : Moveable<Pos> { int pos, len; };
|
||||
Vector<Pos> pos;
|
||||
|
||||
int FindPattern(const String& x) {
|
||||
for(int i = 0; i < words.GetCount(); i++)
|
||||
if(x.StartsWith(words[i]))
|
||||
return words[i].GetCount();
|
||||
return -1;
|
||||
}
|
||||
|
||||
virtual bool operator()(int tpos, const RichPara& para) {
|
||||
WString text = para.GetText();
|
||||
const wchar *s = text;
|
||||
for(;;) {
|
||||
while(!IsLetter(*s) && *s)
|
||||
while(!IsAlpha(*s) && !IsDigit(*s) && *s)
|
||||
s++;
|
||||
if(*s == '\0')
|
||||
break;
|
||||
WStringBuffer wb;
|
||||
String wb;
|
||||
const wchar *b = s;
|
||||
while(IsLetter(*s))
|
||||
wb.Cat(ToLower(*s++));
|
||||
if(words.Find(FromUnicode(wb)) >= 0) {
|
||||
while(IsAlpha(*s) || IsDigit(*s))
|
||||
wb.Cat(ToUpper(*s++));
|
||||
int q = FindPattern(wb);
|
||||
if(q >= 0) {
|
||||
Pos& p = pos.Add();
|
||||
p.pos = int(b - ~text) + tpos;
|
||||
p.len = int(s - b);
|
||||
p.len = q;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
@ -431,6 +441,7 @@ void TopicCtrl::SShow()
|
|||
void TopicCtrl::Search()
|
||||
{
|
||||
int l, h;
|
||||
ClearCurrentLink();
|
||||
search.GetSelection(l, h);
|
||||
SyncDocTree();
|
||||
SetBar();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue