MCPcopy Create free account
hub / github.com/dail8859/NotepadNext / addMacroStep

Method addMacroStep

src/Macro.cpp:30–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30void Macro::addMacroStep(Message message, uptr_t wParam, sptr_t lParam)
31{
32 qInfo(Q_FUNC_INFO);
33
34 // Combine ReplaceSel messages into a single string
35 if (message == Message::ReplaceSel && !steps.empty() && steps.constLast().message == Message::ReplaceSel) {
36 steps.last().str.append(reinterpret_cast<const char*>(lParam));
37 }
38 // Combine DeleteBack (backspace) with ReplaceSel
39 else if (message == Message::DeleteBack && !steps.empty() && steps.constLast().message == Message::ReplaceSel) {
40 if (steps.last().str.size() == 1) {
41 // A single char left so just remove the action
42 steps.takeLast();
43 }
44 else {
45 steps.last().str.chop(1);
46 }
47 }
48 else {
49 steps.append(MacroStep(message, wParam, lParam));
50 }
51
52#ifdef QT_DEBUG
53 for (const MacroStep &step : steps) {
54 qInfo("%s", qUtf8Printable(step.toString()));
55 }
56#endif
57}
58
59void Macro::addMacroStep(MacroStep step)
60{

Callers 2

recordMacroStepMethod · 0.80
copyCurrentMacroMethod · 0.80

Calls 3

MacroStepClass · 0.85
toStringMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected