- Rename several variables to make their use clearer and to
avoid conflicts. (DLR)
- Set the input mode before turning the keypad on. (DLR)
+- cut.c:
+ add_to_cutbuffer()
+ - Add parameter allow_concat to determine whether we're allowed
+ to concatenate strings in the cutbuffer. (DLR)
- files.c:
do_insertfile()
- Wrap one reference to NANO_EXTCMD_KEY in a NANO_SMALL #ifdef.
bracket_mode set to TRUE even though we aren't doing a bracket
search, since after the above efficiency tweaks, it's now more
accurately called can_display_wrap. (DLR)
+ indent_length()
+ - Remove unneeded #ifdef. (David Benbennick)
+ do_justify()
+ - Remove references to the now-unneeded JUSTIFY_MODE flag. (DLR)
signal_init()
- Trap SIGQUIT in addition to turning it off via termios in
main(). This is consistent with SIGINT, which we trap here
- nano.h:
- Move the NANO_H include guard up before the first #include.
(DLR)
+ - Remove the now-unneeded JUSTIFY_MODE flag. (DLR)
- search.c:
regexp_cleanup()
- Only do anything if REGEXP_COMPILED is set. (David Benbennick)
return cutbottom;
}
-void add_to_cutbuffer(filestruct *inptr)
+void add_to_cutbuffer(filestruct *inptr, int allow_concat)
{
#ifdef DEBUG
fprintf(stderr, "add_to_cutbuffer(): inptr->data = %s\n", inptr->data);
if (cutbuffer == NULL)
cutbuffer = inptr;
#ifndef NANO_SMALL
- else if (concatenate_cut && !ISSET(JUSTIFY_MODE)) {
+ else if (allow_concat && concatenate_cut) {
/* Just tack the text in inptr onto the text in cutbottom,
- * unless we're backing up lines while justifying text. */
+ * unless allow_concat is false. */
cutbottom->data = charealloc(cutbottom->data,
strlen(cutbottom->data) + strlen(inptr->data) + 1);
strcat(cutbottom->data, inptr->data);
cutbuffer = NULL;
marked_cut = 0;
#ifndef NANO_SMALL
- concatenate_cut = 0;
+ concatenate_cut = FALSE;
#endif
#ifdef DEBUG
fprintf(stderr, "Blew away cutbuffer =)\n");
junk->data = charalloc(1);
junk->data[0] = '\0';
- add_to_cutbuffer(junk);
+ add_to_cutbuffer(junk, TRUE);
#ifdef DEBUG
dump_buffer(cutbuffer);
#endif
* the first line of any cut done immediately afterward to the
* end of this cut, as Pico does. */
if (current == mark_beginbuf && current_x < strlen(current->data))
- concatenate_cut = 1;
+ concatenate_cut = TRUE;
marked_cut = 1;
edit_refresh();
set_modified();
fileptr = current;
current = current->next;
current->prev = fileptr->prev;
- add_to_cutbuffer(fileptr);
+ add_to_cutbuffer(fileptr, TRUE);
#ifdef DEBUG
dump_buffer(cutbuffer);
#endif
set_modified();
marked_cut = 0;
#ifndef NANO_SMALL
- concatenate_cut = 0;
+ concatenate_cut = FALSE;
#endif
return 1;
}
#endif
}
-#if !defined(DISABLE_WRAPPING) && !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
+#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
/* The "indentation" of a line is the white-space between the quote part
* and the non-white-space of the line. */
size_t indent_length(const char *line)
}
return len;
}
-#endif /* !DISABLE_WRAPPING && !NANO_SMALL || !DISABLE_JUSTIFY */
+#endif /* !NANO_SMALL || !DISABLE_JUSTIFY */
#ifndef DISABLE_JUSTIFY
/* justify_format() replaces Tab by Space and multiple spaces by 1 (except
}
/* Put the next par_len lines, starting with first_line, in the cut
- * buffer. We assume there are enough lines after first_line. We leave
- * copies of the lines in place, too. We return the new copy of
- * first_line. */
+ * buffer, not allowing them to be concatenated. We assume there are
+ * enough lines after first_line. We leave copies of the lines in
+ * place, too. We return the new copy of first_line. */
filestruct *backup_lines(filestruct *first_line, size_t par_len,
size_t quote_len)
{
quote_len + indent_length(bob->data + quote_len));
assert(alice != NULL && bob != NULL);
- add_to_cutbuffer(alice);
+ add_to_cutbuffer(alice, FALSE);
splice_node(bob->prev, bob, bob->next);
alice = bob->next;
}
/* Next step, we loop through the lines of this paragraph, justifying
* each one individually. */
- SET(JUSTIFY_MODE);
for (; par_len > 0; current_y++, par_len--) {
size_t line_len;
size_t display_len;
continue_loc:
current = current->next;
}
- UNSET(JUSTIFY_MODE);
/* We are now done justifying the paragraph. There are cleanup things
* to do, and we check for unjustify. */
if (first_mod_line != NULL) {
filestruct *cutbottom = get_cutbottom();
- /* Splice the cutbuffer back into the file. */
+ /* Splice the cut buffer back into the file. */
cutbottom->next = last_par_line->next;
cutbottom->next->prev = cutbottom;
/* The line numbers after the end of the paragraph have
#define PRESERVE (1<<27)
#define HISTORY_CHANGED (1<<28)
#define HISTORYLOG (1<<29)
-#define JUSTIFY_MODE (1<<30)
/* Control key sequences, changing these would be very very bad. */
#define NANO_CONTROL_SPACE 0
/* Public functions in cut.c */
filestruct *get_cutbottom(void);
-void add_to_cutbuffer(filestruct *inptr);
+void add_to_cutbuffer(filestruct *inptr, int allow_concat);
void cut_marked_segment(void);
int do_cut_text(void);
int do_uncut_text(void);