mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Some code hardening in TextEdit view
This commit is contained in:
1 parent
f38c851383
commit
bfadd2539b
4 files changed
+10
-7
No files matched your search
@@ -1311,6 +1311,10 @@ void TextEdit::Draw(UIContext &dc) {
|
||||
}
|
||||
selectAtX_ = -1;
|
||||
}
|
||||
if (caret_ < 0 || caret_ > text_.size()) {
|
||||
ERROR_LOG(Log::UI, "Caret position out of bounds: %d (text length %d)", caret_, (int)text_.size());
|
||||
caret_ = (int)text_.size();
|
||||
}
|
||||
|
||||
dc.PopScissor();
|
||||
}
|
||||
@@ -1501,6 +1505,7 @@ bool TextEdit::Key(const KeyInput &input) {
|
||||
}
|
||||
|
||||
void TextEdit::InsertAtCaret(const char *text) {
|
||||
_dbg_assert_(caret_ >= 0 && caret_ <= (int)text_.size());
|
||||
size_t len = strlen(text);
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
text_.insert(text_.begin() + caret_, text[i]);
|
||||
|
||||
+1
-1
@@ -1342,7 +1342,7 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
|
||||
|
||||
void UpdateTextFocus() {
|
||||
if (g_textFocusChanged) {
|
||||
INFO_LOG(Log::System, "Updating text focus: %d", g_textFocus);
|
||||
DEBUG_LOG(Log::System, "Updating text focus: %d", g_textFocus);
|
||||
if (g_textFocus) {
|
||||
SDL_StartTextInput();
|
||||
} else {
|
||||
|
||||
@@ -242,7 +242,10 @@ void DeveloperToolsScreen::CreateTestsTab(UI::LinearLayout *list) {
|
||||
using namespace UI;
|
||||
auto dev = GetI18NCategory(I18NCat::DEVELOPER);
|
||||
|
||||
list->Add(new Choice(dev->T("Touchscreen Test")))->OnClick.Handle(this, &DeveloperToolsScreen::OnTouchscreenTest);
|
||||
list->Add(new Choice(dev->T("Touchscreen Test")))->OnClick.Add([this](UI::EventParams &e) {
|
||||
screenManager()->push(new TouchTestScreen(gamePath_));
|
||||
// Handle touchscreen test event
|
||||
});
|
||||
// list->Add(new Choice(dev->T("Memstick Test")))->OnClick.Handle(this, &DeveloperToolsScreen::OnMemstickTest);
|
||||
Choice *frameDumpTests = list->Add(new Choice(dev->T("Framedump tests")));
|
||||
frameDumpTests->OnClick.Add([this](UI::EventParams &e) {
|
||||
@@ -705,10 +708,6 @@ void DeveloperToolsScreen::OnGPUDriverTest(UI::EventParams &e) {
|
||||
screenManager()->push(new GPUDriverTestScreen());
|
||||
}
|
||||
|
||||
void DeveloperToolsScreen::OnTouchscreenTest(UI::EventParams &e) {
|
||||
screenManager()->push(new TouchTestScreen(gamePath_));
|
||||
}
|
||||
|
||||
void DeveloperToolsScreen::OnJitAffectingSetting(UI::EventParams &e) {
|
||||
System_PostUIMessage(UIMessage::REQUEST_CLEAR_JIT);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ private:
|
||||
void OnMIPSTracerClearTracer(UI::EventParams &e);
|
||||
void OnGPUDriverTest(UI::EventParams &e);
|
||||
void OnMemstickTest(UI::EventParams &e);
|
||||
void OnTouchscreenTest(UI::EventParams &e);
|
||||
void OnCopyStatesToRoot(UI::EventParams &e);
|
||||
|
||||
void MemoryMapTest();
|
||||
|
||||
Reference in new issue
Block a user