tweaks: rename a struct element, to avoid a theoretical name collision

The <term.h> header file form ncurses defines the name "tab".
This commit is contained in:
Benno Schulenberg 2023-02-23 17:08:45 +01:00
parent 7681090c12
commit 94812d17c8
4 changed files with 11 additions and 11 deletions

View File

@ -432,7 +432,7 @@ typedef struct syntaxtype {
/* The command with which to lint this type of file. */
char *formatter;
/* The command with which to format/modify/arrange this type of file. */
char *tab;
char *tabstring;
/* What the Tab key should produce; NULL for default behavior. */
#ifdef ENABLE_COMMENT
char *comment;

View File

@ -1107,7 +1107,7 @@ void toggle_this(int flag)
refresh_needed = TRUE;
break;
case TABS_TO_SPACES:
if (openfile->syntax && openfile->syntax->tab) {
if (openfile->syntax && openfile->syntax->tabstring) {
statusline(AHEM, _("Current syntax determines Tab"));
TOGGLE(flag);
return;

View File

@ -674,7 +674,7 @@ void begin_new_syntax(char *ptr)
live_syntax->magics = NULL;
live_syntax->linter = NULL;
live_syntax->formatter = NULL;
live_syntax->tab = NULL;
live_syntax->tabstring = NULL;
#ifdef ENABLE_COMMENT
live_syntax->comment = copy_of(GENERAL_COMMENT_CHARACTER);
#endif
@ -1325,7 +1325,7 @@ bool parse_syntax_commands(char *keyword, char *ptr)
pick_up_name("comment", ptr, &live_syntax->comment);
#endif
} else if (strcmp(keyword, "tabgives") == 0) {
pick_up_name("tabgives", ptr, &live_syntax->tab);
pick_up_name("tabgives", ptr, &live_syntax->tabstring);
} else if (strcmp(keyword, "linter") == 0)
pick_up_name("linter", ptr, &live_syntax->linter);
else if (strcmp(keyword, "formatter") == 0)

View File

@ -65,8 +65,8 @@ void do_mark(void)
void do_tab(void)
{
#ifdef ENABLE_COLOR
if (openfile->syntax && openfile->syntax->tab)
inject(openfile->syntax->tab, strlen(openfile->syntax->tab));
if (openfile->syntax && openfile->syntax->tabstring)
inject(openfile->syntax->tabstring, strlen(openfile->syntax->tabstring));
else
#endif
#ifndef NANO_TINY
@ -134,8 +134,8 @@ void do_indent(void)
indentation = nmalloc(tabsize + 1);
#ifdef ENABLE_COLOR
if (openfile->syntax && openfile->syntax->tab)
indentation = mallocstrcpy(indentation, openfile->syntax->tab);
if (openfile->syntax && openfile->syntax->tabstring)
indentation = mallocstrcpy(indentation, openfile->syntax->tabstring);
else
#endif
/* Set the indentation to either a bunch of spaces or a single tab. */
@ -173,10 +173,10 @@ size_t length_of_white(const char *text)
size_t white_count = 0;
#ifdef ENABLE_COLOR
if (openfile->syntax && openfile->syntax->tab) {
size_t thelength = strlen(openfile->syntax->tab);
if (openfile->syntax && openfile->syntax->tabstring) {
size_t thelength = strlen(openfile->syntax->tabstring);
while (text[white_count] == openfile->syntax->tab[white_count])
while (text[white_count] == openfile->syntax->tabstring[white_count])
if (++white_count == thelength)
return thelength;