aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/AutoComplete.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2012-06-17 13:38:21 +1000
committernyamatongwe <devnull@localhost>2012-06-17 13:38:21 +1000
commit0d2bd5e004b657be9bd66e26161f1cf7299707ea (patch)
treecb92a15ff4afba794cd8cc8ee0bf9ecd75bccfd1 /src/AutoComplete.cxx
parent6b61cd57097eba543a36f6cd78954c43e31a7bef (diff)
downloadscintilla-mirror-0d2bd5e004b657be9bd66e26161f1cf7299707ea.tar.gz
Use std::string instead of fixed size strings.
Decrease direct access to the autocompletion list box from outside AutoComplete.
Diffstat (limited to 'src/AutoComplete.cxx')
-rw-r--r--src/AutoComplete.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx
index aa65810eb..82773f4db 100644
--- a/src/AutoComplete.cxx
+++ b/src/AutoComplete.cxx
@@ -10,6 +10,8 @@
#include <stdio.h>
#include <assert.h>
+#include <string>
+
#include "Platform.h"
#include "CharacterSet.h"
@@ -101,6 +103,16 @@ void AutoComplete::SetList(const char *list) {
lb->SetList(list, separator, typesep);
}
+int AutoComplete::GetSelection() const {
+ return lb->GetSelection();
+}
+
+std::string AutoComplete::GetValue(int item) const {
+ char value[maxItemLen];
+ lb->GetValue(item, value, sizeof(value));
+ return std::string(value);
+}
+
void AutoComplete::Show(bool show) {
lb->Show(show);
if (show)
@@ -130,7 +142,6 @@ void AutoComplete::Move(int delta) {
void AutoComplete::Select(const char *word) {
size_t lenWord = strlen(word);
int location = -1;
- const int maxItemLen=1000;
int start = 0; // lower bound of the api array block to search
int end = lb->Length() - 1; // upper bound of the api array block to search
while ((start <= end) && (location == -1)) { // Binary searching loop