[gnome-builder/wip/libide] libide: use MAX() only in initial value when looping
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide] libide: use MAX() only in initial value when looping
- Date: Tue, 10 Mar 2015 01:18:45 +0000 (UTC)
commit e9a431683ed64e90e7f855b760db8bcc97461223
Author: Christian Hergert <christian hergert me>
Date: Mon Mar 9 18:18:34 2015 -0700
libide: use MAX() only in initial value when looping
libide/ide-source-view-movements.c | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/libide/ide-source-view-movements.c b/libide/ide-source-view-movements.c
index 7b730cc..172cb70 100644
--- a/libide/ide-source-view-movements.c
+++ b/libide/ide-source-view-movements.c
@@ -1219,12 +1219,12 @@ _ide_source_view_apply_movement (IdeSourceView *self,
break;
case IDE_SOURCE_VIEW_MOVEMENT_PREVIOUS_CHAR:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_previous_char (&mv);
break;
case IDE_SOURCE_VIEW_MOVEMENT_NEXT_CHAR:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_next_char (&mv);
break;
@@ -1245,52 +1245,52 @@ _ide_source_view_apply_movement (IdeSourceView *self,
break;
case IDE_SOURCE_VIEW_MOVEMENT_PREVIOUS_FULL_WORD_START:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_previous_full_word_start (&mv);
break;
case IDE_SOURCE_VIEW_MOVEMENT_NEXT_FULL_WORD_START:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_next_full_word_start (&mv);
break;
case IDE_SOURCE_VIEW_MOVEMENT_PREVIOUS_FULL_WORD_END:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_previous_full_word_end (&mv);
break;
case IDE_SOURCE_VIEW_MOVEMENT_NEXT_FULL_WORD_END:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_next_full_word_end (&mv);
break;
case IDE_SOURCE_VIEW_MOVEMENT_PREVIOUS_WORD_START:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_previous_word_start (&mv);
break;
case IDE_SOURCE_VIEW_MOVEMENT_NEXT_WORD_START:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_next_word_start (&mv);
break;
case IDE_SOURCE_VIEW_MOVEMENT_PREVIOUS_WORD_END:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_previous_word_end (&mv);
break;
case IDE_SOURCE_VIEW_MOVEMENT_NEXT_WORD_END:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_next_word_end (&mv);
break;
case IDE_SOURCE_VIEW_MOVEMENT_SENTENCE_START:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_sentence_start (&mv);
break;
case IDE_SOURCE_VIEW_MOVEMENT_SENTENCE_END:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_sentence_end (&mv);
break;
@@ -1313,14 +1313,14 @@ _ide_source_view_apply_movement (IdeSourceView *self,
case IDE_SOURCE_VIEW_MOVEMENT_PREVIOUS_LINE:
mv.ignore_target_offset = TRUE;
mv.ignore_select = TRUE;
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_previous_line (&mv);
break;
case IDE_SOURCE_VIEW_MOVEMENT_NEXT_LINE:
mv.ignore_target_offset = TRUE;
mv.ignore_select = TRUE;
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_next_line (&mv);
break;
@@ -1352,13 +1352,13 @@ _ide_source_view_apply_movement (IdeSourceView *self,
case IDE_SOURCE_VIEW_MOVEMENT_HALF_PAGE_DOWN:
case IDE_SOURCE_VIEW_MOVEMENT_PAGE_UP:
case IDE_SOURCE_VIEW_MOVEMENT_PAGE_DOWN:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_move_page (&mv);
break;
case IDE_SOURCE_VIEW_MOVEMENT_SCREEN_DOWN:
case IDE_SOURCE_VIEW_MOVEMENT_SCREEN_UP:
- for (i = 0; i < MAX (1, mv.count); i++)
+ for (i = MAX (1, mv.count); i > 0; i--)
ide_source_view_movements_scroll (&mv);
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]