mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 10:04:32 +03:00
Add editor_stop_format_chars ini option.
This option contains a set of characters to stop paragraph formatting. If one of those characters is found in the begin of line, that line and all following lines of paragraph will be untouched. Default value is "-+*\,.;:&>". Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
06a9feef32
commit
943320c434
@ -598,6 +598,12 @@ Use
|
|||||||
.B spell_language = NONE
|
.B spell_language = NONE
|
||||||
to disable aspell support. Default value is 'en'. Option must located
|
to disable aspell support. Default value is 'en'. Option must located
|
||||||
in the [Misc] section.
|
in the [Misc] section.
|
||||||
|
.TP
|
||||||
|
.I editor_stop_format_chars
|
||||||
|
Set of characters to stop paragraph formatting. If one of those characters
|
||||||
|
is found in the begin of line, that line and all following lines of paragraph
|
||||||
|
will be untouched. Default value is
|
||||||
|
"\fB-\fR\fB+\fR\fB*\fR\fB\\\fR\fB,\fR\fB.\fR\fB;\fR\fB:\fR\fB&\fR\fB>\fR".
|
||||||
.SH MISCELLANEOUS
|
.SH MISCELLANEOUS
|
||||||
You can use scanf search and replace to search and replace a C format
|
You can use scanf search and replace to search and replace a C format
|
||||||
string. First take a look at the
|
string. First take a look at the
|
||||||
|
@ -49,6 +49,7 @@ extern int option_syntax_highlighting;
|
|||||||
extern int option_group_undo;
|
extern int option_group_undo;
|
||||||
extern char *option_backup_ext;
|
extern char *option_backup_ext;
|
||||||
extern char *option_filesize_threshold;
|
extern char *option_filesize_threshold;
|
||||||
|
extern char *option_stop_format_chars;
|
||||||
|
|
||||||
extern int edit_confirm_save;
|
extern int edit_confirm_save;
|
||||||
|
|
||||||
|
@ -57,11 +57,12 @@
|
|||||||
|
|
||||||
/*** global variables ****************************************************************************/
|
/*** global variables ****************************************************************************/
|
||||||
|
|
||||||
|
char *option_stop_format_chars = NULL;
|
||||||
|
|
||||||
/*** file scope macro definitions ****************************************************************/
|
/*** file scope macro definitions ****************************************************************/
|
||||||
|
|
||||||
#define tab_width option_tab_spacing
|
#define tab_width option_tab_spacing
|
||||||
|
|
||||||
#define NO_FORMAT_CHARS_START "-+*\\,.;:&>"
|
|
||||||
#define FONT_MEAN_WIDTH 1
|
#define FONT_MEAN_WIDTH 1
|
||||||
|
|
||||||
/*** file scope type declarations ****************************************************************/
|
/*** file scope type declarations ****************************************************************/
|
||||||
@ -112,7 +113,7 @@ bad_line_start (const edit_buffer_t * buf, off_t p)
|
|||||||
&& edit_buffer_get_byte (buf, p + 2) == '-');
|
&& edit_buffer_get_byte (buf, p + 2) == '-');
|
||||||
}
|
}
|
||||||
|
|
||||||
return (strchr (NO_FORMAT_CHARS_START, c) != NULL);
|
return (option_stop_format_chars != NULL && strchr (option_stop_format_chars, c) != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -497,20 +498,29 @@ format_paragraph (WEdit * edit, gboolean force)
|
|||||||
if (!force)
|
if (!force)
|
||||||
{
|
{
|
||||||
off_t i;
|
off_t i;
|
||||||
|
char *stop_format_chars;
|
||||||
|
|
||||||
if (strchr (NO_FORMAT_CHARS_START, t->str[0]) != NULL)
|
if (option_stop_format_chars != NULL
|
||||||
|
&& strchr (option_stop_format_chars, t->str[0]) != NULL)
|
||||||
{
|
{
|
||||||
g_string_free (t, TRUE);
|
g_string_free (t, TRUE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (option_stop_format_chars == NULL || *option_stop_format_chars == '\0')
|
||||||
|
stop_format_chars = g_strdup ("\t");
|
||||||
|
else
|
||||||
|
stop_format_chars = g_strconcat (option_stop_format_chars, "\t", (char *) NULL);
|
||||||
|
|
||||||
for (i = 0; i < size - 1; i++)
|
for (i = 0; i < size - 1; i++)
|
||||||
if (t->str[i] == '\n'
|
if (t->str[i] == '\n' && strchr (stop_format_chars, t->str[i + 1]) != NULL)
|
||||||
&& strchr (NO_FORMAT_CHARS_START "\t ", t->str[i + 1]) != NULL)
|
|
||||||
{
|
{
|
||||||
|
g_free (stop_format_chars);
|
||||||
g_string_free (t, TRUE);
|
g_string_free (t, TRUE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (stop_format_chars);
|
||||||
}
|
}
|
||||||
|
|
||||||
t2 = (unsigned char *) g_string_free (t, FALSE);
|
t2 = (unsigned char *) g_string_free (t, FALSE);
|
||||||
|
@ -376,6 +376,7 @@ static const struct
|
|||||||
#ifdef USE_INTERNAL_EDIT
|
#ifdef USE_INTERNAL_EDIT
|
||||||
{ "editor_backup_extension", &option_backup_ext, "~" },
|
{ "editor_backup_extension", &option_backup_ext, "~" },
|
||||||
{ "editor_filesize_threshold", &option_filesize_threshold, "64M" },
|
{ "editor_filesize_threshold", &option_filesize_threshold, "64M" },
|
||||||
|
{ "editor_stop_format_chars", &option_stop_format_chars, "-+*\\,.;:&>" },
|
||||||
#endif
|
#endif
|
||||||
{ "mcview_eof", &mcview_show_eof, "" },
|
{ "mcview_eof", &mcview_show_eof, "" },
|
||||||
{ NULL, NULL, NULL }
|
{ NULL, NULL, NULL }
|
||||||
|
Loading…
Reference in New Issue
Block a user