Patch #2040 2007-06-06 23:47

pauliusz

Patch for Bug #11234
Download
2040-Patch_for_Bug.patch (4.6 KB)
Category
Application::FeatureAdd
Status
Accepted
Close date
2007-07-18 14:18
Assigned to
rickg22
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp    (revision 4067)
+++ src/sdk/cbeditor.cpp    (working copy)
@@ -941,6 +941,20 @@
     control->SetCaretLineVisible(mgr->ReadBool(_T("/highlight_caret_line"), false));
     control->SetCaretLineBackground(GetOptionColour(_T("/highlight_caret_line_colour"), wxColour(0xFF, 0xFF, 0x00)));
 
+    // if user wants "Home" key to set cursor to the very beginning of line
+    if (mgr->ReadBool(_T("/simplified_home"), false))
+    {
+        control->CmdKeyAssign(wxSCI_KEY_HOME, wxSCI_SCMOD_NULL, wxSCI_CMD_HOME);
+        control->CmdKeyAssign(wxSCI_KEY_HOME, wxSCI_SCMOD_SHIFT, wxSCI_CMD_HOMEEXTEND);
+        control->CmdKeyAssign(wxSCI_KEY_HOME, wxSCI_SCMOD_ALT | wxSCI_SCMOD_SHIFT, wxSCI_CMD_HOMERECTEXTEND);
+    }
+    else // else set default "Home" key behavior
+    {
+        control->CmdKeyAssign(wxSCI_KEY_HOME, wxSCI_SCMOD_NULL, wxSCI_CMD_VCHOME);
+        control->CmdKeyAssign(wxSCI_KEY_HOME, wxSCI_SCMOD_SHIFT, wxSCI_CMD_VCHOMEEXTEND);
+        control->CmdKeyAssign(wxSCI_KEY_HOME, wxSCI_SCMOD_ALT | wxSCI_SCMOD_SHIFT, wxSCI_CMD_VCHOMERECTEXTEND);
+    }
+
     control->SetUseTabs(mgr->ReadBool(_T("/use_tab"), false));
     control->SetIndentationGuides(mgr->ReadBool(_T("/show_indent_guides"), false));
     control->SetTabIndents(mgr->ReadBool(_T("/tab_indents"), true));
Index: src/sdk/editorconfigurationdlg.cpp
===================================================================
--- src/sdk/editorconfigurationdlg.cpp    (revision 4067)
+++ src/sdk/editorconfigurationdlg.cpp    (working copy)
@@ -128,6 +128,7 @@
        XRCCTRL(*this, "chkAdvancedRegex", wxCheckBox)->SetValue(cfg->ReadBool(_T("/use_advanced_regexes"), false));
        XRCCTRL(*this, "chkShowLineNumbers", wxCheckBox)->SetValue(cfg->ReadBool(_T("/show_line_numbers"), true));
        XRCCTRL(*this, "chkHighlightCaretLine", wxCheckBox)->SetValue(cfg->ReadBool(_T("/highlight_caret_line"), false));
+       XRCCTRL(*this, "chkSimplifiedHome", wxCheckBox)->SetValue(cfg->ReadBool(_T("/simplified_home"), false));
        XRCCTRL(*this, "spnTabSize", wxSpinCtrl)->SetValue(cfg->ReadInt(_T("/tab_size"), 4));
        XRCCTRL(*this, "cmbViewWS", wxComboBox)->SetSelection(cfg->ReadInt(_T("/view_whitespace"), 0));
        XRCCTRL(*this, "rbTabText", wxRadioBox)->SetSelection(cfg->ReadBool(_T("/tab_text_relative"), true) ? 1 : 0);
@@ -844,6 +845,7 @@
 
         cfg->Write(_T("/show_line_numbers"),     XRCCTRL(*this, "chkShowLineNumbers", wxCheckBox)->GetValue());
         cfg->Write(_T("/highlight_caret_line"), XRCCTRL(*this, "chkHighlightCaretLine", wxCheckBox)->GetValue());
+        cfg->Write(_T("/simplified_home"),      XRCCTRL(*this, "chkSimplifiedHome", wxCheckBox)->GetValue());
         cfg->Write(_T("/tab_size"),             XRCCTRL(*this, "spnTabSize", wxSpinCtrl)->GetValue());
         cfg->Write(_T("/view_whitespace"),      XRCCTRL(*this, "cmbViewWS", wxComboBox)->GetSelection());
         cfg->Write(_T("/tab_text_relative"),    XRCCTRL(*this, "rbTabText", wxRadioBox)->GetSelection() ? true : false);
Index: src/sdk/resources/editor_configuration.xrc
===================================================================
--- src/sdk/resources/editor_configuration.xrc    (revision 4067)
+++ src/sdk/resources/editor_configuration.xrc    (working copy)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8" ?>
 <resource>
     <object class="wxDialog" name="dlgConfigureEditor">
         <title>Configure editor</title>
@@ -323,6 +323,13 @@
                                                             </object>
                                                             <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
                                                         </object>
+                                                        <object class="sizeritem">
+                                                            <object class="wxCheckBox" name="chkSimplifiedHome">
+                                                                <label>Home key always moves caret to first column</label>
+                                                                <checked>1</checked>
+                                                            </object>
+                                                            <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                                        </object>
                                                     </object>
                                                     <flag>wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP</flag>
                                                     <border>8</border>
rickg22 2007-07-18 14:18

Patch applied on revision 4278. Thanks!