KiCad PCB EDA Suite
scintilla_tricks.cpp File Reference
#include <string_utils.h>
#include <scintilla_tricks.h>
#include <wx/stc/stc.h>
#include <gal/color4d.h>
#include <dialog_shim.h>
#include <wx/clipbrd.h>
#include <wx/log.h>
#include <wx/settings.h>
#include <confirm.h>

Go to the source code of this file.

Functions

bool isCtrlSlash (wxKeyEvent &aEvent)
 

Function Documentation

◆ isCtrlSlash()

bool isCtrlSlash ( wxKeyEvent &  aEvent)

Definition at line 120 of file scintilla_tricks.cpp.

121 {
122  if( !aEvent.ControlDown() || aEvent.MetaDown() )
123  return false;
124 
125  if( aEvent.GetUnicodeKey() == '/' )
126  return true;
127 
128  // OK, now the wxWidgets hacks start.
129  // (We should abandon these if https://trac.wxwidgets.org/ticket/18911 gets resolved.)
130 
131  // Many Latin America and European keyboars have have the / over the 7. We know that
132  // wxWidgets messes this up and returns Shift+7 through GetUnicodeKey(). However, other
133  // keyboards (such as France and Belgium) have 7 in the shifted position, so a Shift+7
134  // *could* be legitimate.
135 
136  // However, we *are* checking Ctrl, so to assume any Shift+7 is a Ctrl-/ really only
137  // disallows Ctrl+Shift+7 from doing something else, which is probably OK. (This routine
138  // is only used in the Scintilla editor, not in the rest of Kicad.)
139 
140  // The other main shifted loation of / is over : (France and Belgium), so we'll sacrifice
141  // Ctrl+Shift+: too.
142 
143  if( aEvent.ShiftDown() && ( aEvent.GetUnicodeKey() == '7' || aEvent.GetUnicodeKey() == ':' ) )
144  return true;
145 
146  // A few keyboards have / in an Alt position. Since we're expressly not checking Alt for
147  // up or down, those should work. However, if they don't, there's room below for yet
148  // another hack....
149 
150  return false;
151 }

Referenced by SCINTILLA_TRICKS::onCharHook().