tweaks: reshuffle a couple of lines, and frob a comment or two
parent
d33b5f3dab
commit
77d24300f3
21
src/files.c
21
src/files.c
|
@ -2020,7 +2020,6 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||||
* the buffer is to be discarded. */
|
* the buffer is to be discarded. */
|
||||||
int do_writeout(bool exiting, bool withprompt)
|
int do_writeout(bool exiting, bool withprompt)
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
bool result = FALSE;
|
bool result = FALSE;
|
||||||
kind_of_writing_type method = OVERWRITE;
|
kind_of_writing_type method = OVERWRITE;
|
||||||
char *given;
|
char *given;
|
||||||
|
@ -2042,18 +2041,18 @@ int do_writeout(bool exiting, bool withprompt)
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
const char *msg;
|
const char *msg;
|
||||||
|
int i = 0;
|
||||||
|
functionptrtype func;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
const char *formatstr, *backupstr;
|
const char *formatstr, *backupstr;
|
||||||
|
|
||||||
formatstr = (openfile->fmt == DOS_FILE) ? _(" [DOS Format]") :
|
formatstr = (openfile->fmt == DOS_FILE) ? _(" [DOS Format]") :
|
||||||
(openfile->fmt == MAC_FILE) ? _(" [Mac Format]") : "";
|
(openfile->fmt == MAC_FILE) ? _(" [Mac Format]") : "";
|
||||||
|
|
||||||
backupstr = ISSET(BACKUP_FILE) ? _(" [Backup]") : "";
|
backupstr = ISSET(BACKUP_FILE) ? _(" [Backup]") : "";
|
||||||
|
|
||||||
/* If we're using restricted mode, don't display the "Write
|
/* When the mark is on, offer to write the selection to disk, but
|
||||||
* Selection to File" prompt. This function is disabled, since
|
* not when in restricted mode, because it would allow writing to
|
||||||
* it allows reading from or writing to files not specified on
|
* a file not specified on the command line. */
|
||||||
* the command line. */
|
|
||||||
if (openfile->mark && !exiting && !ISSET(RESTRICTED))
|
if (openfile->mark && !exiting && !ISSET(RESTRICTED))
|
||||||
/* TRANSLATORS: The next six strings are prompts. */
|
/* TRANSLATORS: The next six strings are prompts. */
|
||||||
msg = (method == PREPEND) ? _("Prepend Selection to File") :
|
msg = (method == PREPEND) ? _("Prepend Selection to File") :
|
||||||
|
@ -2089,8 +2088,9 @@ int do_writeout(bool exiting, bool withprompt)
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
statusbar(_("Cancelled"));
|
statusbar(_("Cancelled"));
|
||||||
break;
|
break;
|
||||||
} else {
|
}
|
||||||
functionptrtype func = func_from_key(&i);
|
|
||||||
|
func = func_from_key(&i);
|
||||||
|
|
||||||
/* Upon request, abandon the buffer. */
|
/* Upon request, abandon the buffer. */
|
||||||
if (func == discard_buffer) {
|
if (func == discard_buffer) {
|
||||||
|
@ -2107,7 +2107,6 @@ int do_writeout(bool exiting, bool withprompt)
|
||||||
if (chosen == NULL)
|
if (chosen == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* We have a file now. Indicate this. */
|
|
||||||
free(answer);
|
free(answer);
|
||||||
answer = chosen;
|
answer = chosen;
|
||||||
} else
|
} else
|
||||||
|
@ -2130,12 +2129,11 @@ int do_writeout(bool exiting, bool withprompt)
|
||||||
} else if (func == append_void) {
|
} else if (func == append_void) {
|
||||||
method = (method == APPEND) ? OVERWRITE : APPEND;
|
method = (method == APPEND) ? OVERWRITE : APPEND;
|
||||||
continue;
|
continue;
|
||||||
} else
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
if (func == do_help_void) {
|
if (func == do_help_void) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_EXTRA
|
#ifdef ENABLE_EXTRA
|
||||||
/* If the current file has been modified, we've pressed
|
/* If the current file has been modified, we've pressed
|
||||||
* Ctrl-X at the edit window to exit, we've pressed "y" at
|
* Ctrl-X at the edit window to exit, we've pressed "y" at
|
||||||
|
@ -2254,7 +2252,6 @@ int do_writeout(bool exiting, bool withprompt)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
free(given);
|
free(given);
|
||||||
|
|
||||||
|
|
11
src/text.c
11
src/text.c
|
@ -2335,8 +2335,8 @@ void do_justify(bool full_justify)
|
||||||
* this line again. */
|
* this line again. */
|
||||||
i--;
|
i--;
|
||||||
|
|
||||||
par_len--;
|
|
||||||
openfile->totsize--;
|
openfile->totsize--;
|
||||||
|
par_len--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call justify_format() on the paragraph, which will remove
|
/* Call justify_format() on the paragraph, which will remove
|
||||||
|
@ -2381,8 +2381,8 @@ void do_justify(bool full_justify)
|
||||||
strcpy(openfile->current->next->data + indent_len,
|
strcpy(openfile->current->next->data + indent_len,
|
||||||
openfile->current->data + break_pos);
|
openfile->current->data + break_pos);
|
||||||
|
|
||||||
par_len++;
|
|
||||||
openfile->totsize += indent_len + 1;
|
openfile->totsize += indent_len + 1;
|
||||||
|
par_len++;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Adjust the mark coordinates to compensate for the change
|
/* Adjust the mark coordinates to compensate for the change
|
||||||
|
@ -2393,8 +2393,7 @@ void do_justify(bool full_justify)
|
||||||
openfile->mark_x -= break_pos - indent_len;
|
openfile->mark_x -= break_pos - indent_len;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
/* When requested, snip all trailing blanks. */
|
||||||
/* Break the current line. */
|
|
||||||
if (ISSET(JUSTIFY_TRIM)) {
|
if (ISSET(JUSTIFY_TRIM)) {
|
||||||
while (break_pos > 0 &&
|
while (break_pos > 0 &&
|
||||||
is_blank_mbchar(&openfile->current->data[break_pos - 1])) {
|
is_blank_mbchar(&openfile->current->data[break_pos - 1])) {
|
||||||
|
@ -2402,11 +2401,13 @@ void do_justify(bool full_justify)
|
||||||
openfile->totsize--;
|
openfile->totsize--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Break the current line. */
|
||||||
null_at(&openfile->current->data, break_pos);
|
null_at(&openfile->current->data, break_pos);
|
||||||
|
|
||||||
/* Go to the next line. */
|
/* Go to the next line. */
|
||||||
par_len--;
|
|
||||||
openfile->current = openfile->current->next;
|
openfile->current = openfile->current->next;
|
||||||
|
par_len--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We're done breaking lines, so we don't need indent_string
|
/* We're done breaking lines, so we don't need indent_string
|
||||||
|
|
Loading…
Reference in New Issue