aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-04-13 15:03:08 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-04-13 15:03:08 +0300
commitc210bb036dcb4ce2e9a276d590be815fc4b09897 (patch)
tree2aa7c6859e759630a53d571d81ccfab9f578f80b /main.c
parent8f2c31afbc61160ca024f2a036e48b06fdd49881 (diff)
downloadastar-c210bb036dcb4ce2e9a276d590be815fc4b09897.tar.xz
Fix the filename prompt
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/main.c b/main.c
index 18b8d96..b60b36c 100644
--- a/main.c
+++ b/main.c
@@ -147,7 +147,6 @@ int main(int argc, char **argv) {
draw_map(map, width, height, start_pos, end_pos, NULL, path, visited, NULL);
int c = getch();
/* TODO: add a keybinding to calculate the path again, or maybe do it on 'a' */
- /* TODO: maybe a kbng to move to start/end? */
switch (c) {
case 'h': map_offset_x += 2; break;
case 'l': map_offset_x -= 2; break;
@@ -206,15 +205,18 @@ int main(int argc, char **argv) {
break;
case 's':
- message(height, "Filename: ");
- /* TODO: figure out how to show the cursor and echo the characters */
- curs_set(2); /* Hide the cursor */
- echo(); /* Don't echo characters */
+ curs_set(2); /* Show the cursor */
+ echo(); /* Echo characters */
+
+ message(height, FILENAME_PROMPT);
char filename[FILENAME_BUF_SIZE] = "out.bmp";
+ mvgetnstr(height + map_offset_y + 1, map_offset_x - 2 + sizeof(FILENAME_PROMPT), filename, FILENAME_BUF_SIZE - 1);
+
+ map_to_bmp(map, width, height, start_pos, end_pos, path, visited, filename);
+
curs_set(0); /* Hide the cursor */
noecho(); /* Don't echo characters */
- mvgetnstr(height + map_offset_y + 1, map_offset_x - 2, filename, FILENAME_BUF_SIZE - 1);
- map_to_bmp(map, width, height, start_pos, end_pos, path, visited, filename);
+
message(height, "Saved to %s", filename);
getch();
break;