MCPcopy Create free account
hub / github.com/crossuo/crossuo / Insert

Method Insert

src/TextEngine/EntryText.cpp:165–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165bool CEntryText::Insert(char16_t ch, CGump *gump)
166{
167 if (m_Position < 0)
168 {
169 m_Position = 0;
170 }
171
172 if (m_Position > (int)WText.length())
173 {
174 m_Position = (int)WText.length();
175 }
176
177 if (MaxLength > 0)
178 {
179 if (NumberOnly)
180 {
181 auto str = WText;
182 str.insert(str.begin() + m_Position, ch);
183 if (str_to_int(str) >= MaxLength)
184 {
185 return false;
186 }
187 }
188 else if ((int)WText.length() >= MaxLength)
189 {
190 return false;
191 }
192 }
193
194 WText.insert(WText.begin() + m_Position, ch);
195 m_Position++;
196 Changed = true;
197 if (gump != nullptr)
198 {
199 gump->FrameCreated = false;
200 }
201
202 return true;
203}
204
205void CEntryText::Remove(bool left, CGump *gump)
206{

Callers 15

AddMultiObjectMethod · 0.45
OnTextInputMethod · 0.45
OnTextInputMethod · 0.45
SetAccountingMethod · 0.45
PasteMethod · 0.45
OnTextInputMethod · 0.45
LoadMethod · 0.45
OnTextInputMethod · 0.45
OnTextInputMethod · 0.45
OnTextInputMethod · 0.45
OnTextInputMethod · 0.45
OnKeyDownMethod · 0.45

Calls 4

str_to_intFunction · 0.85
lengthMethod · 0.80
insertMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected