--- a/TextViewer.py Thu Aug 23 09:50:35 2007 +0200
+++ b/TextViewer.py Mon Aug 27 17:37:50 2007 +0200
@@ -92,7 +92,7 @@
class TextViewer(wx.stc.StyledTextCtrl):
def __init__(self, parent, window, controler):
- wx.stc.StyledTextCtrl.__init__(self, parent, ID_TEXTVIEWER, style=0)
+ wx.stc.StyledTextCtrl.__init__(self, parent, ID_TEXTVIEWER, size=wx.Size(0, 0), style=0)
self.CmdKeyAssign(ord('+'), wx.stc.STC_SCMOD_CTRL, wx.stc.STC_CMD_ZOOMIN)
self.CmdKeyAssign(ord('-'), wx.stc.STC_SCMOD_CTRL, wx.stc.STC_CMD_ZOOMOUT)
@@ -143,7 +143,6 @@
self.SetModEventMask(wx.stc.STC_MOD_BEFOREINSERT|wx.stc.STC_MOD_BEFOREDELETE)
self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyleNeeded, id=ID_TEXTVIEWER)
-
if window and controler :
self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
self.Bind(wx.stc.EVT_STC_DO_DROP, self.OnDoDrop, id=ID_TEXTVIEWER)
@@ -230,10 +229,10 @@
self.SetText(new_text)
new_cursor_pos = GetCursorPos(old_text, new_text)
if new_cursor_pos != None:
- self.SetSelection(new_cursor_pos, new_cursor_pos)
- self.EnsureCaretVisible()
- else:
- self.SetSelection(old_cursor_pos, old_cursor_pos)
+ self.GotoPos(new_cursor_pos)
+ else:
+ self.GotoPos(old_cursor_pos)
+ self.ScrollToColumn(0)
self.RefreshJumpList()
self.EmptyUndoBuffer()
self.DisableEvents = False