fxscintilla-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[fxscintilla-users] DND data length incorrect in Win9X


From: Rafael de Pelegrini Soares
Subject: [fxscintilla-users] DND data length incorrect in Win9X
Date: Thu, 29 May 2003 09:40:04 -0300

Hi Gilles,

In the current version of FXScintilla a have experienced some problems when 
pasting 
text in Win9X (not NT and XP). The source of the problem is that in Win9X the 
DND 
data length can be potentially greater than it is (actually i have noted that 
the returned 
data length is a multiple of 32 no matter the correct length of data).

So, to fix this problem we can modify the following function:

void ScintillaFOX::ReceivedSelection(FXDNDOrigin origin){
        FXuchar *data; FXuint len;
        if (!pdoc->IsReadOnly()) {
                if(_fxsc.getDNDData(origin, FXWindow::stringType, data, len)) {
#ifdef WIN32
                        FXint correctLen = len-32;
                        while(data[correctLen] && correctLen<len)
                                ++correctLen;
                        len=correctLen;
#endif  // WIN32
                        FXRESIZE(&data,FXuchar,len+1); data[len]='\0';
                        pdoc->BeginUndoAction();
                        // Check for "\n\0" ending to string indicating that 
selection is 
rectangular
                        int selStart = SelectionStart();
                        if(_fxsc.hasSelection() && (origin == FROM_CLIPBOARD)) {
                                ClearSelection();
                        }
                        pdoc->InsertString(currentPos, (const char *)data, len);
                        SetEmptySelection(currentPos + len);
                }
                pdoc->EndUndoAction();
      FXFREE(&data);
        }
}

[]'s.

-Rafael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]