Skip to content

Commit

Permalink
Merge pull request #453 from RaiKoHoff/BugFixes_RC_II
Browse files Browse the repository at this point in the history
Bugfixes RC II
  • Loading branch information
rizonesoft authored Apr 21, 2018
2 parents f79de72 + 035278f commit 5bca5b1
Show file tree
Hide file tree
Showing 27 changed files with 279 additions and 247 deletions.
Binary file modified Build/Notepad3.ini
Binary file not shown.
8 changes: 4 additions & 4 deletions scintilla/include/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Point {
XYPOSITION x;
XYPOSITION y;

explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) : x(x_), y(y_) {
constexpr explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) : x(x_), y(y_) {
}

static Point FromInts(int x_, int y_) {
Expand Down Expand Up @@ -217,15 +217,15 @@ class ColourDesired {
return co;
}

unsigned int GetRed() const {
unsigned char GetRed() const {
return co & 0xff;
}

unsigned int GetGreen() const {
unsigned char GetGreen() const {
return (co >> 8) & 0xff;
}

unsigned int GetBlue() const {
unsigned char GetBlue() const {
return (co >> 16) & 0xff;
}
};
Expand Down
4 changes: 2 additions & 2 deletions scintilla/lexers/LexHTML.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ inline bool IsOperator(int ch) {
static void GetTextSegment(Accessor &styler, Sci_PositionU start, Sci_PositionU end, char *s, size_t len) {
Sci_PositionU i = 0;
for (; (i < end - start + 1) && (i < len-1); i++) {
s[i] = static_cast<char>(MakeLowerCase(styler[start + i]));
s[i] = MakeLowerCase(styler[start + i]);
}
s[i] = '\0';
}
Expand Down Expand Up @@ -267,7 +267,7 @@ static int classifyTagHTML(Sci_PositionU start, Sci_PositionU end,
for (Sci_PositionU cPos = start; cPos <= end && i < 30; cPos++) {
char ch = styler[cPos];
if ((ch != '<') && (ch != '/')) {
withSpace[i++] = caseSensitive ? ch : static_cast<char>(MakeLowerCase(ch));
withSpace[i++] = caseSensitive ? ch : MakeLowerCase(ch);
}
}

Expand Down
8 changes: 4 additions & 4 deletions scintilla/lexlib/CharacterSet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace Scintilla {
int CompareCaseInsensitive(const char *a, const char *b) {
while (*a && *b) {
if (*a != *b) {
const char upperA = static_cast<char>(MakeUpperCase(*a));
const char upperB = static_cast<char>(MakeUpperCase(*b));
const char upperA = MakeUpperCase(*a);
const char upperB = MakeUpperCase(*b);
if (upperA != upperB)
return upperA - upperB;
}
Expand All @@ -33,8 +33,8 @@ int CompareCaseInsensitive(const char *a, const char *b) {
int CompareNCaseInsensitive(const char *a, const char *b, size_t len) {
while (*a && *b && len) {
if (*a != *b) {
const char upperA = static_cast<char>(MakeUpperCase(*a));
const char upperB = static_cast<char>(MakeUpperCase(*b));
const char upperA = MakeUpperCase(*a);
const char upperB = MakeUpperCase(*b);
if (upperA != upperB)
return upperA - upperB;
}
Expand Down
10 changes: 6 additions & 4 deletions scintilla/lexlib/CharacterSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,18 @@ inline bool isoperator(int ch) {
return false;
}

// Simple case functions for ASCII.
// Simple case functions for ASCII supersets.

inline int MakeUpperCase(int ch) {
template <typename T>
inline T MakeUpperCase(T ch) {
if (ch < 'a' || ch > 'z')
return ch;
else
return static_cast<char>(ch - 'a' + 'A');
return ch - 'a' + 'A';
}

inline int MakeLowerCase(int ch) {
template <typename T>
inline T MakeLowerCase(T ch) {
if (ch < 'A' || ch > 'Z')
return ch;
else
Expand Down
10 changes: 5 additions & 5 deletions scintilla/src/AutoComplete.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ AutoComplete::~AutoComplete() {
}
}

bool AutoComplete::Active() const {
bool AutoComplete::Active() const noexcept {
return active;
}

Expand All @@ -70,31 +70,31 @@ void AutoComplete::SetStopChars(const char *stopChars_) {
stopChars = stopChars_;
}

bool AutoComplete::IsStopChar(char ch) {
bool AutoComplete::IsStopChar(char ch) const noexcept {
return ch && (stopChars.find(ch) != std::string::npos);
}

void AutoComplete::SetFillUpChars(const char *fillUpChars_) {
fillUpChars = fillUpChars_;
}

bool AutoComplete::IsFillUpChar(char ch) {
bool AutoComplete::IsFillUpChar(char ch) const noexcept {
return ch && (fillUpChars.find(ch) != std::string::npos);
}

void AutoComplete::SetSeparator(char separator_) {
separator = separator_;
}

char AutoComplete::GetSeparator() const {
char AutoComplete::GetSeparator() const noexcept {
return separator;
}

void AutoComplete::SetTypesep(char separator_) {
typesep = separator_;
}

char AutoComplete::GetTypesep() const {
char AutoComplete::GetTypesep() const noexcept {
return typesep;
}

Expand Down
10 changes: 5 additions & 5 deletions scintilla/src/AutoComplete.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,27 @@ class AutoComplete {
~AutoComplete();

/// Is the auto completion list displayed?
bool Active() const;
bool Active() const noexcept;

/// Display the auto completion list positioned to be near a character position
void Start(Window &parent, int ctrlID, Sci::Position position, Point location,
Sci::Position startLen_, int lineHeight, bool unicodeMode, int technology);

/// The stop chars are characters which, when typed, cause the auto completion list to disappear
void SetStopChars(const char *stopChars_);
bool IsStopChar(char ch);
bool IsStopChar(char ch) const noexcept;

/// The fillup chars are characters which, when typed, fill up the selected word
void SetFillUpChars(const char *fillUpChars_);
bool IsFillUpChar(char ch);
bool IsFillUpChar(char ch) const noexcept;

/// The separator character is used when interpreting the list in SetList
void SetSeparator(char separator_);
char GetSeparator() const;
char GetSeparator() const noexcept;

/// The typesep character is used for separating the word from the type
void SetTypesep(char separator_);
char GetTypesep() const;
char GetTypesep() const noexcept;

/// The list string contains a sequence of words separated by the separator character
void SetList(const char *list);
Expand Down
19 changes: 7 additions & 12 deletions scintilla/src/CallTip.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>

#include <stdexcept>
#include <string>
Expand Down Expand Up @@ -150,7 +151,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
} else if (IsTabCharacter(s[startSeg])) {
xEnd = NextTabPos(x);
} else {
xEnd = x + RoundXYPosition(surface->WidthText(font, s + startSeg, endSeg - startSeg));
xEnd = x + static_cast<int>(lround(surface->WidthText(font, s + startSeg, endSeg - startSeg)));
if (draw) {
rcClient.left = static_cast<XYPOSITION>(x);
rcClient.right = static_cast<XYPOSITION>(xEnd);
Expand All @@ -172,7 +173,7 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1);

// To make a nice small call tip window, it is only sized to fit most normal characters without accents
const int ascent = RoundXYPosition(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font));
const int ascent = static_cast<int>(lround(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font)));

// For each line...
// Draw the definition in three parts: before highlight, highlighted, after highlight
Expand All @@ -184,7 +185,7 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {

while (moreChunks) {
const char *chunkEnd = strchr(chunkVal, '\n');
if (chunkEnd == NULL) {
if (!chunkEnd) {
chunkEnd = chunkVal + strlen(chunkVal);
moreChunks = false;
}
Expand Down Expand Up @@ -253,7 +254,7 @@ void CallTip::MouseClick(Point pt) {
PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn,
const char *faceName, int size,
int codePage_, int characterSet,
int technology, Window &wParent) {
int technology, const Window &wParent) {
clickPlace = 0;
val = defn;
codePage = codePage_;
Expand All @@ -270,18 +271,12 @@ PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, co
font.Create(fp);
// Look for multiple lines in the text
// Only support \n here - simply means container must avoid \r!
int numLines = 1;
const char *newline;
const char *look = val.c_str();
const int numLines = 1 + static_cast<int>(std::count(val.begin(), val.end(), '\n'));
rectUp = PRectangle(0,0,0,0);
rectDown = PRectangle(0,0,0,0);
offsetMain = insetX; // changed to right edge of any arrows
const int width = PaintContents(surfaceMeasure.get(), false) + insetX;
while ((newline = strchr(look, '\n')) != NULL) {
look = newline + 1;
numLines++;
}
lineHeight = RoundXYPosition(surfaceMeasure->Height(font));
lineHeight = static_cast<int>(lround(surfaceMeasure->Height(font)));

// The returned
// rectangle is aligned to the right edge of the last arrow encountered in
Expand Down
2 changes: 1 addition & 1 deletion scintilla/src/CallTip.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class CallTip {
/// Setup the calltip and return a rectangle of the area required.
PRectangle CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn,
const char *faceName, int size, int codePage_,
int characterSet, int technology, Window &wParent);
int characterSet, int technology, const Window &wParent);

void CallTipCancel();

Expand Down
3 changes: 2 additions & 1 deletion scintilla/src/ContractionState.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ bool ContractionState<LINE>::SetFoldDisplayText(Sci::Line lineDoc, const char *t
EnsureData();
const char *foldText = foldDisplayTexts->ValueAt(lineDoc).get();
if (!foldText || !text || 0 != strcmp(text, foldText)) {
foldDisplayTexts->SetValueAt(lineDoc, UniqueStringCopy(text));
UniqueString uns = UniqueStringCopy(text);
foldDisplayTexts->SetValueAt(lineDoc, std::move(uns));
Check();
return true;
} else {
Expand Down
Loading

0 comments on commit 5bca5b1

Please sign in to comment.