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

Function EditFixPositions

src/Edit.c:4166–4186  ·  view source on GitHub ↗

============================================================================= EditFixPositions()

Source from the content-addressed store, hash-verified

4164// EditFixPositions()
4165//
4166void EditFixPositions ( HWND hwnd )
4167{
4168 int iMaxPos = ( int ) SendMessage ( hwnd, SCI_GETLENGTH, 0, 0 );
4169 int iCurrentPos = ( int ) SendMessage ( hwnd, SCI_GETCURRENTPOS, 0, 0 );
4170 int iAnchorPos = ( int ) SendMessage ( hwnd, SCI_GETANCHOR, 0, 0 );
4171 if ( iCurrentPos > 0 && iCurrentPos < iMaxPos ) {
4172 int iNewPos = ( int ) SendMessage ( hwnd, SCI_POSITIONAFTER, ( WPARAM )
4173 ( int ) SendMessage ( hwnd, SCI_POSITIONBEFORE, ( WPARAM ) iCurrentPos, 0 ), 0 );
4174 if ( iNewPos != iCurrentPos ) {
4175 SendMessage ( hwnd, SCI_SETCURRENTPOS, ( WPARAM ) iNewPos, 0 );
4176 iCurrentPos = iNewPos;
4177 }
4178 }
4179 if ( iAnchorPos != iCurrentPos && iAnchorPos > 0 && iAnchorPos < iMaxPos ) {
4180 int iNewPos = ( int ) SendMessage ( hwnd, SCI_POSITIONAFTER, ( WPARAM )
4181 ( int ) SendMessage ( hwnd, SCI_POSITIONBEFORE, ( WPARAM ) iAnchorPos, 0 ), 0 );
4182 if ( iNewPos != iAnchorPos ) {
4183 SendMessage ( hwnd, SCI_SETANCHOR, ( WPARAM ) iNewPos, 0 );
4184 }
4185 }
4186}
4187
4188
4189//=============================================================================

Callers 3

EditSaveFileFunction · 0.85
MsgCommandFunction · 0.85
MsgNotifyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected