Version v0.3.17 - Refactored to smaller files to help agents out
This commit is contained in:
45
src/state.c
Normal file
45
src/state.c
Normal file
@@ -0,0 +1,45 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "../include/otp.h"
|
||||
|
||||
// Global state variables
|
||||
static char current_pads_dir[512] = DEFAULT_PADS_DIR;
|
||||
static int is_interactive_mode = 0;
|
||||
|
||||
// Terminal dimensions (moved from ui.c to state.c for global access)
|
||||
static int terminal_width = 80; // Default fallback width
|
||||
static int terminal_height = 24; // Default fallback height
|
||||
|
||||
// Getters and setters for global state
|
||||
|
||||
const char* get_current_pads_dir(void) {
|
||||
return current_pads_dir;
|
||||
}
|
||||
|
||||
void set_current_pads_dir(const char* dir) {
|
||||
if (dir) {
|
||||
strncpy(current_pads_dir, dir, sizeof(current_pads_dir) - 1);
|
||||
current_pads_dir[sizeof(current_pads_dir) - 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
int get_interactive_mode(void) {
|
||||
return is_interactive_mode;
|
||||
}
|
||||
|
||||
void set_interactive_mode(int mode) {
|
||||
is_interactive_mode = mode;
|
||||
}
|
||||
|
||||
int get_terminal_width(void) {
|
||||
return terminal_width;
|
||||
}
|
||||
|
||||
int get_terminal_height(void) {
|
||||
return terminal_height;
|
||||
}
|
||||
|
||||
void set_terminal_dimensions(int width, int height) {
|
||||
terminal_width = width;
|
||||
terminal_height = height;
|
||||
}
|
||||
Reference in New Issue
Block a user