MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / updateHistory

Method updateHistory

Engine/source/gui/controls/guiTextEditCtrl.cpp:232–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232void GuiTextEditCtrl::updateHistory( StringBuffer *inTxt, bool moveIndex )
233{
234 if(!mHistorySize)
235 return;
236
237 const UTF16* txt = inTxt->getPtr();
238
239 // Reject empty strings.
240
241 if( !txt || !txt[ 0 ] )
242 return;
243
244 // see if it's already in
245 if(mHistoryLast == -1 || String::compare(txt, mHistoryBuf[mHistoryLast]))
246 {
247 if(mHistoryLast == mHistorySize-1) // we're at the history limit... shuffle the pointers around:
248 {
249 UTF16 *first = mHistoryBuf[0];
250 for(U32 i = 0; i < mHistorySize - 1; i++)
251 mHistoryBuf[i] = mHistoryBuf[i+1];
252 mHistoryBuf[mHistorySize-1] = first;
253 if(mHistoryIndex > 0)
254 mHistoryIndex--;
255 }
256 else
257 mHistoryLast++;
258
259 inTxt->getCopy(mHistoryBuf[mHistoryLast], GuiTextCtrl::MAX_STRING_LENGTH);
260 mHistoryBuf[mHistoryLast][GuiTextCtrl::MAX_STRING_LENGTH] = '\0';
261 }
262
263 if(moveIndex)
264 mHistoryIndex = mHistoryLast + 1;
265}
266
267void GuiTextEditCtrl::getText( char *dest )
268{

Callers

nothing calls this directly

Calls 3

compareFunction · 0.85
getPtrMethod · 0.45
getCopyMethod · 0.45

Tested by

no test coverage detected