nconf.c (0df8e97085946dd79c06720678a845778b6d6bf8) | nconf.c (6c07fd84977b605b6a4ceb03b38e6325974f06d6) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com> 4 * 5 * Derived from menuconfig. 6 */ 7#ifndef _GNU_SOURCE 8#define _GNU_SOURCE 9#endif 10#include <string.h> 11#include <strings.h> 12#include <stdlib.h> 13 14#include "lkc.h" | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com> 4 * 5 * Derived from menuconfig. 6 */ 7#ifndef _GNU_SOURCE 8#define _GNU_SOURCE 9#endif 10#include <string.h> 11#include <strings.h> 12#include <stdlib.h> 13 14#include "lkc.h" |
15#include "mnconf-common.h" |
|
15#include "nconf.h" 16#include <ctype.h> 17 18static const char nconf_global_help[] = 19"Help windows\n" 20"------------\n" 21"o Global help: Unless in a data entry window, pressing <F1> will give \n" 22" you the global help window, which you are just reading.\n" --- 251 unchanged lines hidden (view full) --- 274static struct mitem k_menu_items[MAX_MENU_ITEMS]; 275static unsigned int items_num; 276static int global_exit; 277/* the currently selected button */ 278static const char *current_instructions = menu_instructions; 279 280static char *dialog_input_result; 281static int dialog_input_result_len; | 16#include "nconf.h" 17#include <ctype.h> 18 19static const char nconf_global_help[] = 20"Help windows\n" 21"------------\n" 22"o Global help: Unless in a data entry window, pressing <F1> will give \n" 23" you the global help window, which you are just reading.\n" --- 251 unchanged lines hidden (view full) --- 275static struct mitem k_menu_items[MAX_MENU_ITEMS]; 276static unsigned int items_num; 277static int global_exit; 278/* the currently selected button */ 279static const char *current_instructions = menu_instructions; 280 281static char *dialog_input_result; 282static int dialog_input_result_len; |
282static int jump_key_char; | |
283 284static void selected_conf(struct menu *menu, struct menu *active_menu); 285static void conf(struct menu *menu); 286static void conf_choice(struct menu *menu); 287static void conf_string(struct menu *menu); 288static void conf_load(void); 289static void conf_save(void); 290static void show_help(struct menu *menu); --- 395 unchanged lines hidden (view full) --- 686 1, 687 "<OK>"); 688 break; 689 } 690 global_exit = 1; 691 return 0; 692} 693 | 283 284static void selected_conf(struct menu *menu, struct menu *active_menu); 285static void conf(struct menu *menu); 286static void conf_choice(struct menu *menu); 287static void conf_string(struct menu *menu); 288static void conf_load(void); 289static void conf_save(void); 290static void show_help(struct menu *menu); --- 395 unchanged lines hidden (view full) --- 686 1, 687 "<OK>"); 688 break; 689 } 690 global_exit = 1; 691 return 0; 692} 693 |
694struct search_data { 695 struct list_head *head; 696 struct menu *target; 697}; | |
698 | 694 |
699static int next_jump_key(int key) 700{ 701 if (key < '1' || key > '9') 702 return '1'; 703 704 key++; 705 706 if (key > '9') 707 key = '1'; 708 709 return key; 710} 711 712static int handle_search_keys(int key, size_t start, size_t end, void *_data) 713{ 714 struct search_data *data = _data; 715 struct jump_key *pos; 716 int index = 0; 717 718 if (key < '1' || key > '9') 719 return 0; 720 721 list_for_each_entry(pos, data->head, entries) { 722 index = next_jump_key(index); 723 724 if (pos->offset < start) 725 continue; 726 727 if (pos->offset >= end) 728 break; 729 730 if (key == index) { 731 data->target = pos->target; 732 return 1; 733 } 734 } 735 736 return 0; 737} 738 739int get_jump_key_char(void) 740{ 741 jump_key_char = next_jump_key(jump_key_char); 742 743 return jump_key_char; 744} 745 | |
746static void search_conf(void) 747{ 748 struct symbol **sym_arr; 749 struct gstr res; 750 struct gstr title; 751 char *dialog_input; 752 int dres, vscroll = 0, hscroll = 0; 753 bool again; --- 893 unchanged lines hidden --- | 695static void search_conf(void) 696{ 697 struct symbol **sym_arr; 698 struct gstr res; 699 struct gstr title; 700 char *dialog_input; 701 int dres, vscroll = 0, hscroll = 0; 702 bool again; --- 893 unchanged lines hidden --- |