MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / Paste

Method Paste

plugins/Cardinal/src/DearImGuiColorTextEditor/TextEditor.cpp:1958–1986  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1956}
1957
1958void TextEditor::Paste()
1959{
1960 if (IsReadOnly())
1961 return;
1962
1963 auto clipText = ImGui::GetClipboardText();
1964 if (clipText != nullptr && strlen(clipText) > 0)
1965 {
1966 UndoRecord u;
1967 u.mBefore = mState;
1968
1969 if (HasSelection())
1970 {
1971 u.mRemoved = GetSelectedText();
1972 u.mRemovedStart = mState.mSelectionStart;
1973 u.mRemovedEnd = mState.mSelectionEnd;
1974 DeleteSelection();
1975 }
1976
1977 u.mAdded = clipText;
1978 u.mAddedStart = GetActualCursorCoordinates();
1979
1980 InsertText(clipText);
1981
1982 u.mAddedEnd = GetActualCursorCoordinates();
1983 u.mAfter = mState;
1984 AddUndo(u);
1985 }
1986}
1987
1988bool TextEditor::CanUndo() const
1989{

Callers 1

pasteMethod · 0.80

Calls 1

HasSelectionFunction · 0.85

Tested by

no test coverage detected