193 text += section_comments["start"] |
193 text += section_comments["start"] |
194 text += parts[section] |
194 text += parts[section] |
195 text += section_comments["end"] |
195 text += section_comments["end"] |
196 return text |
196 return text |
197 |
197 |
198 def RefreshView(self): |
198 def RefreshView(self, scroll_to_highlight=False): |
199 self.ResetBuffer() |
199 self.ResetBuffer() |
200 self.DisableEvents = True |
200 self.DisableEvents = True |
201 old_cursor_pos = self.GetCurrentPos() |
201 old_cursor_pos = self.GetCurrentPos() |
202 line = self.GetFirstVisibleLine() |
202 line = self.GetFirstVisibleLine() |
203 column = self.GetXOffset() |
203 column = self.GetXOffset() |
204 old_text = self.GetText() |
204 old_text = self.GetText() |
205 new_text = self.GetCodeText() |
205 new_text = self.GetCodeText() |
206 self.SetText(new_text) |
|
207 if old_text != new_text: |
206 if old_text != new_text: |
|
207 self.SetText(new_text) |
208 new_cursor_pos = GetCursorPos(old_text, new_text) |
208 new_cursor_pos = GetCursorPos(old_text, new_text) |
209 self.LineScroll(column, line) |
209 self.LineScroll(column, line) |
210 if new_cursor_pos != None: |
210 if new_cursor_pos != None: |
211 self.GotoPos(new_cursor_pos) |
211 self.GotoPos(new_cursor_pos) |
212 else: |
212 else: |
429 self.AddHighlight(*self.CurrentFindHighlight) |
429 self.AddHighlight(*self.CurrentFindHighlight) |
430 else: |
430 else: |
431 self.CurrentFindHighlight = self.SearchResults[0] |
431 self.CurrentFindHighlight = self.SearchResults[0] |
432 self.AddHighlight(*self.CurrentFindHighlight) |
432 self.AddHighlight(*self.CurrentFindHighlight) |
433 |
433 |
|
434 self.ScrollToLine(self.CurrentFindHighlight[0][0]) |
|
435 |
434 else: |
436 else: |
435 if self.CurrentFindHighlight is not None: |
437 if self.CurrentFindHighlight is not None: |
436 self.RemoveHighlight(*self.CurrentFindHighlight) |
438 self.RemoveHighlight(*self.CurrentFindHighlight) |
437 self.CurrentFindHighlight = None |
439 self.CurrentFindHighlight = None |
438 |
440 |
439 #------------------------------------------------------------------------------- |
441 #------------------------------------------------------------------------------- |
440 # Highlights showing functions |
442 # Highlights showing functions |
441 #------------------------------------------------------------------------------- |
443 #------------------------------------------------------------------------------- |
442 |
444 |
443 def OnRefreshHighlightsTimer(self, event): |
445 def OnRefreshHighlightsTimer(self, event): |
444 self.RefreshView() |
446 self.RefreshView(True) |
445 event.Skip() |
447 event.Skip() |
446 |
448 |
447 def ClearHighlights(self, highlight_type=None): |
449 def ClearHighlights(self, highlight_type=None): |
448 if highlight_type is None: |
450 if highlight_type is None: |
449 self.Highlights = [] |
451 self.Highlights = [] |