зеркало из https://github.com/github/putty.git
Word-by-word (double-click) selection now spans line breaks if the
line break was created by wrapping. (Equivalently, if the selection would _paste_ as a single word without a newline in the middle, then it will _select_ in the same way.) [originally from svn r1347]
This commit is contained in:
Родитель
a7f196263e
Коммит
4badd37b4b
41
terminal.c
41
terminal.c
|
@ -3067,6 +3067,7 @@ static pos sel_spread_half(pos p, int dir)
|
||||||
{
|
{
|
||||||
unsigned long *ldata;
|
unsigned long *ldata;
|
||||||
short wvalue;
|
short wvalue;
|
||||||
|
int topy = -count234(scrollback);
|
||||||
|
|
||||||
ldata = lineptr(p.y);
|
ldata = lineptr(p.y);
|
||||||
|
|
||||||
|
@ -3093,11 +3094,47 @@ static pos sel_spread_half(pos p, int dir)
|
||||||
*/
|
*/
|
||||||
wvalue = wordtype(ldata[p.x]);
|
wvalue = wordtype(ldata[p.x]);
|
||||||
if (dir == +1) {
|
if (dir == +1) {
|
||||||
while (p.x < cols && wordtype(ldata[p.x + 1]) == wvalue)
|
while (1) {
|
||||||
|
if (p.x < cols-1) {
|
||||||
|
if (wordtype(ldata[p.x + 1]) == wvalue)
|
||||||
p.x++;
|
p.x++;
|
||||||
|
else
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
while (p.x > 0 && wordtype(ldata[p.x - 1]) == wvalue)
|
if (ldata[cols] & LATTR_WRAPPED) {
|
||||||
|
unsigned long *ldata2;
|
||||||
|
ldata2 = lineptr(p.y+1);
|
||||||
|
if (wordtype(ldata2[0]) == wvalue) {
|
||||||
|
p.x = 0;
|
||||||
|
p.y++;
|
||||||
|
ldata = ldata2;
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while (1) {
|
||||||
|
if (p.x > 0) {
|
||||||
|
if (wordtype(ldata[p.x - 1]) == wvalue)
|
||||||
p.x--;
|
p.x--;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
unsigned long *ldata2;
|
||||||
|
if (p.y <= topy)
|
||||||
|
break;
|
||||||
|
ldata2 = lineptr(p.y-1);
|
||||||
|
if ((ldata2[cols] & LATTR_WRAPPED) &&
|
||||||
|
wordtype(ldata2[cols-1]) == wvalue) {
|
||||||
|
p.x = cols-1;
|
||||||
|
p.y--;
|
||||||
|
ldata = ldata2;
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SM_LINE:
|
case SM_LINE:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче