Fix non-working Home and End keys on numpads.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4103 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2009-08-17 22:04:13 +00:00
parent 6690fce2d9
commit 2403d3ade8
3 changed files with 41 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2009-08-18 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/keybindings.c:
Fix non-working Home and End keys on numpads.
2009-08-17 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* doc/geany.txt, doc/geany.html, NEWS:

View File

@ -4567,7 +4567,7 @@ static void setup_sci_keys(ScintillaObject *sci)
sci_clear_cmdkey(sci, '\\' | (SCMOD_CTRL << 16)); /* Next word part */
sci_clear_cmdkey(sci, SCK_UP | (SCMOD_CTRL << 16)); /* scroll line up */
sci_clear_cmdkey(sci, SCK_DOWN | (SCMOD_CTRL << 16)); /* scroll line down */
sci_clear_cmdkey(sci, SCK_HOME); /* line start */
sci_clear_cmdkey(sci, SCK_HOME); /* line start */
sci_clear_cmdkey(sci, SCK_END); /* line end */
sci_clear_cmdkey(sci, SCK_END | (SCMOD_ALT << 16)); /* visual line end */

View File

@ -1077,6 +1077,37 @@ static gboolean check_vte(GdkModifierType state, guint keyval)
#endif
/* Map the keypad keys to their equivalent functions (taken from ScintillaGTK.cxx) */
static guint key_kp_translate(guint key_in)
{
switch (key_in)
{
case GDK_KP_Down:
return GDK_Down;
case GDK_KP_Up:
return GDK_Up;
case GDK_KP_Left:
return GDK_Left;
case GDK_KP_Right:
return GDK_Right;
case GDK_KP_Home:
return GDK_Home;
case GDK_KP_End:
return GDK_End;
case GDK_KP_Page_Up:
return GDK_Page_Up;
case GDK_KP_Page_Down:
return GDK_Page_Down;
case GDK_KP_Delete:
return GDK_Delete;
case GDK_KP_Insert:
return GDK_Insert;
default:
return key_in;
}
}
/* central keypress event handler, almost all keypress events go to this function */
static gboolean on_key_press_event(GtkWidget *widget, GdkEventKey *ev, gpointer user_data)
{
@ -1101,6 +1132,9 @@ static gboolean on_key_press_event(GtkWidget *widget, GdkEventKey *ev, gpointer
if (keyval >= GDK_A && keyval <= GDK_Z)
keyval += GDK_a - GDK_A;
if (keyval >= GDK_KP_Space && keyval < GDK_KP_Equal)
keyval = key_kp_translate(keyval);
/*geany_debug("%d (%d) %d (%d)", keyval, ev->keyval, state, ev->state);*/
/* special cases */