mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
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. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Jesse Taube <Mr.Bossman075@gmail.com>
This commit is contained in:
@@ -275,7 +275,6 @@ struct jump_key {
|
|||||||
struct list_head entries;
|
struct list_head entries;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
struct menu *target;
|
struct menu *target;
|
||||||
int index;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct file *file_list;
|
extern struct file *file_list;
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
#include "lkc.h"
|
#include "lkc.h"
|
||||||
#include "lxdialog/dialog.h"
|
#include "lxdialog/dialog.h"
|
||||||
|
|
||||||
#define JUMP_NB 9
|
|
||||||
|
|
||||||
static const char mconf_readme[] =
|
static const char mconf_readme[] =
|
||||||
"Overview\n"
|
"Overview\n"
|
||||||
"--------\n"
|
"--------\n"
|
||||||
@@ -402,18 +400,21 @@ static int handle_search_keys(int key, size_t start, size_t end, void *_data)
|
|||||||
{
|
{
|
||||||
struct search_data *data = _data;
|
struct search_data *data = _data;
|
||||||
struct jump_key *pos;
|
struct jump_key *pos;
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
if (key < '1' || key > '9')
|
if (key < '1' || key > '9')
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
list_for_each_entry(pos, data->head, entries) {
|
list_for_each_entry(pos, data->head, entries) {
|
||||||
|
index = next_jump_key(index);
|
||||||
|
|
||||||
if (pos->offset < start)
|
if (pos->offset < start)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pos->offset >= end)
|
if (pos->offset >= end)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (key == '1' + (pos->index % JUMP_NB)) {
|
if (key == index) {
|
||||||
data->target = pos->target;
|
data->target = pos->target;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -735,15 +735,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
|
|||||||
}
|
}
|
||||||
if (head && location) {
|
if (head && location) {
|
||||||
jump = xmalloc(sizeof(struct jump_key));
|
jump = xmalloc(sizeof(struct jump_key));
|
||||||
|
|
||||||
jump->target = location;
|
jump->target = location;
|
||||||
|
|
||||||
if (list_empty(head))
|
|
||||||
jump->index = 0;
|
|
||||||
else
|
|
||||||
jump->index = list_entry(head->prev, struct jump_key,
|
|
||||||
entries)->index + 1;
|
|
||||||
|
|
||||||
list_add_tail(&jump->entries, head);
|
list_add_tail(&jump->entries, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user