* panel.h: Convert directory history to GList.
* widget.h: Convert input history to GList. Adjust all dependencies.
Этот коммит содержится в:
родитель
0109ef3666
Коммит
89e5cc319e
@ -1,3 +1,9 @@
|
|||||||
|
2003-02-18 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* panel.h: Convert directory history to GList.
|
||||||
|
* widget.h: Convert input history to GList.
|
||||||
|
Adjust all dependencies.
|
||||||
|
|
||||||
2003-02-11 Pavel Roskin <proski@gnu.org>
|
2003-02-11 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* cmd.c (edit_cmd_new): Call editor with NULL argiment, not with
|
* cmd.c (edit_cmd_new): Call editor with NULL argiment, not with
|
||||||
|
12
src/cmd.c
12
src/cmd.c
@ -921,7 +921,7 @@ void
|
|||||||
history_cmd (void)
|
history_cmd (void)
|
||||||
{
|
{
|
||||||
Listbox *listbox;
|
Listbox *listbox;
|
||||||
Hist *current;
|
GList *current;
|
||||||
|
|
||||||
if (cmdline->need_push) {
|
if (cmdline->need_push) {
|
||||||
if (push_history (cmdline, cmdline->buffer) == 2)
|
if (push_history (cmdline, cmdline->buffer) == 2)
|
||||||
@ -931,14 +931,12 @@ history_cmd (void)
|
|||||||
message (1, MSG_ERROR, _(" The command history is empty "));
|
message (1, MSG_ERROR, _(" The command history is empty "));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
current = cmdline->history;
|
current = g_list_first (cmdline->history);
|
||||||
while (current->prev)
|
|
||||||
current = current->prev;
|
|
||||||
listbox = create_listbox_window (60, 10, _(" Command history "),
|
listbox = create_listbox_window (60, 10, _(" Command history "),
|
||||||
"[Command Menu]");
|
"[Command Menu]");
|
||||||
while (current) {
|
while (current) {
|
||||||
LISTBOX_APPEND_TEXT (listbox, 0, current->text, current);
|
LISTBOX_APPEND_TEXT (listbox, 0, (char *) current->data, current);
|
||||||
current = current->next;
|
current = g_list_next(current);
|
||||||
}
|
}
|
||||||
run_dlg (listbox->dlg);
|
run_dlg (listbox->dlg);
|
||||||
if (listbox->dlg->ret_value == B_CANCEL)
|
if (listbox->dlg->ret_value == B_CANCEL)
|
||||||
@ -951,7 +949,7 @@ history_cmd (void)
|
|||||||
if (!current)
|
if (!current)
|
||||||
return;
|
return;
|
||||||
cmdline->history = current;
|
cmdline->history = current;
|
||||||
assign_text (cmdline, cmdline->history->text);
|
assign_text (cmdline, (char *) current->data);
|
||||||
update_input (cmdline, 1);
|
update_input (cmdline, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
48
src/main.c
48
src/main.c
@ -692,26 +692,12 @@ subshell_chdir (char *directory)
|
|||||||
void
|
void
|
||||||
directory_history_add (struct WPanel *panel, char *s)
|
directory_history_add (struct WPanel *panel, char *s)
|
||||||
{
|
{
|
||||||
if (!panel->dir_history) {
|
char *text;
|
||||||
panel->dir_history = g_new0 (Hist, 1);
|
|
||||||
panel->dir_history->text = g_strdup (s);
|
text = g_strdup (s);
|
||||||
strip_password (panel->dir_history->text, 1);
|
strip_password (s, 1);
|
||||||
return;
|
|
||||||
}
|
panel->dir_history = g_list_append (panel->dir_history, text);
|
||||||
if (!strcmp (panel->dir_history->text, s))
|
|
||||||
return;
|
|
||||||
if (panel->dir_history->next) {
|
|
||||||
if (panel->dir_history->next->text) {
|
|
||||||
g_free (panel->dir_history->next->text);
|
|
||||||
panel->dir_history->next->text = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
panel->dir_history->next = g_new0 (Hist, 1);
|
|
||||||
panel->dir_history->next->prev = panel->dir_history;
|
|
||||||
}
|
|
||||||
panel->dir_history = panel->dir_history->next;
|
|
||||||
panel->dir_history->text = g_strdup (s);
|
|
||||||
strip_password (panel->dir_history->text, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -818,19 +804,29 @@ do_cd (char *new_dir, enum cd_enum exact)
|
|||||||
void
|
void
|
||||||
directory_history_next (WPanel *panel)
|
directory_history_next (WPanel *panel)
|
||||||
{
|
{
|
||||||
if (!panel->dir_history->next)
|
GList *nextdir;
|
||||||
|
|
||||||
|
nextdir = g_list_next (panel->dir_history);
|
||||||
|
|
||||||
|
if (!nextdir)
|
||||||
return;
|
return;
|
||||||
if (_do_panel_cd (panel, panel->dir_history->next->text, cd_exact))
|
|
||||||
panel->dir_history = panel->dir_history->next;
|
if (_do_panel_cd (panel, (char *) nextdir->data, cd_exact))
|
||||||
|
panel->dir_history = nextdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
directory_history_prev (WPanel *panel)
|
directory_history_prev (WPanel *panel)
|
||||||
{
|
{
|
||||||
if (!panel->dir_history->prev)
|
GList *prevdir;
|
||||||
|
|
||||||
|
prevdir = g_list_previous (panel->dir_history);
|
||||||
|
|
||||||
|
if (!prevdir)
|
||||||
return;
|
return;
|
||||||
if (_do_panel_cd (panel, panel->dir_history->prev->text, cd_exact))
|
|
||||||
panel->dir_history = panel->dir_history->prev;
|
if (_do_panel_cd (panel, (char *) prevdir->data, cd_exact))
|
||||||
|
panel->dir_history = prevdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -41,7 +41,7 @@ typedef struct WPanel {
|
|||||||
int active; /* If panel is currently selected */
|
int active; /* If panel is currently selected */
|
||||||
char cwd [MC_MAXPATHLEN];/* Current Working Directory */
|
char cwd [MC_MAXPATHLEN];/* Current Working Directory */
|
||||||
char lwd [MC_MAXPATHLEN];/* Last Working Directory */
|
char lwd [MC_MAXPATHLEN];/* Last Working Directory */
|
||||||
struct hist_entry *dir_history; /* directory history */
|
GList *dir_history; /* directory history */
|
||||||
char *hist_name; /* directory history name for history file */
|
char *hist_name; /* directory history name for history file */
|
||||||
int count; /* Number of files in dir structure */
|
int count; /* Number of files in dir structure */
|
||||||
int marked; /* Count of marked files */
|
int marked; /* Count of marked files */
|
||||||
|
16
src/screen.c
16
src/screen.c
@ -895,20 +895,14 @@ panel_destroy (WPanel *p)
|
|||||||
panel_save_setup (p, name);
|
panel_save_setup (p, name);
|
||||||
panel_clean_dir (p);
|
panel_clean_dir (p);
|
||||||
|
|
||||||
/* save and clean history */
|
/* save and clean history */
|
||||||
if (p->dir_history){
|
if (p->dir_history){
|
||||||
Hist *current, *old;
|
|
||||||
history_put (p->hist_name, p->dir_history);
|
history_put (p->hist_name, p->dir_history);
|
||||||
current = p->dir_history;
|
|
||||||
while (current->next)
|
g_list_foreach (p->dir_history, (GFunc) g_free, NULL);
|
||||||
current = current->next;
|
g_list_free (p->dir_history);
|
||||||
while (current){
|
|
||||||
old = current;
|
|
||||||
current = current->prev;
|
|
||||||
g_free (old->text);
|
|
||||||
g_free (old);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (p->hist_name);
|
g_free (p->hist_name);
|
||||||
|
|
||||||
delete_format (p->format);
|
delete_format (p->format);
|
||||||
|
189
src/widget.c
189
src/widget.c
@ -787,10 +787,12 @@ winput_set_origin (WInput *in, int x, int field_len)
|
|||||||
|
|
||||||
/* {{{ history saving and loading */
|
/* {{{ history saving and loading */
|
||||||
|
|
||||||
|
int num_history_items_recorded = 60;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This loads and saves the history of an input line to and from the
|
This loads and saves the history of an input line to and from the
|
||||||
widget. It is called with the widgets tk name on creation of the
|
widget. It is called with the widgets tk name on creation of the
|
||||||
widget, and returns the Hist list. It stores histories in the file
|
widget, and returns the GList list. It stores histories in the file
|
||||||
~/.mc/history in using the profile code.
|
~/.mc/history in using the profile code.
|
||||||
|
|
||||||
If def_text is passed as INPUT_LAST_TEXT (to the input_new()
|
If def_text is passed as INPUT_LAST_TEXT (to the input_new()
|
||||||
@ -798,17 +800,15 @@ winput_set_origin (WInput *in, int x, int field_len)
|
|||||||
entered, or "" if not found.
|
entered, or "" if not found.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int num_history_items_recorded = 60;
|
GList *
|
||||||
|
|
||||||
Hist *
|
|
||||||
history_get (char *input_name)
|
history_get (char *input_name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Hist *old, *new;
|
GList *hist;
|
||||||
char *profile;
|
char *profile;
|
||||||
|
|
||||||
old = new = NULL;
|
hist = NULL;
|
||||||
|
|
||||||
if (!num_history_items_recorded) /* this is how to disable */
|
if (!num_history_items_recorded) /* this is how to disable */
|
||||||
return 0;
|
return 0;
|
||||||
if (!input_name)
|
if (!input_name)
|
||||||
@ -820,22 +820,21 @@ history_get (char *input_name)
|
|||||||
char key_name[BUF_TINY];
|
char key_name[BUF_TINY];
|
||||||
char this_entry[BUF_LARGE];
|
char this_entry[BUF_LARGE];
|
||||||
g_snprintf (key_name, sizeof (key_name), "%d", i);
|
g_snprintf (key_name, sizeof (key_name), "%d", i);
|
||||||
GetPrivateProfileString (input_name, key_name, "", this_entry, sizeof (this_entry), profile);
|
GetPrivateProfileString (input_name, key_name, "", this_entry,
|
||||||
|
sizeof (this_entry), profile);
|
||||||
if (!*this_entry)
|
if (!*this_entry)
|
||||||
break;
|
break;
|
||||||
new = g_new0 (Hist, 1);
|
|
||||||
new->text = g_strdup (this_entry);
|
hist = g_list_append (hist, g_strdup (this_entry));
|
||||||
new->prev = old; /* set up list pointers */
|
|
||||||
if (old)
|
|
||||||
old->next = new;
|
|
||||||
old = new;
|
|
||||||
}
|
}
|
||||||
g_free (profile);
|
g_free (profile);
|
||||||
return new; /* return pointer to last entry in list */
|
|
||||||
|
/* return pointer to last entry in list */
|
||||||
|
return hist;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
history_put (char *input_name, Hist *h)
|
history_put (char *input_name, GList *h)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *profile;
|
char *profile;
|
||||||
@ -845,7 +844,7 @@ history_put (char *input_name, Hist *h)
|
|||||||
|
|
||||||
if (!*input_name)
|
if (!*input_name)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!h)
|
if (!h)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -856,34 +855,38 @@ history_put (char *input_name, Hist *h)
|
|||||||
|
|
||||||
if ((i = open (profile, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) != -1)
|
if ((i = open (profile, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) != -1)
|
||||||
close (i);
|
close (i);
|
||||||
/* Just in case I forgot to strip passwords somewhere -- Norbert */
|
|
||||||
if (chmod (profile, S_IRUSR | S_IWUSR) == -1 && errno != ENOENT){
|
/* Make sure the history is only readable by the user */
|
||||||
|
if (chmod (profile, S_IRUSR | S_IWUSR) == -1 && errno != ENOENT) {
|
||||||
g_free (profile);
|
g_free (profile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (h->next) /* go to end of list */
|
/* go to end of list */
|
||||||
h = h->next;
|
h = g_list_last (h);
|
||||||
|
|
||||||
/* go back 60 places */
|
/* go back 60 places */
|
||||||
for (i = 0; i < num_history_items_recorded - 1 && h->prev; i++)
|
for (i = 0; i < num_history_items_recorded - 1 && h->prev; i++)
|
||||||
h = h->prev;
|
h = g_list_previous (h);
|
||||||
|
|
||||||
if (input_name)
|
if (input_name)
|
||||||
profile_clean_section (input_name, profile);
|
profile_clean_section (input_name, profile);
|
||||||
|
|
||||||
/* dump histories into profile */
|
/* dump histories into profile */
|
||||||
for (i = 0; h; h = h->next){
|
for (i = 0; h; h = g_list_next (h)) {
|
||||||
if (h->text){
|
char *text;
|
||||||
|
|
||||||
/* probably aren't any null entries, but lets be sure */
|
text = (char *) h->data;
|
||||||
if (*(h->text)){
|
|
||||||
char key_name[BUF_TINY];
|
/* We shouldn't have null entries, but let's be sure */
|
||||||
g_snprintf (key_name, sizeof(key_name), "%d", i++);
|
if (text && *text) {
|
||||||
WritePrivateProfileString (input_name, key_name, h->text, profile);
|
char key_name[BUF_TINY];
|
||||||
}
|
g_snprintf (key_name, sizeof (key_name), "%d", i++);
|
||||||
|
WritePrivateProfileString (input_name, key_name, text,
|
||||||
|
profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (profile);
|
g_free (profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -905,9 +908,9 @@ i18n_htitle (void)
|
|||||||
static inline int listbox_fwd (WListbox *l);
|
static inline int listbox_fwd (WListbox *l);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
show_hist (Hist * history, int widget_x, int widget_y)
|
show_hist (GList *history, int widget_x, int widget_y)
|
||||||
{
|
{
|
||||||
Hist *hi, *z;
|
GList *hi, *z;
|
||||||
size_t maxlen = strlen (i18n_htitle ()), i, count = 0;
|
size_t maxlen = strlen (i18n_htitle ()), i, count = 0;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
char *q, *r = 0;
|
char *q, *r = 0;
|
||||||
@ -918,14 +921,13 @@ show_hist (Hist * history, int widget_x, int widget_y)
|
|||||||
if (!z)
|
if (!z)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while (z->prev) /* goto first */
|
z = g_list_first (history);
|
||||||
z = z->prev;
|
|
||||||
hi = z;
|
hi = z;
|
||||||
while (hi) {
|
while (hi) {
|
||||||
if ((i = strlen (hi->text)) > maxlen)
|
if ((i = strlen ((char *) hi->data)) > maxlen)
|
||||||
maxlen = i;
|
maxlen = i;
|
||||||
count++;
|
count++;
|
||||||
hi = hi->next;
|
hi = g_list_next (hi);
|
||||||
}
|
}
|
||||||
|
|
||||||
y = widget_y;
|
y = widget_y;
|
||||||
@ -954,17 +956,18 @@ show_hist (Hist * history, int widget_x, int widget_y)
|
|||||||
add_widget (query_dlg, query_list);
|
add_widget (query_dlg, query_list);
|
||||||
hi = z;
|
hi = z;
|
||||||
if (y < widget_y) {
|
if (y < widget_y) {
|
||||||
while (hi) { /* traverse */
|
/* traverse */
|
||||||
listbox_add_item (query_list, 0, 0, hi->text, NULL);
|
while (hi) {
|
||||||
hi = hi->next;
|
listbox_add_item (query_list, 0, 0, (char *) hi->data, NULL);
|
||||||
|
hi = g_list_next (hi);
|
||||||
}
|
}
|
||||||
while (listbox_fwd (query_list));
|
while (listbox_fwd (query_list));
|
||||||
} else {
|
} else {
|
||||||
while (hi->next)
|
/* traverse backwards */
|
||||||
hi = hi->next;
|
hi = g_list_last (history);
|
||||||
while (hi) { /* traverse backwards */
|
while (hi) {
|
||||||
listbox_add_item (query_list, 0, 0, hi->text, NULL);
|
listbox_add_item (query_list, 0, 0, (char *) hi->data, NULL);
|
||||||
hi = hi->prev;
|
hi = g_list_previous (hi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
run_dlg (query_dlg);
|
run_dlg (query_dlg);
|
||||||
@ -999,22 +1002,15 @@ input_destroy (WInput *in)
|
|||||||
}
|
}
|
||||||
|
|
||||||
new_input (in);
|
new_input (in);
|
||||||
if (in->history){
|
|
||||||
Hist *current, *old;
|
|
||||||
|
|
||||||
|
if (in->history){
|
||||||
if (!in->is_password) /* don't save passwords ;-) */
|
if (!in->is_password) /* don't save passwords ;-) */
|
||||||
history_put (in->history_name, in->history);
|
history_put (in->history_name, in->history);
|
||||||
|
|
||||||
current = in->history;
|
g_list_foreach (in->history, (GFunc) g_free, NULL);
|
||||||
while (current->next)
|
g_list_free (in->history);
|
||||||
current = current->next;
|
|
||||||
while (current){
|
|
||||||
old = current;
|
|
||||||
current = current->prev;
|
|
||||||
g_free (old->text);
|
|
||||||
g_free (old);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (in->buffer);
|
g_free (in->buffer);
|
||||||
free_completions (in);
|
free_completions (in);
|
||||||
if (in->history_name)
|
if (in->history_name)
|
||||||
@ -1049,44 +1045,43 @@ push_history (WInput *in, char *text)
|
|||||||
N_(" FTP to machine "),
|
N_(" FTP to machine "),
|
||||||
N_(" SMB link to machine ")
|
N_(" SMB link to machine ")
|
||||||
};
|
};
|
||||||
Hist *new;
|
char *t;
|
||||||
char *p;
|
char *p;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!i18n) {
|
if (!i18n) {
|
||||||
i18n = 1;
|
i18n = 1;
|
||||||
for (i = 0; i < ELEMENTS(password_input_fields); i++)
|
for (i = 0; i < ELEMENTS (password_input_fields); i++)
|
||||||
password_input_fields[i] = _(password_input_fields[i]);
|
password_input_fields[i] = _(password_input_fields[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (p = text; *p == ' ' || *p == '\t'; p++);
|
for (p = text; *p == ' ' || *p == '\t'; p++);
|
||||||
if (!*p)
|
if (!*p)
|
||||||
return 0;
|
return 0;
|
||||||
if (in->history){
|
|
||||||
while (in->history->next)
|
if (in->history) {
|
||||||
in->history = in->history->next;
|
/* Avoid duplicated entries */
|
||||||
if (!strcmp (in->history->text, text))
|
in->history = g_list_last (in->history);
|
||||||
|
if (!strcmp ((char *) in->history->data, text))
|
||||||
return 1;
|
return 1;
|
||||||
new = g_new (Hist, 1);
|
|
||||||
in->history->next = new;
|
|
||||||
} else
|
|
||||||
new = g_new (Hist, 1);
|
|
||||||
in->need_push = 0;
|
|
||||||
new->next = 0;
|
|
||||||
new->prev = in->history;
|
|
||||||
new->text = g_strdup (text);
|
|
||||||
if (in->history_name) {
|
|
||||||
p = in->history_name + 3;
|
|
||||||
for (i = 0; i < ELEMENTS(password_input_fields); i++)
|
|
||||||
if (strcmp (p, password_input_fields[i]) == 0)
|
|
||||||
break;
|
|
||||||
if (i < ELEMENTS(password_input_fields))
|
|
||||||
strip_password (new->text, 0);
|
|
||||||
else
|
|
||||||
strip_password (new->text, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
in->history = new;
|
t = g_strdup (text);
|
||||||
|
|
||||||
|
if (in->history_name) {
|
||||||
|
p = in->history_name + 3;
|
||||||
|
for (i = 0; i < ELEMENTS (password_input_fields); i++)
|
||||||
|
if (strcmp (p, password_input_fields[i]) == 0)
|
||||||
|
break;
|
||||||
|
if (i < ELEMENTS (password_input_fields))
|
||||||
|
strip_password (t, 0);
|
||||||
|
else
|
||||||
|
strip_password (t, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
in->history = g_list_append (in->history, t);
|
||||||
|
in->need_push = 0;
|
||||||
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1351,15 +1346,21 @@ hist_prev (WInput *in)
|
|||||||
|
|
||||||
if (in->need_push) {
|
if (in->need_push) {
|
||||||
switch (push_history (in, in->buffer)) {
|
switch (push_history (in, in->buffer)) {
|
||||||
case 2: in->history = in->history->prev; break;
|
case 2:
|
||||||
case 1: if (in->history->prev) in->history = in->history->prev; break;
|
in->history = g_list_previous (in->history);
|
||||||
case 0: break;
|
break;
|
||||||
|
case 1:
|
||||||
|
if (in->history->prev)
|
||||||
|
in->history = g_list_previous (in->history);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else if (in->history->prev)
|
} else if (in->history->prev)
|
||||||
in->history = in->history->prev;
|
in->history = g_list_previous (in->history);
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
assign_text (in, in->history->text);
|
assign_text (in, (char *) in->history->data);
|
||||||
in->need_push = 0;
|
in->need_push = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1384,8 +1385,8 @@ hist_next (WInput *in)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
in->history = in->history->next;
|
in->history = g_list_next (in->history);
|
||||||
assign_text (in, in->history->text);
|
assign_text (in, (char *) in->history->data);
|
||||||
in->need_push = 0;
|
in->need_push = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1623,8 +1624,8 @@ input_new (int y, int x, int color, int len, const char *def_text, char *tkname)
|
|||||||
if (def_text == INPUT_LAST_TEXT) {
|
if (def_text == INPUT_LAST_TEXT) {
|
||||||
def_text = "";
|
def_text = "";
|
||||||
if (in->history)
|
if (in->history)
|
||||||
if (in->history->text)
|
if (in->history->data)
|
||||||
def_text = in->history->text;
|
def_text = (char *) in->history->data;
|
||||||
}
|
}
|
||||||
initial_buffer_len = 1 + max (len, strlen (def_text));
|
initial_buffer_len = 1 + max (len, strlen (def_text));
|
||||||
in->widget.options |= W_IS_INPUT;
|
in->widget.options |= W_IS_INPUT;
|
||||||
|
14
src/widget.h
14
src/widget.h
@ -50,15 +50,9 @@ typedef struct WGauge {
|
|||||||
int current;
|
int current;
|
||||||
} WGauge;
|
} WGauge;
|
||||||
|
|
||||||
typedef struct hist_entry {
|
GList *history_get (char *input_name);
|
||||||
struct hist_entry *prev;
|
void history_put (char *input_name, GList *h);
|
||||||
struct hist_entry *next;
|
char *show_hist (GList *history, int widget_y, int widget_x);
|
||||||
char *text;
|
|
||||||
} Hist;
|
|
||||||
|
|
||||||
Hist *history_get (char *input_name);
|
|
||||||
void history_put (char *input_name, Hist *h);
|
|
||||||
char *show_hist (Hist *history, int widget_y, int widget_x);
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Widget widget;
|
Widget widget;
|
||||||
@ -72,7 +66,7 @@ typedef struct {
|
|||||||
int disable_update; /* Do we want to skip updates? */
|
int disable_update; /* Do we want to skip updates? */
|
||||||
int is_password; /* Is this a password input line? */
|
int is_password; /* Is this a password input line? */
|
||||||
unsigned char *buffer; /* pointer to editing buffer */
|
unsigned char *buffer; /* pointer to editing buffer */
|
||||||
Hist *history; /* The history */
|
GList *history; /* The history */
|
||||||
int need_push; /* need to push the current Input on hist? */
|
int need_push; /* need to push the current Input on hist? */
|
||||||
char **completions; /* Possible completions array */
|
char **completions; /* Possible completions array */
|
||||||
int completion_flags; /* INPUT_COMPLETE* bitwise flags(complete.h) */
|
int completion_flags; /* INPUT_COMPLETE* bitwise flags(complete.h) */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user