diff --git a/ext/texteditor/TextEditor.cpp b/ext/texteditor/TextEditor.cpp index 1f009c4..085e854 100644 --- a/ext/texteditor/TextEditor.cpp +++ b/ext/texteditor/TextEditor.cpp @@ -767,7 +767,7 @@ void TextEditor::HandleKeyboardInputs() EnterCharacter('\n', false); else if (!IsReadOnly() && !ctrl && !alt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Tab))) { EnterCharacter('\t', shift); - } + } if (!IsReadOnly() && !io.InputQueueCharacters.empty()) { @@ -1871,15 +1871,16 @@ void TextEditor::Backspace() auto& line = mLines[mState.mCursorPosition.mLine]; auto cindex = GetCharacterIndex(pos) - 1; auto cend = cindex + 1; - while (cindex > 0 && IsUTFSequence(line[cindex].mChar)) + while (cindex > 0 && IsUTFSequence(line[cindex].mChar)) { --cindex; + } //if (cindex > 0 && UTF8CharLength(line[cindex].mChar) > 1) // --cindex; u.mRemovedStart = u.mRemovedEnd = GetActualCursorCoordinates(); --u.mRemovedStart.mColumn; - --mState.mCursorPosition.mColumn; + mState.mCursorPosition.mColumn = GetCharacterColumn(mState.mCursorPosition.mLine, cindex); while (cindex < line.size() && cend-- > cindex) {