Changeset 43328 in vbox
- Timestamp:
- Sep 14, 2012 12:39:54 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/VBoxDbgConsole.cpp
r43324 r43328 183 183 Assert(m_hGUIThread == RTThreadNativeSelf()); 184 184 185 QString command = currentText();185 QString strCommand = currentText(); 186 186 /* TODO: trim whitespace? */ 187 if ( command.isEmpty()) {187 if (strCommand.isEmpty()) 188 188 return; 189 }190 189 191 190 /* deal with the current command. */ 192 emit commandSubmitted( command);191 emit commandSubmitted(strCommand); 193 192 194 193 … … 196 195 * Add current command to history. 197 196 */ 198 bool needsAppending = true;197 bool fNeedsAppending = true; 199 198 200 199 /* invariant: empty line at the end */ 201 int lastItem = count() - 1;202 Assert(itemText( lastItem).isEmpty());200 int iLastItem = count() - 1; 201 Assert(itemText(iLastItem).isEmpty()); 203 202 204 203 /* have previous command? check duplicate. */ 205 if (lastItem > 0) { 206 const QString prevCommand(itemText(lastItem - 1)); 207 if (command == prevCommand) { 208 needsAppending = false; 204 if (iLastItem > 0) 205 { 206 const QString strPrevCommand(itemText(iLastItem - 1)); 207 if (strCommand == strPrevCommand) 208 fNeedsAppending = false; 209 } 210 211 if (fNeedsAppending) 212 { 213 /* history full? drop the oldest command. */ 214 if (count() == maxCount()) 215 { 216 removeItem(0); 217 --iLastItem; 209 218 } 210 }211 212 if (needsAppending) {213 /* history full? drop the oldest command. */214 if (count() == maxCount()) {215 removeItem(0);216 --lastItem;217 }218 219 219 220 /* insert before the empty line. */ 220 insertItem( lastItem, command);221 insertItem(iLastItem, strCommand); 221 222 } 222 223 223 224 /* invariant: empty line at the end */ 224 int newLastItem = count() - 1;225 Assert(itemText( newLastItem).isEmpty());225 int iNewLastItem = count() - 1; 226 Assert(itemText(iNewLastItem).isEmpty()); 226 227 227 228 /* select empty line to present "new" command line to the user */ 228 setCurrentIndex( newLastItem);229 setCurrentIndex(iNewLastItem); 229 230 } 230 231
Note:
See TracChangeset
for help on using the changeset viewer.