Lines Matching refs:openfile

52     openfile->mark_set = !openfile->mark_set;
53 if (openfile->mark_set) {
55 openfile->mark_begin = openfile->current;
56 openfile->mark_begin_x = openfile->current_x;
59 openfile->mark_begin = NULL;
60 openfile->mark_begin_x = 0;
73 assert(openfile->current != NULL && openfile->current->data != NULL && openfile->current_x <= strlen(openfile->current->data));
75 openfile->placewewant = xplustabs();
77 if (openfile->current->data[openfile->current_x] != '\0') {
78 int char_buf_len = parse_mbchar(openfile->current->data +
79 openfile->current_x, NULL, NULL);
80 size_t line_len = strlen(openfile->current->data +
81 openfile->current_x);
83 assert(openfile->current_x < strlen(openfile->current->data));
86 charmove(&openfile->current->data[openfile->current_x],
87 &openfile->current->data[openfile->current_x +
90 null_at(&openfile->current->data, openfile->current_x +
93 if (openfile->mark_set && openfile->mark_begin ==
94 openfile->current && openfile->current_x <
95 openfile->mark_begin_x)
96 openfile->mark_begin_x -= char_buf_len;
98 openfile->totsize--;
99 } else if (openfile->current != openfile->filebot) {
100 filestruct *foo = openfile->current->next;
102 assert(openfile->current_x == strlen(openfile->current->data));
106 if (openfile->current->data[openfile->current_x] == '\0')
109 openfile->current->data = charealloc(openfile->current->data,
110 openfile->current_x + strlen(foo->data) + 1);
111 strcpy(openfile->current->data + openfile->current_x,
114 if (openfile->mark_set && openfile->mark_begin ==
115 openfile->current->next) {
116 openfile->mark_begin = openfile->current;
117 openfile->mark_begin_x += openfile->current_x;
120 if (openfile->filebot == foo)
121 openfile->filebot = openfile->current;
125 renumber(openfile->current);
126 openfile->totsize--;
131 if (!ISSET(NO_NEWLINES) && openfile->current ==
132 openfile->filebot && openfile->current->data[0] != '\0')
142 if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX))
149 update_line(openfile->current, openfile->current_x);
156 if (openfile->current != openfile->fileage ||
157 openfile->current_x > 0) {
213 assert(openfile->current != NULL && openfile->current->data != NULL);
230 if (openfile->mark_set)
235 top = openfile->current;
275 openfile->totsize += line_indent_len;
278 if (openfile->mark_set && f == openfile->mark_begin &&
279 openfile->mark_begin_x >= indent_len)
280 openfile->mark_begin_x += line_indent_len;
282 if (f == openfile->current && openfile->current_x >=
284 openfile->current_x += line_indent_len;
288 if (!ISSET(NO_NEWLINES) && f == openfile->filebot)
310 openfile->totsize -= indent_shift;
313 if (openfile->mark_set && f == openfile->mark_begin &&
314 openfile->mark_begin_x > indent_new) {
315 if (openfile->mark_begin_x <= indent_len)
316 openfile->mark_begin_x = indent_new;
318 openfile->mark_begin_x -= indent_shift;
321 if (f == openfile->current && openfile->current_x >
323 if (openfile->current_x <= indent_len)
324 openfile->current_x = indent_new;
326 openfile->current_x -= indent_shift;
367 filestruct *newnode = make_new_node(openfile->current);
370 assert(openfile->current != NULL && openfile->current->data != NULL);
378 extra = indent_length(openfile->current->data);
379 if (extra > openfile->current_x)
380 extra = openfile->current_x;
383 newnode->data = charalloc(strlen(openfile->current->data +
384 openfile->current_x) + extra + 1);
385 strcpy(&newnode->data[extra], openfile->current->data +
386 openfile->current_x);
389 strncpy(newnode->data, openfile->current->data, extra);
390 openfile->totsize += mbstrlen(newnode->data);
393 null_at(&openfile->current->data, openfile->current_x);
395 if (openfile->mark_set && openfile->current ==
396 openfile->mark_begin && openfile->current_x <
397 openfile->mark_begin_x) {
398 openfile->mark_begin = newnode;
399 openfile->mark_begin_x += extra - openfile->current_x;
402 openfile->current_x = extra;
404 if (openfile->current == openfile->filebot)
405 openfile->filebot = newnode;
406 splice_node(openfile->current, newnode,
407 openfile->current->next);
409 renumber(openfile->current);
410 openfile->current = newnode;
412 openfile->totsize++;
415 openfile->placewewant = xplustabs();
617 if (prepend_wrap && line != openfile->filebot) {
630 openfile->totsize++;
659 openfile->totsize += mbstrnlen(indent_string, indent_len);
693 if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0')
698 splice_node(openfile->current, make_new_node(openfile->current),
699 openfile->current->next);
703 if (openfile->filebot == openfile->current)
704 openfile->filebot = openfile->current->next;
706 openfile->current->next->data = new_line;
708 openfile->totsize++;
725 if (openfile->current_x > wrap_loc) {
728 openfile->current = openfile->current->next;
729 openfile->current_x -= wrap_loc
734 openfile->placewewant = xplustabs();
741 if (openfile->mark_set) {
742 if (openfile->mark_begin == line && openfile->mark_begin_x >
744 openfile->mark_begin = line->next;
745 openfile->mark_begin_x -= wrap_loc - indent_len + 1;
746 } else if (prepending && openfile->mark_begin == line->next)
747 openfile->mark_begin_x += after_break_len;
933 if (openfile->mark_set && openfile->mark_begin ==
934 paragraph && openfile->mark_begin_x >= end -
988 if (openfile->mark_set && openfile->mark_begin ==
989 paragraph && openfile->mark_begin_x >= end -
1020 openfile->totsize -= shift;
1028 if (openfile->mark_set && openfile->mark_begin == paragraph) {
1029 openfile->mark_begin_x -= mark_shift;
1030 if (openfile->mark_begin_x > new_end - new_paragraph_data)
1031 openfile->mark_begin_x = new_end - new_paragraph_data;
1121 if (foo == openfile->fileage)
1176 size_t current_x_save = openfile->current_x;
1178 ssize_t edittop_lineno_save = openfile->edittop->lineno;
1179 ssize_t current_lineno_save = openfile->current->lineno;
1181 bool old_mark_set = openfile->mark_set;
1186 mb_lineno_save = openfile->mark_begin->lineno;
1187 mark_begin_x_save = openfile->mark_begin_x;
1194 assert(par_len > 0 && openfile->current->lineno + par_len <=
1195 openfile->filebot->lineno + 1);
1199 for (i = par_len; i > 0 && bot != openfile->filebot; i--)
1205 (i == 1 && bot == openfile->filebot) ? strlen(bot->data) : 0);
1215 if (openfile->current != openfile->fileage) {
1216 top = openfile->current->prev;
1219 openfile->current->lineno == mb_lineno_save) {
1220 openfile->mark_begin = openfile->current;
1221 openfile->mark_begin_x = mark_begin_x_save;
1225 top = openfile->current;
1230 openfile->edittop = top;
1232 openfile->current = top;
1235 openfile->mark_begin = top;
1236 openfile->mark_begin_x = mark_begin_x_save;
1244 openfile->current_x = current_x_save;
1277 assert(openfile->current != NULL);
1281 if (openfile->current == openfile->filebot && openfile->current_x ==
1282 strlen(openfile->filebot->data))
1287 if (!inpar(openfile->current)) {
1299 if (openfile->current_x == 0) {
1300 if (!inpar(openfile->current->prev))
1302 if (openfile->current != openfile->fileage)
1303 openfile->current = openfile->current->prev;
1309 if (!begpar(openfile->current))
1315 quote_len = quote_length(openfile->current->data);
1316 current_save = openfile->current;
1317 current_y_save = openfile->current_y;
1319 par_len = openfile->current->lineno - current_save->lineno;
1325 if (openfile->current_x > 0)
1327 openfile->current = current_save;
1328 openfile->current_y = current_y_save;
1355 filestruct *edittop_save = openfile->edittop;
1356 filestruct *current_save = openfile->current;
1357 size_t current_x_save = openfile->current_x;
1358 size_t pww_save = openfile->placewewant;
1359 size_t totsize_save = openfile->totsize;
1361 filestruct *mark_begin_save = openfile->mark_begin;
1362 size_t mark_begin_x_save = openfile->mark_begin_x;
1364 bool modified_save = openfile->modified;
1372 openfile->current_x = 0;
1376 openfile->current = openfile->fileage;
1418 last_par_line = openfile->filebot;
1429 filebot_inpar = (openfile->current->lineno + par_len ==
1430 openfile->filebot->lineno + 1);
1437 backup_lines(openfile->current, full_justify ?
1438 openfile->filebot->lineno - openfile->current->lineno +
1439 ((openfile->filebot->data[0] != '\0') ? 1 : 0) :
1441 first_par_line = openfile->current;
1446 curr_first_par_line = openfile->current;
1456 const filestruct *indent_line = openfile->current;
1472 if (indent_line == openfile->current)
1482 filestruct *next_line = openfile->current->next;
1483 size_t line_len = strlen(openfile->current->data);
1485 strlen(openfile->current->next->data);
1488 indent_length(openfile->current->next->data +
1492 openfile->totsize -= indent_len;
1497 openfile->current->data[line_len - 1] != ' ') {
1499 openfile->current->data =
1500 charealloc(openfile->current->data,
1502 openfile->current->data[line_len - 1] = ' ';
1503 openfile->current->data[line_len] = '\0';
1504 openfile->totsize++;
1507 openfile->current->data =
1508 charealloc(openfile->current->data, line_len +
1510 strcat(openfile->current->data, next_line->data +
1514 if (next_line == openfile->edittop)
1515 openfile->edittop = openfile->current;
1516 if (next_line == openfile->filebot)
1517 openfile->filebot = openfile->current;
1522 if (openfile->mark_set && openfile->mark_begin ==
1524 openfile->mark_begin = openfile->current;
1525 openfile->mark_begin_x += line_len - indent_len;
1537 openfile->totsize--;
1543 justify_format(openfile->current, quote_len +
1544 indent_length(openfile->current->data + quote_len));
1546 while (par_len > 0 && strlenpt(openfile->current->data) >
1548 size_t line_len = strlen(openfile->current->data);
1554 break_pos = break_line(openfile->current->data + indent_len,
1555 fill - strnlenpt(openfile->current->data, indent_len)
1574 splice_node(openfile->current,
1575 make_new_node(openfile->current),
1576 openfile->current->next);
1590 openfile->current->next->data = charalloc(indent_len + 1 +
1592 strncpy(openfile->current->next->data, indent_string,
1594 strcpy(openfile->current->next->data + indent_len,
1595 openfile->current->data + break_pos);
1598 openfile->totsize += indent_len + 1;
1603 if (openfile->mark_set && openfile->mark_begin ==
1604 openfile->current && openfile->mark_begin_x >
1606 openfile->mark_begin = openfile->current->next;
1607 openfile->mark_begin_x -= break_pos - indent_len;
1612 null_at(&openfile->current->data, break_pos);
1616 if (openfile->filebot == openfile->current)
1617 openfile->filebot = openfile->filebot->next;
1621 openfile->current_y++;
1622 openfile->current = openfile->current->next;
1631 if (openfile->current != openfile->filebot) {
1632 openfile->current_y++;
1633 openfile->current = openfile->current->next;
1635 openfile->current_x = strlen(openfile->current->data);
1655 last_par_line = openfile->current;
1698 free_filestruct(openfile->fileage);
1699 openfile->fileage = jusbuffer;
1700 openfile->filebot = jusbottom;
1702 top_save = openfile->fileage;
1714 openfile->edittop = edittop_save;
1715 openfile->current = current_save;
1716 openfile->current_x = current_x_save;
1717 openfile->placewewant = pww_save;
1718 openfile->totsize = totsize_save;
1720 if (openfile->mark_set) {
1721 openfile->mark_begin = mark_begin_save;
1722 openfile->mark_begin_x = mark_begin_x_save;
1725 openfile->modified = modified_save;
1730 if (!openfile->modified)
1768 size_t match_len, current_x_save = openfile->current_x;
1769 size_t pww_save = openfile->placewewant;
1770 filestruct *edittop_save = openfile->edittop;
1771 filestruct *current_save = openfile->current;
1783 bool old_mark_set = openfile->mark_set;
1825 added_magicline = (openfile->filebot->data[0] != '\0');
1826 openfile->mark_set = FALSE;
1831 openfile->edittop = openfile->fileage;
1832 openfile->current = openfile->fileage;
1833 openfile->current_x = (size_t)-1;
1834 openfile->placewewant = 0;
1838 while (findnextstr(TRUE, FALSE, openfile->fileage, 0, word,
1840 if (is_whole_word(openfile->current_x, openfile->current->data,
1843 char *exp_word = display_string(openfile->current->data,
1844 xpt, strnlenpt(openfile->current->data,
1845 openfile->current_x + match_len) - xpt, FALSE);
1867 openfile->current_x--;
1868 do_replace_loop(TRUE, &canceled, openfile->current,
1869 &openfile->current_x, word);
1885 if (openfile->fileage == openfile->filebot)
1888 openfile->mark_begin_x = top_x;
1892 openfile->mark_begin_x = bot_x;
1898 openfile->mark_set = TRUE;
1909 openfile->edittop = edittop_save;
1910 openfile->current = current_save;
1911 openfile->current_x = current_x_save;
1912 openfile->placewewant = pww_save;
2119 size_t current_x_save = openfile->current_x;
2120 size_t pww_save = openfile->placewewant;
2121 ssize_t current_y_save = openfile->current_y;
2122 ssize_t lineno_save = openfile->current->lineno;
2128 bool old_mark_set = openfile->mark_set;
2141 size_t totsize_save = openfile->totsize;
2148 mb_lineno_save = openfile->mark_begin->lineno;
2149 openfile->mark_set = FALSE;
2212 openfile->mark_set = old_mark_set;
2233 added_magicline = (openfile->filebot->data[0] != '\0');
2247 filestruct *top_save = openfile->fileage;
2256 if (openfile->fileage == openfile->filebot)
2259 openfile->mark_begin_x = top_x;
2263 openfile->mark_begin_x = bot_x;
2277 totsize_save += openfile->totsize;
2278 openfile->totsize = totsize_save;
2281 do_gotopos(mb_lineno_save, openfile->mark_begin_x,
2283 openfile->mark_begin = openfile->current;
2288 openfile->mark_begin_x = openfile->current_x;
2291 openfile->mark_set = TRUE;
2323 openfile->mark_set ? write_marked_file(temp, temp_file, TRUE,
2364 size_t current_x_save = openfile->current_x;
2365 size_t pww_save = openfile->placewewant;
2366 filestruct *current_save = openfile->current;
2367 bool old_mark_set = openfile->mark_set;
2377 openfile->mark_set = FALSE;
2381 openfile->current = openfile->fileage;
2382 openfile->current_x = 0;
2383 openfile->placewewant = 0;
2389 while (openfile->current != openfile->filebot ||
2390 openfile->current->data[openfile->current_x] != '\0') {
2398 lines = openfile->filebot->lineno -
2399 openfile->fileage->lineno + 1;
2400 chars = get_totsize(openfile->fileage, openfile->filebot);
2405 openfile->mark_set = TRUE;
2407 lines = openfile->filebot->lineno;
2408 chars = openfile->totsize;
2412 openfile->current = current_save;
2413 openfile->current_x = current_x_save;
2414 openfile->placewewant = pww_save;