Patch #2110 2007-07-27 15:37

dmoore

Fix for home/end key behavior for word wrapped text
Download
2110-Fix_for_home_e.patch (993 bytes)
Category
Application::Bugfix
Status
Closed
Close date
2007-07-31 03:33
Assigned to
 
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp    (revision 4331)
+++ src/sdk/cbeditor.cpp    (working copy)
@@ -960,6 +960,13 @@
     control->SetTabIndents(mgr->ReadBool(_T("/tab_indents"), true));
     control->SetBackSpaceUnIndents(mgr->ReadBool(_T("/backspace_unindents"), true));
     control->SetWrapMode(mgr->ReadBool(_T("/word_wrap"), false));
+    if(mgr->ReadBool(_T("/word_wrap_style_home_end"), true))
+    {
+    control->CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_NULL,wxSCI_CMD_VCHOMEWRAP);
+    control->CmdKeyAssign(wxSCI_KEY_END,wxSCI_SCMOD_NULL,wxSCI_CMD_LINEENDWRAP);
+    control->CmdKeyAssign(wxSCI_KEY_HOME,wxSCI_SCMOD_SHIFT,wxSCI_CMD_VCHOMEWRAPEXTEND);
+    control->CmdKeyAssign(wxSCI_KEY_END,wxSCI_SCMOD_SHIFT,wxSCI_CMD_LINEENDWRAPEXTEND);
+    }
     control->SetViewEOL(mgr->ReadBool(_T("/show_eol"), false));
     control->SetViewWhiteSpace(mgr->ReadInt(_T("/view_whitespace"), 0));
     //gutter
dmoore 2007-07-27 15:38
dmoore 2007-07-29 22:20

Notes:

1. updates home/end behavior for wordwrapped text (no impact on unwrapped text)

a. New default behavior

* press home to goto wrap point (start of the current row). if already at wrap point, pressing home goes to first indent of the entire line

* press end to goto wrap point (end of the current row). if already at wrap point, pressing home goes to end of the entire line

* pressing alt+home goes to first indent of entire line

* pressing alt+end goes to end of entire line

* shift modifier will extend the selection in each of these cases

b. Optional legacy behavior

* same as (a) but swap effect of alt modified keystroke with unmodified keystroke

2. update goto matching brace behavior

* default key to goto matching brace is now ctrl+.

* if caret is inside of brace, new caret position will inside of brace.

* if caret is outside of brace, new caret position will outside of brace.

* new support for extending the selection to the matching brace point (also respects inside/outside caret position)

dmoore 2007-07-29 22:43

please remove, i have updated at patch #2116

biplab 2007-07-31 03:33

Closed on request from submitter.