aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaHistory.html1
-rw-r--r--win32/ScintillaWin.cxx28
2 files changed, 20 insertions, 9 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index cbd7f568f..999141df8 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -470,6 +470,7 @@
<li>
Copy and paste of rectangular selections compatible with Borland Delphi IDE on Windows.
<a href="http://sourceforge.net/p/scintilla/feature-requests/1002/">Feature #1002.</a>
+ <a href="http://sourceforge.net/p/scintilla/bugs/1513/">Bug #1513</a>.
</li>
<li>
On Windows, fix painting on an explicit HDC when first paint attempt abandoned.
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 52f8fa4a1..216334b17 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -197,7 +197,7 @@ class ScintillaWin :
bool hasOKText;
CLIPFORMAT cfColumnSelect;
- CLIPFORMAT cfColumnSelectBorland;
+ CLIPFORMAT cfBorlandIDEBlockType;
CLIPFORMAT cfLineSelect;
HRESULT hrOle;
@@ -316,7 +316,7 @@ public:
friend class DataObject;
friend class DropTarget;
bool DragIsRectangularOK(CLIPFORMAT fmt) const {
- return drag.rectangular && ((fmt == cfColumnSelect) || (fmt == cfColumnSelectBorland));
+ return drag.rectangular && (fmt == cfColumnSelect);
}
private:
@@ -351,7 +351,7 @@ ScintillaWin::ScintillaWin(HWND hwnd) {
// contains a rectangular selection, so copy Developer Studio and Borland Delphi.
cfColumnSelect = static_cast<CLIPFORMAT>(
::RegisterClipboardFormat(TEXT("MSDEVColumnSelect")));
- cfColumnSelectBorland = static_cast<CLIPFORMAT>(
+ cfBorlandIDEBlockType = static_cast<CLIPFORMAT>(
::RegisterClipboardFormat(TEXT("Borland IDE Block Type")));
// Likewise for line-copy (copies a full line when no text is selected)
@@ -1704,7 +1704,16 @@ void ScintillaWin::Paste() {
SelectionPosition selStart = sel.IsRectangular() ?
sel.Rectangular().Start() :
sel.Range(sel.Main()).Start();
- bool isRectangular = ((::IsClipboardFormatAvailable(cfColumnSelect) != 0) || (::IsClipboardFormatAvailable(cfColumnSelectBorland) != 0));
+ bool isRectangular = (::IsClipboardFormatAvailable(cfColumnSelect) != 0);
+
+ if (!isRectangular) {
+ // Evaluate "Borland IDE Block Type" explicitly
+ GlobalMemory memBorlandSelection(::GetClipboardData(cfBorlandIDEBlockType));
+ if (memBorlandSelection) {
+ isRectangular = (memBorlandSelection.Size() == 1) && (static_cast<BYTE *>(memBorlandSelection.ptr)[0] == 0x02);
+ memBorlandSelection.Unlock();
+ }
+ }
// Always use CF_UNICODETEXT if available
GlobalMemory memUSelection(::GetClipboardData(CF_UNICODETEXT));
@@ -2251,11 +2260,12 @@ void ScintillaWin::CopyToClipboard(const SelectionText &selectedText) {
if (selectedText.rectangular) {
::SetClipboardData(cfColumnSelect, 0);
- GlobalMemory borlandColumn;
- borlandColumn.Allocate(1);
- if (borlandColumn) {
- static_cast<BYTE *>(borlandColumn.ptr)[0] = 0x02;
- borlandColumn.SetClip(cfColumnSelectBorland);
+
+ GlobalMemory borlandSelection;
+ borlandSelection.Allocate(1);
+ if (borlandSelection) {
+ static_cast<BYTE *>(borlandSelection.ptr)[0] = 0x02;
+ borlandSelection.SetClip(cfBorlandIDEBlockType);
}
}