MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / handleDelete

Function handleDelete

src/mykeyboard.cpp:140–159  ·  view source on GitHub ↗

Handles character deletion from the text string and screen

Source from the content-addressed store, hash-verified

138
139/// Handles character deletion from the text string and screen
140bool handleDelete(String &current_text, int &cursor_x, int &cursor_y) {
141 if (current_text.length() == 0) return false;
142
143 // remove from string
144 current_text.remove(current_text.length() - 1);
145 // delete from screen:
146 int fontSize = FM;
147 if (current_text.length() > max_FP_size) {
148 tft->setTextSize(FP);
149 fontSize = FP;
150 } else tft->setTextSize(FM);
151 tft->setCursor((cursor_x - fontSize * LW), cursor_y);
152 tft->setTextColor(FGCOLOR, BGCOLOR);
153 tft->print(" ");
154 tft->setTextColor(getComplementaryColor(BGCOLOR), 0x5AAB);
155 tft->setCursor(cursor_x - fontSize * LW, cursor_y);
156 cursor_x = tft->getCursorX();
157 cursor_y = tft->getCursorY();
158 return true;
159}
160
161/// Handles adding a character to the text string
162bool handleCharacterAdd(

Callers 2

handleKeyboardSelectionFunction · 0.85
generalKeyboardFunction · 0.85

Calls 7

getComplementaryColorFunction · 0.85
printMethod · 0.80
setTextSizeMethod · 0.45
setCursorMethod · 0.45
setTextColorMethod · 0.45
getCursorXMethod · 0.45
getCursorYMethod · 0.45

Tested by

no test coverage detected