diff --git a/ctl/ctlSQLBox.cpp b/ctl/ctlSQLBox.cpp
index bc191ae..1c73e4f 100644
--- a/ctl/ctlSQLBox.cpp
+++ b/ctl/ctlSQLBox.cpp
@@ -43,6 +43,7 @@ wxString pgscriptKeywords = wxT(" assert break columns continue date datetime fi
BEGIN_EVENT_TABLE(ctlSQLBox, wxStyledTextCtrl)
EVT_KEY_DOWN(ctlSQLBox::OnKeyDown)
EVT_MENU(MNU_FIND, ctlSQLBox::OnSearchReplace)
+ EVT_MENU(MNU_COPY, ctlSQLBox::OnCopy)
EVT_MENU(MNU_AUTOCOMPLETE, ctlSQLBox::OnAutoComplete)
EVT_KILL_FOCUS(ctlSQLBox::OnKillFocus)
// EVT_ERASE_BACKGROUND(ctlSQLBox::OnBackGround)
@@ -192,10 +193,11 @@ void ctlSQLBox::Create(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
SetFoldFlags(16);
// Setup accelerators
- wxAcceleratorEntry entries[2];
+ wxAcceleratorEntry entries[3];
entries[0].Set(wxACCEL_CTRL, (int)'F', MNU_FIND);
entries[1].Set(wxACCEL_CTRL, WXK_SPACE, MNU_AUTOCOMPLETE);
- wxAcceleratorTable accel(2, entries);
+ entries[0].Set(wxACCEL_CTRL, (int)'C', MNU_COPY);
+ wxAcceleratorTable accel(3, entries);
SetAcceleratorTable(accel);
// Autocompletion configuration
@@ -483,6 +485,9 @@ void ctlSQLBox::SetDefFunction(wxArrayString &name, wxArrayString &def) {
m_name=&name;
m_def=&def;
}
+void ctlSQLBox::OnCopy(wxCommandEvent& ev) {
+ Copy();
+}
void ctlSQLBox::OnKeyDown(wxKeyEvent &event)
{
@@ -1296,14 +1301,14 @@ void ctlSQLBox::Copy() {
l=1;
if (!selText[k].IsAscii()) l++;
int s=0;
- if (selText[k].GetValue()==9) s=5;
- if (selText[k].GetValue()==32) s=1;
+ char c = selText[k].GetValue();
+ if (c == '\r') { startp = startp + l; k++; continue; };
+ if (c == '\n') { str += wxT("
"); startp = startp + l; k++; continue; };
+ if (c==9) s=5;
+ if (c==32) s=1;
if (s>0) for (int tt=0;tt");
- startp=startp+l;
- k++;
+ startp=startp+l; k++;
}
str=str+wxT("");
diff --git a/include/ctl/ctlSQLBox.h b/include/ctl/ctlSQLBox.h
index 93fb6e8..5d8b2d5 100644
--- a/include/ctl/ctlSQLBox.h
+++ b/include/ctl/ctlSQLBox.h
@@ -55,6 +55,7 @@ public:
void OnKeyDown(wxKeyEvent &event);
void OnAutoComplete(wxCommandEvent &event);
void OnSearchReplace(wxCommandEvent &event);
+ void OnCopy(wxCommandEvent& ev);
void OnKillFocus(wxFocusEvent &event);
// void OnBackGround(wxEraseEvent &event);
void SetQueryBook(ctlAuiNotebook *query_book);