tweaks: reshuffle and frob a couple of comments, and reindent two lines

master
Benno Schulenberg 2019-01-01 17:19:46 +01:00
parent 329b82d284
commit f9bb5382aa
1 changed files with 6 additions and 10 deletions

View File

@ -65,7 +65,7 @@ void do_mark(void)
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
#if defined(ENABLE_COLOR) || defined(ENABLE_SPELLER) #if defined(ENABLE_COLOR) || defined(ENABLE_SPELLER)
/* Return an error message containing the given name. */ /* Return an error message about invoking the given name. */
char *invocation_error(const char *name) char *invocation_error(const char *name)
{ {
char *message, *invoke_error = _("Error invoking \"%s\""); char *message, *invoke_error = _("Error invoking \"%s\"");
@ -85,13 +85,12 @@ void do_deletion(undo_type action)
openfile->placewewant = xplustabs(); openfile->placewewant = xplustabs();
/* When in the middle of a line, delete the current character. */
if (openfile->current->data[openfile->current_x] != '\0') { if (openfile->current->data[openfile->current_x] != '\0') {
/* We're in the middle of a line: delete the current character. */
int char_len = parse_mbchar(openfile->current->data + int char_len = parse_mbchar(openfile->current->data +
openfile->current_x, NULL, NULL); openfile->current_x, NULL, NULL);
size_t line_len = strlen(openfile->current->data + size_t line_len = strlen(openfile->current->data +
openfile->current_x); openfile->current_x);
#ifndef NANO_TINY #ifndef NANO_TINY
/* If the type of action changed or the cursor moved to a different /* If the type of action changed or the cursor moved to a different
* line, create a new undo item, otherwise update the existing item. */ * line, create a new undo item, otherwise update the existing item. */
@ -104,21 +103,18 @@ void do_deletion(undo_type action)
if (ISSET(SOFTWRAP)) if (ISSET(SOFTWRAP))
old_amount = number_of_chunks_in(openfile->current); old_amount = number_of_chunks_in(openfile->current);
#endif #endif
/* Move the remainder of the line "in", over the current character. */ /* Move the remainder of the line "in", over the current character. */
charmove(&openfile->current->data[openfile->current_x], charmove(&openfile->current->data[openfile->current_x],
&openfile->current->data[openfile->current_x + char_len], &openfile->current->data[openfile->current_x + char_len],
line_len - char_len + 1); line_len - char_len + 1);
#ifndef NANO_TINY #ifndef NANO_TINY
/* Adjust the mark if it is after the cursor on the current line. */ /* Adjust the mark if it is after the cursor on the current line. */
if (openfile->mark == openfile->current && if (openfile->mark == openfile->current &&
openfile->mark_x > openfile->current_x) openfile->mark_x > openfile->current_x)
openfile->mark_x -= char_len; openfile->mark_x -= char_len;
#endif #endif
/* Otherwise, when not at end of buffer, join this line with the next. */
} else if (openfile->current != openfile->filebot) { } else if (openfile->current != openfile->filebot) {
/* We're at the end of a line and not at the end of the file: join
* this line with the next. */
filestruct *joining = openfile->current->next; filestruct *joining = openfile->current->next;
/* If there is a magic line, and we're before it: don't eat it. */ /* If there is a magic line, and we're before it: don't eat it. */
@ -290,7 +286,7 @@ void indent_a_line(filestruct *line, char *indentation)
size_t length = strlen(line->data); size_t length = strlen(line->data);
size_t indent_len = strlen(indentation); size_t indent_len = strlen(indentation);
/* If the indent is empty, don't change the line. */ /* If the requested indentation is empty, don't change the line. */
if (indent_len == 0) if (indent_len == 0)
return; return;