| 3859 | } |
| 3860 | |
| 3861 | void EditSortLines ( HWND hwnd, int iSortFlags ) |
| 3862 | { |
| 3863 | int iCurPos; |
| 3864 | int iAnchorPos; |
| 3865 | int iSelStart; |
| 3866 | int iSelEnd; |
| 3867 | int iLineStart; |
| 3868 | int iLineEnd; |
| 3869 | int iLineCount; |
| 3870 | BOOL bIsRectangular = FALSE; |
| 3871 | int iRcCurLine; |
| 3872 | int iRcAnchorLine; |
| 3873 | int iRcCurCol; |
| 3874 | int iRcAnchorCol; |
| 3875 | int i, iLine; |
| 3876 | int cchTotal = 0; |
| 3877 | int ichlMax = 3; |
| 3878 | SORTLINE *pLines; |
| 3879 | char *pmszResult; |
| 3880 | char *pmszBuf; |
| 3881 | UINT uCodePage; |
| 3882 | DWORD cEOLMode; |
| 3883 | char mszEOL[] = "\r\n"; |
| 3884 | UINT iTabWidth; |
| 3885 | UINT iSortColumn; |
| 3886 | BOOL bLastDup = FALSE; |
| 3887 | FNSTRCMP pfnStrCmp; |
| 3888 | pfnStrCmpLogicalW = GetProcAddress ( GetModuleHandle ( L"shlwapi" ), "StrCmpLogicalW" ); |
| 3889 | pfnStrCmp = ( iSortFlags & SORT_NOCASE ) ? StrCmpIW : StrCmpW; |
| 3890 | iCurPos = ( int ) SendMessage ( hwnd, SCI_GETCURRENTPOS, 0, 0 ); |
| 3891 | iAnchorPos = ( int ) SendMessage ( hwnd, SCI_GETANCHOR, 0, 0 ); |
| 3892 | if ( iCurPos == iAnchorPos ) { |
| 3893 | return; |
| 3894 | } |
| 3895 | if ( SC_SEL_RECTANGLE == SendMessage ( hwnd, SCI_GETSELECTIONMODE, 0, 0 ) ) { |
| 3896 | iRcCurLine = ( int ) SendMessage ( hwnd, SCI_LINEFROMPOSITION, ( WPARAM ) iCurPos, 0 ); |
| 3897 | iRcAnchorLine = ( int ) SendMessage ( hwnd, SCI_LINEFROMPOSITION, ( WPARAM ) iAnchorPos, 0 ); |
| 3898 | iRcCurCol = ( int ) SendMessage ( hwnd, SCI_GETCOLUMN, ( WPARAM ) iCurPos, 0 ); |
| 3899 | iRcAnchorCol = ( int ) SendMessage ( hwnd, SCI_GETCOLUMN, ( WPARAM ) iAnchorPos, 0 ); |
| 3900 | bIsRectangular = TRUE; |
| 3901 | iLineStart = min ( iRcCurLine, iRcAnchorLine ); |
| 3902 | iLineEnd = max ( iRcCurLine, iRcAnchorLine ); |
| 3903 | iSortColumn = min ( iRcCurCol, iRcAnchorCol ); |
| 3904 | } else { |
| 3905 | iSelStart = ( int ) SendMessage ( hwnd, SCI_GETSELECTIONSTART, 0, 0 ); |
| 3906 | iSelEnd = ( int ) SendMessage ( hwnd, SCI_GETSELECTIONEND, 0, 0 ); |
| 3907 | iLine = ( int ) SendMessage ( hwnd, SCI_LINEFROMPOSITION, ( WPARAM ) iSelStart, 0 ); |
| 3908 | iSelStart = ( int ) SendMessage ( hwnd, SCI_POSITIONFROMLINE, ( WPARAM ) iLine, 0 ); |
| 3909 | iLineStart = ( int ) SendMessage ( hwnd, SCI_LINEFROMPOSITION, ( WPARAM ) iSelStart, 0 ); |
| 3910 | iLineEnd = ( int ) SendMessage ( hwnd, SCI_LINEFROMPOSITION, ( WPARAM ) iSelEnd, 0 ); |
| 3911 | if ( iSelEnd <= SendMessage ( hwnd, SCI_POSITIONFROMLINE, ( WPARAM ) iLineEnd, 0 ) ) { |
| 3912 | iLineEnd--; |
| 3913 | } |
| 3914 | iSortColumn = ( UINT ) SendMessage ( hwnd, SCI_GETCOLUMN, |
| 3915 | ( WPARAM ) SendMessage ( hwnd, SCI_GETCURRENTPOS, 0, 0 ), 0 ); |
| 3916 | } |
| 3917 | iLineCount = iLineEnd - iLineStart + 1; |
| 3918 | if ( iLineCount < 2 ) { |
no test coverage detected