============================================================================= EditPadWithSpaces()
| 3133 | // EditPadWithSpaces() |
| 3134 | // |
| 3135 | void EditPadWithSpaces ( HWND hwnd, BOOL bSkipEmpty, BOOL bNoUndoGroup ) |
| 3136 | { |
| 3137 | char *pmszPadStr; |
| 3138 | int iMaxColumn = 0; |
| 3139 | int iLine; |
| 3140 | BOOL bIsRectangular = FALSE; |
| 3141 | BOOL bReducedSelection = FALSE; |
| 3142 | int iSelStart; |
| 3143 | int iSelEnd; |
| 3144 | int iLineStart; |
| 3145 | int iLineEnd; |
| 3146 | int iRcCurLine; |
| 3147 | int iRcAnchorLine; |
| 3148 | int iRcCurCol; |
| 3149 | int iRcAnchorCol; |
| 3150 | if ( SC_SEL_RECTANGLE != SendMessage ( hwnd, SCI_GETSELECTIONMODE, 0, 0 ) ) { |
| 3151 | iSelStart = ( int ) SendMessage ( hwnd, SCI_GETSELECTIONSTART, 0, 0 ); |
| 3152 | iSelEnd = ( int ) SendMessage ( hwnd, SCI_GETSELECTIONEND, 0, 0 ); |
| 3153 | iLineStart = ( int ) SendMessage ( hwnd, SCI_LINEFROMPOSITION, ( WPARAM ) iSelStart, 0 ); |
| 3154 | iLineEnd = ( int ) SendMessage ( hwnd, SCI_LINEFROMPOSITION, ( WPARAM ) iSelEnd, 0 ); |
| 3155 | if ( iLineStart == iLineEnd ) { |
| 3156 | iLineStart = 0; |
| 3157 | iLineEnd = ( int ) SendMessage ( hwnd, SCI_GETLINECOUNT, 0, 0 ) - 1; |
| 3158 | } else { |
| 3159 | if ( iSelEnd <= SendMessage ( hwnd, SCI_POSITIONFROMLINE, ( WPARAM ) iLineEnd, 0 ) ) { |
| 3160 | if ( iLineEnd - iLineStart >= 1 ) { |
| 3161 | iLineEnd--; |
| 3162 | bReducedSelection = TRUE; |
| 3163 | } |
| 3164 | } |
| 3165 | } |
| 3166 | for ( iLine = iLineStart; iLine <= iLineEnd; iLine++ ) { |
| 3167 | int iPos = ( int ) SendMessage ( hwnd, SCI_GETLINEENDPOSITION, ( WPARAM ) iLine, 0 ); |
| 3168 | iMaxColumn = max ( iMaxColumn, ( int ) SendMessage ( hwnd, SCI_GETCOLUMN, ( WPARAM ) iPos, 0 ) ); |
| 3169 | } |
| 3170 | } else { |
| 3171 | int iCurPos = ( int ) SendMessage ( hwnd, SCI_GETCURRENTPOS, 0, 0 ); |
| 3172 | int iAnchorPos = ( int ) SendMessage ( hwnd, SCI_GETANCHOR, 0, 0 ); |
| 3173 | iRcCurLine = ( int ) SendMessage ( hwnd, SCI_LINEFROMPOSITION, ( WPARAM ) iCurPos, 0 ); |
| 3174 | iRcAnchorLine = ( int ) SendMessage ( hwnd, SCI_LINEFROMPOSITION, ( WPARAM ) iAnchorPos, 0 ); |
| 3175 | iRcCurCol = ( int ) SendMessage ( hwnd, SCI_GETCOLUMN, ( WPARAM ) iCurPos, 0 ); |
| 3176 | iRcAnchorCol = ( int ) SendMessage ( hwnd, SCI_GETCOLUMN, ( WPARAM ) iAnchorPos, 0 ); |
| 3177 | bIsRectangular = TRUE; |
| 3178 | iLineStart = 0; |
| 3179 | iLineEnd = ( int ) SendMessage ( hwnd, SCI_GETLINECOUNT, 0, 0 ) - 1; |
| 3180 | for ( iLine = iLineStart; iLine <= iLineEnd; iLine++ ) { |
| 3181 | int iPos = ( int ) SendMessage ( hwnd, SCI_GETLINESELENDPOSITION, ( WPARAM ) iLine, 0 ); |
| 3182 | if ( iPos != INVALID_POSITION ) { |
| 3183 | iMaxColumn = max ( iMaxColumn, ( int ) SendMessage ( hwnd, SCI_GETCOLUMN, ( WPARAM ) iPos, 0 ) ); |
| 3184 | } |
| 3185 | } |
| 3186 | } |
| 3187 | pmszPadStr = LocalAlloc ( LPTR, ( iMaxColumn + 1 ) * sizeof ( char ) ); |
| 3188 | if ( pmszPadStr ) { |
| 3189 | FillMemory ( pmszPadStr, LocalSize ( pmszPadStr ), ' ' ); |
| 3190 | if ( !bNoUndoGroup ) { |
| 3191 | SendMessage ( hwnd, SCI_BEGINUNDOACTION, 0, 0 ); |
| 3192 | } |
no outgoing calls
no test coverage detected