From c466b18f672306f808bb4a38a3c4f3ae72f5e83e Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 24 Feb 2013 16:21:53 +0400 Subject: [PATCH] (edit_indent_width, edit_insert_indent): move to wordproc.c and make static. Signed-off-by: Andrew Borodin --- src/editor/edit-impl.h | 2 -- src/editor/edit.c | 31 ------------------------------- src/editor/wordproc.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/src/editor/edit-impl.h b/src/editor/edit-impl.h index 806044569..4afb797c8 100644 --- a/src/editor/edit-impl.h +++ b/src/editor/edit-impl.h @@ -285,8 +285,6 @@ void book_mark_restore (WEdit * edit, int color); gboolean edit_line_is_blank (WEdit * edit, long line); 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_syntax_dialog (WEdit * edit); void edit_mail_dialog (WEdit * edit); diff --git a/src/editor/edit.c b/src/editor/edit.c index 24d31f5c8..c0da1506c 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -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 edit_push_key_press (WEdit * edit) { diff --git a/src/editor/wordproc.c b/src/editor/wordproc.c index 3ade9aab3..3695a530c 100644 --- a/src/editor/wordproc.c +++ b/src/editor/wordproc.c @@ -354,6 +354,37 @@ replace_at (WEdit * edit, long q, int 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 */