aboutsummaryrefslogtreecommitdiffhomepage
path: root/reader.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-24 12:13:35 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-24 12:19:31 -0800
commita515db4aea51a032b06eb463fcc5a5b70066a18c (patch)
tree68774c3b9afbdadfbdde6ecdf8934b3099cdb331 /reader.cpp
parent90e979d0d9a94601fc9a0c1e5ad785ede1e92381 (diff)
Some work to allow completions to be evaluated off of the main thread
Diffstat (limited to 'reader.cpp')
-rw-r--r--reader.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/reader.cpp b/reader.cpp
index f1dea75d..7c65cd33 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -258,8 +258,7 @@ class reader_data_t
/**
Function for tab completion
*/
- void (*complete_func)( const wchar_t *,
- std::vector<completion_t>& );
+ complete_function_t complete_func;
/**
Function for syntax highlighting
@@ -1235,6 +1234,10 @@ struct autosuggestion_context_t {
int threaded_autosuggest(void) {
ASSERT_IS_BACKGROUND_THREAD();
+
+ std::vector<completion_t> completions;
+ complete(search_string.c_str(), completions, COMPLETE_AUTOSUGGEST);
+
while (searcher.go_backwards()) {
history_item_t item = searcher.current_item();
bool item_ok = false;
@@ -2299,8 +2302,7 @@ void reader_set_prompt( const wchar_t *new_prompt )
data->prompt = new_prompt;
}
-void reader_set_complete_function( void (*f)( const wchar_t *,
- std::vector<completion_t>& ) )
+void reader_set_complete_function( complete_function_t f )
{
data->complete_func = f;
}
@@ -2828,7 +2830,7 @@ const wchar_t *reader_readline()
buffcpy = wcsndup( begin, len );
// comp = al_halloc( 0 );
- data->complete_func( buffcpy, comp );
+ data->complete_func( buffcpy, comp, COMPLETE_DEFAULT );
sort_completion_list( comp );
remove_duplicates( comp );