From 154f6a427557e6ae93a386f303e4c9888caa45a2 Mon Sep 17 00:00:00 2001
From: Andrew Borodin <aborodin@vmail.ru>
Date: Thu, 31 Jan 2013 14:10:50 +0400
Subject: [PATCH] mcedit: fix autocompletion.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
---
src/editor/editcmd_dialogs.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/editor/editcmd_dialogs.c b/src/editor/editcmd_dialogs.c
index aa9f145..ae15957 100644
a
|
b
|
editcmd_dialog_completion_show (WEdit * edit, int max_len, int word_len, |
386 | 386 | if (run_dlg (compl_dlg) == B_ENTER) |
387 | 387 | { |
388 | 388 | listbox_get_current (compl_list, &curr, NULL); |
389 | | if (curr) |
| 389 | if (curr != NULL) |
390 | 390 | { |
391 | 391 | #ifdef HAVE_CHARSET |
392 | | GString *temp, *temp2; |
393 | | temp = g_string_new (""); |
394 | | for (curr += word_len; *curr; curr++) |
395 | | g_string_append_c (temp, *curr); |
| 392 | GString *temp; |
396 | 393 | |
397 | | temp2 = str_convert_to_input (temp->str); |
| 394 | temp = str_convert_to_input (curr); |
398 | 395 | |
399 | | if (temp2 && temp2->len) |
400 | | { |
401 | | g_string_free (temp, TRUE); |
402 | | temp = temp2; |
403 | | } |
404 | | else |
405 | | g_string_free (temp2, TRUE); |
406 | | for (curr = temp->str; *curr; curr++) |
| 396 | for (curr = temp->str + word_len; *curr != '\0'; curr++) |
407 | 397 | edit_insert (edit, *curr); |
| 398 | |
408 | 399 | g_string_free (temp, TRUE); |
409 | 400 | #else |
410 | | for (curr += word_len; *curr; curr++) |
| 401 | for (curr += word_len; *curr != '\0'; curr++) |
411 | 402 | edit_insert (edit, *curr); |
412 | 403 | #endif |
413 | 404 | } |