Hi, On Monday 05 December 2011, meik michalke wrote: > i just noticed that the mac version of RKWard lacks support for the > left/right cursor keys in its R console (up/down are working).
hm, could you test the attached patch? (I tested and reproduced the issue via VNC, but did not find the time to figure out, how to test patches on the Mac). > the good news is that the binary bundle was successfully installed on an > iBook Pro :-) Nice! Regards Thomas
Index: rkward/rkconsole.cpp
===================================================================
--- rkward/rkconsole.cpp (revision 4064)
+++ rkward/rkconsole.cpp (working copy)
@@ -237,18 +237,22 @@
previous_chunk_was_piped = false;
+ // Apparently, on MacOS, additional modifiers may sometimes be present (KeypadModifier?), which we want to ignore.
+ const int modifier_mask = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier;
+ int modifier = e->modifier () & modifier_mask;
+
if (e->key () == Qt::Key_Up) {
- commandsListUp (RKSettingsModuleConsole::shouldDoHistoryContextSensitive (e->modifiers ()));
+ commandsListUp (RKSettingsModuleConsole::shouldDoHistoryContextSensitive (modifier));
return true;
}
else if (e->key () == Qt::Key_Down) {
- commandsListDown (RKSettingsModuleConsole::shouldDoHistoryContextSensitive (e->modifiers ()));
+ commandsListDown (RKSettingsModuleConsole::shouldDoHistoryContextSensitive (modifier));
return true;
}
command_edited = true; // all other keys are considered as "editing" the current comand
if (e->key () == Qt::Key_Home) {
- if (e->modifiers () == Qt::ShiftModifier) {
+ if (modifier == Qt::ShiftModifier) {
int lastline = doc->lines () - 1;
int firstcol = prefix.length ();
KTextEditor::Range newrange (lastline, firstcol, lastline, pos);
@@ -266,7 +270,7 @@
cursorAtTheBeginning ();
return true;
} else if (e->key () == Qt::Key_End) {
- if (e->modifiers () == Qt::ShiftModifier) {
+ if (modifier == Qt::ShiftModifier) {
int lastline = doc->lines () - 1;
int lastcol = doc->lineLength (lastline);
KTextEditor::Range newrange (lastline, pos, lastline, lastcol);
@@ -291,20 +295,20 @@
} else if (e->key () == Qt::Key_Left){
if (pos <= prefix.length ()) return true;
- if (e->modifiers () == Qt::NoModifier) setCursorClear (para, pos - 1);
- else if (e->modifiers () == Qt::ShiftModifier) triggerEditAction ("select_char_left");
- else if (e->modifiers () == Qt::ControlModifier) triggerEditAction ("word_left");
- else if (e->modifiers () == (Qt::ControlModifier + Qt::ShiftModifier)) triggerEditAction ("select_word_left");
+ if (modifier == Qt::NoModifier) setCursorClear (para, pos - 1);
+ else if (modifier == Qt::ShiftModifier) triggerEditAction ("select_char_left");
+ else if (modifier == Qt::ControlModifier) triggerEditAction ("word_left");
+ else if (modifier == (Qt::ControlModifier + Qt::ShiftModifier)) triggerEditAction ("select_word_left");
else return false;
return true;
} else if (e->key () == Qt::Key_Right){
if (pos >= doc->lineLength (para)) return true;
- if (e->modifiers () == Qt::NoModifier) setCursorClear (para, pos + 1);
- else if (e->modifiers () == Qt::ShiftModifier) triggerEditAction ("select_char_right");
- else if (e->modifiers () == Qt::ControlModifier) triggerEditAction ("word_right");
- else if (e->modifiers () == (Qt::ControlModifier + Qt::ShiftModifier)) triggerEditAction ("select_word_right");
+ if (modifier == Qt::NoModifier) setCursorClear (para, pos + 1);
+ else if (modifier == Qt::ShiftModifier) triggerEditAction ("select_char_right");
+ else if (modifier == Qt::ControlModifier) triggerEditAction ("word_right");
+ else if (modifier == (Qt::ControlModifier + Qt::ShiftModifier)) triggerEditAction ("select_word_right");
else return false;
return true;
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d
_______________________________________________ RKWard-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rkward-devel
