Copy bookmark selection.
Some checks failed
CMake on a single platform / build (push) Has been cancelled

Выделеные Ctrl+B фрагменты текста теперь копируются в виде выделеного желтым фоновым цветом.
This commit is contained in:
lsv 2026-05-07 13:53:41 +05:00
parent fb9da46b50
commit d45725ab82

View file

@ -1822,7 +1822,7 @@ wxString ctlSQLBox::TextToHtml(int start, int end,bool isAddNewLine, const std::
int lenstr = selText.Length(); int lenstr = selText.Length();
//str = wxT("<div style=\"font-family: ") + fontName + wxT("; font-size: " + sz + "px\"><font>"); //str = wxT("<div style=\"font-family: ") + fontName + wxT("; font-size: " + sz + "px\"><font>");
str.Alloc(lenstr*2); str.Alloc(lenstr*2);
str = wxString::Format("<div style=\"font-family: %s; font-size: %spx\"><font face=\"%s\" >", fontName, sz, fontName); str = wxString::Format("<div style=\"font-family: %s; font-size: %spx\"><span>", fontName, sz);
int k = 0; int k = 0;
int l = 1; int l = 1;
wxString newline = "<br>"; wxString newline = "<br>";
@ -1836,14 +1836,48 @@ wxString ctlSQLBox::TextToHtml(int start, int end,bool isAddNewLine, const std::
int lenobj; int lenobj;
if (listobj.size()>0) {pos=listobj[IndexObj].startIndex; obj=listobj[IndexObj].table;lenobj=obj.Len();} if (listobj.size()>0) {pos=listobj[IndexObj].startIndex; obj=listobj[IndexObj].table;lenobj=obj.Len();}
wxString lstr; wxString lstr;
wxString bgclr="";
// find Indicator bookmark
int spos=-1;
int epos=-1;
int tmppos=0;
int textlen=GetTextLength();
while (tmppos<textlen) {
tmppos=IndicatorEnd(9,tmppos);
if (tmppos==0 || tmppos==textlen) break;
if (tmppos>0 && tmppos!=textlen) {
spos=tmppos;
epos=IndicatorEnd(9,tmppos);
if (epos>=start) break;
tmppos=epos;
spos=epos=-1;
} else break;
}
bool refreshgbcolor=false;
while (k<lenstr) { while (k<lenstr) {
int st = GetStyleAt(startp); int st = GetStyleAt(startp);
if (st < 34) tColor = frColor[st].GetAsString(wxC2S_HTML_SYNTAX); if (st < 34) tColor = frColor[st].GetAsString(wxC2S_HTML_SYNTAX);
if (prevColor != tColor) { if (startp>=spos && spos!=-1) {
str+= wxT("</font><font color=\""); refreshgbcolor=true;
bgclr="#ffff00";
tmppos=IndicatorEnd(9,epos);
if (tmppos==textlen) spos=-1;
else spos=tmppos;
} else if (startp>=epos && epos!=-1) {
bgclr="";
refreshgbcolor=true;
tmppos=IndicatorEnd(9,spos);
if (tmppos==textlen) epos=-1;
else epos=tmppos;
}
if (prevColor != tColor || refreshgbcolor) {
str+= wxT("</span><span style=\"color:");
str+= tColor; str+= tColor;
if (!bgclr.IsEmpty())
str+= wxString::Format(";background-color: %s",bgclr);
str+= wxT("\">"); str+= wxT("\">");
prevColor = tColor; if (prevColor != tColor) prevColor = tColor;
refreshgbcolor=false;
} }
//str.append(str[k].GetValue()); //str.append(str[k].GetValue());
wxUniChar c = selText[k]; wxUniChar c = selText[k];