Commit 66c33b87 authored by Chris Allegretta's avatar Chris Allegretta
Browse files

Add tabsize support to rc file (Nathan Heagy)

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@819 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent dc2ca887
No related merge requests found
Showing with 16 additions and 3 deletions
+16 -3
...@@ -66,6 +66,7 @@ CVS code - ...@@ -66,6 +66,7 @@ CVS code -
- corrected the Mouse Toggle section, noticed by Daniel Bonniot. - corrected the Mouse Toggle section, noticed by Daniel Bonniot.
- rcfile.c: - rcfile.c:
- NUM_RCOPTS fix (DLR). - NUM_RCOPTS fix (DLR).
- Add tabsize support to rc file (Nathan Heagy).
- search.c: - search.c:
- Changed search prompt to "Search" followed by a list of - Changed search prompt to "Search" followed by a list of
bracketed, free-standing modifiers that do not imply a grammar, bracketed, free-standing modifiers that do not imply a grammar,
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
# Use this value instead of the default # Use this value instead of the default
# set fill -8 # set fill -8
# Use this tab size instead of the default
# set tabsize 8
# Use this spelling checker instead of the default one # Use this spelling checker instead of the default one
# set speller aspell # set speller aspell
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define _(string) (string) #define _(string) (string)
#endif #endif
#define NUM_RCOPTS 17 #define NUM_RCOPTS 18
/* Static stuff for the nanorc file */ /* Static stuff for the nanorc file */
rcoption rcopts[NUM_RCOPTS] = rcoption rcopts[NUM_RCOPTS] =
{ {
...@@ -51,6 +51,7 @@ rcoption rcopts[NUM_RCOPTS] = ...@@ -51,6 +51,7 @@ rcoption rcopts[NUM_RCOPTS] =
{"mouse", USE_MOUSE}, {"mouse", USE_MOUSE},
{"operatingdir", 0}, {"operatingdir", 0},
{"pico", PICO_MODE}, {"pico", PICO_MODE},
{"tabsize", 0},
#ifndef DISABLE_WRAPJUSTIFY #ifndef DISABLE_WRAPJUSTIFY
{"fill", 0}, {"fill", 0},
...@@ -169,6 +170,7 @@ void parse_rcfile(FILE *rcstream, char *filename) ...@@ -169,6 +170,7 @@ void parse_rcfile(FILE *rcstream, char *filename)
if (set == 1 || rcopts[i].flag == FOLLOW_SYMLINKS) { if (set == 1 || rcopts[i].flag == FOLLOW_SYMLINKS) {
if ( if (
!strcasecmp(rcopts[i].name, "operatingdir") || !strcasecmp(rcopts[i].name, "operatingdir") ||
!strcasecmp(rcopts[i].name, "tabsize") ||
#ifndef DISABLE_WRAPJUSTIFY #ifndef DISABLE_WRAPJUSTIFY
!strcasecmp(rcopts[i].name, "fill") || !strcasecmp(rcopts[i].name, "fill") ||
#endif #endif
...@@ -197,8 +199,15 @@ void parse_rcfile(FILE *rcstream, char *filename) ...@@ -197,8 +199,15 @@ void parse_rcfile(FILE *rcstream, char *filename)
else else
fill = i; fill = i;
#endif #endif
} else if (!strcasecmp(rcopts[i].name, "tabsize")) {
if ((i = atoi(option)) <= 0) {
rcfile_msg(&errors,
_("Error in %s on line %d: requested tab size %d too small"),
filename, lineno, option);
} else {
tabsize = i;
} }
else { } else {
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
alt_speller = charalloc(strlen(option) + 1); alt_speller = charalloc(strlen(option) + 1);
strcpy(alt_speller, option); strcpy(alt_speller, option);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment