Browse Source

gcc linux fixes, use -Wno-strict-overflow

master
Odilitime 4 years ago
parent
commit
531bbd9bda

+ 5
- 5
src/graphics/components/DocumentComponent.cpp View File

@@ -28,7 +28,7 @@ std::pair<size_t, size_t> getLine(std::string text, int findLine) {
while(pos != std::string::npos) {
lPos = pos;
pos = text.find("\r", lPos + 1);
if (line == findLine) {
if (line == static_cast<unsigned int>(findLine)) {
//std::cout << "lPos: " << lPos << " pos: " << pos << " line: " << line << std::endl;
//std::cout << "DocumentComponent.getLine start " << (lPos + line + 1) << " end " << (pos == std::string::npos ? text.length() : (lPos + pos)) << std::endl;
return std::make_pair(lPos + line + 1, pos == std::string::npos ? text.length() : (lPos + pos));
@@ -187,12 +187,12 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
//std::pair<int, int> lineData = getLine(focusedInputComponent->value, 0);
focusedInputComponent->cursorCharY++;
size_t lines = getNumberOfLines(focusedInputComponent->getValue());
if (focusedInputComponent->cursorCharY > lines) {
if (focusedInputComponent->cursorCharY > static_cast<int>(lines)) {
focusedInputComponent->cursorCharY = lines;
focusedInputComponent->cursorCharX = focusedInputComponent->getValue().length();
}
} else {
focusedInputComponent->cursorCharX = static_cast<size_t>(focusedInputComponent->getValue().size());
focusedInputComponent->cursorCharX = focusedInputComponent->getValue().size();
}
focusedInputComponent->updateCursor();
} else if (key == GLFW_KEY_LEFT) {
@@ -214,11 +214,11 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
focusedInputComponent->updateCursor();
} else if (key == GLFW_KEY_RIGHT) {
focusedInputComponent->cursorCharX++;
if (focusedInputComponent->cursorCharX > focusedInputComponent->getValue().size()) {
if (focusedInputComponent->cursorCharX > static_cast<int>(focusedInputComponent->getValue().size())) {
if (focusedInputComponent->multiLine) {
focusedInputComponent->cursorCharY++;
size_t lines = getNumberOfLines(focusedInputComponent->getValue());
if (focusedInputComponent->cursorCharY > lines) {
if (focusedInputComponent->cursorCharY > static_cast<int>(lines)) {
focusedInputComponent->cursorCharY = lines;
} else {;
focusedInputComponent->cursorCharX = 0;

+ 1
- 0
src/graphics/components/DocumentComponent.h View File

@@ -11,6 +11,7 @@
#include "../../WebResource.h"

std::pair<size_t, size_t> getLine(std::string text, int findLine);
size_t getNumberOfLines(std::string text);

// document is scrollable until multicomponent
class DocumentComponent : public MultiComponent {

+ 3
- 3
src/graphics/components/InputComponent.cpp View File

@@ -27,11 +27,11 @@ void TextBlock::delLastChar() {
}
}

void insertCharAt(char chr, size_t pos) {
void TextBlock::insertCharAt(char chr, size_t pos) {
}

void delCharAt(size_t pos) {
void TextBlock::delCharAt(size_t pos) {
}

@@ -363,7 +363,7 @@ void InputComponent::updateCursor() {
//std::cout << "InputComponent::updateCursor - text[" << this->value << "]" << std::endl;
std::pair<int, int> lineData = getLine(this->value, this->cursorCharY);
std::cout << "InputComponent::updateCursor - line " << this->cursorCharY << " starts at " << lineData.first << std::endl;
size_t pos = lineData.first + this->cursorCharX;
size_t pos = static_cast<size_t>(lineData.first + this->cursorCharX);
//std::cout << "InputComponent::updateCursor - cx " << this->cursorCharX << " starts at value pos " << pos << std::endl;

if (pos < this->value.size()) {

+ 4
- 1
src/graphics/opengl/Window.cpp View File

@@ -507,7 +507,7 @@ bool Window::initGLFW() {
if (action == GLFW_RELEASE || action == GLFW_REPEAT) {
if (key == GLFW_KEY_V && action == GLFW_RELEASE && mods == attentionMod) {
const char* clipBoard = glfwGetClipboardString(thiz->window);
for(int i=0; i < strlen(clipBoard); i++) {
for(unsigned int i=0; i < strlen(clipBoard); i++) {
inputComponent->addChar(clipBoard[i]);
}
//inputComponent->setValue(std::string(clipBoard));
@@ -545,6 +545,9 @@ bool Window::initGLFW() {
case GLFW_KEY_RIGHT_BRACKET: key='}'; break;
case GLFW_KEY_GRAVE_ACCENT: key='~'; break;
case GLFW_KEY_0: key=')'; break;
default:
// a key we don't care about atm
break;
}
} else {
// no shift or caplocks

Loading…
Cancel
Save