@@ -92,10 +92,21 @@ void IndicatorPanel::OnUpdateLines()
92
92
}
93
93
}
94
94
95
- void IndicatorPanel::EraseIndicatorLines (int begin, int end)
95
+ void IndicatorPanel::ClearIndicators (int begin, int end)
96
96
{
97
- auto beginViewPos = m_View.sci (SCI_VISIBLEFROMDOCLINE, begin, 0 );
98
- auto endViewPos = m_View.sci (SCI_VISIBLEFROMDOCLINE, end, 0 );
97
+ if (m_Indicators.empty ())
98
+ return ;
99
+
100
+ // document line
101
+ unsigned int beginLine = (begin <= 0 ) ? 0 : m_View.sci (SCI_LINEFROMPOSITION, begin, 0 );
102
+ unsigned int endLine = (end < 0 ) ? m_View.sci (SCI_GETLINECOUNT, 0 , 0 ) : m_View.sci (SCI_LINEFROMPOSITION, end, 0 );
103
+
104
+ // view line
105
+ auto beginViewPos = m_View.sci (SCI_VISIBLEFROMDOCLINE, beginLine, 0 );
106
+ auto endViewPos = m_View.sci (SCI_VISIBLEFROMDOCLINE, endLine, 0 );
107
+
108
+ if (end < 0 )
109
+ endViewPos = max (endViewPos, m_Indicators.rbegin ()->first );
99
110
100
111
m_Indicators.erase (
101
112
m_Indicators.emplace (beginViewPos, 0 ).first ,
@@ -107,14 +118,14 @@ bool IndicatorPanel::GetIndicatorLines() {
107
118
108
119
auto stopTime = GetTickCount64 () + 200 ; // 200ms
109
120
121
+ ClearIndicators (m_Begin, m_End);
122
+
110
123
if (m_Begin < 0 )
111
124
m_Begin = 0 ;
112
125
113
126
if (m_End < 0 )
114
127
m_End = m_View.sci (SCI_GETLENGTH, 0 , 0 );
115
128
116
- EraseIndicatorLines (m_Begin, m_End);
117
-
118
129
auto line = m_View.sci (SCI_LINEFROMPOSITION, m_Begin, 0 );
119
130
auto lineEnd = m_View.sci (SCI_GETLINEENDPOSITION, line, 0 );
120
131
auto nextSavePosition = min (lineEnd, m_End - 1 );
0 commit comments