return nMaxLineLength;
}
+bool CCrystalTextView::
+CoverLength(int nTopLine, int nLines, int min_length)
+{
+ const int nLineCount = (std::min)(nTopLine + nLines, GetLineCount());
+ for (int I = nTopLine; I != nLineCount; I++) {
+ if (GetLineActualLength(I) >= min_length)
+ return true;
+ }
+ return false;
+}
+
CCrystalTextView *CCrystalTextView::
GetSiblingView (int nRow, int nCol)
{
ESB_DISABLE_BOTH : ESB_ENABLE_BOTH);
CScrollBar *pHorzScrollBarCtrl = GetScrollBarCtrl (SB_HORZ);
if (pHorzScrollBarCtrl != nullptr)
- pHorzScrollBarCtrl->EnableScrollBar (GetScreenChars () >= GetMaxLineLength (m_nTopLine, GetScreenLines())?
- ESB_DISABLE_BOTH : ESB_ENABLE_BOTH);
+ pHorzScrollBarCtrl->EnableScrollBar(CoverLength(m_nTopLine, GetScreenLines(), GetScreenChars()) ?
+ ESB_DISABLE_BOTH : ESB_ENABLE_BOTH);
// Update scrollbars
InvalidateVertScrollBar ();
void CCrystalTextView::
ScrollRight ()
{
- if (m_nOffsetChar < GetMaxLineLength (m_nTopLine, GetScreenLines()) - 1)
+ if (CoverLength(m_nTopLine, GetScreenLines(), m_nOffsetChar))
{
ScrollToChar (m_nOffsetChar + 1);
UpdateCaret ();