diff -ur work.orig/nano-1.2.2/global.c work/nano-1.2.2/global.c --- work.orig/nano-1.2.2/global.c 2003-09-01 18:15:59.000000000 -0400 +++ work/nano-1.2.2/global.c 2003-09-02 08:46:03.000000000 -0400 @@ -80,6 +80,8 @@ int tabsize = -1; /* Our internal tabsize variable. The default value 8 is set in main(). */ +int tabconvert = ' '; +int spaceconvert = ' '; char *hblank = NULL; /* A horizontal blank line */ #ifndef DISABLE_HELP @@ -224,7 +226,7 @@ char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg, *toggle_nohelp_msg, *toggle_cuttoend_msg, *toggle_noconvert_msg, *toggle_dos_msg, *toggle_mac_msg, - *toggle_backup_msg, *toggle_smooth_msg; + *toggle_backup_msg, *toggle_smooth_msg;//, *toggle_wsconvert_msg; #if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION) char *toggle_mouse_msg; #endif @@ -256,6 +258,7 @@ toggle_mac_msg = _("Writing file in Mac format"); toggle_backup_msg = _("Backing up file"); toggle_smooth_msg = _("Smooth scrolling"); +// toggle_wsconvert_msg = _("Whitespace converting"); #ifdef ENABLE_COLOR toggle_syntax_msg = _("Color syntax highlighting"); #endif @@ -270,6 +273,7 @@ toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT); toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND); toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP); +// toggle_init_one(TOGGLE_WSCONVERT_KEY, toggle_wsconvert_msg, WS_CONVERT); #ifndef DISABLE_WRAPPING toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP); #endif diff -ur work.orig/nano-1.2.2/nano.h work/nano-1.2.2/nano.h --- work.orig/nano-1.2.2/nano.h 2003-09-01 18:15:59.000000000 -0400 +++ work/nano-1.2.2/nano.h 2003-09-02 09:05:17.000000000 -0400 @@ -253,6 +253,7 @@ #define HISTORY_CHANGED (1<<29) #define HISTORYLOG (1<<30) #define JUSTIFY_MODE (1<<31) +//#define WS_CONVERT (1<<32) /* Control key sequences, changing these would be very very bad */ @@ -404,6 +405,7 @@ #define TOGGLE_MAC_KEY NANO_ALT_O #define TOGGLE_SMOOTH_KEY NANO_ALT_S #define TOGGLE_NOCONVERT_KEY NANO_ALT_N +//#define TOGGLE_WSCONVERT_KEY NANO_ALT_V #define TOGGLE_BACKUP_KEY NANO_ALT_B #define TOGGLE_SYNTAX_KEY NANO_ALT_Y #endif /* !NANO_SMALL */ diff -ur work.orig/nano-1.2.2/nanorc.sample work/nano-1.2.2/nanorc.sample --- work.orig/nano-1.2.2/nanorc.sample 2003-09-01 18:15:59.000000000 -0400 +++ work/nano-1.2.2/nanorc.sample 2003-09-01 18:32:31.000000000 -0400 @@ -86,6 +86,14 @@ ## Use this tab size instead of the default; it must be greater than 0 # set tabsize 8 +## Use this tab char instead of the default space; it can either be the +## ascii value of the character you wish to see (refer to ascii(7)) or +## it can be a single character. 187 seems to be a 'good' value. +# set tabconvert 32 +## Same as tabconverting above, but applied to spaces. +## it can be a single character. 183 seems to be a 'good' value. +# set tabconvert 32 + ## Save automatically on exit, don't prompt # set tempfile diff -ur work.orig/nano-1.2.2/proto.h work/nano-1.2.2/proto.h --- work.orig/nano-1.2.2/proto.h 2003-09-01 18:15:59.000000000 -0400 +++ work/nano-1.2.2/proto.h 2003-09-02 08:42:53.000000000 -0400 @@ -38,7 +38,7 @@ #endif extern long totsize; extern int temp_opt; -extern int wrap_at, flags, tabsize; +extern int wrap_at, flags, tabsize, tabconvert, spaceconvert; extern int search_last_line; extern int search_offscreen; extern int currslen; diff -ur work.orig/nano-1.2.2/rcfile.c work/nano-1.2.2/rcfile.c --- work.orig/nano-1.2.2/rcfile.c 2003-09-01 18:15:59.000000000 -0400 +++ work/nano-1.2.2/rcfile.c 2003-09-02 08:45:49.000000000 -0400 @@ -58,6 +58,7 @@ #endif #ifndef NANO_SMALL {"noconvert", NO_CONVERT}, +/* {"wsconvert", WS_CONVERT}, */ #endif {"nofollow", NOFOLLOW_SYMLINKS}, {"nohelp", NO_HELP}, @@ -82,6 +83,8 @@ #endif {"suspend", SUSPEND}, {"tabsize", 0}, + {"tabconvert", ' '}, + {"spaceconvert", ' '}, {"tempfile", TEMP_OPT}, {"view", VIEW_MODE}, {"historylog", HISTORYLOG}, @@ -523,6 +526,8 @@ #endif if (set == 1) { if (!strcasecmp(rcopts[i].name, "tabsize") + || !strcasecmp(rcopts[i].name, "tabconvert") + || !strcasecmp(rcopts[i].name, "spaceconvert") #ifndef DISABLE_OPERATINGDIR || !strcasecmp(rcopts[i].name, "operatingdir") #endif @@ -586,11 +591,29 @@ * accept 0 while checking other * errors. */ j = (int)strtol(option, &first_error, 10); - if (errno == ERANGE || *option == '\0' || *first_error != '\0') - rcfile_error(_("requested tab size %d invalid"), - j); - else - tabsize = j; + if (!strcasecmp(rcopts[i].name, "tabconvert")) { + if (errno == ERANGE || *first_error != '\0') { + if (*option == '\0') + rcfile_error(_("requested tab convert is invalid")); + else + tabconvert = option[0]; + } else + tabconvert = j; + } else if (!strcasecmp(rcopts[i].name, "spaceconvert")) { + if (errno == ERANGE || *first_error != '\0') { + if (*option == '\0') + rcfile_error(_("requested space convert is invalid")); + else + spaceconvert = option[0]; + } else + spaceconvert = j; + } else { + if (errno == ERANGE || *option == '\0' || *first_error != '\0') + rcfile_error(_("requested tab size %d invalid"), + j); + else + tabsize = j; + } } } else SET(rcopts[i].flag); diff -ur work.orig/nano-1.2.2/winio.c work/nano-1.2.2/winio.c --- work.orig/nano-1.2.2/winio.c 2003-09-01 18:15:59.000000000 -0400 +++ work/nano-1.2.2/winio.c 2003-09-02 08:43:56.000000000 -0400 @@ -1067,11 +1067,11 @@ pos = 0; for (; *original != '\0'; original++) { - if (*original == '\t') - do { + if (*original == '\t') { + converted[pos++] = tabconvert; + while (pos % tabsize) converted[pos++] = ' '; - } while (pos % tabsize); - else if (is_cntrl_char(*original)) { + } else if (is_cntrl_char(*original)) { converted[pos++] = '^'; if (*original == 127) converted[pos++] = '?'; @@ -1083,7 +1083,7 @@ else converted[pos++] = *original + 64; } else - converted[pos++] = *original; + converted[pos++] = (*original==' ') ? spaceconvert : *original; } converted[pos] = '\0';