Skip to content

Commit

Permalink
Of course i messed cancel stuff up.
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSaiyajinStackZ committed Jun 27, 2021
1 parent 19473c7 commit 4a964f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion source/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ size_t Common::Numpad(const std::string &Text, const size_t CurVal, const size_t
SwkbdButton Ret = swkbdInputText(&State, Input, sizeof(Input));
Input[Length] = '\0';

if (Ret != SWKBD_BUTTON_CONFIRM) return CurVal;

if (Input[0] < '0' || Input[0] > '9') return CurVal; // Because citra allows you to enter actual characters for dumb reasons.
size_t Num = std::min<size_t>(std::stoi(Input), MaxVal);

if (Num < MinVal) Num = MinVal; // If smaller than MinVal, set to MinVal.
return (Ret == SWKBD_BUTTON_CONFIRM ? Num : CurVal);
return Num;
};

std::string Common::Keyboard(const std::string &Text, const std::string &CurStr, const int Length) {
Expand Down
2 changes: 1 addition & 1 deletion source/Components/Utils/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void Utils::JumpTo() {

const size_t Line = Common::Numpad(Common::GetStr("ENTER_LINE_TO_JUMP"), TextEditor::CurrentLine, 1, UniversalEdit::UE->CurrentFile->GetLines(), Digits);

if (Line <= UniversalEdit::UE->CurrentFile->GetLines()) {
if (Line <= UniversalEdit::UE->CurrentFile->GetLines() && Line > 0) {
TextEditor::CursorPos = 0;
TextEditor::CurrentLine = Line - 1;
TextEditor::JumpScroll();
Expand Down

0 comments on commit 4a964f0

Please sign in to comment.