[f-spot: 1/6] Shift-Tab cycles backwards in tag completion
- From: Stephane Delcroix <sdelcroix src gnome org>
- To: svn-commits-list gnome org
- Subject: [f-spot: 1/6] Shift-Tab cycles backwards in tag completion
- Date: Mon, 15 Jun 2009 03:11:57 -0400 (EDT)
commit d0c22181acf0b0144904d61d3be259f829c4ce84
Author: Joachim Breitner <mail joachim-breitner de>
Date: Thu Jun 11 20:27:28 2009 +0200
Shift-Tab cycles backwards in tag completion
When you skip a tag while cycling through possible completions with Tab,
it is handy to use Shift-Tab to go backwards. To achieve this, an
argument indicating the direction has to be passed to DoTagCompletion.
Additionally, ClearTagCompletions must not be called upon pressing
Shift.
src/Widgets/TagEntry.cs | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/Widgets/TagEntry.cs b/src/Widgets/TagEntry.cs
index 1f54aa4..c6a6e34 100644
--- a/src/Widgets/TagEntry.cs
+++ b/src/Widgets/TagEntry.cs
@@ -139,9 +139,15 @@ namespace FSpot.Widgets {
} else
args.RetVal = false;
} else if (args.Event.Key == Gdk.Key.Tab) {
- DoTagCompletion ();
+ DoTagCompletion (true);
args.RetVal = true;
- } else
+ } else if (args.Event.Key == Gdk.Key.ISO_Left_Tab) {
+ DoTagCompletion (false);
+ args.RetVal = true;
+ } else if (args.Event.Key != Gdk.Key.Shift_L &&
+ args.Event.Key != Gdk.Key.Shift_R &&
+ args.Event.Key != Gdk.Key.Control_L &&
+ args.Event.Key != Gdk.Key.Control_R)
ClearTagCompletions ();
}
@@ -158,12 +164,15 @@ namespace FSpot.Widgets {
string tag_completion_typed_so_far;
int tag_completion_typed_position;
- private void DoTagCompletion ()
+ private void DoTagCompletion (bool forward)
{
string completion;
if (tag_completion_index != -1) {
- tag_completion_index = (tag_completion_index + 1) % tag_completions.Length;
+ if (forward)
+ tag_completion_index = (tag_completion_index + 1) % tag_completions.Length;
+ else
+ tag_completion_index = (tag_completion_index + tag_completions.Length - 1) % tag_completions.Length;
} else {
tag_completion_typed_position = Position;
@@ -184,7 +193,10 @@ namespace FSpot.Widgets {
if (tag_completions == null)
return;
- tag_completion_index = 0;
+ if (forward)
+ tag_completion_index = 0;
+ else
+ tag_completion_index = tag_completions.Length - 1;
}
tag_ignore_changes = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]