Skip to content

Commit 0c5dace

Browse files
committed
fixes to shift home key
1 parent d1b8fa6 commit 0c5dace

4 files changed

Lines changed: 11 additions & 6 deletions

File tree

common.pri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# included by main.pro and lib.pro
22

3-
VERSION = 2.6.1
3+
VERSION = 2.6.2
44
JDLLVER = 9.7
55
BUILDVERSION = 1
66

lib/base/bedit.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ void Bedit::homeshift()
8585
{
8686
QString ws=" \t";
8787
QTextCursor c = textCursor();
88+
int sel = qMax(0,c.anchor() - c.position());
8889
QString txt = c.block().text();
8990
int pos=getpositioninblock(c);
9091
txt = txt.left(pos);
@@ -95,7 +96,7 @@ void Bedit::homeshift()
9596
break;
9697
}
9798
int cur=c.position();
98-
setselect(cur-pos+mov,pos-mov);
99+
setselect(cur-pos+mov,sel+pos-mov);
99100
}
100101

101102
// ---------------------------------------------------------------------

lib/base/nedit.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ void Nedit::keyPressEvent(QKeyEvent *e)
5858
bool shift = mod.testFlag(Qt::ShiftModifier);
5959
bool ctrl = mod.testFlag(Qt::ControlModifier);
6060
int key = e->key();
61-
if (key==Qt::Key_Home && (ctrl==false) && shift==false)
62-
home();
63-
else
61+
if (key==Qt::Key_Home && (ctrl==false)) {
62+
if (shift==false)
63+
home();
64+
else
65+
homeshift();
66+
} else
6467
Bedit::keyPressEvent(e);
6568
}
6669

lib/base/textedit.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ void TextEdit::homeshift()
8989
{
9090
QString ws=" \t";
9191
QTextCursor c = textCursor();
92+
int sel = qMax(0,c.anchor() - c.position());
9293
QString txt = c.block().text();
9394
int pos=getpositioninblock(c);
9495
txt = txt.left(pos);
@@ -99,7 +100,7 @@ void TextEdit::homeshift()
99100
break;
100101
}
101102
int cur=c.position();
102-
setselect(cur-pos+mov,pos-mov);
103+
setselect(cur-pos+mov,sel+pos-mov);
103104
}
104105

105106
// ---------------------------------------------------------------------

0 commit comments

Comments
 (0)