MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / EditStripFirstCharacter

Function EditStripFirstCharacter

src/Edit.c:3251–3283  ·  view source on GitHub ↗

============================================================================= EditStripFirstCharacter()

Source from the content-addressed store, hash-verified

3249// EditStripFirstCharacter()
3250//
3251void EditStripFirstCharacter ( HWND hwnd )
3252{
3253 int iSelStart = ( int ) SendMessage ( hwnd, SCI_GETSELECTIONSTART, 0, 0 );
3254 int iSelEnd = ( int ) SendMessage ( hwnd, SCI_GETSELECTIONEND, 0, 0 );
3255 if ( iSelStart == iSelEnd ) {
3256 iSelStart = 0;
3257 iSelEnd = ( int ) SendMessage ( hwnd, SCI_GETLENGTH, 0, 0 );
3258 }
3259 if ( SC_SEL_RECTANGLE != SendMessage ( hwnd, SCI_GETSELECTIONMODE, 0, 0 ) ) {
3260 int iLine;
3261 int iLineStart = ( int ) SendMessage ( hwnd, SCI_LINEFROMPOSITION, ( WPARAM ) iSelStart, 0 );
3262 int iLineEnd = ( int ) SendMessage ( hwnd, SCI_LINEFROMPOSITION, ( WPARAM ) iSelEnd, 0 );
3263 if ( iSelStart > SendMessage ( hwnd, SCI_POSITIONFROMLINE, ( WPARAM ) iLineStart, 0 ) ) {
3264 iLineStart++;
3265 }
3266 if ( iSelEnd <= SendMessage ( hwnd, SCI_POSITIONFROMLINE, ( WPARAM ) iLineEnd, 0 ) ) {
3267 iLineEnd--;
3268 }
3269 SendMessage ( hwnd, SCI_BEGINUNDOACTION, 0, 0 );
3270 for ( iLine = iLineStart; iLine <= iLineEnd; iLine++ ) {
3271 int iPos = ( int ) SendMessage ( hwnd, SCI_POSITIONFROMLINE, ( WPARAM ) iLine, 0 );
3272 if ( SendMessage ( hwnd, SCI_GETLINEENDPOSITION, ( WPARAM ) iLine, 0 ) - iPos > 0 ) {
3273 SendMessage ( hwnd, SCI_SETTARGETSTART, ( WPARAM ) iPos, 0 );
3274 SendMessage ( hwnd, SCI_SETTARGETEND,
3275 ( WPARAM ) SendMessage ( hwnd, SCI_POSITIONAFTER, ( WPARAM ) iPos, 0 ), 0 );
3276 SendMessage ( hwnd, SCI_REPLACETARGET, 0, ( LPARAM ) "" );
3277 }
3278 }
3279 SendMessage ( hwnd, SCI_ENDUNDOACTION, 0, 0 );
3280 } else {
3281 MsgBox ( MBINFO, IDS_SELRECT );
3282 }
3283}
3284
3285
3286//=============================================================================

Callers 1

MsgCommandFunction · 0.85

Calls 1

MsgBoxFunction · 0.85

Tested by

no test coverage detected