Feature #170 I did a small patch that allows SPACE to trigger autocompletion on any space (Thanassis Tsiodras)
This commit is contained in:
parent
0065a8054c
commit
0a5c83adfd
|
@ -622,9 +622,9 @@ void XmlCtrl::handleSpace ( wxKeyEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
int style = getLexerStyleAt ( pos - 1 );
|
||||
|
||||
char c = GetCharAt ( pos - 1 );
|
||||
int prevPos;
|
||||
char c = getPrevNonSpaceChar ( pos, &prevPos );
|
||||
int style = getLexerStyleAt ( prevPos );
|
||||
|
||||
bool proceed = false;
|
||||
// space pressed after element name
|
||||
|
@ -641,7 +641,7 @@ void XmlCtrl::handleSpace ( wxKeyEvent& event )
|
|||
( style == wxSTC_H_DOUBLESTRING ||
|
||||
style == wxSTC_H_SINGLESTRING ) &&
|
||||
( c == '\'' || c == '"' ) &&
|
||||
GetCharAt ( pos - 2 ) != '=' )
|
||||
getPrevNonSpaceChar ( prevPos - 1, NULL ) != '=' )
|
||||
{
|
||||
proceed = true;
|
||||
}
|
||||
|
@ -2403,3 +2403,20 @@ void XmlCtrl::OnKillFocus ( wxFocusEvent &event )
|
|||
AutoCompCancel();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
int XmlCtrl::getPrevNonSpaceChar ( int curPos, int *charPos )
|
||||
{
|
||||
int c = 0;
|
||||
int pos = curPos;
|
||||
while ( pos-- > 0 )
|
||||
{
|
||||
c = GetCharAt ( pos );
|
||||
if ( !wxIsspace ( c ) )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( charPos )
|
||||
*charPos = pos;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -162,6 +162,7 @@ class XmlCtrl: public wxStyledTextCtrl
|
|||
bool selectCurrentElement();
|
||||
void toggleComment();
|
||||
wxString getCurrentXPath();
|
||||
int getPrevNonSpaceChar ( int curPos, int *charPos );
|
||||
private:
|
||||
ValidationThread *validationThread; // used for background validation
|
||||
XmlPromptGenerator *mPromptGeneratorThread;
|
||||
|
|
Loading…
Reference in New Issue