QmlJSEditor: bugfix

We have to check for  m_oldCursorPosition != -1
to avoid calling apply() in the case of a TextMarker
update. Otherwise the QuickToolBar misbehaves.

I also removed the comment.
This commit is contained in:
Thomas Hartmann
2010-08-13 17:20:33 +02:00
parent 8a86265c74
commit d7956ad2e0

View File

@@ -958,14 +958,13 @@ void QmlJSTextEditor::updateCursorPositionNow()
document()->revision() == semanticInfo().document->editorRevision()) { document()->revision() == semanticInfo().document->editorRevision()) {
Node *oldNode = m_semanticInfo.declaringMemberNoProperties(m_oldCursorPosition); Node *oldNode = m_semanticInfo.declaringMemberNoProperties(m_oldCursorPosition);
Node *newNode = m_semanticInfo.declaringMemberNoProperties(position()); Node *newNode = m_semanticInfo.declaringMemberNoProperties(position());
if (oldNode != newNode) if (oldNode != newNode && m_oldCursorPosition != -1)
m_contextPane->apply(editableInterface(), m_semanticInfo.document, m_semanticInfo.snapshot, newNode, false); m_contextPane->apply(editableInterface(), m_semanticInfo.document, m_semanticInfo.snapshot, newNode, false);
if (oldNode != newNode && if (oldNode != newNode &&
m_contextPane->isAvailable(editableInterface(), m_semanticInfo.document, m_semanticInfo.snapshot, newNode) && m_contextPane->isAvailable(editableInterface(), m_semanticInfo.document, m_semanticInfo.snapshot, newNode) &&
!m_contextPane->widget()->isVisible()) { !m_contextPane->widget()->isVisible()) {
QList<TextEditor::Internal::RefactorMarker> markers; QList<TextEditor::Internal::RefactorMarker> markers;
if (UiObjectMember *m = newNode->uiObjectMemberCast()) { if (UiObjectMember *m = newNode->uiObjectMemberCast()) {
//const int start = m->firstSourceLocation().begin(); ### we consider moving the icon to the front
for (UiQualifiedId *q = qualifiedTypeNameId(m); q; q = q->next) { for (UiQualifiedId *q = qualifiedTypeNameId(m); q; q = q->next) {
if (! q->next) { if (! q->next) {
const int end = q->identifierToken.end(); const int end = q->identifierToken.end();