summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Readme-mod.txt2
-rw-r--r--scintilla/doc/ScintillaHistory.html1
-rw-r--r--scintilla/lexers/LexAsm.cxx2
-rw-r--r--scintilla/lexers/LexBasic.cxx2
-rw-r--r--scintilla/lexers/LexCPP.cxx2
-rw-r--r--scintilla/lexers/LexD.cxx2
-rw-r--r--scintilla/lexers/LexPerl.cxx2
-rw-r--r--scintilla/lexers/LexSQL.cxx2
-rw-r--r--scintilla/src/Editor.cxx50
-rw-r--r--scintilla/src/Editor.h1
-rw-r--r--scintilla/win32/PlatWin.cxx20
-rw-r--r--scintilla/win32/ScintillaWin.cxx8
12 files changed, 66 insertions, 28 deletions
diff --git a/Readme-mod.txt b/Readme-mod.txt
index 21e2ffe..42afc4e 100644
--- a/Readme-mod.txt
+++ b/Readme-mod.txt
@@ -31,6 +31,6 @@ Ctrl+Alt+F2 Expand selection to next match.
Ctrl+Alt+Shift+F2 Expand selection to previous match.
Ctrl+Shift+Enter New line with toggled auto indent option.
-Notepad2-mod 4.2.25 has been created with Scintilla 3.1.0 HG b14cefb66637.
+Notepad2-mod 4.2.25 has been created with Scintilla 3.1.0 HG 4e439e31f632.
You can use WDK 7.1, MSVC 2010 or Intel C++ Compiler XE 2011 SP1 Update 10
to build Notepad2-mod.
diff --git a/scintilla/doc/ScintillaHistory.html b/scintilla/doc/ScintillaHistory.html
index e8bdbf3..1132ce4 100644
--- a/scintilla/doc/ScintillaHistory.html
+++ b/scintilla/doc/ScintillaHistory.html
@@ -399,6 +399,7 @@
<td>zeniko</td>
<td>James Ribe</td>
<td>Markus Nißl</td>
+ <td>Martin Panter</td>
</tr>
</table>
<p>
diff --git a/scintilla/lexers/LexAsm.cxx b/scintilla/lexers/LexAsm.cxx
index 42e9b41..2446297 100644
--- a/scintilla/lexers/LexAsm.cxx
+++ b/scintilla/lexers/LexAsm.cxx
@@ -153,7 +153,7 @@ class LexerAsm : public ILexer {
public:
LexerAsm() {
}
- ~LexerAsm() {
+ virtual ~LexerAsm() {
}
void SCI_METHOD Release() {
delete this;
diff --git a/scintilla/lexers/LexBasic.cxx b/scintilla/lexers/LexBasic.cxx
index 59f7f05..15ecc4d 100644
--- a/scintilla/lexers/LexBasic.cxx
+++ b/scintilla/lexers/LexBasic.cxx
@@ -223,7 +223,7 @@ public:
CheckFoldPoint(CheckFoldPoint_),
osBasic(wordListDescriptions) {
}
- ~LexerBasic() {
+ virtual ~LexerBasic() {
}
void SCI_METHOD Release() {
delete this;
diff --git a/scintilla/lexers/LexCPP.cxx b/scintilla/lexers/LexCPP.cxx
index 1332a73..783710d 100644
--- a/scintilla/lexers/LexCPP.cxx
+++ b/scintilla/lexers/LexCPP.cxx
@@ -335,7 +335,7 @@ public:
setRelOp(CharacterSet::setNone, "=!<>"),
setLogicalOp(CharacterSet::setNone, "|&") {
}
- ~LexerCPP() {
+ virtual ~LexerCPP() {
}
void SCI_METHOD Release() {
delete this;
diff --git a/scintilla/lexers/LexD.cxx b/scintilla/lexers/LexD.cxx
index f8851a0..ccb94a6 100644
--- a/scintilla/lexers/LexD.cxx
+++ b/scintilla/lexers/LexD.cxx
@@ -160,7 +160,7 @@ public:
LexerD(bool caseSensitive_) :
caseSensitive(caseSensitive_) {
}
- ~LexerD() {
+ virtual ~LexerD() {
}
void SCI_METHOD Release() {
delete this;
diff --git a/scintilla/lexers/LexPerl.cxx b/scintilla/lexers/LexPerl.cxx
index 4b33f44..70aec18 100644
--- a/scintilla/lexers/LexPerl.cxx
+++ b/scintilla/lexers/LexPerl.cxx
@@ -366,7 +366,7 @@ public:
setSpecialVar(CharacterSet::setNone, "\"$;<>&`'+,./\\%:=~!?@[]"),
setControlVar(CharacterSet::setNone, "ACDEFHILMNOPRSTVWX") {
}
- ~LexerPerl() {
+ virtual ~LexerPerl() {
}
void SCI_METHOD Release() {
delete this;
diff --git a/scintilla/lexers/LexSQL.cxx b/scintilla/lexers/LexSQL.cxx
index a8f306c..eb0b710 100644
--- a/scintilla/lexers/LexSQL.cxx
+++ b/scintilla/lexers/LexSQL.cxx
@@ -267,6 +267,8 @@ class LexerSQL : public ILexer {
public :
LexerSQL() {}
+ virtual ~LexerSQL() {}
+
int SCI_METHOD Version () const {
return lvOriginal;
}
diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx
index 928154e..e6d71c2 100644
--- a/scintilla/src/Editor.cxx
+++ b/scintilla/src/Editor.cxx
@@ -5032,14 +5032,28 @@ void Editor::CancelModes() {
}
void Editor::NewLine() {
- ClearSelection();
+ // Remove non-main ranges
+ InvalidateSelection(sel.RangeMain(), true);
+ sel.SetSelection(sel.RangeMain());
+
+ // Clear main range and insert line end
+ bool needGroupUndo = !sel.Empty();
+ if (needGroupUndo)
+ pdoc->BeginUndoAction();
+
+ if (!sel.Empty())
+ ClearSelection();
const char *eol = "\n";
if (pdoc->eolMode == SC_EOL_CRLF) {
eol = "\r\n";
} else if (pdoc->eolMode == SC_EOL_CR) {
eol = "\r";
} // else SC_EOL_LF -> "\n" already set
- if (pdoc->InsertCString(sel.MainCaret(), eol)) {
+ bool inserted = pdoc->InsertCString(sel.MainCaret(), eol);
+ // Want to end undo group before NotifyChar as applications often modify text here
+ if (needGroupUndo)
+ pdoc->EndUndoAction();
+ if (inserted) {
SetEmptySelection(sel.MainCaret() + istrlen(eol));
while (*eol) {
NotifyChar(*eol);
@@ -5803,6 +5817,19 @@ void Editor::SearchAnchor() {
searchAnchor = SelectionStart().Position();
}
+// Simple RAII wrapper for CaseFolder as std::auto_ptr is now deprecated
+class ScopedCaseFolder {
+ CaseFolder *pcf;
+public:
+ ScopedCaseFolder(CaseFolder *pcf_) : pcf(pcf_) {
+ }
+ ~ScopedCaseFolder() {
+ delete pcf;
+ pcf = 0;
+ }
+ CaseFolder *get() const { return pcf; }
+};
+
/**
* Find text from current search anchor: Must call @c SearchAnchor first.
* Used for next text and previous text requests.
@@ -5817,7 +5844,7 @@ long Editor::SearchText(
const char *txt = reinterpret_cast<char *>(lParam);
int pos;
int lengthFound = istrlen(txt);
- std::auto_ptr<CaseFolder> pcf(CaseFolderForEncoding());
+ ScopedCaseFolder pcf(CaseFolderForEncoding());
if (iMessage == SCI_SEARCHNEXT) {
pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt,
(wParam & SCFIND_MATCHCASE) != 0,
@@ -5868,7 +5895,7 @@ std::string Editor::CaseMapString(const std::string &s, int caseMapping) {
long Editor::SearchInTarget(const char *text, int length) {
int lengthFound = length;
- std::auto_ptr<CaseFolder> pcf(CaseFolderForEncoding());
+ ScopedCaseFolder pcf(CaseFolderForEncoding());
int pos = pdoc->FindText(targetStart, targetEnd, text,
(searchFlags & SCFIND_MATCHCASE) != 0,
(searchFlags & SCFIND_WHOLEWORD) != 0,
@@ -6142,6 +6169,11 @@ Window::Cursor Editor::GetMarginCursor(Point pt) {
return Window::cursorReverseArrow;
}
+void Editor::TrimAndSetSelection(int currentPos_, int anchor_) {
+ sel.TrimSelection(SelectionRange(currentPos_, anchor_));
+ SetSelection(currentPos_, anchor_);
+}
+
void Editor::LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine) {
int selCurrentPos, selAnchorPos;
if (wholeLine) {
@@ -6172,7 +6204,7 @@ void Editor::LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLi
selAnchorPos = StartEndDisplayLine(lineAnchorPos_, true);
}
}
- SetSelection(selCurrentPos, selAnchorPos);
+ TrimAndSetSelection(selCurrentPos, selAnchorPos);
}
void Editor::WordSelection(int pos) {
@@ -6182,20 +6214,20 @@ void Editor::WordSelection(int pos) {
// This ensures that a series of empty lines isn't counted as a single "word".
if (!pdoc->IsLineEndPosition(pos))
pos = pdoc->ExtendWordSelect(pdoc->MovePositionOutsideChar(pos + 1, 1), -1);
- SetSelection(pos, wordSelectAnchorEndPos);
+ TrimAndSetSelection(pos, wordSelectAnchorEndPos);
} else if (pos > wordSelectAnchorEndPos) {
// Extend forward to the word containing the character to the left of pos.
// Skip ExtendWordSelect if the line is empty or if pos is the first position on the line.
// This ensures that a series of empty lines isn't counted as a single "word".
if (pos > pdoc->LineStart(pdoc->LineFromPosition(pos)))
pos = pdoc->ExtendWordSelect(pdoc->MovePositionOutsideChar(pos - 1, -1), 1);
- SetSelection(pos, wordSelectAnchorStartPos);
+ TrimAndSetSelection(pos, wordSelectAnchorStartPos);
} else {
// Select only the anchored word
if (pos >= originalAnchorPos)
- SetSelection(wordSelectAnchorEndPos, wordSelectAnchorStartPos);
+ TrimAndSetSelection(wordSelectAnchorEndPos, wordSelectAnchorStartPos);
else
- SetSelection(wordSelectAnchorStartPos, wordSelectAnchorEndPos);
+ TrimAndSetSelection(wordSelectAnchorStartPos, wordSelectAnchorEndPos);
}
}
diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h
index 9009d59..bd6186a 100644
--- a/scintilla/src/Editor.h
+++ b/scintilla/src/Editor.h
@@ -493,6 +493,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool PointInSelection(Point pt);
bool PointInSelMargin(Point pt);
Window::Cursor GetMarginCursor(Point pt);
+ void TrimAndSetSelection(int currentPos_, int anchor_);
void LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine);
void WordSelection(int pos);
void DwellEnd(bool mouseMoved);
diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx
index 2b11a81..a791001 100644
--- a/scintilla/win32/PlatWin.cxx
+++ b/scintilla/win32/PlatWin.cxx
@@ -115,7 +115,8 @@ Point Point::FromLong(long lpoint) {
}
static RECT RectFromPRectangle(PRectangle prc) {
- RECT rc = {prc.left, prc.top, prc.right, prc.bottom};
+ RECT rc = {static_cast<LONG>(prc.left), static_cast<LONG>(prc.top),
+ static_cast<LONG>(prc.right), static_cast<LONG>(prc.bottom)};
return rc;
}
@@ -698,7 +699,7 @@ void SurfaceGDI::Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired
BrushColor(back);
std::vector<POINT> outline;
for (int i=0;i<npts;i++) {
- POINT pt = {pts[i].x, pts[i].y};
+ POINT pt = {static_cast<LONG>(pts[i].x), static_cast<LONG>(pts[i].y)};
outline.push_back(pt);
}
::Polygon(hdc, &outline[0], npts);
@@ -1859,7 +1860,7 @@ void Window::SetPositionRelative(PRectangle rc, Window w) {
#ifdef MONITOR_DEFAULTTONULL
// We're using the stub functionality of MultiMon.h to decay gracefully on machines
// (ie, pre Win2000, Win95) that do not support the newer functions.
- RECT rcMonitor = {rc.left, rc.top, rc.right, rc.bottom};
+ RECT rcMonitor = RectFromPRectangle(rc);
MONITORINFO mi = {0};
mi.cbSize = sizeof(mi);
@@ -1999,7 +2000,8 @@ PRectangle Window::GetMonitorRect(Point pt) {
// There could be conditional code and dynamic loading in a future version
// so this would work on those platforms where they are available.
PRectangle rcPosition = GetPosition();
- POINT ptDesktop = {pt.x + rcPosition.left, pt.y + rcPosition.top};
+ POINT ptDesktop = {static_cast<LONG>(pt.x + rcPosition.left),
+ static_cast<LONG>(pt.y + rcPosition.top)};
HMONITOR hMonitor = ::MonitorFromPoint(ptDesktop, MONITOR_DEFAULTTONEAREST);
MONITORINFO mi = {0};
memset(&mi, 0, sizeof(mi));
@@ -2239,7 +2241,7 @@ void ListBoxX::Create(Window &parent_, int ctrlID_, Point location_, int lineHei
hinstanceParent,
this);
- POINT locationw = {location.x, location.y};
+ POINT locationw = {static_cast<LONG>(location.x), static_cast<LONG>(location.y)};
::MapWindowPoints(hwndParent, NULL, &locationw, 1);
location = Point(locationw.x, locationw.y);
}
@@ -2528,7 +2530,7 @@ void ListBoxX::SetList(const char *list, char separator, char typesep) {
}
void ListBoxX::AdjustWindowRect(PRectangle *rc) const {
- RECT rcw = {rc->left, rc->top, rc->right, rc->bottom };
+ RECT rcw = RectFromPRectangle(*rc);
::AdjustWindowRectEx(&rcw, WS_THICKFRAME, false, WS_EX_WINDOWEDGE);
*rc = PRectangle(rcw.left, rcw.top, rcw.right, rcw.bottom);
}
@@ -2549,7 +2551,7 @@ int ListBoxX::MinClientWidth() const {
POINT ListBoxX::MinTrackSize() const {
PRectangle rc(0, 0, MinClientWidth(), ItemHeight());
AdjustWindowRect(&rc);
- POINT ret = {rc.Width(), rc.Height()};
+ POINT ret = {static_cast<LONG>(rc.Width()), static_cast<LONG>(rc.Height())};
return ret;
}
@@ -2559,7 +2561,7 @@ POINT ListBoxX::MaxTrackSize() const {
TextOffset() + ::GetSystemMetrics(SM_CXVSCROLL),
ItemHeight() * lti.Count());
AdjustWindowRect(&rc);
- POINT ret = {rc.Width(), rc.Height()};
+ POINT ret = {static_cast<LONG>(rc.Width()), static_cast<LONG>(rc.Height())};
return ret;
}
@@ -2739,7 +2741,7 @@ void ListBoxX::Paint(HDC hDC) {
// The list background is mainly erased during painting, but can be a small
// unpainted area when at the end of a non-integrally sized list with a
// vertical scroll bar
- RECT rc = { 0, 0, extent.x, extent.y };
+ RECT rc = { 0, 0, static_cast<LONG>(extent.x), static_cast<LONG>(extent.y) };
::FillRect(bitmapDC, &rc, reinterpret_cast<HBRUSH>(COLOR_WINDOW+1));
// Paint the entire client area and vertical scrollbar
::SendMessage(lb, WM_PRINT, reinterpret_cast<WPARAM>(bitmapDC), PRF_CLIENT|PRF_NONCLIENT);
diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx
index 769c046..cccc457 100644
--- a/scintilla/win32/ScintillaWin.cxx
+++ b/scintilla/win32/ScintillaWin.cxx
@@ -429,7 +429,7 @@ void ScintillaWin::EnsureRenderTarget() {
// Create a Direct2D render target.
#if 1
pD2DFactory->CreateHwndRenderTarget(
- D2D1::RenderTargetProperties(),
+ D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT, D2D1::PixelFormat(), 96.0, 96.0),
D2D1::HwndRenderTargetProperties(hw, size),
&pRenderTarget);
#else
@@ -929,7 +929,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
case WM_CHAR:
if (((wParam >= 128) || !iscntrl(wParam)) || !lastKeyDownConsumed) {
if (::IsWindowUnicode(MainHWND()) || keysAlwaysUnicode) {
- wchar_t wcs[2] = {wParam, 0};
+ wchar_t wcs[2] = {static_cast<wchar_t>(wParam), 0};
if (IsUnicodeMode()) {
// For a wide character version of the window:
char utfval[4];
@@ -1049,7 +1049,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
if ((pt.x == -1) && (pt.y == -1)) {
// Caused by keyboard so display menu near caret
pt = PointMainCaret();
- POINT spt = {pt.x, pt.y};
+ POINT spt = {static_cast<int>(pt.x), static_cast<int>(pt.y)};
::ClientToScreen(MainHWND(), &spt);
pt = Point(spt.x, spt.y);
}
@@ -2816,7 +2816,7 @@ sptr_t PASCAL ScintillaWin::CTWndProc(
} else {
#if defined(USE_D2D)
pD2DFactory->CreateHwndRenderTarget(
- D2D1::RenderTargetProperties(),
+ D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT, D2D1::PixelFormat(), 96.0, 96.0),
D2D1::HwndRenderTargetProperties(hWnd, D2D1::SizeU(rc.right - rc.left, rc.bottom - rc.top)),
&pCTRenderTarget);
surfaceWindow->Init(pCTRenderTarget, hWnd);