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

Function copy_line

text.c:225–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223
224
225static CopyEntry *copy_line(TextEditorState *state, int line_number) {
226 if (state->copy_reset) {
227 state->copy_reset = 0;
228 state->n_copied_lines = 0;
229 }
230
231 // Get current line
232 int line_start = state->offset_list[line_number];
233 char line[MAX_LINE_CHARACTERS];
234 int length = textReadLine(state->buffer, line_start, state->size, line);
235
236 CopyEntry *entry = &state->copy_buffer[state->n_copied_lines];
237
238 // Copy line into copy_buffer
239 memcpy(entry->line, &state->buffer[line_start], length);
240
241 // Make sure line end with a newline
242 if (entry->line[length - 1] != '\n') {
243 entry->line[length] = '\n';
244 length++;
245 }
246
247 // Terminate line
248 state->copy_buffer[state->n_copied_lines].line[length] = '\0';
249
250 state->n_copied_lines++;
251
252 return entry;
253}
254
255
256static void delete_line(TextEditorState *state, int line_number) {

Callers 2

cut_lineFunction · 0.85
contextMenuEnterCallbackFunction · 0.85

Calls 1

textReadLineFunction · 0.85

Tested by

no test coverage detected