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
275 struct list_head entries;275 struct list_head entries;
276 size_t offset;276 size_t offset;
277 struct menu *target;277 struct menu *target;
278 int index;
279};278};
280 279
281extern struct file *file_list;280extern struct file *file_list;
scripts/kconfig/mconf.c+4−3
@@ -22,8 +22,6 @@ · 21 unmodified lines
22#include "lkc.h"22#include "lkc.h"
23#include "lxdialog/dialog.h"23#include "lxdialog/dialog.h"
24 24
25#define JUMP_NB 9
26
27static const char mconf_readme[] =25static const char mconf_readme[] =
28"Overview\n"26"Overview\n"
29"--------\n"27"--------\n"
@@ -402,18 +400,21 @@ static int handle_search_keys(int key, size_t start, size_t end, void *_data) · 372 unmodified lines
402{400{
403 struct search_data *data = _data;401 struct search_data *data = _data;
404 struct jump_key *pos;402 struct jump_key *pos;
403 int index = 0;
405 404
406 if (key < '1' || key > '9')405 if (key < '1' || key > '9')
407 return 0;406 return 0;
408 407
409 list_for_each_entry(pos, data->head, entries) {408 list_for_each_entry(pos, data->head, entries) {
409 index = next_jump_key(index);
410
410 if (pos->offset < start)411 if (pos->offset < start)
411 continue;412 continue;
412 413
413 if (pos->offset >= end)414 if (pos->offset >= end)
414 break;415 break;
415 416
416 if (key == '1' + (pos->index % JUMP_NB)) {417 if (key == index) {
417 data->target = pos->target;418 data->target = pos->target;
418 return 1;419 return 1;
419 }420 }
scripts/kconfig/menu.c+0−8
@@ -735,15 +735,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, · 734 unmodified lines
735 }735 }
736 if (head && location) {736 if (head && location) {
737 jump = xmalloc(sizeof(struct jump_key));737 jump = xmalloc(sizeof(struct jump_key));
738
739 jump->target = location;738 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
747 list_add_tail(&jump->entries, head);739 list_add_tail(&jump->entries, head);
748 }740 }
749 741

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