Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sat, 31 Dec 2016 15:28:00 UTC Commit: c914598dbaf12a1b6877f590604d5e4b8c0d439c https://github.com/geany/geany/commit/c914598dbaf12a1b6877f590604d5e4b8c0d43...
Log Message: ----------- Update Scintilla to version 3.7.2
Modified Paths: -------------- scintilla/src/EditView.cxx scintilla/src/EditView.h scintilla/src/Editor.cxx scintilla/src/Editor.h scintilla/src/PositionCache.h scintilla/version.txt
Modified: scintilla/src/EditView.cxx 5 lines changed, 3 insertions(+), 2 deletions(-) =================================================================== @@ -650,7 +650,7 @@ Range EditView::RangeDisplayLine(Surface *surface, const EditModel &model, int l return rangeSubLine; }
-SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditModel &model, Point pt, bool canReturnInvalid, bool charPosition, bool virtualSpace, const ViewStyle &vs) { +SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument pt, bool canReturnInvalid, bool charPosition, bool virtualSpace, const ViewStyle &vs) { pt.x = pt.x - vs.textStart; int visibleLine = static_cast<int>(floor(pt.y / vs.lineHeight)); if (!canReturnInvalid && (visibleLine < 0)) @@ -671,7 +671,8 @@ SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditMo const XYPOSITION subLineStart = ll->positions[rangeSubLine.start]; if (subLine > 0) // Wrapped pt.x -= ll->wrapIndent; - const int positionInLine = ll->FindPositionFromX(pt.x + subLineStart, rangeSubLine, charPosition); + const int positionInLine = ll->FindPositionFromX(static_cast<XYPOSITION>(pt.x + subLineStart), + rangeSubLine, charPosition); if (positionInLine < rangeSubLine.end) { return SelectionPosition(model.pdoc->MovePositionOutsideChar(positionInLine + posLineStart, 1)); }
Modified: scintilla/src/EditView.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -114,7 +114,7 @@ class EditView { Point LocationFromPosition(Surface *surface, const EditModel &model, SelectionPosition pos, int topLine, const ViewStyle &vs, PointEnd pe); Range RangeDisplayLine(Surface *surface, const EditModel &model, int lineVisible, const ViewStyle &vs); - SelectionPosition SPositionFromLocation(Surface *surface, const EditModel &model, Point pt, bool canReturnInvalid, + SelectionPosition SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument pt, bool canReturnInvalid, bool charPosition, bool virtualSpace, const ViewStyle &vs); SelectionPosition SPositionFromLineX(Surface *surface, const EditModel &model, int lineDoc, int x, const ViewStyle &vs); int DisplayFromPosition(Surface *surface, const EditModel &model, int pos, const ViewStyle &vs);
Modified: scintilla/src/Editor.cxx 79 lines changed, 43 insertions(+), 36 deletions(-) =================================================================== @@ -283,8 +283,8 @@ Point Editor::GetVisibleOriginInMain() const { return Point(0,0); }
-Point Editor::DocumentPointFromView(Point ptView) const { - Point ptDocument = ptView; +PointDocument Editor::DocumentPointFromView(Point ptView) const { + PointDocument ptDocument(ptView); if (wMargin.GetID()) { Point ptOrigin = GetVisibleOriginInMain(); ptDocument.x += ptOrigin.x; @@ -399,8 +399,8 @@ SelectionPosition Editor::SPositionFromLocation(Point pt, bool canReturnInvalid, if (pt.y < 0) return SelectionPosition(INVALID_POSITION); } - pt = DocumentPointFromView(pt); - return view.SPositionFromLocation(surface, *this, pt, canReturnInvalid, charPosition, virtualSpace, vs); + PointDocument ptdoc = DocumentPointFromView(pt); + return view.SPositionFromLocation(surface, *this, ptdoc, canReturnInvalid, charPosition, virtualSpace, vs); }
int Editor::PositionFromLocation(Point pt, bool canReturnInvalid, bool charPosition) { @@ -5694,6 +5694,39 @@ sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lPar return 0; }
+void Editor::SetSelectionNMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + InvalidateRange(sel.Range(wParam).Start().Position(), sel.Range(wParam).End().Position()); + + switch (iMessage) { + case SCI_SETSELECTIONNCARET: + sel.Range(wParam).caret.SetPosition(static_cast<int>(lParam)); + break; + + case SCI_SETSELECTIONNANCHOR: + sel.Range(wParam).anchor.SetPosition(static_cast<int>(lParam)); + break; + + case SCI_SETSELECTIONNCARETVIRTUALSPACE: + sel.Range(wParam).caret.SetVirtualSpace(static_cast<int>(lParam)); + break; + + case SCI_SETSELECTIONNANCHORVIRTUALSPACE: + sel.Range(wParam).anchor.SetVirtualSpace(static_cast<int>(lParam)); + break; + + case SCI_SETSELECTIONNSTART: + sel.Range(wParam).anchor.SetPosition(static_cast<int>(lParam)); + break; + + case SCI_SETSELECTIONNEND: + sel.Range(wParam).caret.SetPosition(static_cast<int>(lParam)); + break; + } + + InvalidateRange(sel.Range(wParam).Start().Position(), sel.Range(wParam).End().Position()); + ContainerNeedsUpdate(SC_UPDATE_SELECTION); +} + sptr_t Editor::StringResult(sptr_t lParam, const char *val) { const size_t len = val ? strlen(val) : 0; if (lParam) { @@ -7967,55 +8000,29 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return sel.Main();
case SCI_SETSELECTIONNCARET: - sel.Range(wParam).caret.SetPosition(static_cast<int>(lParam)); - ContainerNeedsUpdate(SC_UPDATE_SELECTION); - Redraw(); + case SCI_SETSELECTIONNANCHOR: + case SCI_SETSELECTIONNCARETVIRTUALSPACE: + case SCI_SETSELECTIONNANCHORVIRTUALSPACE: + case SCI_SETSELECTIONNSTART: + case SCI_SETSELECTIONNEND: + SetSelectionNMessage(iMessage, wParam, lParam); break;
case SCI_GETSELECTIONNCARET: return sel.Range(wParam).caret.Position();
- case SCI_SETSELECTIONNANCHOR: - sel.Range(wParam).anchor.SetPosition(static_cast<int>(lParam)); - ContainerNeedsUpdate(SC_UPDATE_SELECTION); - Redraw(); - break; case SCI_GETSELECTIONNANCHOR: return sel.Range(wParam).anchor.Position();
- case SCI_SETSELECTIONNCARETVIRTUALSPACE: - sel.Range(wParam).caret.SetVirtualSpace(static_cast<int>(lParam)); - ContainerNeedsUpdate(SC_UPDATE_SELECTION); - Redraw(); - break; - case SCI_GETSELECTIONNCARETVIRTUALSPACE: return sel.Range(wParam).caret.VirtualSpace();
- case SCI_SETSELECTIONNANCHORVIRTUALSPACE: - sel.Range(wParam).anchor.SetVirtualSpace(static_cast<int>(lParam)); - ContainerNeedsUpdate(SC_UPDATE_SELECTION); - Redraw(); - break; - case SCI_GETSELECTIONNANCHORVIRTUALSPACE: return sel.Range(wParam).anchor.VirtualSpace();
- case SCI_SETSELECTIONNSTART: - sel.Range(wParam).anchor.SetPosition(static_cast<int>(lParam)); - ContainerNeedsUpdate(SC_UPDATE_SELECTION); - Redraw(); - break; - case SCI_GETSELECTIONNSTART: return sel.Range(wParam).Start().Position();
- case SCI_SETSELECTIONNEND: - sel.Range(wParam).caret.SetPosition(static_cast<int>(lParam)); - ContainerNeedsUpdate(SC_UPDATE_SELECTION); - Redraw(); - break; - case SCI_GETSELECTIONNEND: return sel.Range(wParam).End().Position();
Modified: scintilla/src/Editor.h 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -275,7 +275,7 @@ class Editor : public EditModel, public DocWatcher { // The top left visible point in main window coordinates. Will be 0,0 except for // scroll views where it will be equivalent to the current scroll position. virtual Point GetVisibleOriginInMain() const; - Point DocumentPointFromView(Point ptView) const; // Convert a point from view space to document + PointDocument DocumentPointFromView(Point ptView) const; // Convert a point from view space to document int TopLineOfMain() const; // Return the line at Main's y coordinate 0 virtual PRectangle GetClientRectangle() const; virtual PRectangle GetClientDrawingRectangle(); @@ -577,6 +577,7 @@ class Editor : public EditModel, public DocWatcher { bool ValidMargin(uptr_t wParam) const; void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + void SetSelectionNMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
static const char *StringFromEOLMode(int eolMode);
Modified: scintilla/src/PositionCache.h 17 lines changed, 17 insertions(+), 0 deletions(-) =================================================================== @@ -16,6 +16,23 @@ static inline bool IsEOLChar(char ch) { return (ch == '\r') || (ch == '\n'); }
+/** +* A point in document space. +* Uses double for sufficient resolution in large (>20,000,000 line) documents. +*/ +class PointDocument { +public: + double x; + double y; + + explicit PointDocument(double x_ = 0, double y_ = 0) : x(x_), y(y_) { + } + + // Conversion from Point. + explicit PointDocument(Point pt) : x(pt.x), y(pt.y) { + } +}; + // There are two points for some positions and this enumeration // can choose between the end of the first line or subline // and the start of the next line or subline.
Modified: scintilla/version.txt 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1 +1 @@ -371 +372
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).