mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/code] Use textLength in VarBoxController::insertTextInCaller
This commit is contained in:
@@ -14,9 +14,10 @@ extern "C" {
|
||||
#include "py/nlr.h"
|
||||
}
|
||||
|
||||
|
||||
namespace Code {
|
||||
|
||||
static inline int minInt(int x, int y) { return x < y ? x : y; }
|
||||
|
||||
VariableBoxController::VariableBoxController(ScriptStore * scriptStore) :
|
||||
NestedMenuController(nullptr, I18n::Message::FunctionsAndVariables),
|
||||
m_scriptStore(scriptStore),
|
||||
@@ -369,10 +370,10 @@ bool VariableBoxController::selectLeaf(int rowIndex) {
|
||||
}
|
||||
|
||||
void VariableBoxController::insertTextInCaller(const char * text, int textLength) {
|
||||
int commandBufferMaxSize = strlen(text)+1;
|
||||
int textLen = textLength < 0 ? strlen(text) : textLength;
|
||||
int commandBufferMaxSize = minInt(k_maxScriptObjectNameSize, textLen + 1);
|
||||
char commandBuffer[k_maxScriptObjectNameSize];
|
||||
assert(commandBufferMaxSize <= k_maxScriptObjectNameSize);
|
||||
Shared::ToolboxHelpers::TextToInsertForCommandText(text, textLength, commandBuffer, commandBufferMaxSize, true);
|
||||
Shared::ToolboxHelpers::TextToInsertForCommandText(text, textLen, commandBuffer, commandBufferMaxSize, true);
|
||||
sender()->handleEventWithText(commandBuffer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user