editor: Fix scrolling crash.
This commit is contained in:
parent
8818c16a56
commit
401005ee3a
3 changed files with 18 additions and 20 deletions
6
BUGS
6
BUGS
|
|
@ -1,9 +1,9 @@
|
||||||
Current:
|
Current:
|
||||||
|
|
||||||
|
|
||||||
|
Fixed:
|
||||||
- Interface freezing often.
|
- Interface freezing often.
|
||||||
- Fix scrolling.
|
- Fix scrolling.
|
||||||
|
|
||||||
|
|
||||||
Fixed:
|
|
||||||
|
|
||||||
|
|
||||||
Won't fix:
|
Won't fix:
|
||||||
|
|
|
||||||
2
TODO
2
TODO
|
|
@ -1,5 +1,7 @@
|
||||||
Todo:
|
Todo:
|
||||||
- Right align the left editor.
|
- Right align the left editor.
|
||||||
|
- Keyboard shortcuts for resolving differences.
|
||||||
|
- tab key should align code.
|
||||||
|
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
|
|
|
||||||
|
|
@ -228,24 +228,20 @@ class Editor:
|
||||||
@scroll_position.setter
|
@scroll_position.setter
|
||||||
def scroll_position(self, position):
|
def scroll_position(self, position):
|
||||||
x, y = position
|
x, y = position
|
||||||
# text_width = self.text_widget.max_line_length
|
text_width = self.text_widget.max_line_length
|
||||||
# if x < 0:
|
if x < 0:
|
||||||
# new_x = 0
|
new_x = 0
|
||||||
# elif x > text_width - self.last_width + 2:
|
elif x > text_width - self.last_width + 2:
|
||||||
# new_x = max(text_width - self.last_width + 2, 0)
|
new_x = max(text_width - self.last_width + 2, 0)
|
||||||
# else:
|
else:
|
||||||
# new_x = x
|
new_x = x
|
||||||
# if y < 0:
|
if y < 0:
|
||||||
# new_y = 0
|
new_y = 0
|
||||||
# elif y > len(self.text_widget) - self.last_height + 2:
|
elif y > len(self.text_widget) - self.last_height + 2:
|
||||||
# new_y = max(len(self.text_widget) - self.last_height + 2, 0)
|
new_y = max(len(self.text_widget) - self.last_height + 2, 0)
|
||||||
# else:
|
else:
|
||||||
# new_y = y
|
new_y = y
|
||||||
new_x, new_y = max(x, 0), y
|
|
||||||
self.view_widget.position = new_x, new_y
|
self.view_widget.position = new_x, new_y
|
||||||
view_x, view_y = self.view_widget.position
|
|
||||||
new_cursor_y = self.cursor_y + y - view_y
|
|
||||||
self.cursor_y = max(0, min(new_cursor_y, len(self.text_widget) - 1))
|
|
||||||
|
|
||||||
def get_selection_interval(self):
|
def get_selection_interval(self):
|
||||||
mark_x, mark_y = self.mark
|
mark_x, mark_y = self.mark
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue