(is_aligned_on_a_tab): return gboolean instead of int. Minor optimization.
(right_of_four_spaces): likewise. (left_of_four_spaces): likewise. Simplifying expression for easy code support. Signed-off-by: Ilia Maslakov <il.smind@gmail.com> Signed-off-by: Andrew Borodin <aborodin@vmail.ru> Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Этот коммит содержится в:
родитель
ad0f58e51e
Коммит
1326197d1b
@ -169,10 +169,6 @@ static off_t last_bracket = -1;
|
||||
* fin.
|
||||
*/
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int left_of_four_spaces (WEdit * edit);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Initialize the buffers for an empty files.
|
||||
@ -1440,38 +1436,40 @@ edit_delete_to_line_begin (WEdit * edit)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
static gboolean
|
||||
is_aligned_on_a_tab (WEdit * edit)
|
||||
{
|
||||
long curs_col;
|
||||
|
||||
edit_update_curs_col (edit);
|
||||
return !((edit->curs_col % (TAB_SIZE * space_width))
|
||||
&& edit->curs_col % (TAB_SIZE * space_width) != (HALF_TAB_SIZE * space_width));
|
||||
curs_col = edit->curs_col % (TAB_SIZE * space_width);
|
||||
return (curs_col == 0 || curs_col == (HALF_TAB_SIZE * space_width));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
static gboolean
|
||||
right_of_four_spaces (WEdit * edit)
|
||||
{
|
||||
int i, ch = 0;
|
||||
|
||||
for (i = 1; i <= HALF_TAB_SIZE; i++)
|
||||
ch |= edit_get_byte (edit, edit->curs1 - i);
|
||||
if (ch == ' ')
|
||||
return is_aligned_on_a_tab (edit);
|
||||
return 0;
|
||||
|
||||
return (ch == ' ' && is_aligned_on_a_tab (edit));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
static gboolean
|
||||
left_of_four_spaces (WEdit * edit)
|
||||
{
|
||||
int i, ch = 0;
|
||||
|
||||
for (i = 0; i < HALF_TAB_SIZE; i++)
|
||||
ch |= edit_get_byte (edit, edit->curs1 + i);
|
||||
if (ch == ' ')
|
||||
return is_aligned_on_a_tab (edit);
|
||||
return 0;
|
||||
|
||||
return (ch == ' ' && is_aligned_on_a_tab (edit));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user