# HG changeset patch # User Laurent Bessard # Date 1368563133 -7200 # Node ID f9cf74053b7d51b0d664b58f404c6a693749804b # Parent cf2a6a7c87e891d40a72ac953cc35f7fa1a7155d Fixed bug when deleting line between code and headers on Windows diff -r cf2a6a7c87e8 -r f9cf74053b7d editors/CodeFileEditor.py --- a/editors/CodeFileEditor.py Tue May 14 20:16:07 2013 +0200 +++ b/editors/CodeFileEditor.py Tue May 14 22:25:33 2013 +0200 @@ -291,6 +291,13 @@ selected = self.GetSelection() text_selected = selected[0] != selected[1] + # Test if caret is before Windows like new line + text = self.GetText() + if ord(text[current_pos]) == 13: + newline_size = 2 + else: + newline_size = 1 + # Disable to type any character in section header lines if (self.GetLineState(self.LineFromPosition(current_pos)) and not text_selected and @@ -304,7 +311,7 @@ (key == wx.WXK_BACK and self.GetLineState(self.LineFromPosition(max(0, current_pos - 1))) or key in [wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE] and - self.GetLineState(self.LineFromPosition(min(len(self.GetText()), current_pos + 1))))): + self.GetLineState(self.LineFromPosition(min(len(text), current_pos + newline_size))))): return elif key == 32 and event.ControlDown():