Merge pull request #49 from marcel303/fixedKeyMappings
Use GetKeyIndex for Z, Y, C, V and X keys..
diff --git a/TextEditor.cpp b/TextEditor.cpp
index c66ef9f..73b12b7 100644
--- a/TextEditor.cpp
+++ b/TextEditor.cpp
@@ -262,7 +262,7 @@
// First we find the hovered column coord.
while ( mTextStart + cumulatedStringWidth[0] < local.x &&
- columnCoord < line.size())
+ (size_t)columnCoord < line.size())
{
cumulatedStringWidth[1] = cumulatedStringWidth[0];
cumulatedString += line[columnCoord].mChar;
@@ -273,7 +273,7 @@
// Then we reduce by 1 column coord if cursor is on the left side of the hovered column.
if( mTextStart + cumulatedStringWidth[0] - columnWidth / 2.0f > local.x)
- columnCoord = std::max(0, --columnCoord);
+ columnCoord = std::max(0, columnCoord - 1);
}
return SanitizeCoordinates(Coordinates(lineNo, columnCoord));
@@ -337,7 +337,7 @@
{
assert(!mReadOnly);
assert(aEnd >= aStart);
- assert(mLines.size() > aEnd - aStart);
+ assert(mLines.size() > (size_t)(aEnd - aStart));
ErrorMarkers etmp;
for (auto& i : mErrorMarkers)
@@ -1027,7 +1027,7 @@
case TextEditor::SelectionMode::Line:
{
const auto lineNo = mState.mSelectionEnd.mLine;
- const auto lineSize = lineNo < mLines.size() ? mLines[lineNo].size() : 0;
+ const auto lineSize = (size_t)lineNo < mLines.size() ? mLines[lineNo].size() : 0;
mState.mSelectionStart = Coordinates(mState.mSelectionStart.mLine, 0);
mState.mSelectionEnd = Coordinates(lineNo, (int) lineSize);
break;
@@ -1755,7 +1755,7 @@
preproc = true;
}
- for (int j = 0; j < token_length; ++j)
+ for (size_t j = 0; j < token_length; ++j)
line[(token_begin - bufferBegin) + j].mColorIndex = token_color;
first = token_end;
@@ -2202,6 +2202,8 @@
static bool TokenizeCStylePunctuation(const char * in_begin, const char * in_end, const char *& out_begin, const char *& out_end)
{
+ (void)in_end;
+
switch (*in_begin)
{
case '[':