MCPcopy Create free account
hub / github.com/TheOfficialFloW/VitaShell / insert_line

Function insert_line

text.c:290–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290static void insert_line(TextEditorState *state, char *line, int pos) {
291 int offset = state->offset_list[pos];
292
293 // calculated size of inserted line
294 int length = strlen(line);
295
296 // Make space for inserted line
297 memmove(&state->buffer[offset + length], &state->buffer[offset], state->size - offset);
298 state->size += length;
299
300 // Insert the lines
301 memcpy(&state->buffer[offset], line, length);
302
303 int i;
304 for (i = 0; i < length; i++) {
305 if (line[i] == '\n') {
306 state->n_lines++;
307 }
308 }
309
310 state->n_selections = 0;
311 state->changed = 1;
312 state->copy_reset = 1;
313
314 // Update entries
315 updateTextEntries(state);
316}
317
318static void cut_line(TextEditorState *state, int line_number) {
319 copy_line(state, line_number);

Callers 2

contextMenuEnterCallbackFunction · 0.85
textViewerFunction · 0.85

Calls 1

updateTextEntriesFunction · 0.85

Tested by

no test coverage detected