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/>.
21 #pragma warning(disable : 4514)
22 #pragma warning(push, 1)
28 #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__DragonFly__)
33 #if defined(WINPORT_DIRECT)
35 static inline wchar_t __cdecl
Upper(wchar_t Ch
)
37 WINPORT(CharUpperBuff
)(&Ch
, 1);
41 #define __int64 __int64_t
42 #define _MAX_PATH MAX_PATH
43 #define _tstrcpy(a, b) lstrcpy((a), (b))
44 #define _tstrlen(a) lstrlen((a))
45 #define _tstrnlen(a, n) lstrnlen((a), (n))
48 #define _tstrcpy(a, b) strcpy((a), (b))
49 #define _tstrlen(a) strlen((a))
50 #define _tstrnlen(a, n) sstrnlen((a), (n))
56 #include "farplug-wide.h"
65 #define TITLE_PREFIX_STR _T("^: ")
66 #define TITLE_PREFIX_STR_DWORD 0x203A5E
67 #define TITLE_PREFIX_LEN 3
68 #define PREVIEW_EVENTS MAX_STR
70 #if defined(__WATCOMC__)
71 #define __plugin __declspec(dllexport)
72 #elif defined(WINPORT_DIRECT)
73 #define __plugin SHAREDSYMBOL
78 #if !defined(WINPORT_DIRECT) && !defined(EXP_NAME)
86 extern INT_PTR ModuleNumber
;
87 extern FARAPIMENU apiMenu
;
88 extern FARAPIGETMSG apiGetMsg
;
89 extern FARAPITEXT apiText
;
90 extern FARAPIEDITORCONTROL apiEditorControl
;
91 #ifdef VIEWVER_SUPPORT
92 extern FARAPIVIEWERCONTROL apiViewerControl
;
93 extern int iViewerStatusColor
;
95 #if defined(WINPORT_DIRECT)
96 extern FARAPIDIALOGINIT apiDialogInit
;
97 extern FARAPIDIALOGRUN apiDialogRun
;
98 extern FARAPIDIALOGFREE apiDialogFree
;
99 extern FARAPISENDDLGMESSAGE apiSendDlgMessage
;
100 extern FARSTDSNPRINTF apiSnprintf
;
102 extern FARAPIDIALOG apiDialog
;
103 extern FARAPICHARTABLE apiCharTable
;
106 #define GetMsg(MsgId) apiGetMsg(ModuleNumber, MsgId)
108 extern struct EditorInfo ei
;
109 extern struct EditorConvertText ect
;
110 extern struct EditorSetPosition esp
;
111 extern struct EditorGetString egs
;
113 extern TCHAR sStr
[MAX_STR
];
116 extern void SearchLoopEditor(void);
117 extern void SearchLoopViewer(void);
118 extern BOOL
WaitInput(BOOL Infinite
);
120 #define DIFT_MSGNUM 0x80000000
122 typedef struct _DialogTemplateItem
127 signed char Selected
;
129 INT_PTR Data
; // Message number or pointer to string
130 } DialogTemplateItem
;
132 extern int DialogFromTemplate(const TCHAR
*sTitle
, const DialogTemplateItem
*aTplItems
,
133 struct FarDialogItem
*aDialogItems
, int nItemsNumber
, TCHAR
*sHelpTopic
, int nFocus
,
136 extern BOOL
CollectEvents(void);
137 extern void ShowTitle(int OpenFrom
);
138 extern void SelectFound(BOOL bRedraw
);
139 extern void StatusMessage(int Index
);
140 extern void SetPosition(int nLine
, int nPos
, int nLeftPos
);
141 extern void PositionToView(int nLine
, int nStartPos
);
142 extern void PasteSearchText(void);
149 #define KC_CLEARMSG 32
150 #define KC_FAILKILL 128
152 typedef struct _KbdCommand
155 unsigned char AsciiChar
;
158 extern KbdCommand aEvents
[PREVIEW_EVENTS
];
162 extern BOOL bTermEvent
;
163 extern INPUT_RECORD Event
;
164 #if !defined(WINPORT_DIRECT)
165 extern HANDLE hInputHandle
;
167 extern BOOL bNotFound
;
170 extern BOOL bCaseSensitive
;
171 extern BOOL bKeepSelection
;
172 extern BOOL bBeepOnMismatch
;
173 extern BOOL bRestartEOF
;
174 extern BOOL bUseSelection
;
175 extern BOOL bAutoNext
;
176 extern BOOL bBSunroll
;
178 extern BOOL bThisUseSelection
;
179 extern BOOL bThisAutoNext
;
180 extern BOOL bStopOnFound
;
181 extern BOOL bReverse
;
191 #define _heapshrink _heapmin