- fix: Crash when scroll file which has more than 65535 lines.
- fix: Can't scroll to lines greater than 65535.
This commit is contained in:
parent
4093f29ac4
commit
13f0be3154
3
NEWS.md
3
NEWS.md
|
@ -19,7 +19,8 @@ Red Panda C++ Version 2.6
|
|||
- enhancement: Auto disable "compile" button if gcc doesn't exist.
|
||||
- enhancement: Auto disable "debug" button if gdb doesn't exist.
|
||||
- enhancement: Auto disable "compile" button for project if make doesn't exist.
|
||||
- Fix: Crash when scroll file which has more than 65535 lines.
|
||||
- fix: Crash when scroll file which has more than 65535 lines.
|
||||
- fix: Can't scroll to lines greater than 65535.
|
||||
|
||||
Red Panda C++ Version 2.5
|
||||
|
||||
|
|
|
@ -27,9 +27,6 @@ extern const QChar TabGlyph;
|
|||
extern const QChar LineBreakGlyph;
|
||||
extern const QChar SoftBreakGlyph;
|
||||
|
||||
|
||||
#define MAX_SCROLL 65535
|
||||
|
||||
// names for token attributes
|
||||
#define SYNS_AttrAssembler "Assembler"
|
||||
#define SYNS_AttrCharacter "Character"
|
||||
|
|
|
@ -3238,17 +3238,10 @@ void SynEdit::updateScrollbars()
|
|||
}
|
||||
if (mScrollBars == ScrollStyle::ssBoth || mScrollBars == ScrollStyle::ssHorizontal) {
|
||||
nMaxScroll = maxScrollWidth();
|
||||
if (nMaxScroll <= MAX_SCROLL) {
|
||||
nMin = 1;
|
||||
nMax = nMaxScroll;
|
||||
nPage = mCharsInWindow;
|
||||
nPos = mLeftChar;
|
||||
} else {
|
||||
nMin = 1;
|
||||
nMax = MAX_SCROLL;
|
||||
nPage = mulDiv(MAX_SCROLL, mCharsInWindow, nMaxScroll);
|
||||
nPos = mulDiv(MAX_SCROLL, mLeftChar, nMaxScroll);
|
||||
}
|
||||
horizontalScrollBar()->setMinimum(nMin);
|
||||
horizontalScrollBar()->setMaximum(nMax);
|
||||
horizontalScrollBar()->setPageStep(nPage);
|
||||
|
@ -3259,17 +3252,10 @@ void SynEdit::updateScrollbars()
|
|||
|
||||
if (mScrollBars == ScrollStyle::ssBoth || mScrollBars == ScrollStyle::ssVertical) {
|
||||
nMaxScroll = maxScrollHeight();
|
||||
if (nMaxScroll <= MAX_SCROLL) {
|
||||
nMin = 1;
|
||||
nMax = std::max(1, nMaxScroll);
|
||||
nPage = mLinesInWindow;
|
||||
nPos = mTopLine;
|
||||
} else {
|
||||
nMin = 1;
|
||||
nMax = MAX_SCROLL;
|
||||
nPage = mulDiv(MAX_SCROLL, mLinesInWindow, nMaxScroll);
|
||||
nPos = mulDiv(MAX_SCROLL, mTopLine, nMaxScroll);
|
||||
}
|
||||
verticalScrollBar()->setMinimum(nMin);
|
||||
verticalScrollBar()->setMaximum(nMax);
|
||||
verticalScrollBar()->setPageStep(nPage);
|
||||
|
|
Loading…
Reference in New Issue