fide/editing.py

18 lines
443 B
Python

from fide import *
global ctx
ctx = GlobalContext()
# def cursor_go_left():
def go_left():
buf = ctx.current_buffer
cursor = ctx.current_buffer.cursor
if cursor.col == 0:
if cursor.line_num > 0:
cursor.col = buf.lines[cursor.line_num-1].length
cursor.want_col = cursor.col
cursor.line_num -= 1
else:
cursor.col = max(0, cursor.col - 1)
cursor.want_col = cursor.col