sled.h (5084B)
1 /* This program is licensed under the terms of GNU GPL v3 or (at your option) 2 * any later version. Copyright (C) 2022-2026 Страхиња Радић. 3 * See the file LICENSE for exact copyright and license details. */ 4 5 static int cancel_close(struct DrawState* state); 6 static int clear_selection(struct DrawState* state); 7 static int cp(const char* from, const char* to); 8 static int create_file(struct DrawState* dstate); 9 static int cut_to_paste(struct DrawState* state); 10 static char* dirname(char* dir, char* path, const ssize_t path_size); 11 static int do_search_replace(struct DrawState* state); 12 static int enter_command_mode(struct DrawState* state); 13 static int enter_insert_mode(struct DrawState* state); 14 static int erase_backwards(struct DrawState* state); 15 static int erase_forward(struct DrawState* state); 16 static int erase_line(struct DrawState* state); 17 static int erase_prev_word(struct DrawState* state); 18 static int erase_selection(struct DrawState* state); 19 static int erase_to_end(struct DrawState* state); 20 static int erase_to_start(struct DrawState* state); 21 static int exit_program(struct DrawState* state); 22 void get_selection(int* ssr, int* ssc, int* ser, int* sec, 23 const struct DrawState* state); 24 static int go_to_line_callback(struct DrawState* state); 25 static void handle_key_event(struct tb_event* ev, struct DrawState* state); 26 static int input_cancel(struct DrawState* state); 27 static int input_enter(struct DrawState* state); 28 static int input_erase_backwards(struct DrawState* state); 29 static int input_erase_forward(struct DrawState* state); 30 static int input_erase_to_end(struct DrawState* state); 31 static int input_erase_to_start(struct DrawState* state); 32 static int input_insert_char(struct DrawState* state, uint32_t ch); 33 static int input_insert_space(struct DrawState* state); 34 static int input_insert_tab(struct DrawState* state); 35 static int input_move_end(struct DrawState* state); 36 static int input_move_left(struct DrawState* state); 37 static int input_move_next_word(struct DrawState* state); 38 static int input_move_prev_word(struct DrawState* state); 39 static int input_move_right(struct DrawState* state); 40 static int input_move_start(struct DrawState* state); 41 static void input_position_to(struct DrawState* state, const int column); 42 static int insert_char(struct DrawState* state, uint32_t ch); 43 static int insert_line(struct DrawState* state); 44 static int insert_space(struct DrawState* state); 45 static int insert_tab(struct DrawState* state); 46 static int join_lines(struct DrawState* state); 47 static int load_file(struct DrawState* dstate); 48 static int move_bottom(struct DrawState* state); 49 static int move_down(struct DrawState* state); 50 static int move_end(struct DrawState* state); 51 static int move_left(struct DrawState* state); 52 static int move_next_word(struct DrawState* state); 53 static int move_page_down(struct DrawState* state); 54 static int move_page_up(struct DrawState* state); 55 static int move_prev_word(struct DrawState* state); 56 static int move_right(struct DrawState* state); 57 static int move_screen_bottom(struct DrawState* state); 58 static int move_screen_middle(struct DrawState* state); 59 static int move_screen_top(struct DrawState* state); 60 static int move_start(struct DrawState* state); 61 static int move_top(struct DrawState* state); 62 static int move_up(struct DrawState* state); 63 static int next_match(struct DrawState* state); 64 static int paste_from_paste(struct DrawState* state); 65 static void position_to(struct DrawState* state, const int row, 66 const int column); 67 static int position_to_selection_end(struct DrawState* state); 68 static int position_to_selection_start(struct DrawState* state); 69 static int prev_match(struct DrawState* state); 70 static int print_error(const int code, const char* msg, ...); 71 static int quit_callback(struct DrawState* state, struct tb_event* ev); 72 static int reread_callback(struct DrawState* state, struct tb_event* ev); 73 static int reread_file(struct DrawState* state); 74 static int reread_or_callback(struct DrawState* state); 75 static int save_file(struct DrawState* state); 76 static int search_dialog_callback(struct DrawState* state); 77 static int search_replace_replace_dialog_callback(struct DrawState* state); 78 static int search_replace_search_dialog_callback(struct DrawState* state); 79 static int search_update_callback(struct DrawState* state); 80 static int show_go_to_line(struct DrawState* state); 81 static int show_help(struct DrawState* state); 82 static int show_replace(struct DrawState* state); 83 static int show_search(struct DrawState* state); 84 static int show_search_replace(struct DrawState* state); 85 static void simple_insert_line(struct DrawState* state); 86 static void simple_join_lines(struct DrawState* state); 87 static void simple_yank(struct DrawState* state); 88 static int suspend_program(struct DrawState* state); 89 static int toggle_line_numbers(struct DrawState* state); 90 static int toggle_overwrite(struct DrawState* state); 91 static int toggle_selection(struct DrawState* state); 92 static int wrap_para(struct DrawState* state); 93 static int write_file(struct DrawState* state); 94 static int yank_to_paste(struct DrawState* state);