From a054851c8f070262d3764cc6450c0585c4f009ff 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 | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/src/editor/editcmd_dialogs.c b/src/editor/editcmd_dialogs.c
index aa9f145..c3500a6 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 | 392 | GString *temp, *temp2; |
393 | | temp = g_string_new (""); |
394 | | for (curr += word_len; *curr; curr++) |
395 | | g_string_append_c (temp, *curr); |
396 | 393 | |
397 | | temp2 = str_convert_to_input (temp->str); |
| 394 | temp = g_string_sized_new (8); |
| 395 | temp2 = str_convert_to_input (curr); |
| 396 | curr = temp2->str; |
398 | 397 | |
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++) |
| 398 | for (curr += word_len; *curr != '\0'; curr++) |
| 399 | g_string_append_c (temp, *curr); |
| 400 | g_string_free (temp2, TRUE); |
| 401 | |
| 402 | for (curr = temp->str; *curr != '\0'; curr++) |
407 | 403 | edit_insert (edit, *curr); |
408 | 404 | g_string_free (temp, TRUE); |
409 | 405 | #else |
410 | | for (curr += word_len; *curr; curr++) |
| 406 | for (curr += word_len; *curr != '\0'; curr++) |
411 | 407 | edit_insert (edit, *curr); |
412 | 408 | #endif |
413 | 409 | } |