File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 55
66setuptools .setup (
77 name = "PluginsPy" ,
8- version = "0.0.9 " ,
8+ version = "0.0.10 " ,
99 author = "zengjf" ,
1010 author_email = "zengjf42@163.com" ,
1111 description = "Plugins Framework" ,
Original file line number Diff line number Diff line change @@ -259,6 +259,8 @@ def _showPlugins(plugins, helpList):
259259 elif ch == KEY_BOARD_Search :
260260 # 进入检索模式
261261 inSearchMode = True
262+ # /字符表示进入检索,参考vim
263+ inputString += "/"
262264
263265 # 移动一下窗口
264266 helpScreen .mvwin (
@@ -271,15 +273,15 @@ def _showPlugins(plugins, helpList):
271273
272274 helpScreen .clear ()
273275 helpScreen .border (0 )
274- # 光标一动到中间
275- helpScreen .move (1 , (maxCols - 4 - 2 ) // 2 )
276+ helpScreenWidth = maxCols - 4 - 2
277+ helpScreen .addstr (1 , (helpScreenWidth ) // 2 - _strWidth ( inputString ) // 2 , inputString )
276278 helpScreen .refresh ()
277279 else :
278280 pass
279281
280282 # 允许使用首字母进行快速定位选择
281283 else :
282- if (( ch >= ord ("A" ) and ch <= ord ("z" )) or (ch >= ord ("0" ) and (ch <= ord ("9" ))) or ch == KEY_BOARD_BACKSPACE ) and inSearchMode :
284+ if (ch >= ord ("A" ) and ch <= ord ("z" )) or (ch >= ord ("0" ) and (ch <= ord ("9" ))) or ch == KEY_BOARD_BACKSPACE :
283285 if ch == KEY_BOARD_BACKSPACE :
284286 if len (inputString ) == 0 :
285287 continue
@@ -295,7 +297,8 @@ def _showPlugins(plugins, helpList):
295297 helpScreen .refresh ()
296298 elif ch == KEY_BOARD_ENTER :
297299 for i in range (len (plugins )):
298- if plugins [i ].lower ().startswith (inputString .lower ()):
300+ # 忽略第一个字符/,这个字符只是表示在检索模式,参考vim
301+ if plugins [i ].lower ().startswith (inputString [1 :].lower ()):
299302 index = i
300303 topIndex = index
301304
@@ -309,7 +312,7 @@ def _showPlugins(plugins, helpList):
309312 inSearchMode = False
310313 # 清除当前输入字符串缓冲区
311314 inputString = ""
312- # 关启光标显示
315+ # 关闭光标显示
313316 curses .curs_set (0 )
314317 else :
315318 pass
You can’t perform that action at this time.
0 commit comments