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

Function paste_lines

text.c:323–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323static void paste_lines(TextEditorState *state, int pos) {
324 int line_start = state->offset_list[pos];
325
326 // calculated size of pasted content
327 int length = 0, i;
328 for (i = 0; i < state->n_copied_lines; i++) {
329 length += strlen(state->copy_buffer[i].line);
330 }
331
332 // Make space for pasted lines
333 memmove(&state->buffer[line_start + length], &state->buffer[line_start], state->size - line_start);
334 state->size += length;
335
336 // Paste the lines
337 for (i = 0; i < state->n_copied_lines; i++) {
338 int line_length = strlen(state->copy_buffer[i].line);
339
340 memcpy(&state->buffer[line_start], state->copy_buffer[i].line, line_length);
341 line_start += line_length;
342 }
343
344 state->n_lines += state->n_copied_lines;
345
346 state->changed = 1;
347 state->copy_reset = 1;
348 state->n_selections = 0;
349
350 // Update entries
351 updateTextEntries(state);
352}
353
354static int cmp (const void * a, const void * b) {
355 return ( *(int*)a - *(int*)b );

Callers 1

contextMenuEnterCallbackFunction · 0.85

Calls 1

updateTextEntriesFunction · 0.85

Tested by

no test coverage detected