+2015-08-09 Benno Schulenberg <bensberg@justemail.net>
+ * src/global.c, src/help.c (help_init), src/nano.c (do_toggle, main),
+ src/winio.c (display_string, statusbar): Allow toggling the display
+ of whitespace also when support for nanorc files was not built in,
+ because the default values are quite usable.
+
2015-08-08 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (display_string): For some reason the reallocation done
by null_at() messes things up. So put in the null byte "manually".
char *matchbrackets = NULL;
/* The opening and closing brackets that can be found by bracket
* searches. */
-#endif
-
-#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
char *whitespace = NULL;
- /* The characters used when displaying the first characters of
- * tabs and spaces. */
+ /* The characters used when visibly showing tabs and spaces. */
int whitespace_len[2];
- /* The length of these characters. */
+ /* The length in bytes of these characters. */
#endif
#ifndef DISABLE_JUSTIFY
int scsfound = 0;
#ifndef NANO_TINY
-#ifndef DISABLE_NANORC
bool old_whitespace = ISSET(WHITESPACE_DISPLAY);
UNSET(WHITESPACE_DISPLAY);
-#endif
#endif
/* First, set up the initial help text for the current function. */
}
}
-#ifndef DISABLE_NANORC
if (old_whitespace)
SET(WHITESPACE_DISPLAY);
-#endif
#endif /* !NANO_TINY */
/* If all went well, we didn't overwrite the allocated space for
case SUSPEND:
signal_init();
break;
-#ifndef DISABLE_NANORC
case WHITESPACE_DISPLAY:
titlebar(NULL);
edit_refresh();
break;
-#endif
#ifndef DISABLE_COLOR
case NO_COLOR_SYNTAX:
#endif
if (matchbrackets == NULL)
matchbrackets = mallocstrcpy(NULL, "(<[{)>]}");
-#ifndef DISABLE_NANORC
/* If whitespace wasn't specified, set its default value. If we're
* using UTF-8, it's Unicode 00BB (Right-Pointing Double Angle
* Quotation Mark) and Unicode 00B7 (Middle Dot). Otherwise, it's
whitespace_len[1] = 1;
}
}
-#endif /* !DISABLE_NANORC */
#endif /* !NANO_TINY */
/* Initialize the search and replace strings. */
extern char *matchbrackets;
#endif
-#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
+#ifndef NANO_TINY
extern char *whitespace;
extern int whitespace_len[2];
#endif
/* If buf contains a tab character, interpret it. */
if (*buf_mb == '\t') {
-#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
+#ifndef NANO_TINY
if (ISSET(WHITESPACE_DISPLAY)) {
int i;
free(ctrl_buf_mb);
/* If buf contains a space character, interpret it. */
} else if (*buf_mb == ' ') {
-#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
+#ifndef NANO_TINY
if (ISSET(WHITESPACE_DISPLAY)) {
int i;
va_list ap;
char *bar, *foo;
size_t start_x;
-#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
- bool old_whitespace;
+#ifndef NANO_TINY
+ bool old_whitespace = ISSET(WHITESPACE_DISPLAY);
+
+ UNSET(WHITESPACE_DISPLAY);
#endif
va_start(ap, msg);
blank_statusbar();
-#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
- old_whitespace = ISSET(WHITESPACE_DISPLAY);
- UNSET(WHITESPACE_DISPLAY);
-#endif
bar = charalloc(mb_cur_max() * (COLS - 3));
vsnprintf(bar, mb_cur_max() * (COLS - 3), msg, ap);
va_end(ap);
foo = display_string(bar, 0, COLS - 4, FALSE);
free(bar);
-#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
+
+#ifndef NANO_TINY
if (old_whitespace)
SET(WHITESPACE_DISPLAY);
#endif