tweaks: miscellaneous frobbings and rewrappings

This commit is contained in:
Benno Schulenberg 2016-12-07 19:56:27 +01:00
parent 0e01080983
commit 964c10db17
4 changed files with 16 additions and 20 deletions

View File

@ -88,13 +88,12 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_comment" = xyes; then
AC_MSG_ERROR([--enable-comment cannot work with --enable-tiny])
else
# Disabling nanorc silently disables comment support.
enable_comment=no
fi
fi
if test "x$disable_comment" != xyes; then
if test "x$enable_comment" != xno; then
AC_DEFINE(ENABLE_COMMENT, 1, [Define this to disable the comment/uncomment functionality.])
AC_DEFINE(ENABLE_COMMENT, 1, [Define this to enable the comment/uncomment function.])
fi
fi
@ -173,7 +172,7 @@ fi
AC_ARG_ENABLE(tabcomp,
AS_HELP_STRING([--disable-tabcomp], [Disable tab completion functions]))
if test "x$enable_tabcomp" = xno; then
AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab completion functions for files and search strings.])
AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab completion functions for filenames and search strings.])
fi
AC_ARG_ENABLE(wordcomp,

View File

@ -2234,8 +2234,7 @@ int do_writeout(bool exiting)
/* If we're using restricted mode, and the filename isn't blank,
* disable tab completion. */
i = do_prompt(!ISSET(RESTRICTED) ||
openfile->filename[0] == '\0',
i = do_prompt(!ISSET(RESTRICTED) || openfile->filename[0] == '\0',
#ifndef DISABLE_TABCOMP
TRUE,
#endif
@ -2997,10 +2996,8 @@ void load_history(void)
ssize_t read;
while ((read = getline(&line, &buf_len, hist)) >= 0) {
if (read > 0 && line[read - 1] == '\n') {
read--;
line[read] = '\0';
}
if (read > 0 && line[read - 1] == '\n')
line[--read] = '\0';
if (read > 0) {
unsunder(line, read);
update_history(history, line);

View File

@ -534,9 +534,6 @@ void shortcut_init(void)
N_("Copy the current line and store it in the cutbuffer");
const char *nano_indent_msg = N_("Indent the current line");
const char *nano_unindent_msg = N_("Unindent the current line");
#ifdef ENABLE_COMMENT
const char *nano_comment_msg = N_("Comment/uncomment the current line or marked lines");
#endif
const char *nano_undo_msg = N_("Undo the last operation");
const char *nano_redo_msg = N_("Redo the last undone operation");
#endif
@ -597,6 +594,10 @@ void shortcut_init(void)
#ifdef ENABLE_WORDCOMPLETION
const char *nano_completion_msg = N_("Try and complete the current word");
#endif
#ifdef ENABLE_COMMENT
const char *nano_comment_msg =
N_("Comment/uncomment the current line or marked lines");
#endif
#ifndef NANO_TINY
const char *nano_savefile_msg = N_("Save file without prompting");
const char *nano_findprev_msg = N_("Search next occurrence backward");

View File

@ -1212,12 +1212,14 @@ void add_undo(undo_type action)
case BACK:
/* If the next line is the magic line, don't ever undo this
* backspace, as it won't actually have deleted anything. */
if (openfile->current->next == openfile->filebot && openfile->current->data[0] != '\0')
if (openfile->current->next == openfile->filebot &&
openfile->current->data[0] != '\0')
u->xflags = WAS_FINAL_BACKSPACE;
case DEL:
if (u->begin != strlen(openfile->current->data)) {
char *char_buf = charalloc(mb_cur_max() + 1);
int char_buf_len = parse_mbchar(&openfile->current->data[u->begin], char_buf, NULL);
int char_buf_len = parse_mbchar(&openfile->current->data[u->begin],
char_buf, NULL);
null_at(&char_buf, char_buf_len);
u->strdata = char_buf;
if (u->type == BACK)
@ -2288,8 +2290,7 @@ void do_justify(bool full_justify)
if (first_par_line == NULL) {
backup_lines(openfile->current, full_justify ?
openfile->filebot->lineno - openfile->current->lineno +
((openfile->filebot->data[0] != '\0') ? 1 : 0) :
par_len);
((openfile->filebot->data[0] != '\0') ? 1 : 0) : par_len);
first_par_line = openfile->current;
}
@ -2343,8 +2344,7 @@ void do_justify(bool full_justify)
/* We're just about to tack the next line onto this one. If
* this line isn't empty, make sure it ends in a space. */
if (line_len > 0 &&
openfile->current->data[line_len - 1] != ' ') {
if (line_len > 0 && openfile->current->data[line_len - 1] != ' ') {
line_len++;
openfile->current->data =
charealloc(openfile->current->data, line_len + 1);
@ -2359,8 +2359,7 @@ void do_justify(bool full_justify)
#ifndef NANO_TINY
/* If needed, adjust the coordinates of the mark. */
if (openfile->mark_set &&
openfile->mark_begin == next_line) {
if (openfile->mark_set && openfile->mark_begin == next_line) {
openfile->mark_begin = openfile->current;
openfile->mark_begin_x += line_len - indent_len;
}