MCPcopy Create free account
hub / github.com/ZDoom/Raze / Del

Method Del

libraries/ZWidget/src/widgets/textedit/textedit.cpp:813–846  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

811}
812
813void TextEdit::Del()
814{
815 if (undo_info.first_erase)
816 {
817 undo_info.first_erase = false;
818 undo_info.undo_text = GetText();
819 }
820
821 if (GetSelectionLength() != 0)
822 {
823 DeleteSelectedText();
824 ClearSelection();
825 Update();
826 }
827 else
828 {
829 if (cursor_pos.x < (int)lines[cursor_pos.y].text.size())
830 {
831 UTF8Reader utf8_reader(lines[cursor_pos.y].text.data(), lines[cursor_pos.y].text.length());
832 utf8_reader.set_position(cursor_pos.x);
833 int length = utf8_reader.char_length();
834 lines[cursor_pos.y].text.erase(cursor_pos.x, length);
835 lines[cursor_pos.y].invalidated = true;
836 Update();
837 }
838 else if (cursor_pos.y + 1 < lines.size())
839 {
840 selection_start = ivec2(lines[cursor_pos.y].text.length(), cursor_pos.y);
841 selection_length = 1;
842 DeleteSelectedText();
843 }
844 }
845 MoveVerticalScroll();
846}
847
848void TextEdit::OnTimerExpired()
849{

Callers

nothing calls this directly

Calls 7

ivec2Class · 0.85
lengthMethod · 0.80
set_positionMethod · 0.80
char_lengthMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected