• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision8400 (tree)
Time2019-11-23 00:25:44
Authordoda

Log Message

マウスでのドラッグを行った時間が短い場合にドラッグとみなさないようにした。

Ticket: #39591

問題:

ウィンドウをアクティブにする為に VT ウィンドウをクリックした時、マウスが
少し動いた事でドラッグした事になり選択内容が消える事が有る。

対処:

短時間でのドラッグをドラッグとみなさないよう設定できるようにした。

Change Summary

Incremental Difference

--- trunk/teraterm/common/tttypes.h (revision 8399)
+++ trunk/teraterm/common/tttypes.h (revision 8400)
@@ -707,6 +707,7 @@
707707 int DialogFontCharSet;
708708 int ConfigVersion;
709709 int RunningVersion;
710+ DWORD SelectStartDelay;
710711 };
711712
712713 typedef struct tttset TTTSet, *PTTSet;
--- trunk/teraterm/teraterm/buffer.c (revision 8399)
+++ trunk/teraterm/teraterm/buffer.c (revision 8400)
@@ -57,7 +57,7 @@
5757 int StatusLine; //0: none 1: shown
5858 /* top, bottom, left & right margin */
5959 int CursorTop, CursorBottom, CursorLeftM, CursorRightM;
60-BOOL Selected;
60+BOOL Selected, Selecting;
6161 BOOL Wrap;
6262
6363 static WORD TabStops[256];
@@ -84,7 +84,8 @@
8484 static LONG BufferSize;
8585 static int NumOfLinesInBuff;
8686 static int BuffStartAbs, BuffEndAbs;
87-static POINT SelectStart, SelectEnd, SelectEndOld;
87+static POINT SelectStart, SelectStartTmp, SelectEnd, SelectEndOld;
88+static DWORD SelectStartTime;
8889 static BOOL BoxSelect;
8990 static POINT DblClkStart, DblClkEnd;
9091
@@ -416,6 +417,7 @@
416417 SelectEnd.y = BuffEnd;
417418 // SelectEnd.x = NumOfColumns;
418419 // SelectEnd.y = BuffEnd - 1;
420+ Selecting = TRUE;
419421 }
420422
421423 void BuffScreenSelect()
@@ -428,6 +430,7 @@
428430 SelectEnd.y = SelectStart.y + NumOfLines;
429431 // SelectEnd.x = X + NumOfColumns;
430432 // SelectEnd.y = Y + PageStart + NumOfLines - 1;
433+ Selecting = TRUE;
431434 }
432435
433436 void BuffCancelSelection()
@@ -436,6 +439,7 @@
436439 SelectStart.y = 0;
437440 SelectEnd.x = 0;
438441 SelectEnd.y = 0;
442+ Selecting = FALSE;
439443 }
440444
441445 void BuffReset()
@@ -2726,6 +2730,11 @@
27262730
27272731 CaretOff();
27282732
2733+ if (!Selecting) {
2734+ SelectStart = SelectStartTmp;
2735+ Selecting = TRUE;
2736+ }
2737+
27292738 DispConvWinToScreen(Xw,Yw,&X,&Y,NULL);
27302739 Y = Y + PageStart;
27312740 if ((Y<0) || (Y>=BuffEnd)) {
@@ -2997,31 +3006,23 @@
29973006 ChangeSelectRegion();
29983007 UnlockBuffer();
29993008
3000- SelectStart.x = X;
3001- SelectStart.y = Y;
3002- if (SelectStart.x<0) {
3003- SelectStart.x = 0;
3004- }
3005- if (SelectStart.x > NumOfColumns) {
3006- SelectStart.x = NumOfColumns;
3007- }
3008- if (SelectStart.y < 0) {
3009- SelectStart.y = 0;
3010- }
3011- if (SelectStart.y >= BuffEnd) {
3012- SelectStart.y = BuffEnd - 1;
3013- }
3009+ SelectStartTime = GetTickCount();
3010+ Selecting = FALSE;
30143011
3012+#define range_check(v, min, max) ((v)<(min) ? (min) : (v)>(max) ? (max) : (v))
3013+ SelectStartTmp.x = range_check(X, 0, NumOfColumns);
3014+ SelectStartTmp.y = range_check(Y, 0, BuffEnd-1);
3015+
30153016 TmpPtr = GetLinePtr(SelectStart.y);
30163017 // check if the cursor is on the right half of a character
3017- if ((SelectStart.x>0) &&
3018- ((AttrBuff[TmpPtr+SelectStart.x-1] & AttrKanji) != 0) ||
3019- ((AttrBuff[TmpPtr+SelectStart.x] & AttrKanji) == 0) &&
3018+ if ((SelectStartTmp.x>0) &&
3019+ ((AttrBuff[TmpPtr+SelectStartTmp.x-1] & AttrKanji) != 0) ||
3020+ ((AttrBuff[TmpPtr+SelectStartTmp.x] & AttrKanji) == 0) &&
30203021 Right) {
3021- SelectStart.x++;
3022+ SelectStartTmp.x++;
30223023 }
30233024
3024- SelectEnd = SelectStart;
3025+ SelectEnd = SelectStartTmp;
30253026 SelectEndOld = SelectEnd;
30263027 CaretOff();
30273028 Selected = TRUE;
@@ -3041,6 +3042,14 @@
30413042 BYTE b;
30423043 BOOL DBCS;
30433044
3045+ if (!Selecting) {
3046+ if (GetTickCount() - SelectStartTime < ts.SelectStartDelay) {
3047+ return;
3048+ }
3049+ SelectStart = SelectStartTmp;
3050+ Selecting = TRUE;
3051+ }
3052+
30443053 DispConvWinToScreen(Xw,Yw,&X,&Y,&Right);
30453054 Y = Y + PageStart;
30463055
@@ -3197,6 +3206,19 @@
31973206 void BuffEndSelect()
31983207 // End text selection by mouse button up
31993208 {
3209+ if (!Selecting) {
3210+ if (GetTickCount() - SelectStartTime < ts.SelectStartDelay) {
3211+ SelectEnd = SelectStart;
3212+ SelectEndOld = SelectEnd;
3213+ LockBuffer();
3214+ ChangeSelectRegion();
3215+ UnlockBuffer();
3216+ Selected = FALSE;
3217+ return;
3218+ }
3219+ SelectStart = SelectStartTmp;
3220+ }
3221+
32003222 Selected = (SelectStart.x!=SelectEnd.x) ||
32013223 (SelectStart.y!=SelectEnd.y);
32023224 if (Selected) {
--- trunk/teraterm/ttpset/ttset.c (revision 8399)
+++ trunk/teraterm/ttpset/ttset.c (revision 8400)
@@ -2231,6 +2231,10 @@
22312231 if (GetOnOff(Section, "ClearScrollBufferFromRemote", FName, TRUE))
22322232 ts->TermFlag |= TF_REMOTECLEARSBUFF;
22332233
2234+ // Delay for start of mouse selection
2235+ ts->SelectStartDelay =
2236+ GetPrivateProfileInt(Section, "MouseSelectStartDelay", 0, FName);
2237+
22342238 // Fallback to CP932 (Experimental)
22352239 ts->FallbackToCP932 = GetOnOff(Section, "FallbackToCP932", FName, FALSE);
22362240
@@ -3555,6 +3559,9 @@
35553559 WriteOnOff(Section, "ClearScrollBufferFromRemote", FName,
35563560 (WORD) (ts->PasteFlag & TF_REMOTECLEARSBUFF));
35573561
3562+ // Delay for start of mouse selection
3563+ WriteInt(Section, "MouseSelectStartDelay", FName, ts->SelectStartDelay);
3564+
35583565 // CygTerm Configuration File
35593566 WriteCygtermConfFile(ts);
35603567
Show on old repository browser