MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / LInput_Backspace

Function LInput_Backspace

src/LWidgets.c:254–268  ·  view source on GitHub ↗

Removes the character preceding the caret in the currently entered text */

Source from the content-addressed store, hash-verified

252
253/* Removes the character preceding the caret in the currently entered text */
254static void LInput_Backspace(struct LInput* w) {
255 if (!w->text.length || w->caretPos == 0) return;
256
257 if (w->caretPos == -1) {
258 String_DeleteAt(&w->text, w->text.length - 1);
259 } else {
260 String_DeleteAt(&w->text, w->caretPos - 1);
261 w->caretPos--;
262 if (w->caretPos == -1) w->caretPos = 0;
263 }
264
265 if (w->TextChanged) w->TextChanged(w);
266 LInput_ClampCaret(w);
267 LBackend_InputUpdate(w);
268}
269
270/* Removes the character at the caret in the currently entered text */
271static void LInput_Delete(struct LInput* w) {

Callers 1

LInput_KeyDownFunction · 0.85

Calls 3

String_DeleteAtFunction · 0.85
LInput_ClampCaretFunction · 0.85
LBackend_InputUpdateFunction · 0.70

Tested by

no test coverage detected