(edit_indent_width, edit_insert_indent): move to wordproc.c and make static.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2013-02-24 16:21:53 +04:00
parent ca26181f5d
commit c466b18f67
3 changed files with 31 additions and 33 deletions

View File

@ -285,8 +285,6 @@ void book_mark_restore (WEdit * edit, int color);
gboolean edit_line_is_blank (WEdit * edit, long line); gboolean edit_line_is_blank (WEdit * edit, long line);
gboolean is_break_char (char c); gboolean is_break_char (char c);
long edit_indent_width (const WEdit * edit, off_t p);
void edit_insert_indent (WEdit * edit, int indent);
void edit_options_dialog (WDialog * h); void edit_options_dialog (WDialog * h);
void edit_syntax_dialog (WEdit * edit); void edit_syntax_dialog (WEdit * edit);
void edit_mail_dialog (WEdit * edit); void edit_mail_dialog (WEdit * edit);

View File

@ -3196,37 +3196,6 @@ edit_delete_line (WEdit * edit)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
long
edit_indent_width (const WEdit * edit, off_t p)
{
off_t q = p;
/* move to the end of the leading whitespace of the line */
while (strchr ("\t ", edit_buffer_get_byte (&edit->buffer, q)) && q < edit->last_byte - 1)
q++;
/* count the number of columns of indentation */
return (long) edit_move_forward3 (edit, p, 0, q);
}
/* --------------------------------------------------------------------------------------------- */
void
edit_insert_indent (WEdit * edit, int indent)
{
if (!option_fill_tabs_with_spaces)
{
while (indent >= TAB_SIZE)
{
edit_insert (edit, '\t');
indent -= TAB_SIZE;
}
}
while (indent-- > 0)
edit_insert (edit, ' ');
}
/* --------------------------------------------------------------------------------------------- */
void void
edit_push_key_press (WEdit * edit) edit_push_key_press (WEdit * edit)
{ {

View File

@ -354,6 +354,37 @@ replace_at (WEdit * edit, long q, int c)
edit_insert_ahead (edit, c); edit_insert_ahead (edit, c);
} }
/* --------------------------------------------------------------------------------------------- */
static long
edit_indent_width (const WEdit * edit, off_t p)
{
off_t q = p;
/* move to the end of the leading whitespace of the line */
while (strchr ("\t ", edit_buffer_get_byte (&edit->buffer, q)) != NULL
&& q < edit->last_byte - 1)
q++;
/* count the number of columns of indentation */
return (long) edit_move_forward3 (edit, p, 0, q);
}
/* --------------------------------------------------------------------------------------------- */
static void
edit_insert_indent (WEdit * edit, long indent)
{
if (!option_fill_tabs_with_spaces)
while (indent >= TAB_SIZE)
{
edit_insert (edit, '\t');
indent -= TAB_SIZE;
}
while (indent-- > 0)
edit_insert (edit, ' ');
}
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/** replaces a block of text */ /** replaces a block of text */