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

Function EditJumpTo

src/Edit.c:4088–4117  ·  view source on GitHub ↗

============================================================================= EditJumpTo()

Source from the content-addressed store, hash-verified

4086// EditJumpTo()
4087//
4088void EditJumpTo ( HWND hwnd, int iNewLine, int iNewCol )
4089{
4090 int iMaxLine = ( int ) SendMessage ( hwnd, SCI_GETLINECOUNT, 0, 0 );
4091 // Jumpt to end with line set to -1
4092 if ( iNewLine == -1 ) {
4093 SendMessage ( hwnd, SCI_DOCUMENTEND, 0, 0 );
4094 return;
4095 }
4096 // Line maximum is iMaxLine
4097 iNewLine = min ( iNewLine, iMaxLine );
4098 // Column minimum is 1
4099 iNewCol = max ( iNewCol, 1 );
4100 if ( iNewLine > 0 && iNewLine <= iMaxLine && iNewCol > 0 ) {
4101 int iNewPos = ( int ) SendMessage ( hwnd, SCI_POSITIONFROMLINE, ( WPARAM ) iNewLine - 1, 0 );
4102 int iLineEndPos = ( int ) SendMessage ( hwnd, SCI_GETLINEENDPOSITION, ( WPARAM ) iNewLine - 1, 0 );
4103 while ( iNewCol - 1 > SendMessage ( hwnd, SCI_GETCOLUMN, ( WPARAM ) iNewPos, 0 ) ) {
4104 if ( iNewPos >= iLineEndPos ) {
4105 break;
4106 }
4107 iNewPos = ( int ) SendMessage ( hwnd, SCI_POSITIONAFTER, ( WPARAM ) iNewPos, 0 );
4108 }
4109 SendMessage ( hwnd, SCI_SETXCARETPOLICY, CARET_SLOP | CARET_STRICT | CARET_EVEN, 50 );
4110 SendMessage ( hwnd, SCI_SETYCARETPOLICY, CARET_SLOP | CARET_STRICT | CARET_EVEN, 5 );
4111 iNewPos = min ( iNewPos, iLineEndPos );
4112 SendMessage ( hwnd, SCI_GOTOPOS, ( WPARAM ) iNewPos, 0 );
4113 SendMessage ( hwnd, SCI_CHOOSECARETX, 0, 0 );
4114 SendMessage ( hwnd, SCI_SETXCARETPOLICY, CARET_SLOP | CARET_EVEN, 50 );
4115 SendMessage ( hwnd, SCI_SETYCARETPOLICY, CARET_EVEN, 0 );
4116 }
4117}
4118
4119VOID HL_Adjust_offset ( int *pos , BOOL in )
4120{

Callers 5

EditLinenumDlgProcFunction · 0.85
InitInstanceFunction · 0.85
MainWndProcFunction · 0.85
_FileLoadFunction · 0.85
PasteBoardTimerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected