| 302 | } |
| 303 | |
| 304 | void LuaConsoleDock::runCurrentCommand() |
| 305 | { |
| 306 | int prevLastLine = output->lineCount(); |
| 307 | int newLastLine = 0; |
| 308 | |
| 309 | Sci_TextRange tr; |
| 310 | tr.chrg.cpMin = 0; |
| 311 | tr.chrg.cpMax = input->length(); |
| 312 | tr.lpstrText = new char[2 * (tr.chrg.cpMax - tr.chrg.cpMin) + 2]; // See documentation |
| 313 | input->send(SCI_GETSTYLEDTEXT, 0, (sptr_t) &tr); |
| 314 | |
| 315 | output->documentEnd(); |
| 316 | output->setReadOnly(false); |
| 317 | output->addStyledText(2 * (tr.chrg.cpMax - tr.chrg.cpMin), tr.lpstrText); |
| 318 | |
| 319 | writeToOutput("\r\n"); |
| 320 | |
| 321 | delete[] tr.lpstrText; |
| 322 | |
| 323 | newLastLine = output->lineCount(); |
| 324 | |
| 325 | for (int i = prevLastLine; i < newLastLine; ++i) { |
| 326 | output->marginSetText(i - 1, ">"); |
| 327 | output->marginSetStyle(i - 1, STYLE_LINENUMBER); |
| 328 | } |
| 329 | |
| 330 | QString text((const char *)input->characterPointer()); |
| 331 | historyAdd(text); |
| 332 | |
| 333 | input->clearAll(); |
| 334 | input->emptyUndoBuffer(); |
| 335 | input->marginSetText(0, ">"); |
| 336 | input->marginSetStyle(0, STYLE_LINENUMBER); |
| 337 | |
| 338 | LuaExtension::Instance().OnExecute(text.toLatin1().constData()); |
| 339 | } |
| 340 | |
| 341 | bool LuaConsoleDock::eventFilter(QObject *obj, QEvent *event) |
| 342 | { |