|
|
|
@ -28,7 +28,7 @@ std::pair<size_t, size_t> getLine(std::string text, int findLine) {
@@ -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)); |
|
|
|
@ -190,12 +190,12 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
@@ -190,12 +190,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(0, 1); |
|
|
|
@ -221,11 +221,11 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
@@ -221,11 +221,11 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
|
|
|
|
|
} 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; |
|
|
|
|