2 FAR manager incremental search plugin, search as you type in editor.
3 Copyright (C) 1999-2019, Stanislav V. Mekhanoshin
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>.
20 void PasteSearchText(void)
27 if (!OpenClipboard(NULL
))
29 #if defined(WINPORT_DIRECT)
30 p
= GetClipboardData(CF_UNICODETEXT
);
31 len
= _tstrnlen(p
, MAX_STR
);
32 memcpy(pData
, p
, len
* sizeof(pData
[0]));
34 for (nFmt
= 0; (nFmt
= EnumClipboardFormats(nFmt
)) != 0;) {
37 p
= GetClipboardData(CF_TEXT
);
39 len
= _tstrnlen(p
, MAX_STR
);
40 CharToOemBuff(p
, pData
, len
);
45 p
= GetClipboardData(CF_OEMTEXT
);
48 len
= _tstrnlen(p
, MAX_STR
);
49 memcpy(pData
, p
, len
* sizeof(pData
[0]));
54 p
= GetClipboardData(CF_UNICODETEXT
);
56 WideCharToMultiByte(CP_OEMCP
, WC_COMPOSITECHECK
, (LPCWSTR
)p
, -1, pData
, MAX_STR
, NULL
,
58 len
= _tstrnlen(pData
, MAX_STR
);
64 p
= GetClipboardData(CF_OEMTEXT
);
69 for (i
= 0; i
< len
; i
++) {
70 if (nEvents
== PREVIEW_EVENTS
) {
71 #if defined(WINPORT_DIRECT)
74 MessageBeep((UINT
)-1);
78 aEvents
[nEvents
].Flags
= (unsigned char)(i
? KC_CHAR
| KC_FAILKILL
: KC_CHAR
);
79 aEvents
[nEvents
].AsciiChar
= pData
[i
];