Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sbp
Created October 29, 2010 22:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sbp/654528 to your computer and use it in GitHub Desktop.
Save sbp/654528 to your computer and use it in GitHub Desktop.
Code Shui
def moveLeft(self):
y, x, q, p = self.position()
schar = self.editor.doc.getStartchar(q)
if x: self.editor.moveCursor(y, x - 1)
elif schar:
start = max(0, schar - self.editor.maxx - 5)
self.editor.doc.setStartchar(q, start)
self.drawline(y)
self.editor.moveCursor(y, min(p - 1, self.editor.maxx))
elif (y or self.editor.doc.startline):
self.moveUp()
self.endOfLine()
Which became:
def move_left(self):
screen, doc = self.context()
if not screen.start_of_line():
self.move_cursor_left()
elif screen.start_of_line() and \
not doc.first_line() and \
not screen.hidden_left():
self.move_up()
self.end_of_line()
elif screen.start_of_line() and \
screen.hidden_left():
self.show_left_section()
self.end_of_screen_line()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment