From 67362b7402752e7cd32e226f5f2a95695c0900bc Mon Sep 17 00:00:00 2001 From: Madeleine <32415621+SpyHoodle@users.noreply.github.com> Date: Sat, 19 Mar 2022 15:14:49 +0000 Subject: [PATCH] Delete cursor.py --- core/cursor.py | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 core/cursor.py diff --git a/core/cursor.py b/core/cursor.py deleted file mode 100644 index e9cadeb..0000000 --- a/core/cursor.py +++ /dev/null @@ -1,44 +0,0 @@ -from core import utils, buffer - - -def cursor_mode(mode): - if mode == "block": - print("\033[2 q") - - elif mode == "line": - print("\033[6 q") - - elif mode == "hidden": - print('\033[? 25l') - - elif mode == "visible": - print('\033[? 25h') - - -def check_cursor(data): - if data["cursor_y"] + data["visible_y"] == len(data["buffer_list"]): - data["cursor_y"] -= 1 - - if data["cursor_y"] == data["height"] - 2 and not data["cursor_y"] + data["visible_y"] == len(data["buffer_list"]): - data["visible_y"] += 1 - - elif data["cursor_y"] == 0 and data["buffer_list"][data["visible_y"]] != data["buffer_list"][0]: - data["visible_y"] -= 1 - - elif data["cursor_x"] > len(data["buffer_list"][data["cursor_y"]]): - data["cursor_x"] = len(data["buffer_list"][data["cursor_y"]]) - - data["cursor_x"] = max(2, data["cursor_x"]) - data["cursor_x"] = min(data["width"] - 1, data["cursor_x"]) - data["cursor_y"] = max(0, data["cursor_y"]) - data["cursor_y"] = min(data["height"] - 3, data["cursor_y"]) - - return data - - -def move(screen, data): - # Calculate a valid cursor position from data - data = check_cursor(data) - - # Move the cursor - screen.move(data["cursor_y"], data["cursor_x"])