esc

Externally Scriptable Editor

git clone git://mccd.space/esc

commit 6849e4b9fa7ae6a34cebcd0eaeec76ffa1cd4940
parent 1eb764779f5ba844ea4f62079651c5c43b4a92aa
Author: Marc Coquand <marc@coquand.email>
Date:   Thu, 19 Feb 2026 15:48:35 +0100

Remove unused func

Diffstat:
Mmain.c | 43-------------------------------------------
1 file changed, 0 insertions(+), 43 deletions(-)
diff --git a/main.c b/main.c
@@ -7,49 +7,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-int get_idx_from_coords(const char *buffer, float mx, float my, float scroll_x,
-			float scroll_y, int char_width, float line_height) {
-	int target_col =
-	    (int)((mx - 20.0f + scroll_x + (char_width / 2.0f)) / char_width);
-	int target_row = (int)((my - 20.0f + scroll_y) / line_height);
-
-	if (target_col < 0)
-		target_col = 0;
-	if (target_row < 0)
-		target_row = 0;
-
-	int current_row = 0, current_col = 0;
-	const char *ptr = buffer;
-	const char *last_ptr = buffer;
-
-	while (*ptr != '\0') {
-		if (current_row == target_row && current_col == target_col)
-			break;
-
-		last_ptr = ptr;
-		Uint32 codepoint = SDL_StepUTF8(&ptr, NULL);
-
-		if (codepoint == '\t') {
-			current_col += TAB_SIZE - (current_col % TAB_SIZE);
-		} else if (codepoint == '\n') {
-			if (current_row == target_row) {
-				ptr = last_ptr;
-				break;
-			}
-			current_row++;
-			current_col = 0;
-		} else {
-			current_col++;
-		}
-
-		if (current_row > target_row) {
-			ptr = last_ptr;
-			break;
-		}
-	}
-	return (int)(ptr - buffer);
-}
-
 int main(int argc, char *argv[]) {
 	// Otherwise wayland just wouldn't load.
 	SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "wayland",