if (s_ruby_export_local_variables == Qfalse) {
const char *s2 =
"proc { |_bind_| \n"
+ " # find local variables newly defined in _bind_ \n"
" _a_ = _bind_.eval(\"local_variables\") - TOPLEVEL_BINDING.eval(\"local_variables\"); \n"
- " _i_ = 0; \n"
- " while _i_ < _a_.length \n"
- " # define local variables \n"
- " TOPLEVEL_BINDING.eval(_a_[_i_].to_s + \" = nil\") \n"
- " _i_ += 1 \n"
- " end \n"
" _a_.each { |_vsym_| \n"
" _vname_ = _vsym_.to_s \n"
" _vval_ = _bind_.eval(_vname_) \n"
pos = textCtrl->GetInsertionPoint();
lastpos = textCtrl->GetLastPosition();
- // Get the block of script to be executed
- if (pos < lastpos) {
- // The inserted newline character should be removed
- textCtrl->Remove(pos - 1, pos);
- lastpos = textCtrl->GetLastPosition();
- pos--;
- }
veryend = -1;
while (pos >= 0) {
if (!GetLineIncludingPosition(textCtrl, pos, &start, &end) || start == end) {
ConsoleFrame::OnKeyDown(wxKeyEvent &event)
{
int code = event.GetKeyCode();
+
+#if __WXOSX_COCOA__
+ // in wxCocoa, the key down event is fired even when the input method still has
+ // marked text. We need to avoid doing our own work when the input method is expecting
+ // key events.
+ extern bool textCtrl_hasMarkedText();
+ if (textCtrl_hasMarkedText()) {
+ event.Skip();
+ return;
+ }
+#endif
+
if (code == WXK_RETURN || code == WXK_NUMPAD_ENTER)
OnEnterPressed();
else if ((code == WXK_UP || code == WXK_DOWN) && (textCtrl->GetInsertionPoint() == textCtrl->GetLastPosition()))
--- /dev/null
+/*
+ * textctrl_addition.mm
+ * Molby
+ *
+ * Created by Toshi Nagata on 14/02/04.
+ * Copyright 2014 Toshi Nagata. All rights reserved.
+ *
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+bool
+textCtrl_hasMarkedText(void)
+{
+ id firstResponder = [[NSApp keyWindow] firstResponder];
+ if ([firstResponder isKindOfClass:[NSTextView class]] && [(NSTextView *)firstResponder hasMarkedText])
+ return true;
+ else return false;
+}
E420BE22188574F600A2B983 /* ProgressFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E420BE1D188574F600A2B983 /* ProgressFrame.cpp */; };
E420BE23188574F600A2B983 /* RubyDialogFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E420BE1F188574F600A2B983 /* RubyDialogFrame.cpp */; };
E420BE24188574F600A2B983 /* wxKillAddition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E420BE21188574F600A2B983 /* wxKillAddition.cpp */; };
+ E4653CB118A0CC7D0022377B /* textctrl_addition.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4653CB018A0CC7D0022377B /* textctrl_addition.mm */; };
E49BFBFA1886E72000188237 /* MyVersion.c in Sources */ = {isa = PBXBuildFile; fileRef = E420BE18188574D700A2B983 /* MyVersion.c */; };
E49BFBFB1886E74600188237 /* IntGroup.c in Sources */ = {isa = PBXBuildFile; fileRef = E4FC777D183E4F3F0064FB2E /* IntGroup.c */; };
E49BFBFF1886E74600188237 /* MainViewCommon.c in Sources */ = {isa = PBXBuildFile; fileRef = E4FC7781183E4F3F0064FB2E /* MainViewCommon.c */; };
E420BE1F188574F600A2B983 /* RubyDialogFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RubyDialogFrame.cpp; sourceTree = "<group>"; };
E420BE20188574F600A2B983 /* RubyDialogFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RubyDialogFrame.h; sourceTree = "<group>"; };
E420BE21188574F600A2B983 /* wxKillAddition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wxKillAddition.cpp; sourceTree = "<group>"; };
+ E4653CB018A0CC7D0022377B /* textctrl_addition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = textctrl_addition.mm; sourceTree = "<group>"; };
E49BFB761886E2E400188237 /* Molby_command */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Molby_command; sourceTree = BUILT_PRODUCTS_DIR; };
E4FC777A183E4F3F0064FB2E /* cmdtool_stubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cmdtool_stubs.c; path = ../MolLib/cmdtool_stubs.c; sourceTree = SOURCE_ROOT; };
E4FC777B183E4F3F0064FB2E /* Dcd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Dcd.c; path = ../MolLib/Dcd.c; sourceTree = SOURCE_ROOT; };
E420BDEE1885746700A2B983 /* GlobalParameterFrame.h */,
E420BDF31885749000A2B983 /* listctrl_private.h */,
E420BDF41885749000A2B983 /* listctrl.cpp */,
+ E4653CB018A0CC7D0022377B /* textctrl_addition.mm */,
E420BDF51885749000A2B983 /* MoleculeView.cpp */,
E420BDF61885749000A2B983 /* MoleculeView.h */,
E420BDF71885749000A2B983 /* MyApp.cpp */,
E420BE22188574F600A2B983 /* ProgressFrame.cpp in Sources */,
E420BE23188574F600A2B983 /* RubyDialogFrame.cpp in Sources */,
E420BE24188574F600A2B983 /* wxKillAddition.cpp in Sources */,
+ E4653CB118A0CC7D0022377B /* textctrl_addition.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};