| 230 | } |
| 231 | |
| 232 | void 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 | |
| 267 | void GuiTextEditCtrl::getText( char *dest ) |
| 268 | { |