History

kconfig: menuconfig: remove jump_key::index

You do not need to remember the index of each jump key because you can count it up after a key is pressed.

Masahiro Yamada committed 3 years ago

Commit 356f0cb1 parent e14f1243 files · +4 −12Browse files

Showing the changes to scripts (3 of 3 files). Show all

Unified · Split

3 files
  1. scripts/kconfig/expr.h +0 −1
  2. scripts/kconfig/mconf.c +4 −3
  3. scripts/kconfig/menu.c +0 −8
scripts/kconfig/expr.h+0−1
@@ -275,7 +275,6 @@ struct jump_key { · 274 unmodified lines
275275 struct list_head entries;
276276 size_t offset;
277277 struct menu *target;
278− int index;
279278 };
280279
281280 extern struct file *file_list;
scripts/kconfig/mconf.c+4−3
@@ -22,8 +22,6 @@ · 21 unmodified lines
2222 #include "lkc.h"
2323 #include "lxdialog/dialog.h"
2424
25−#define JUMP_NB 9
26−
2725 static const char mconf_readme[] =
2826 "Overview\n"
2927 "--------\n"
@@ -402,18 +400,21 @@ static int handle_search_keys(int key, size_t start, size_t end, void *_data) · 372 unmodified lines
402400 {
403401 struct search_data *data = _data;
404402 struct jump_key *pos;
403+ int index = 0;
405404
406405 if (key < '1' || key > '9')
407406 return 0;
408407
409408 list_for_each_entry(pos, data->head, entries) {
409+ index = next_jump_key(index);
410+
410411 if (pos->offset < start)
411412 continue;
412413
413414 if (pos->offset >= end)
414415 break;
415416
416− if (key == '1' + (pos->index % JUMP_NB)) {
417+ if (key == index) {
417418 data->target = pos->target;
418419 return 1;
419420 }
scripts/kconfig/menu.c+0−8
@@ -735,15 +735,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, · 734 unmodified lines
735735 }
736736 if (head && location) {
737737 jump = xmalloc(sizeof(struct jump_key));
738−
739738 jump->target = location;
740−
741− if (list_empty(head))
742− jump->index = 0;
743− else
744− jump->index = list_entry(head->prev, struct jump_key,
745− entries)->index + 1;
746−
747739 list_add_tail(&jump->entries, head);
748740 }
749741

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t