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

Method WordSelection

scintilla/src/Editor.cxx:6388–6414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6386}
6387
6388void Editor::WordSelection ( int pos )
6389{
6390 if ( pos < wordSelectAnchorStartPos ) {
6391 // Extend backward to the word containing pos.
6392 // Skip ExtendWordSelect if the line is empty or if pos is after the last character.
6393 // This ensures that a series of empty lines isn't counted as a single "word".
6394 if ( !pdoc->IsLineEndPosition ( pos ) ) {
6395 pos = pdoc->ExtendWordSelect ( pdoc->MovePositionOutsideChar ( pos + 1, 1 ), -1 );
6396 }
6397 TrimAndSetSelection ( pos, wordSelectAnchorEndPos );
6398 } else if ( pos > wordSelectAnchorEndPos ) {
6399 // Extend forward to the word containing the character to the left of pos.
6400 // Skip ExtendWordSelect if the line is empty or if pos is the first position on the line.
6401 // This ensures that a series of empty lines isn't counted as a single "word".
6402 if ( pos > pdoc->LineStart ( pdoc->LineFromPosition ( pos ) ) ) {
6403 pos = pdoc->ExtendWordSelect ( pdoc->MovePositionOutsideChar ( pos - 1, -1 ), 1 );
6404 }
6405 TrimAndSetSelection ( pos, wordSelectAnchorStartPos );
6406 } else {
6407 // Select only the anchored word
6408 if ( pos >= originalAnchorPos ) {
6409 TrimAndSetSelection ( wordSelectAnchorEndPos, wordSelectAnchorStartPos );
6410 } else {
6411 TrimAndSetSelection ( wordSelectAnchorStartPos, wordSelectAnchorEndPos );
6412 }
6413 }
6414}
6415
6416void Editor::DwellEnd ( bool mouseMoved )
6417{

Callers

nothing calls this directly

Calls 5

IsLineEndPositionMethod · 0.80
ExtendWordSelectMethod · 0.80
LineStartMethod · 0.45
LineFromPositionMethod · 0.45

Tested by

no test coverage detected