improved autocomplete and history
This commit is contained in:
parent
51e3b949c4
commit
c70453ff65
@ -182,7 +182,7 @@ std::string TextInputNode::getText()
|
|||||||
void TextInputNode::clearText()
|
void TextInputNode::clearText()
|
||||||
{
|
{
|
||||||
m_history.push_back(m_text);
|
m_history.push_back(m_text);
|
||||||
m_history_pos++;
|
m_history_pos=m_history.size();
|
||||||
m_text.clear();
|
m_text.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +73,11 @@ void SparrowShell::AutocompletionCallBack::exec(){
|
|||||||
std::vector<std::string> results = m_shell->m_script->possibleCompletion(text);
|
std::vector<std::string> results = m_shell->m_script->possibleCompletion(text);
|
||||||
|
|
||||||
if (!results.empty()){
|
if (!results.empty()){
|
||||||
|
if(results.size() == 1){
|
||||||
|
std::string text = results[0];
|
||||||
|
text+="()";
|
||||||
|
m_text_input_node->setText(text);
|
||||||
|
}else{
|
||||||
std:: string common_prefix = results[0];
|
std:: string common_prefix = results[0];
|
||||||
for( auto result : results){
|
for( auto result : results){
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -84,12 +89,13 @@ void SparrowShell::AutocompletionCallBack::exec(){
|
|||||||
common_prefix = cp;
|
common_prefix = cp;
|
||||||
}
|
}
|
||||||
m_text_input_node->setText(common_prefix);
|
m_text_input_node->setText(common_prefix);
|
||||||
}
|
|
||||||
std::string output = "";
|
std::string output = "";
|
||||||
for(std::string& fun : results)
|
for(std::string& fun : results)
|
||||||
output+=fun+" ";
|
output+=fun+" ";
|
||||||
m_shell->out(output,glm::vec3(1,1,0));
|
m_shell->out(output,glm::vec3(1,1,0));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SparrowShell::InputCallBack::exec(){
|
void SparrowShell::InputCallBack::exec(){
|
||||||
std::string text = m_text_input_node->getText();
|
std::string text = m_text_input_node->getText();
|
||||||
|
@ -438,13 +438,8 @@ int main(){
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
// shell output tests
|
// shell output tests
|
||||||
engine.getShell()->out("Hello World!");
|
// engine.getShell()->out("Hello World!");
|
||||||
engine.getShell()->out("Starting test :");
|
// engine.getShell()->out("Starting test :");
|
||||||
|
|
||||||
|
|
||||||
// engine.getScene()->updateShaders();
|
|
||||||
// BackGroundNode* bgrn = new BackGroundNode(glm::vec2(10),glm::vec3(1.,1.,1.),1,1);
|
|
||||||
// engine.getScene()->getRootObject()->addChild(bgrn);
|
|
||||||
|
|
||||||
// preparing shaders and launching the engine
|
// preparing shaders and launching the engine
|
||||||
engine.start();
|
engine.start();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user