parse_syntax(), parse_colors(), parse_rcfile(), do_rcfile(),
etc. (David Benbennick) DLR: Rename colortoint() to
color_to_int(), and add a few miscellaneous tweaks.
+ - Still more steps toward full wide/multibyte character support.
+ Make whitespace display mode work with multibyte characters,
+ and add a few related documentation updates. Changes to
+ do_help(), main(), parse_rcfile(), and display_string(). (DLR)
- cut.c:
do_cut_text()
- If keep_cutbuffer is FALSE, only blow away the text in the
Piefel)
- Add the "morespace" option. (DLR)
- Add support for characters to the "c-file" regexes. (DLR)
+ - Add the hexadecimal equivalents of the decimal values
+ suggested for whitespace display, now that it can handle
+ multibyte characters. (DLR)
- nano.1. nanorc.5, nano.texi:
- Add the "morespace" option, and sync with the descriptions in
nanorc.sample in a few places. (DLR)
## Save automatically on exit, don't prompt.
# set tempfile
-## Disallow file modification, why would you want this in an rc file? ;)
+## Disallow file modification; why would you want this in an rcfile? ;)
# set view
## The two characters used to display the first characters of tabs and
-## spaces. 187 and 183 seem to be good values for these.
+## spaces. 187 decimal (00BB hexadecimal) and 183 decimal (00B7
+## hexadecimal) seem to be good values for these.
# set whitespace " "
## Color setup
char *whitespace = NULL; /* Characters used when displaying
the first characters of tabs and
spaces. */
+int whitespace_len[2]; /* The length of the characters. */
#endif
#ifndef DISABLE_JUSTIFY
"Esc key twice. Escape-key sequences are notated with the Meta "
"(M) symbol and can be entered using either the Esc, Alt or "
"Meta key depending on your keyboard setup. Also, pressing Esc "
- "twice and then typing a three-digit number from 000 to 255 "
- "will enter the character with the corresponding value. The "
- "following keystrokes are available in the main editor window. "
- "Alternative keys are shown in parentheses:\n\n");
+ "twice and then typing a three-digit decimal number from 000 to "
+ " 255 will enter the character with the corresponding value. "
+ "The following keystrokes are available in the main editor "
+ " window. Alternative keys are shown in parentheses:\n\n");
htx = _(htx);
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
/* If whitespace wasn't specified, set its default value. */
- if (whitespace == NULL)
+ if (whitespace == NULL) {
whitespace = mallocstrcpy(NULL, " ");
+ whitespace_len[0] = 1;
+ whitespace_len[1] = 1;
+ }
#endif
/* If tabsize wasn't specified, set its default value. */
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
extern char *whitespace;
+extern int whitespace_len[2];
#endif
#ifndef DISABLE_JUSTIFY
#endif
#ifndef NANO_SMALL
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
- size_t ws_len;
- whitespace = mallocstrcpy(NULL, option);
- ws_len = strlen(whitespace);
- if (ws_len != 2 || (ws_len == 2 && (is_cntrl_char(whitespace[0]) || is_cntrl_char(whitespace[1])))) {
- rcfile_error(N_("Two non-control characters required"));
+ /* We use display_string() here so that any
+ * invalid multibyte characters in option
+ * will be converted to valid multibyte
+ * characters in whitespace. */
+ whitespace = display_string(option, 0, 3, FALSE);
+
+ if (mbstrlen(whitespace) != 2 || strlenpt(whitespace) != 2) {
+ rcfile_error(N_("Two single-column characters required"));
free(whitespace);
whitespace = NULL;
+ } else {
+ whitespace_len[0] =
+ parse_mbchar(whitespace, NULL,
+ NULL, NULL);
+ whitespace_len[1] =
+ parse_mbchar(whitespace +
+ whitespace_len[0], NULL,
+ NULL, NULL);
}
} else
#endif
NULL);
if (*buf_mb == '\t') {
- converted[index++] =
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
- ISSET(WHITESPACE_DISPLAY) ? whitespace[0] :
+ if (ISSET(WHITESPACE_DISPLAY)) {
+ int i;
+
+ for (i = 0; i < whitespace_len[0]; i++)
+ converted[index++] = whitespace[i];
+ } else
#endif
- ' ';
+ converted[index++] = ' ';
start_col++;
while (start_col % tabsize != 0) {
converted[index++] = ' ';
free(ctrl_buf_mb);
} else if (*buf_mb == ' ') {
- converted[index++] =
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
- ISSET(WHITESPACE_DISPLAY) ? whitespace[1] :
+ if (ISSET(WHITESPACE_DISPLAY)) {
+ int i;
+
+ for (i = whitespace_len[0]; i < whitespace_len[0] +
+ whitespace_len[1]; i++)
+ converted[index++] = whitespace[i];
+ } else
#endif
- ' ';
+ converted[index++] = ' ';
start_col++;
} else {
int i;