Nux

Merge lp:~wenjoseph/nux/fix-for-bug-737752 into lp:nux

Proposed by Joseph Wen
Status: Merged
Merged at revision: 305
Proposed branch: lp:~wenjoseph/nux/fix-for-bug-737752
Merge into: lp:nux
Prerequisite: lp:~wenjoseph/nux/fix-for-bug-737726
Diff against target: 89 lines (+32/-8)
2 files modified
Nux/TextEntry.cpp (+30/-6)
Nux/TextEntry.h (+2/-2)
To merge this branch: bzr merge lp:~wenjoseph/nux/fix-for-bug-737752
Reviewer Review Type Date Requested Status
Jay Taoko (community) Approve
Review via email: mp+54906@code.launchpad.net

Description of the change

This branch fixed bug #737752

To post a comment you must log in.
Revision history for this message
Jay Taoko (jaytaoko) wrote :

Approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Nux/TextEntry.cpp'
2--- Nux/TextEntry.cpp 2011-03-25 18:03:38 +0000
3+++ Nux/TextEntry.cpp 2011-03-25 18:03:38 +0000
4@@ -460,11 +460,17 @@
5 }
6 else if (keyval == NUX_VK_BACKSPACE)
7 {
8- BackSpace();
9+ if (!ctrl)
10+ BackSpace(VISUALLY);
11+ else
12+ BackSpace(WORDS);
13 }
14 else if ((keyval == NUX_VK_DELETE) && (!shift))
15 {
16- Delete();
17+ if (!ctrl)
18+ Delete(VISUALLY);
19+ else
20+ Delete(WORDS);
21 }
22 else if ((keyval == NUX_VK_INSERT) && (!shift) && (!ctrl))
23 {
24@@ -1537,7 +1543,7 @@
25 // }
26 }
27
28- void TextEntry::BackSpace()
29+ void TextEntry::BackSpace(MovementStep step)
30 {
31 if (GetSelectionBounds(NULL, NULL))
32 {
33@@ -1547,11 +1553,20 @@
34 {
35 if (cursor_ == 0)
36 return;
37- DeleteText(cursor_ - GetPrevCharLength(cursor_), cursor_);
38+ if (step == VISUALLY)
39+ {
40+ DeleteText(cursor_ - GetPrevCharLength(cursor_), cursor_);
41+ }
42+ else if (step == WORDS)
43+ {
44+ int new_cursor;
45+ new_cursor = MoveWords(cursor_, -1);
46+ DeleteText(new_cursor, cursor_);
47+ }
48 }
49 }
50
51- void TextEntry::Delete()
52+ void TextEntry::Delete(MovementStep step)
53 {
54 if (GetSelectionBounds(NULL, NULL))
55 {
56@@ -1561,7 +1576,16 @@
57 {
58 if (cursor_ == static_cast<int>(_text.length()))
59 return;
60- DeleteText(cursor_, cursor_ + GetCharLength(cursor_));
61+ if (step == VISUALLY)
62+ {
63+ DeleteText(cursor_, cursor_ + GetCharLength(cursor_));
64+ }
65+ else if (step == WORDS)
66+ {
67+ int new_cursor;
68+ new_cursor = MoveWords(cursor_, 1);
69+ DeleteText(cursor_, new_cursor);
70+ }
71 }
72 }
73
74
75=== modified file 'Nux/TextEntry.h'
76--- Nux/TextEntry.h 2011-03-23 16:48:18 +0000
77+++ Nux/TextEntry.h 2011-03-25 18:03:38 +0000
78@@ -294,9 +294,9 @@
79 /** Paste the text in the clipboard to current offset */
80 void PasteClipboard();
81 /** Delete a character before the offset of the cursor */
82- void BackSpace();
83+ void BackSpace(MovementStep step);
84 /** Delete a character at the offset of the cursor */
85- void Delete();
86+ void Delete(MovementStep step);
87 /** Switch between the overwrite mode and the insert mode*/
88 void ToggleOverwrite();
89 //

Subscribers

People subscribed via source and target branches