#996 "IsTyped" flag for SCN_MODIFIED

Completed
closed
scintilla (89)
2
2013-06-18
2013-06-06
No

We have our own pop-up completion system. It is triggered by SCN_MODIFIED+SC_MOD_INSERTTEXT.

However, it should only be triggered when the user has typed something, not when we insert text programmaticaly.

We have updated (hack) the SC_MOD_INSERTTEXT to put a IsTyped flag in the line field of the notification structure.

Our update is.

Add an extra isTyped parameter to Document::InsertText:

bool InsertString(int position, const char *s, int insertLength, bool isTyped = false);  // PDC MODIFICATION

Which is placed in the line field:

bool Document::InsertString(int position, const char *s, int insertLength, bool isTyped) {  // PDC MODIFICATION
    ...
            ModifiedAt(position);
            NotifyModified(
                DocModification(
                SC_MOD_INSERTTEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0),
                position, insertLength,
                LinesTotal() - prevLinesTotal, text, isTyped));  // PDC MODIFICATION
        }
        enteredModification--;
    }
    return !cb.IsReadOnly();
}

Finally, Editor::AddCharUTF is updated like this:

void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
    FilterSelections();
    {
        UndoGroup ug(pdoc, (sel.Count() > 1) || !sel.Empty() || inOverstrike);

        ...
                positionInsert = InsertSpace(positionInsert, currentSel->caret.VirtualSpace());
                if (pdoc->InsertString(positionInsert, s, len, true)) {  // PDC MODIFICATION
                    currentSel->caret.SetPosition(positionInsert + len);
                    currentSel->anchor.SetPosition(positionInsert + len);
                }
                currentSel->ClearVirtualSpace();
        ...

So the questions are:

  • Should we do this in another way?
  • Or otherwise could the notifications be updated with such information?

Discussion

  • Neil Hodgson

    Neil Hodgson - 2013-06-06
    • labels: --> scintilla
    • assigned_to: Neil Hodgson
    • Priority: 5 --> 2
     
  • Neil Hodgson

    Neil Hodgson - 2013-06-06

    The normal technique is to use SCN_CHARADDED.

     
  • Thomas Linder Puls

    Thank you.

     
  • Neil Hodgson

    Neil Hodgson - 2013-06-18
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks