CVS code -
- General:
- Minor comment cleanups. (DLR)
+ - Convert more ints used as boolean values to use TRUE and
+ FALSE. (David Benbennick)
- Make sure the special control keys are handled the same way
after the window is resized or we come out of suspend mode.
Changes to do_cont() and handle_sigwinch(). (DLR)
- Rearrange the NANO_SMALL #ifdef so that the code to set the
MODIFIED flag in open_files->flags is included only once.
(DLR)
+- nano.c:
+ do_delete()
+ - Tweak for efficiency. (David Benbennick)
- search.c:
not_found_msg()
- Convert to properly handle strings generated by
display_string() that have been used in the search prompt
since 1.3.0. (David Benbennick)
- do_replace_loop()
- - Convert more ints used as boolean values to use TRUE and
- FALSE. (David Benbennick)
- utils.c:
nstricmp(), nstrnicmp()
- Add extra blank lines for greater readability, and remove
{
size_t current_len = strlen(current->data);
#if !defined(DISABLE_WRAPPING) || defined(ENABLE_COLOR)
- int refresh = 0;
+ int refresh = FALSE;
/* Do we have to run edit_refresh(), or can we get away with
* update_line()? */
#endif
#ifdef ENABLE_COLOR
if (ISSET(COLOR_SYNTAX))
- refresh = 1;
+ refresh = TRUE;
#endif
#if !defined(DISABLE_WRAPPING) || defined(ENABLE_COLOR)
int do_delete(void)
{
- int refresh = 0;
+ assert(current != NULL && current->data != NULL && current_x <=
+ strlen(current->data));
- /* blbf -> blank line before filebot (see below) */
- int blbf = 0;
+ placewewant = xplustabs();
- if (current->next == filebot && current->data[0] == '\0')
- blbf = 1;
+ if (current->data[current_x] != '\0') {
+ size_t linelen = strlen(current->data + current_x);
- placewewant = xplustabs();
+ assert(current_x < strlen(current->data));
- if (current_x != strlen(current->data)) {
- /* Let's get dangerous */
+ /* Let's get dangerous. */
charmove(¤t->data[current_x], ¤t->data[current_x + 1],
- strlen(current->data) - current_x);
+ linelen);
- align(¤t->data);
-#ifdef ENABLE_COLOR
- if (ISSET(COLOR_SYNTAX))
- refresh = 1;
+ null_at(¤t->data, linelen + current_x - 1);
+#ifndef NANO_SMALL
+ if (current_x < mark_beginx && mark_beginbuf == current)
+ mark_beginx--;
#endif
- } else if (current->next != NULL && (current->next != filebot || blbf)) {
+ } else if (current != filebot && (current->next != filebot ||
+ current->data[0] == '\0')) {
/* We can delete the line before filebot only if it is blank: it
- becomes the new magic line then. */
+ * becomes the new magic line then. */
+ filestruct *foo = current->next;
- filestruct *foo;
-
- current->data = charealloc(current->data,
- strlen(current->data) +
- strlen(current->next->data) + 1);
- strcat(current->data, current->next->data);
-
- foo = current->next;
+ assert(current_x == strlen(current->data));
+ current->data = charealloc(current->data, current_x +
+ strlen(foo->data) + 1);
+ strcpy(current->data + current_x, foo->data);
+#ifndef NANO_SMALL
+ if (mark_beginbuf == current->next) {
+ mark_beginx += current_x;
+ mark_beginbuf = current;
+ }
+#endif
if (filebot == foo)
filebot = current;
delete_node(foo);
renumber(current);
totlines--;
- refresh = 1;
+ wrap_reset();
} else
return 0;
totsize--;
set_modified();
- update_line(current, current_x);
- if (refresh)
- edit_refresh();
+ edit_refresh();
return 1;
}