大文本只读模式下,显示其文本
| 1344 | |
| 1345 | //大文本只读模式下,显示其文本 |
| 1346 | void ScintillaEditView::showBigTextRoLineNum(BigTextEditFileMgr* txtFile, int blockIndex) |
| 1347 | { |
| 1348 | |
| 1349 | BlockIndex bi = txtFile->blocks.at(blockIndex); |
| 1350 | |
| 1351 | int nbDigits = 0; |
| 1352 | |
| 1353 | if (bi.fileOffset < 0xffffffff) |
| 1354 | { |
| 1355 | nbDigits = INIT_BIG_RO_TEXT_LINE_WIDTH; |
| 1356 | } |
| 1357 | else |
| 1358 | { |
| 1359 | nbDigits = 12; |
| 1360 | } |
| 1361 | char* lineString = new char[17]; |
| 1362 | memset(lineString, 0, 17); |
| 1363 | |
| 1364 | auto pixelWidth = 6 + nbDigits * execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast<sptr_t>("8")); |
| 1365 | this->execute(SCI_SETMARGINWIDTHN, SC_BIGTEXT_LINES, pixelWidth); |
| 1366 | |
| 1367 | int lineNums = this->lines(); |
| 1368 | |
| 1369 | qint64 curLineNum = bi.lineNumStart + 1;//行号从1开始 |
| 1370 | |
| 1371 | int style = STYLE_LINENUMBER; |
| 1372 | |
| 1373 | for (int i = 0; i < lineNums; ++i) |
| 1374 | { |
| 1375 | memset(lineString, 0, 17); |
| 1376 | |
| 1377 | if (bi.fileOffset < 0xffffffff) |
| 1378 | { |
| 1379 | sprintf(lineString, "%08lld ", curLineNum+i); |
| 1380 | } |
| 1381 | else |
| 1382 | { |
| 1383 | sprintf(lineString, "%012lld ", curLineNum + i); |
| 1384 | } |
| 1385 | |
| 1386 | QString num(lineString); |
| 1387 | this->setMarginText(i, num, style); |
| 1388 | } |
| 1389 | |
| 1390 | delete[]lineString; |
| 1391 | } |
| 1392 | |
| 1393 | void ScintillaEditView::bookmarkNext(bool forwardScan) |
| 1394 | { |
no test coverage detected