summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/calcurse.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index 6a91e74..fefe18e 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -224,11 +224,10 @@ static inline void key_pipe_item(int key)
wins_update(FLAG_ALL);
}
-static inline void key_change_priority(int key)
+static inline void change_priority(int diff)
{
if (wins_slctd() == TOD && todo_hilt() != 0) {
- todo_chg_priority(todo_get_item(todo_hilt()),
- key == KEY_RAISE_PRIORITY ? 1 : -1);
+ todo_chg_priority(todo_get_item(todo_hilt()), diff);
if (todo_hilt_pos() < 0)
todo_set_first(todo_hilt());
else if (todo_hilt_pos() >= win[TOD].h - 4)
@@ -237,6 +236,16 @@ static inline void key_change_priority(int key)
}
}
+static inline void key_raise_priority(int key)
+{
+ change_priority(1);
+}
+
+static inline void key_lower_priority(int key)
+{
+ change_priority(-1);
+}
+
static inline void key_edit_note(int key)
{
if (wins_slctd() == APP && apoint_hilt() != 0) {
@@ -584,8 +593,8 @@ int main(int argc, char **argv)
HANDLE_KEY(KEY_REPEAT_ITEM, key_repeat_item);
HANDLE_KEY(KEY_FLAG_ITEM, key_flag_item);
HANDLE_KEY(KEY_PIPE_ITEM, key_pipe_item);
- HANDLE_KEY(KEY_RAISE_PRIORITY, key_change_priority);
- HANDLE_KEY(KEY_LOWER_PRIORITY, key_change_priority);
+ HANDLE_KEY(KEY_RAISE_PRIORITY, key_raise_priority);
+ HANDLE_KEY(KEY_LOWER_PRIORITY, key_lower_priority);
HANDLE_KEY(KEY_EDIT_NOTE, key_edit_note);
HANDLE_KEY(KEY_VIEW_NOTE, key_view_note);
HANDLE_KEY(KEY_GENERIC_HELP, key_generic_help);