mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2025-02-17 01:11:20 +00:00
improved mark mode's end key handling of white space
This commit is contained in:
parent
b517f56959
commit
d43a016e61
1 changed files with 35 additions and 2 deletions
|
@ -1119,14 +1119,47 @@ qbool Con_HandleMarkMode( qbool ctrlDown, qbool shiftDown, int key )
|
|||
return qtrue;
|
||||
}
|
||||
|
||||
if(key == K_END) {
|
||||
if (key == K_END) {
|
||||
if (ctrlDown)
|
||||
return qfalse;
|
||||
con.markX = con.linewidth - 1;
|
||||
if (!shiftDown) {
|
||||
|
||||
if (shiftDown) {
|
||||
// avoid selecting trailing columns of whitespace
|
||||
const int markStartY = min( con.markStartY, con.markY );
|
||||
const int markEndY = max( con.markStartY, con.markY );
|
||||
while (con.markX > 0) {
|
||||
qboolean skip = qtrue;
|
||||
for (int y = markStartY; y <= markEndY; ++y) {
|
||||
const int row = y % con.totallines;
|
||||
const short* const text = con.text + row * con.linewidth;
|
||||
const char c = text[con.markX] & 0xFF;
|
||||
if (c != ' ')
|
||||
skip = qfalse;
|
||||
}
|
||||
|
||||
if (!skip)
|
||||
break;
|
||||
|
||||
con.markX--;
|
||||
}
|
||||
} else {
|
||||
// avoid jumping into whitespace
|
||||
const int row = con.markY % con.totallines;
|
||||
const short* const text = con.text + row * con.linewidth;
|
||||
while (con.markX > 0) {
|
||||
const char c = text[con.markX] & 0xFF;
|
||||
if (c != ' ')
|
||||
break;
|
||||
|
||||
con.markX--;
|
||||
}
|
||||
|
||||
// back to single character selection
|
||||
con.markStartX = con.markX;
|
||||
con.markStartY = con.markY;
|
||||
}
|
||||
|
||||
Con_AutoScrollMarkPosition();
|
||||
return qtrue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue