mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
+ merge: Scintilla's current GitHub mirror (404: 0430) development
+ fix: Deactivate "Focused View": set FoldingLevel to default before applying Lexer's Style (-> speed-up)
This commit is contained in:
parent
2d2c3668eb
commit
54c4083ec1
@ -551,6 +551,9 @@
|
||||
including line numbers.
|
||||
</li>
|
||||
<li>
|
||||
SciTE can read settings in EditorConfig format when enabled with editor.config.enable property.
|
||||
</li>
|
||||
<li>
|
||||
Set the last X chosen when SCI_REPLACESEL called to ensure macros work
|
||||
when text insertion followed by caret up or down.
|
||||
</li>
|
||||
|
||||
@ -53,7 +53,9 @@ public:
|
||||
CallTip();
|
||||
// Deleted so CallTip objects can not be copied.
|
||||
CallTip(const CallTip &) = delete;
|
||||
CallTip(CallTip &&) = delete;
|
||||
CallTip &operator=(const CallTip &) = delete;
|
||||
CallTip &operator=(CallTip &&) = delete;
|
||||
~CallTip();
|
||||
|
||||
void PaintCT(Surface *surfaceWindow);
|
||||
|
||||
@ -53,6 +53,11 @@ public:
|
||||
LineVector() : starts(256), perLine(0) {
|
||||
Init();
|
||||
}
|
||||
// Deleted so LineVector objects can not be copied.
|
||||
LineVector(const LineVector &) = delete;
|
||||
LineVector(LineVector &&) = delete;
|
||||
LineVector &operator=(const LineVector &) = delete;
|
||||
LineVector &operator=(LineVector &&) = delete;
|
||||
~LineVector() override {
|
||||
}
|
||||
void Init() override {
|
||||
|
||||
@ -68,7 +68,9 @@ public:
|
||||
UndoHistory();
|
||||
// Deleted so UndoHistory objects can not be copied.
|
||||
UndoHistory(const UndoHistory &) = delete;
|
||||
UndoHistory(UndoHistory &&) = delete;
|
||||
void operator=(const UndoHistory &) = delete;
|
||||
void operator=(UndoHistory &&) = delete;
|
||||
~UndoHistory();
|
||||
|
||||
const char *AppendAction(actionType at, Sci::Position position, const char *data, Sci::Position lengthData, bool &startSequence, bool mayCoalesce=true);
|
||||
|
||||
@ -54,8 +54,10 @@ public:
|
||||
|
||||
EditModel();
|
||||
// Deleted so EditModel objects can not be copied.
|
||||
explicit EditModel(const EditModel &) = delete;
|
||||
EditModel(const EditModel &) = delete;
|
||||
EditModel(EditModel &&) = delete;
|
||||
EditModel &operator=(const EditModel &) = delete;
|
||||
EditModel &operator=(EditModel &&) = delete;
|
||||
virtual ~EditModel();
|
||||
virtual Sci::Line TopLineOfMain() const = 0;
|
||||
virtual Point GetVisibleOriginInMain() const = 0;
|
||||
|
||||
@ -186,8 +186,8 @@ EditView::EditView() {
|
||||
llc.SetLevel(LineLayoutCache::llcCaret);
|
||||
posCache.SetSize(0x400);
|
||||
tabArrowHeight = 4;
|
||||
customDrawTabArrow = NULL;
|
||||
customDrawWrapMarker = NULL;
|
||||
customDrawTabArrow = nullptr;
|
||||
customDrawWrapMarker = nullptr;
|
||||
}
|
||||
|
||||
EditView::~EditView() {
|
||||
@ -638,23 +638,6 @@ Range EditView::RangeDisplayLine(Surface *surface, const EditModel &model, Sci::
|
||||
return rangeSubLine;
|
||||
}
|
||||
|
||||
#ifdef NP3_MATCH_BRACE_RECT_SEL_PATCH
|
||||
|
||||
XYPOSITION EditView::EndSpaceWidth(const EditModel &model, const ViewStyle &vs, LineLayout *ll, Sci::Line line) {
|
||||
int styleEnd = ll->EndLineStyle();
|
||||
const bool bracesIgnoreStyle = ((vs.braceHighlightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACELIGHT)) ||
|
||||
(vs.braceBadLightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACEBAD)));
|
||||
if (!bracesIgnoreStyle) {
|
||||
const Sci::Position lineLastCharacter = static_cast<Sci::Position>(model.pdoc->LineEnd(line)) - 1;
|
||||
if ((lineLastCharacter == model.braces[0]) || (lineLastCharacter == model.braces[1])) {
|
||||
styleEnd = model.bracesMatchStyle;
|
||||
}
|
||||
}
|
||||
return vs.styles[styleEnd].spaceWidth;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
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;
|
||||
Sci::Line visibleLine = static_cast<int>(floor(pt.y / vs.lineHeight));
|
||||
@ -683,11 +666,7 @@ SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditMo
|
||||
return SelectionPosition(model.pdoc->MovePositionOutsideChar(positionInLine + posLineStart, 1));
|
||||
}
|
||||
if (virtualSpace) {
|
||||
#ifdef NP3_MATCH_BRACE_RECT_SEL_PATCH
|
||||
const XYPOSITION spaceWidth = EndSpaceWidth(model,vs,ll,lineDoc);
|
||||
#else
|
||||
const XYPOSITION spaceWidth = vs.styles[ll->EndLineStyle()].spaceWidth;
|
||||
#endif
|
||||
const int spaceOffset = static_cast<int>(
|
||||
(pt.x + subLineStart - ll->positions[rangeSubLine.end] + spaceWidth / 2) / spaceWidth);
|
||||
return SelectionPosition(rangeSubLine.end + posLineStart, spaceOffset);
|
||||
@ -721,11 +700,7 @@ SelectionPosition EditView::SPositionFromLineX(Surface *surface, const EditModel
|
||||
if (positionInLine < rangeSubLine.end) {
|
||||
return SelectionPosition(model.pdoc->MovePositionOutsideChar(positionInLine + posLineStart, 1));
|
||||
}
|
||||
#ifdef NP3_MATCH_BRACE_RECT_SEL_PATCH
|
||||
const XYPOSITION spaceWidth = EndSpaceWidth(model,vs,ll,lineDoc);
|
||||
#else
|
||||
const XYPOSITION spaceWidth = vs.styles[ll->EndLineStyle()].spaceWidth;
|
||||
#endif
|
||||
const int spaceOffset = static_cast<int>(
|
||||
(x + subLineStart - ll->positions[rangeSubLine.end] + spaceWidth / 2) / spaceWidth);
|
||||
return SelectionPosition(rangeSubLine.end + posLineStart, spaceOffset);
|
||||
@ -1032,7 +1007,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
|
||||
rcPlace.right = rcLine.right;
|
||||
rcPlace.left = rcPlace.right - vsDraw.aveCharWidth;
|
||||
}
|
||||
if (customDrawWrapMarker == NULL) {
|
||||
if (!customDrawWrapMarker) {
|
||||
DrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour());
|
||||
} else {
|
||||
customDrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour());
|
||||
@ -1452,7 +1427,7 @@ static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, c
|
||||
else
|
||||
rcPlace.right = rcPlace.left + vsDraw.aveCharWidth;
|
||||
|
||||
if (customDrawWrapMarker == NULL) {
|
||||
if (!customDrawWrapMarker) {
|
||||
DrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour());
|
||||
} else {
|
||||
customDrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour());
|
||||
@ -1738,10 +1713,11 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
|
||||
surface->PenColour(textFore);
|
||||
const PRectangle rcTab(rcSegment.left + 1, rcSegment.top + tabArrowHeight,
|
||||
rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent);
|
||||
if (customDrawTabArrow == NULL)
|
||||
DrawTabArrow(surface, rcTab, static_cast<int>(rcSegment.top + vsDraw.lineHeight / 2), vsDraw);
|
||||
const int segmentTop = static_cast<int>(rcSegment.top + vsDraw.lineHeight / 2);
|
||||
if (!customDrawTabArrow)
|
||||
DrawTabArrow(surface, rcTab, segmentTop, vsDraw);
|
||||
else
|
||||
customDrawTabArrow(surface, rcTab, static_cast<int>(rcSegment.top + vsDraw.lineHeight / 2));
|
||||
customDrawTabArrow(surface, rcTab, segmentTop);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -10,8 +10,6 @@
|
||||
|
||||
namespace Scintilla {
|
||||
|
||||
#undef NP3_MATCH_BRACE_RECT_SEL_PATCH
|
||||
|
||||
struct PrintParameters {
|
||||
int magnification;
|
||||
int colourMode;
|
||||
@ -94,7 +92,9 @@ public:
|
||||
EditView();
|
||||
// Deleted so EditView objects can not be copied.
|
||||
EditView(const EditView &) = delete;
|
||||
EditView(EditView &&) = delete;
|
||||
void operator=(const EditView &) = delete;
|
||||
void operator=(EditView &&) = delete;
|
||||
virtual ~EditView();
|
||||
|
||||
bool SetTwoPhaseDraw(bool twoPhaseDraw);
|
||||
@ -119,9 +119,6 @@ public:
|
||||
Point LocationFromPosition(Surface *surface, const EditModel &model, SelectionPosition pos, Sci::Line topLine,
|
||||
const ViewStyle &vs, PointEnd pe);
|
||||
Range RangeDisplayLine(Surface *surface, const EditModel &model, Sci::Line lineVisible, const ViewStyle &vs);
|
||||
#ifdef NP3_MATCH_BRACE_RECT_SEL_PATCH
|
||||
XYPOSITION EndSpaceWidth(const EditModel &model, const ViewStyle &vs, LineLayout *ll, Sci::Line line);
|
||||
#endif
|
||||
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, Sci::Line lineDoc, int x, const ViewStyle &vs);
|
||||
@ -164,8 +161,10 @@ class AutoLineLayout {
|
||||
LineLayout *ll;
|
||||
public:
|
||||
AutoLineLayout(LineLayoutCache &llc_, LineLayout *ll_) : llc(llc_), ll(ll_) {}
|
||||
explicit AutoLineLayout(const AutoLineLayout &) = delete;
|
||||
AutoLineLayout(const AutoLineLayout &) = delete;
|
||||
AutoLineLayout(AutoLineLayout &&) = delete;
|
||||
AutoLineLayout &operator=(const AutoLineLayout &) = delete;
|
||||
AutoLineLayout &operator=(AutoLineLayout &&) = delete;
|
||||
~AutoLineLayout() {
|
||||
llc.Dispose(ll);
|
||||
ll = 0;
|
||||
|
||||
@ -5167,9 +5167,6 @@ void Editor::SetBraceHighlight(Sci::Position pos0, Sci::Position pos1, int match
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
#ifdef NP3_MATCH_BRACE_RECT_SEL_PATCH
|
||||
SetRectangularRange();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Editor::SetAnnotationHeights(Sci::Line start, Sci::Line end) {
|
||||
|
||||
@ -256,8 +256,10 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
|
||||
Editor();
|
||||
// Deleted so Editor objects can not be copied.
|
||||
explicit Editor(const Editor &) = delete;
|
||||
Editor(const Editor &) = delete;
|
||||
Editor(Editor &&) = delete;
|
||||
Editor &operator=(const Editor &) = delete;
|
||||
Editor &operator=(Editor &&) = delete;
|
||||
~Editor() override;
|
||||
virtual void Initialise() = 0;
|
||||
virtual void Finalise();
|
||||
|
||||
@ -100,7 +100,7 @@ void DrawWrapMarker(Surface *surface, PRectangle rcPlace,
|
||||
|
||||
MarginView::MarginView() {
|
||||
wrapMarkerPaddingRight = 3;
|
||||
customDrawWrapMarker = NULL;
|
||||
customDrawWrapMarker = nullptr;
|
||||
}
|
||||
|
||||
void MarginView::DropGraphics(bool freeObjects) {
|
||||
@ -398,7 +398,7 @@ void MarginView::PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc,
|
||||
PRectangle rcWrapMarker = rcMarker;
|
||||
rcWrapMarker.right -= wrapMarkerPaddingRight;
|
||||
rcWrapMarker.left = rcWrapMarker.right - vs.styles[STYLE_LINENUMBER].aveCharWidth;
|
||||
if (customDrawWrapMarker == NULL) {
|
||||
if (!customDrawWrapMarker) {
|
||||
DrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore);
|
||||
} else {
|
||||
customDrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore);
|
||||
|
||||
@ -30,7 +30,9 @@ public:
|
||||
MarkerHandleSet();
|
||||
// Deleted so MarkerHandleSet objects can not be copied.
|
||||
MarkerHandleSet(const MarkerHandleSet &) = delete;
|
||||
MarkerHandleSet(MarkerHandleSet &&) = delete;
|
||||
void operator=(const MarkerHandleSet &) = delete;
|
||||
void operator=(MarkerHandleSet &&) = delete;
|
||||
~MarkerHandleSet();
|
||||
bool Empty() const noexcept;
|
||||
int MarkValue() const noexcept; ///< Bit set of marker numbers.
|
||||
@ -72,9 +74,11 @@ class LineLevels : public PerLine {
|
||||
public:
|
||||
LineLevels() {
|
||||
}
|
||||
// Deleted so Worker objects can not be copied.
|
||||
// Deleted so LineLevels objects can not be copied.
|
||||
LineLevels(const LineLevels &) = delete;
|
||||
LineLevels(LineLevels &&) = delete;
|
||||
void operator=(const LineLevels &) = delete;
|
||||
void operator=(LineLevels &&) = delete;
|
||||
~LineLevels() override;
|
||||
void Init() override;
|
||||
void InsertLine(Sci::Line line) override;
|
||||
@ -93,7 +97,9 @@ public:
|
||||
}
|
||||
// Deleted so Worker objects can not be copied.
|
||||
LineState(const LineState &) = delete;
|
||||
LineState(LineState &&) = delete;
|
||||
void operator=(const LineState &) = delete;
|
||||
void operator=(LineState &&) = delete;
|
||||
~LineState() override;
|
||||
void Init() override;
|
||||
void InsertLine(Sci::Line line) override;
|
||||
@ -111,7 +117,9 @@ public:
|
||||
}
|
||||
// Deleted so Worker objects can not be copied.
|
||||
LineAnnotation(const LineAnnotation &) = delete;
|
||||
LineAnnotation(LineAnnotation &&) = delete;
|
||||
void operator=(const LineAnnotation &) = delete;
|
||||
void operator=(LineAnnotation &&) = delete;
|
||||
~LineAnnotation() override;
|
||||
void Init() override;
|
||||
void InsertLine(Sci::Line line) override;
|
||||
@ -138,7 +146,9 @@ public:
|
||||
}
|
||||
// Deleted so Worker objects can not be copied.
|
||||
LineTabstops(const LineTabstops &) = delete;
|
||||
LineTabstops(LineTabstops &&) = delete;
|
||||
void operator=(const LineTabstops &) = delete;
|
||||
void operator=(LineTabstops &&) = delete;
|
||||
~LineTabstops() override;
|
||||
void Init() override;
|
||||
void InsertLine(Sci::Line line) override;
|
||||
|
||||
@ -77,7 +77,9 @@ public:
|
||||
explicit LineLayout(int maxLineLength_);
|
||||
// Deleted so LineLayout objects can not be copied.
|
||||
LineLayout(const LineLayout &) = delete;
|
||||
LineLayout(LineLayout &&) = delete;
|
||||
void operator=(const LineLayout &) = delete;
|
||||
void operator=(LineLayout &&) = delete;
|
||||
virtual ~LineLayout();
|
||||
void Resize(int maxLineLength_);
|
||||
void Free();
|
||||
@ -110,7 +112,9 @@ public:
|
||||
LineLayoutCache();
|
||||
// Deleted so LineLayoutCache objects can not be copied.
|
||||
LineLayoutCache(const LineLayoutCache &) = delete;
|
||||
LineLayoutCache(LineLayoutCache &&) = delete;
|
||||
void operator=(const LineLayoutCache &) = delete;
|
||||
void operator=(LineLayoutCache &&) = delete;
|
||||
virtual ~LineLayoutCache();
|
||||
void Deallocate();
|
||||
enum {
|
||||
@ -137,7 +141,9 @@ public:
|
||||
// Copy constructor not currently used, but needed for being element in std::vector.
|
||||
PositionCacheEntry(const PositionCacheEntry &);
|
||||
// Deleted so PositionCacheEntry objects can not be assigned.
|
||||
PositionCacheEntry(PositionCacheEntry &&) = delete;
|
||||
void operator=(const PositionCacheEntry &) = delete;
|
||||
void operator=(PositionCacheEntry &&) = delete;
|
||||
~PositionCacheEntry();
|
||||
void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_, unsigned int clock_);
|
||||
void Clear();
|
||||
@ -204,7 +210,9 @@ public:
|
||||
int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw);
|
||||
// Deleted so BreakFinder objects can not be copied.
|
||||
BreakFinder(const BreakFinder &) = delete;
|
||||
BreakFinder(BreakFinder &&) = delete;
|
||||
void operator=(const BreakFinder &) = delete;
|
||||
void operator=(BreakFinder &&) = delete;
|
||||
~BreakFinder();
|
||||
TextSegment Next();
|
||||
bool More() const;
|
||||
@ -218,7 +226,9 @@ public:
|
||||
PositionCache();
|
||||
// Deleted so PositionCache objects can not be copied.
|
||||
PositionCache(const PositionCache &) = delete;
|
||||
PositionCache(PositionCache &&) = delete;
|
||||
void operator=(const PositionCache &) = delete;
|
||||
void operator=(PositionCache &&) = delete;
|
||||
~PositionCache();
|
||||
void Clear();
|
||||
void SetSize(size_t size_);
|
||||
|
||||
@ -553,6 +553,11 @@ public:
|
||||
int lexLanguage;
|
||||
|
||||
explicit LexState(Document *pdoc_);
|
||||
// Deleted so LexState objects can not be copied.
|
||||
LexState(const LexState &) = delete;
|
||||
LexState(LexState &&) = delete;
|
||||
LexState &operator=(const LexState &) = delete;
|
||||
LexState &operator=(LexState &&) = delete;
|
||||
~LexState() override;
|
||||
void SetLexer(uptr_t wParam);
|
||||
void SetLexerLanguage(const char *languageName);
|
||||
|
||||
@ -53,8 +53,10 @@ protected:
|
||||
|
||||
ScintillaBase();
|
||||
// Deleted so ScintillaBase objects can not be copied.
|
||||
explicit ScintillaBase(const ScintillaBase &) = delete;
|
||||
ScintillaBase(const ScintillaBase &) = delete;
|
||||
ScintillaBase(ScintillaBase &&) = delete;
|
||||
ScintillaBase &operator=(const ScintillaBase &) = delete;
|
||||
ScintillaBase &operator=(ScintillaBase &&) = delete;
|
||||
~ScintillaBase() override;
|
||||
void Initialise() override {}
|
||||
void Finalise() override;
|
||||
|
||||
@ -18,9 +18,6 @@ private:
|
||||
std::unique_ptr<Partitioning<Sci::Position>> starts;
|
||||
std::unique_ptr<SplitVector<T>> values;
|
||||
T empty;
|
||||
// Deleted so SparseVector objects can not be copied.
|
||||
SparseVector(const SparseVector &) = delete;
|
||||
void operator=(const SparseVector &) = delete;
|
||||
void ClearValue(Sci::Position partition) {
|
||||
values->SetValueAt(partition, T());
|
||||
}
|
||||
@ -30,6 +27,11 @@ public:
|
||||
values = std::make_unique<SplitVector<T>>();
|
||||
values->InsertEmpty(0, 2);
|
||||
}
|
||||
// Deleted so SparseVector objects can not be copied.
|
||||
SparseVector(const SparseVector &) = delete;
|
||||
SparseVector(SparseVector &&) = delete;
|
||||
void operator=(const SparseVector &) = delete;
|
||||
void operator=(SparseVector &&) = delete;
|
||||
~SparseVector() {
|
||||
starts.reset();
|
||||
// starts dead here but not used by ClearValue.
|
||||
|
||||
@ -60,10 +60,10 @@ bool FontSpecification::operator<(const FontSpecification &other) const {
|
||||
}
|
||||
|
||||
FontMeasurements::FontMeasurements() {
|
||||
Clear();
|
||||
ClearMeasurements();
|
||||
}
|
||||
|
||||
void FontMeasurements::Clear() {
|
||||
void FontMeasurements::ClearMeasurements() {
|
||||
ascent = 1;
|
||||
descent = 1;
|
||||
capitalHeight = 1;
|
||||
@ -140,7 +140,7 @@ void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_,
|
||||
changeable = changeable_;
|
||||
hotspot = hotspot_;
|
||||
font.ClearFont();
|
||||
FontMeasurements::Clear();
|
||||
FontMeasurements::ClearMeasurements();
|
||||
}
|
||||
|
||||
void Style::ClearTo(const Style &source) {
|
||||
|
||||
@ -34,8 +34,10 @@ class FontAlias : public Font {
|
||||
public:
|
||||
FontAlias();
|
||||
// FontAlias objects can not be assigned except for initialization
|
||||
FontAlias &operator=(const FontAlias &) = delete;
|
||||
FontAlias(const FontAlias &);
|
||||
FontAlias(FontAlias &&) = delete;
|
||||
FontAlias &operator=(const FontAlias &) = delete;
|
||||
FontAlias &operator=(FontAlias &&) = delete;
|
||||
~FontAlias() override;
|
||||
void MakeAlias(Font &fontOrigin);
|
||||
void ClearFont();
|
||||
@ -49,7 +51,7 @@ struct FontMeasurements {
|
||||
XYPOSITION spaceWidth;
|
||||
int sizeZoomed;
|
||||
FontMeasurements();
|
||||
void Clear();
|
||||
void ClearMeasurements();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -70,8 +72,10 @@ public:
|
||||
|
||||
Style();
|
||||
Style(const Style &source);
|
||||
Style(Style &&) = delete;
|
||||
~Style();
|
||||
Style &operator=(const Style &source);
|
||||
Style &operator=(Style &&) = delete;
|
||||
void Clear(ColourDesired fore_, ColourDesired back_,
|
||||
int size_,
|
||||
const char *fontName_, int characterSet_,
|
||||
|
||||
@ -105,9 +105,8 @@ constexpr unsigned char TrailByteValue(unsigned char c) {
|
||||
|
||||
size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen) {
|
||||
size_t ui = 0;
|
||||
const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
|
||||
for (size_t i = 0; i < len;) {
|
||||
unsigned char ch = us[i];
|
||||
unsigned char ch = s[i];
|
||||
const unsigned int byteCount = UTF8BytesOfLead[ch];
|
||||
unsigned int value;
|
||||
|
||||
@ -132,26 +131,26 @@ size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen) {
|
||||
break;
|
||||
case 2:
|
||||
value = (ch & 0x1F) << 6;
|
||||
ch = us[i++];
|
||||
ch = s[i++];
|
||||
value += TrailByteValue(ch);
|
||||
tbuf[ui] = static_cast<wchar_t>(value);
|
||||
break;
|
||||
case 3:
|
||||
value = (ch & 0xF) << 12;
|
||||
ch = us[i++];
|
||||
ch = s[i++];
|
||||
value += (TrailByteValue(ch) << 6);
|
||||
ch = us[i++];
|
||||
ch = s[i++];
|
||||
value += TrailByteValue(ch);
|
||||
tbuf[ui] = static_cast<wchar_t>(value);
|
||||
break;
|
||||
default:
|
||||
// Outside the BMP so need two surrogates
|
||||
value = (ch & 0x7) << 18;
|
||||
ch = us[i++];
|
||||
ch = s[i++];
|
||||
value += TrailByteValue(ch) << 12;
|
||||
ch = us[i++];
|
||||
ch = s[i++];
|
||||
value += TrailByteValue(ch) << 6;
|
||||
ch = us[i++];
|
||||
ch = s[i++];
|
||||
value += TrailByteValue(ch);
|
||||
tbuf[ui] = static_cast<wchar_t>(((value - 0x10000) >> 10) + SURROGATE_LEAD_FIRST);
|
||||
ui++;
|
||||
@ -165,9 +164,8 @@ size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen) {
|
||||
|
||||
size_t UTF32FromUTF8(const char *s, size_t len, unsigned int *tbuf, size_t tlen) {
|
||||
size_t ui = 0;
|
||||
const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
|
||||
for (size_t i = 0; i < len;) {
|
||||
unsigned char ch = us[i];
|
||||
unsigned char ch = s[i];
|
||||
const unsigned int byteCount = UTF8BytesOfLead[ch];
|
||||
unsigned int value;
|
||||
|
||||
@ -191,23 +189,23 @@ size_t UTF32FromUTF8(const char *s, size_t len, unsigned int *tbuf, size_t tlen)
|
||||
break;
|
||||
case 2:
|
||||
value = (ch & 0x1F) << 6;
|
||||
ch = us[i++];
|
||||
ch = s[i++];
|
||||
value += TrailByteValue(ch);
|
||||
break;
|
||||
case 3:
|
||||
value = (ch & 0xF) << 12;
|
||||
ch = us[i++];
|
||||
ch = s[i++];
|
||||
value += TrailByteValue(ch) << 6;
|
||||
ch = us[i++];
|
||||
ch = s[i++];
|
||||
value += TrailByteValue(ch);
|
||||
break;
|
||||
default:
|
||||
value = (ch & 0x7) << 18;
|
||||
ch = us[i++];
|
||||
ch = s[i++];
|
||||
value += TrailByteValue(ch) << 12;
|
||||
ch = us[i++];
|
||||
ch = s[i++];
|
||||
value += TrailByteValue(ch) << 6;
|
||||
ch = us[i++];
|
||||
ch = s[i++];
|
||||
value += TrailByteValue(ch);
|
||||
break;
|
||||
}
|
||||
@ -253,14 +251,14 @@ const unsigned char UTF8BytesOfLead[256] = {
|
||||
// the non-characters *FFFE, *FFFF and FDD0 .. FDEF return 3 or 4 as they can be
|
||||
// reasonably treated as code points in some circumstances. They will, however,
|
||||
// not have associated glyphs.
|
||||
int UTF8Classify(const unsigned char *us, int len) noexcept {
|
||||
int UTF8Classify(const unsigned char *us, size_t len) noexcept {
|
||||
// For the rules: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
if (us[0] < 0x80) {
|
||||
// ASCII
|
||||
return 1;
|
||||
}
|
||||
|
||||
const int byteCount = UTF8BytesOfLead[us[0]];
|
||||
const size_t byteCount = UTF8BytesOfLead[us[0]];
|
||||
if (byteCount == 1 || byteCount > len) {
|
||||
// Invalid lead byte
|
||||
return UTF8MaskInvalid | 1;
|
||||
@ -332,19 +330,19 @@ int UTF8DrawBytes(const unsigned char *us, int len) noexcept {
|
||||
// Replace invalid bytes in UTF-8 with the replacement character
|
||||
std::string FixInvalidUTF8(const std::string &text) {
|
||||
std::string result;
|
||||
const unsigned char *us = reinterpret_cast<const unsigned char *>(text.c_str());
|
||||
const char *s = text.c_str();
|
||||
size_t remaining = text.size();
|
||||
while (remaining > 0) {
|
||||
const int utf8Status = UTF8Classify(us, static_cast<int>(remaining));
|
||||
const int utf8Status = UTF8Classify(reinterpret_cast<const unsigned char *>(s), remaining);
|
||||
if (utf8Status & UTF8MaskInvalid) {
|
||||
// Replacement character 0xFFFD = UTF8:"efbfbd".
|
||||
result.append("\xef\xbf\xbd");
|
||||
us++;
|
||||
s++;
|
||||
remaining--;
|
||||
} else {
|
||||
const int len = utf8Status&UTF8MaskWidth;
|
||||
result.append(reinterpret_cast<const char *>(us), len);
|
||||
us += len;
|
||||
const size_t len = utf8Status & UTF8MaskWidth;
|
||||
result.append(s, len);
|
||||
s += len;
|
||||
remaining -= len;
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ inline bool UTF8IsAscii(int ch) noexcept {
|
||||
}
|
||||
|
||||
enum { UTF8MaskWidth=0x7, UTF8MaskInvalid=0x8 };
|
||||
int UTF8Classify(const unsigned char *us, int len) noexcept;
|
||||
int UTF8Classify(const unsigned char *us, size_t len) noexcept;
|
||||
|
||||
// Similar to UTF8Classify but returns a length of 1 for invalid bytes
|
||||
// instead of setting the invalid flag
|
||||
|
||||
@ -32,7 +32,9 @@ public:
|
||||
FontNames();
|
||||
// FontNames objects can not be copied.
|
||||
FontNames(const FontNames &) = delete;
|
||||
FontNames(FontNames &&) = delete;
|
||||
FontNames &operator=(const FontNames &) = delete;
|
||||
FontNames &operator=(FontNames &&) = delete;
|
||||
~FontNames();
|
||||
void Clear();
|
||||
const char *Save(const char *name);
|
||||
@ -44,7 +46,9 @@ public:
|
||||
FontRealised();
|
||||
// FontRealised objects can not be copied.
|
||||
FontRealised(const FontRealised &) = delete;
|
||||
FontRealised(FontRealised &&) = delete;
|
||||
FontRealised &operator=(const FontRealised &) = delete;
|
||||
FontRealised &operator=(FontRealised &&) = delete;
|
||||
virtual ~FontRealised();
|
||||
void Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs);
|
||||
};
|
||||
@ -174,8 +178,10 @@ public:
|
||||
|
||||
ViewStyle();
|
||||
ViewStyle(const ViewStyle &source);
|
||||
ViewStyle(ViewStyle &&) = delete;
|
||||
// Can only be copied through copy constructor which ensures font names initialised correctly
|
||||
ViewStyle &operator=(const ViewStyle &) = delete;
|
||||
ViewStyle &operator=(ViewStyle &&) = delete;
|
||||
~ViewStyle();
|
||||
void CalculateMarginWidthAndMask();
|
||||
void Init(size_t stylesSize_=256);
|
||||
|
||||
@ -25,6 +25,10 @@ class XPM {
|
||||
public:
|
||||
explicit XPM(const char *textForm);
|
||||
explicit XPM(const char *const *linesForm);
|
||||
XPM(const XPM &) = delete;
|
||||
XPM(XPM &&) = delete;
|
||||
XPM &operator=(const XPM &) = delete;
|
||||
XPM &operator=(XPM &&) = delete;
|
||||
~XPM();
|
||||
void Init(const char *textForm);
|
||||
void Init(const char *const *linesForm);
|
||||
@ -50,7 +54,9 @@ public:
|
||||
explicit RGBAImage(const XPM &xpm);
|
||||
// Deleted so RGBAImage objects can not be copied.
|
||||
RGBAImage(const RGBAImage &) = delete;
|
||||
RGBAImage(RGBAImage &&) = delete;
|
||||
RGBAImage &operator=(const RGBAImage &) = delete;
|
||||
RGBAImage &operator=(RGBAImage &&) = delete;
|
||||
virtual ~RGBAImage();
|
||||
int GetHeight() const { return height; }
|
||||
int GetWidth() const { return width; }
|
||||
@ -72,6 +78,11 @@ class RGBAImageSet {
|
||||
mutable int width; ///< Memorize largest width of the set.
|
||||
public:
|
||||
RGBAImageSet();
|
||||
// Deleted so RGBAImageSet objects can not be copied.
|
||||
RGBAImageSet(const RGBAImageSet &) = delete;
|
||||
RGBAImageSet(RGBAImageSet &&) = delete;
|
||||
RGBAImageSet &operator=(const RGBAImageSet &) = delete;
|
||||
RGBAImageSet &operator=(RGBAImageSet &&) = delete;
|
||||
~RGBAImageSet();
|
||||
/// Remove all images.
|
||||
void Clear();
|
||||
|
||||
@ -857,10 +857,10 @@ void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsig
|
||||
if (rc.Width() > 0) {
|
||||
HDC hMemDC = ::CreateCompatibleDC(hdc);
|
||||
if (rc.Width() > width)
|
||||
rc.left += static_cast<int>((rc.Width() - width) / 2);
|
||||
rc.left += floor((rc.Width() - width) / 2);
|
||||
rc.right = rc.left + width;
|
||||
if (rc.Height() > height)
|
||||
rc.top += static_cast<int>((rc.Height() - height) / 2);
|
||||
rc.top += floor((rc.Height() - height) / 2);
|
||||
rc.bottom = rc.top + height;
|
||||
|
||||
const BITMAPINFO bpih = {{sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0},
|
||||
@ -1472,10 +1472,10 @@ void SurfaceD2D::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil
|
||||
void SurfaceD2D::DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) {
|
||||
if (pRenderTarget) {
|
||||
if (rc.Width() > width)
|
||||
rc.left += static_cast<int>((rc.Width() - width) / 2);
|
||||
rc.left += floor((rc.Width() - width) / 2);
|
||||
rc.right = rc.left + width;
|
||||
if (rc.Height() > height)
|
||||
rc.top += static_cast<int>((rc.Height() - height) / 2);
|
||||
rc.top += floor((rc.Height() - height) / 2);
|
||||
rc.bottom = rc.top + height;
|
||||
|
||||
std::vector<unsigned char> image(height * width * 4);
|
||||
|
||||
@ -131,7 +131,6 @@
|
||||
#define SCS_SETRECONVERTSTRING 0x00010000
|
||||
#endif
|
||||
|
||||
typedef BOOL (WINAPI *TrackMouseEventSig)(LPTRACKMOUSEEVENT);
|
||||
typedef UINT_PTR (WINAPI *SetCoalescableTimerSig)(HWND hwnd, UINT_PTR nIDEvent,
|
||||
UINT uElapse, TIMERPROC lpTimerFunc, ULONG uToleranceDelay);
|
||||
|
||||
@ -217,6 +216,11 @@ public:
|
||||
IMContext(HWND hwnd_) :
|
||||
hwnd(hwnd_), hIMC(::ImmGetContext(hwnd_)) {
|
||||
}
|
||||
// Deleted so IMContext objects can not be copied.
|
||||
IMContext(const IMContext &) = delete;
|
||||
IMContext(IMContext &&) = delete;
|
||||
IMContext &operator=(const IMContext &) = delete;
|
||||
IMContext &operator=(IMContext &&) = delete;
|
||||
~IMContext() {
|
||||
if (hIMC)
|
||||
::ImmReleaseContext(hwnd, hIMC);
|
||||
@ -284,7 +288,9 @@ class ScintillaWin :
|
||||
explicit ScintillaWin(HWND hwnd);
|
||||
// Deleted so ScintillaWin objects can not be copied.
|
||||
ScintillaWin(const ScintillaWin &) = delete;
|
||||
ScintillaWin(ScintillaWin &&) = delete;
|
||||
ScintillaWin &operator=(const ScintillaWin &) = delete;
|
||||
ScintillaWin &operator=(ScintillaWin &&) = delete;
|
||||
~ScintillaWin() override;
|
||||
|
||||
void Init();
|
||||
@ -328,7 +334,7 @@ class ScintillaWin :
|
||||
bool ValidCodePage(int codePage) const override;
|
||||
sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override;
|
||||
bool SetIdle(bool on) override;
|
||||
UINT_PTR timers[tickDwell+1];
|
||||
UINT_PTR timers[tickDwell+1] {};
|
||||
bool FineTickerRunning(TickReason reason) override;
|
||||
void FineTickerStart(TickReason reason, int millis, int tolerance) override;
|
||||
void FineTickerCancel(TickReason reason) override;
|
||||
@ -429,7 +435,7 @@ ScintillaWin::ScintillaWin(HWND hwnd) {
|
||||
|
||||
capturedMouse = false;
|
||||
trackedMouseLeave = false;
|
||||
SetCoalescableTimerFn = 0;
|
||||
SetCoalescableTimerFn = nullptr;
|
||||
|
||||
linesPerScroll = 0;
|
||||
wheelDelta = 0; // Wheel delta from roll
|
||||
@ -488,9 +494,6 @@ void ScintillaWin::Init() {
|
||||
SetCoalescableTimerFn = (SetCoalescableTimerSig)::GetProcAddress(user32, "SetCoalescableTimer");
|
||||
}
|
||||
|
||||
for (TickReason tr = tickCaret; tr <= tickDwell; tr = static_cast<TickReason>(tr + 1)) {
|
||||
timers[tr] = 0;
|
||||
}
|
||||
vs.indicators[SC_INDICATOR_UNKNOWN] = Indicator(INDIC_HIDDEN, ColourDesired(0, 0, 0xff));
|
||||
vs.indicators[SC_INDICATOR_INPUT] = Indicator(INDIC_DOTS, ColourDesired(0, 0, 0xff));
|
||||
vs.indicators[SC_INDICATOR_CONVERTED] = Indicator(INDIC_COMPOSITIONTHICK, ColourDesired(0, 0, 0xff));
|
||||
@ -2175,6 +2178,11 @@ public:
|
||||
ptr = ::GlobalLock(hand);
|
||||
}
|
||||
}
|
||||
// Deleted so GlobalMemory objects can not be copied.
|
||||
GlobalMemory(const GlobalMemory &) = delete;
|
||||
GlobalMemory(GlobalMemory &&) = delete;
|
||||
GlobalMemory &operator=(const GlobalMemory &) = delete;
|
||||
GlobalMemory &operator=(GlobalMemory &&) = delete;
|
||||
~GlobalMemory() {
|
||||
PLATFORM_ASSERT(!ptr);
|
||||
assert(!hand);
|
||||
|
||||
@ -6717,12 +6717,8 @@ void EditHideNotMarkedLineRange(HWND hwnd, DocPos iStartPos, DocPos iEndPos, boo
|
||||
IgnoreNotifyChangeEvent();
|
||||
SciCall_MarkerDeleteAll(MARKER_NP3_OCCUR_LINE);
|
||||
if (!g_bCodeFoldingAvailable) { SciCall_SetProperty("fold", "0"); }
|
||||
//DocLn const iLnCount = SciCall_GetLineCount();
|
||||
//for (DocLn iLine = 0; iLine < iLnCount; ++iLine) {
|
||||
// if ((SciCall_GetFoldLevel(iLine) & SC_FOLDLEVELNUMBERMASK) != SC_FOLDLEVELBASE) {
|
||||
// SciCall_SetFoldLevel(iLine, SC_FOLDLEVELBASE);
|
||||
// }
|
||||
//}
|
||||
DocLn const iLnCount = SciCall_GetLineCount();
|
||||
for (DocLn iLine = 0; iLine < iLnCount; ++iLine) { SciCall_SetFoldLevel(iLine, SC_FOLDLEVELBASE); }
|
||||
SciCall_SetFoldFlags(0);
|
||||
Style_SetFolding(hwnd, g_bCodeFoldingAvailable && g_bShowCodeFolding);
|
||||
EditApplyLexerStyle(hwnd, 0, -1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user