forked from enlightenment/edi
autocomplete: fix screen flicker when use autocomplete
Summary: Remove file save function when initialize clang. Test Plan: Check that the screen is not blinking when use autocomplete. Reviewers: ajwillia.ms Reviewed By: ajwillia.ms Differential Revision: https://phab.enlightenment.org/D4486
This commit is contained in:
parent
9d128bdb40
commit
8d82796fa1
|
@ -178,6 +178,7 @@ _autocomplete_list_set(Edi_Editor *editor)
|
||||||
CXIndex idx;
|
CXIndex idx;
|
||||||
CXTranslationUnit tx_unit;
|
CXTranslationUnit tx_unit;
|
||||||
CXCodeCompleteResults *res;
|
CXCodeCompleteResults *res;
|
||||||
|
struct CXUnsavedFile unsaved_file;
|
||||||
char *curword, **clang_argv;
|
char *curword, **clang_argv;
|
||||||
const char *path, *args;
|
const char *path, *args;
|
||||||
unsigned int clang_argc, row, col;
|
unsigned int clang_argc, row, col;
|
||||||
|
@ -195,7 +196,6 @@ _autocomplete_list_set(Edi_Editor *editor)
|
||||||
"autocomplete_list");
|
"autocomplete_list");
|
||||||
}
|
}
|
||||||
|
|
||||||
edi_editor_save(editor);
|
|
||||||
elm_code_widget_cursor_position_get(editor->entry, &row, &col);
|
elm_code_widget_cursor_position_get(editor->entry, &row, &col);
|
||||||
|
|
||||||
code = elm_code_widget_code_get(editor->entry);
|
code = elm_code_widget_code_get(editor->entry);
|
||||||
|
@ -208,13 +208,19 @@ _autocomplete_list_set(Edi_Editor *editor)
|
||||||
clang_argv = eina_str_split_full(args, " ", 0, &clang_argc);
|
clang_argv = eina_str_split_full(args, " ", 0, &clang_argc);
|
||||||
|
|
||||||
idx = clang_createIndex(0, 0);
|
idx = clang_createIndex(0, 0);
|
||||||
|
|
||||||
|
unsaved_file.Filename = path;
|
||||||
|
unsaved_file.Contents = elm_code_widget_text_between_positions_get(
|
||||||
|
editor->entry, 1, 1, col, row);
|
||||||
|
unsaved_file.Length = strlen(unsaved_file.Contents);
|
||||||
/* FIXME: Possibly activate more options? */
|
/* FIXME: Possibly activate more options? */
|
||||||
tx_unit = clang_parseTranslationUnit(idx, path,
|
tx_unit = clang_parseTranslationUnit(idx, path,
|
||||||
(const char *const *)clang_argv,
|
(const char *const *)clang_argv,
|
||||||
(int)clang_argc, NULL, 0,
|
(int)clang_argc, &unsaved_file, 1,
|
||||||
CXTranslationUnit_PrecompiledPreamble);
|
CXTranslationUnit_PrecompiledPreamble);
|
||||||
clang_reparseTranslationUnit(tx_unit, 0, 0, 0);
|
clang_reparseTranslationUnit(tx_unit, 0, 0, 0);
|
||||||
res = clang_codeCompleteAt(tx_unit, path, row, col - strlen(curword), NULL, 0,
|
res = clang_codeCompleteAt(tx_unit, path, row, col - strlen(curword),
|
||||||
|
&unsaved_file, 1,
|
||||||
CXCodeComplete_IncludeMacros |
|
CXCodeComplete_IncludeMacros |
|
||||||
CXCodeComplete_IncludeCodePatterns);
|
CXCodeComplete_IncludeCodePatterns);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue