1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Ignore text after the cursor when performing a completion. The text will

be deleted.
This commit is contained in:
Miciah Dashiel Butler Masters 2006-04-29 22:30:07 +00:00 committed by Miciah Dashiel Butler Masters
parent 54009b217c
commit 6d3b2a97f6

View File

@ -62,7 +62,7 @@ do_tab_compl(struct dialog_data *dlg_data, struct list_head *history)
{ {
struct terminal *term = dlg_data->win->term; struct terminal *term = dlg_data->win->term;
struct widget_data *widget_data = selected_widget(dlg_data); struct widget_data *widget_data = selected_widget(dlg_data);
int cdata_len = strlen(widget_data->cdata); int cpos = widget_data->info.field.cpos;
int n = 0; int n = 0;
struct input_history_entry *entry; struct input_history_entry *entry;
struct menu_item *items = new_menu(FREE_LIST | NO_INTL); struct menu_item *items = new_menu(FREE_LIST | NO_INTL);
@ -70,7 +70,7 @@ do_tab_compl(struct dialog_data *dlg_data, struct list_head *history)
if (!items) return; if (!items) return;
foreach (entry, *history) { foreach (entry, *history) {
if (strncmp(widget_data->cdata, entry->data, cdata_len)) if (strncmp(widget_data->cdata, entry->data, cpos))
continue; continue;
add_to_menu(&items, entry->data, NULL, ACT_MAIN_NONE, add_to_menu(&items, entry->data, NULL, ACT_MAIN_NONE,
@ -107,7 +107,7 @@ void
do_tab_compl_unambiguous(struct dialog_data *dlg_data, struct list_head *history) do_tab_compl_unambiguous(struct dialog_data *dlg_data, struct list_head *history)
{ {
struct widget_data *widget_data = selected_widget(dlg_data); struct widget_data *widget_data = selected_widget(dlg_data);
int base_len = strlen(widget_data->cdata); int base_len = widget_data->info.field.cpos;
/* Maximum number of characters in a match. Characters after this /* Maximum number of characters in a match. Characters after this
* position are varying in other matches. */ * position are varying in other matches. */
int longest_common_match = 0; int longest_common_match = 0;