| 1745 | } |
| 1746 | |
| 1747 | void ShaderViewer::SetTextAndUpdateMargin0(ScintillaEdit *sc, const QString &text) |
| 1748 | { |
| 1749 | sc->setText(text.toUtf8().data()); |
| 1750 | |
| 1751 | int numLines = sc->lineCount(); |
| 1752 | |
| 1753 | // don't make the margin too narrow, it looks strange even if there are only 5 lines in a file |
| 1754 | // we also add on an extra character for padding (with the *10) |
| 1755 | numLines = qMax(1000, numLines * 10); |
| 1756 | |
| 1757 | sptr_t width = sc->textWidth(SC_MARGIN_RTEXT, QString::number(numLines).toUtf8().data()); |
| 1758 | |
| 1759 | sc->setMarginWidthN(0, int(width)); |
| 1760 | } |
| 1761 | |
| 1762 | void ShaderViewer::readonly_keyPressed(QKeyEvent *event) |
| 1763 | { |