/* after_break is the text that will be moved to the next line. */
after_break = inptr->data + wrap_loc + 1;
after_break_len = len - wrap_loc - 1;
+
assert(after_break_len == strlen(after_break));
/* new_line_len will later be increased by the lengths of indentation
#endif
strcat(newline, after_break);
new_line_len += after_break_len;
+
/* We end the old line after wrap_loc. Note that this does not eat
* the space. */
null_at(&inptr->data, wrap_loc + 1);
temp->prev = inptr;
temp->next = inptr->next;
temp->prev->next = temp;
+
/* If temp->next is NULL, then temp is the last line of the
* file, so we must set filebot. */
if (temp->next != NULL)
return NULL;
close_pipes_and_exit:
-
/* Don't leak any handles. */
close(tempfile_fd);
close(spell_fd[0]);
/* Wait for alternate speller to complete. */
wait(&alt_spell_status);
- if (!WIFEXITED(alt_spell_status) || WEXITSTATUS(alt_spell_status) != 0) {
+ if (!WIFEXITED(alt_spell_status) ||
+ WEXITSTATUS(alt_spell_status) != 0) {
char *altspell_error = NULL;
char *invoke_error = _("Could not invoke \"%s\"");
- int msglen = strlen(invoke_error) + strlen(alt_speller) + 2;
+ int msglen = strlenpt(invoke_error) + strlenpt(alt_speller) + 2;
altspell_error = charalloc(msglen);
snprintf(altspell_error, msglen, invoke_error, alt_speller);
bool quotes_match(const char *a_line, size_t a_quote, const char
*b_line)
{
- /* Here is the assumption about a_quote: */
+ /* Here is the assumption about a_quote. */
assert(a_quote == quote_length(a_line));
+
return a_quote == quote_length(b_line) &&
strncmp(a_line, b_line, a_quote) == 0;
}
/* Run the function associated with this shortcut,
* if there is one. */
- if (s->func != NULL) {
- if (ISSET(VIEW_MODE) && !s->viewok)
- print_view_warning();
- else
- s->func();
+ if (s->func != NULL) {
+ if (ISSET(VIEW_MODE) && !s->viewok)
+ print_view_warning();
+ else
+ s->func();
}
break;
}
)
{
- static int escapes = 0;
- static int word_digits = 0;
+ static int escapes = 0, word_digits = 0;
buffer *kbinput;
int retval = ERR;
/* Put back the non-escape character, get
* the complete escape sequence, translate
- * its key values into the corresponding key
+ * the sequence into its corresponding key
* value, and save that as the result. */
unget_input(kbinput, 1);
seq_len = get_buffer_len();
}
}
-/* Translate a word sequence: turn a three-digit decimal number from
- * 000 to 255 into its corresponding word value. */
+/* Translate a word sequence: turn a five-digit decimal number from
+ * 00000 to 65535 into its corresponding word value. */
int get_word_kbinput(int kbinput
#ifndef NANO_SMALL
, bool reset
#endif
)
{
- static int word_digits = 0;
- static int word_kbinput = 0;
+ static int word_digits = 0, word_kbinput = 0;
int retval = ERR;
#ifndef NANO_SMALL
while (word == ERR) {
while ((kbinput = get_input(win, 1)) == NULL);
+
word = get_word_kbinput(kbinput->key
#ifndef NANO_SMALL
, FALSE