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

Method Clear

scintilla/src/Editor.cxx:4358–4390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4356}
4357
4358void Editor::Clear()
4359{
4360 // If multiple selections, don't delete EOLS
4361 if ( sel.Empty() ) {
4362 bool singleVirtual = false;
4363 if ( ( sel.Count() == 1 ) &&
4364 !RangeContainsProtected ( sel.MainCaret(), sel.MainCaret() + 1 ) &&
4365 sel.RangeMain().Start().VirtualSpace() ) {
4366 singleVirtual = true;
4367 }
4368 UndoGroup ug ( pdoc, ( sel.Count() > 1 ) || singleVirtual );
4369 for ( size_t r = 0; r < sel.Count(); r++ ) {
4370 if ( !RangeContainsProtected ( sel.Range ( r ).caret.Position(), sel.Range ( r ).caret.Position() + 1 ) ) {
4371 if ( sel.Range ( r ).Start().VirtualSpace() ) {
4372 if ( sel.Range ( r ).anchor < sel.Range ( r ).caret ) {
4373 sel.Range ( r ) = SelectionPosition ( InsertSpace ( sel.Range ( r ).anchor.Position(), sel.Range ( r ).anchor.VirtualSpace() ) );
4374 } else {
4375 sel.Range ( r ) = SelectionPosition ( InsertSpace ( sel.Range ( r ).caret.Position(), sel.Range ( r ).caret.VirtualSpace() ) );
4376 }
4377 }
4378 if ( ( sel.Count() == 1 ) || !pdoc->IsPositionInLineEnd ( sel.Range ( r ).caret.Position() ) ) {
4379 pdoc->DelChar ( sel.Range ( r ).caret.Position() );
4380 sel.Range ( r ).ClearVirtualSpace();
4381 } // else multiple selection so don't eat line ends
4382 } else {
4383 sel.Range ( r ).ClearVirtualSpace();
4384 }
4385 }
4386 } else {
4387 ClearSelection();
4388 }
4389 sel.RemoveDuplicates();
4390}
4391
4392void Editor::SelectAll()
4393{

Callers 10

InvalidateStyleDataMethod · 0.45
SetEmptySelectionMethod · 0.45
MovePositionToMethod · 0.45
FormatRangeMethod · 0.45
ClearAllMethod · 0.45
PasteRectangularMethod · 0.45
SelectAllMethod · 0.45
ButtonDownMethod · 0.45
SetDocPointerMethod · 0.45
WndProcMethod · 0.45

Calls 12

SelectionPositionClass · 0.85
MainCaretMethod · 0.80
VirtualSpaceMethod · 0.80
PositionMethod · 0.80
RangeMethod · 0.80
IsPositionInLineEndMethod · 0.80
ClearVirtualSpaceMethod · 0.80
RemoveDuplicatesMethod · 0.80
EmptyMethod · 0.45
CountMethod · 0.45
StartMethod · 0.45
DelCharMethod · 0.45

Tested by

no test coverage detected