-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This plugin enhances the default "Find in Files" (FiF) functionality in CudaText by providing additional features inspired by Notepad++.
-
Result Display in Bottom Panel:
Search results are displayed in the bottom panel. -
Additional Search Options:
-
Find in Current Tab button:
Allows you to search for keywords exclusively within the active document.
Note: This option bypasses thefiles
,skip
,from
, anddepth
input fields. -
Find in All Tabs button:
Allows you to search for keywords across all open documents.
Note: This option also ignores thefiles
,skip
,from
, anddepth
input fields.
-
-
Quick Access via Bottom Bar:
A dedicated bottom bar is provided to open and manage the search results panel with ease.
- use class Bpanel in bottom_panel.py
from .bottom_panel import *
...
bpanel = Bpanel() #ok
class Command:
def open_console(self): return bpanel.open_console()
def close_console(self): return bpanel.close_console()
def on_start2(self, ed_self): return bpanel.close_console()
- insert button
@@ -1873,6 +1956,10 @@ class Fif4D:
),in_case=d(tp='chbt' ,tid='di_menu' ,x=reex_x+WRDW*1,w=WRDW ,cap='&aA' ,hint=case_hi ,p='pt' # &a
),in_word=d(tp='chbt' ,tid='di_menu' ,x=reex_x+WRDW*2,w=WRDW ,cap='"&w"' ,hint=word_hi ,p='pt' # &w
),rp_cntx=d(tp='chbt' ,tid='di_menu' ,x=cntx_x ,w=CTXW ,cap=m.cntx_ca(),hint=cntx_hi ,p='pt' # &-
+ ),di_fict=d(tp='bttn' ,tid='di_menu' ,x=cntx_x+WRDW*3,w=CTXW*1.55 ,cap='Find in Current Tab' ,hint='ignore Files, Skip, From, Depth value' ,p='pt'
+ # Find All in Current Doc
+ ),di_fiat=d(tp='bttn' ,tid='di_menu' ,x=cntx_x+WRDW*6,w=CTXW*1.55 ,cap='Find in All Tabs' ,hint='ignore Files, Skip, From, Depth value' ,p='pt'
+ # Find All in All Opened Doc
),di_i4o_=d(tp='bvel' ,y = 3 ,x=i4op_x ,r=-5-FNDW-5,h=bttn_h ,a='r>' ,p='pt' ,props='1'
),di_i4op=d(tp='labl' ,tid='di_menu' ,x=i4op_x+4 ,r=-5-FNDW-9,cap=m.i4op_ca(),hint=i4op_hi ,a='r>' ,p='pt'
),di_find=d(tp='bttn' ,tid='di_menu' ,x=-5-FNDW ,r=-5 ,cap=find_ca ,hint=find_hi ,a='>>' ,p='pt' ,def_bt=True # &d Enter
- implement button's function
- store info in variable
body
4-1. filepath - FiFJ needs filepath
@@ -3624,9 +3760,11 @@ class Reporter:
locs[len(body)] = [kid.p, []]
pass; #log("kid=\n{}",pfw(kid))
tim = ' ('+fit_ftim(kid.p)+')' if ftim and os.path.exists(kid.p) else ''
+
+ #filename in result
body += [f('{gap}<{fil}{tim}>: #{cnt}'
, gap=TAB*dpth
- , fil=os.path.relpath(kid.p, root) if relp else kid.p
+ , fil=kid.p #fifx for full path in diff folder
, tim=tim
, cnt=kid.cnt)]
node2body(kid.subs, body, locs, 1+dpth)
@@ -3983,7 +4147,10 @@ class TabsWalker:
# Skip the tab?
if not any(map(lambda cl:fnmatch(title, cl), incls)): continue#for
if excls and any(map(lambda cl:fnmatch(title, cl), excls)): continue#for
- path = f'tab:{tab_id}/{title}'
+ if filename:
+ path = f'tab:{tab_id}/{filename}'
+ else:
+ path = f'tab:{tab_id}/{title}'
# Use!
Walker.stats[Walker.WKST_UFNS] += 1
- change bottom panel's keyword style. Set
bpanel.bottom_ed.attr(...)
as ed_.attr(...)
ex1: change color for keyword
@@ -3699,6 +3852,15 @@ class Reporter:
else: # Report about searches
rws, cls, lns = list(zip(*marks))
ed_.attr(app.MARKERS_ADD_MANY, x=cls, y=rws, len=lns, **MARK_FIND_STYLE)
+ theme = app.app_proc(app.PROC_THEME_SYNTAX_DICT_GET, '')
+ if theme and theme["LightBG5"]:
+ if theme["LightBG5"]["color_back"]:
+ color_back = theme["LightBG5"]["color_back"]
+ color_ft = theme["LightBG5"]["color_font"]
+ else:
+ color_back = 0x00FF00
+ #color_ft =
+ bpanel.bottom_ed.attr(app.MARKERS_ADD_MANY, x=cls, y=rws, len=lns, color_font=color_ft, color_bg=color_back)
if lpths:
rws, cls, lns = list(zip(*lpths))
then ltkns = {} #hack
may affect normal FiF function!!!
ltkns
has a lot of marks, but FiFJ only needs keyword's mark.
@@ -3677,10 +3819,21 @@ class Reporter:
set_text_all(ed_,'\n'.join(body))
ed_.set_prop(app.PROP_RO ,True)
+ #body show result without syntax
+ #logx(f"body: {body}")
+ bpanel.bottom_ed.insert( 0, 0, '\n'.join(body) + "\n" )
+
pass; #log("?? marks")
if -1==-1 and app.app_api_version()>='1.0.310':# app 1.88.8
+ ltkns = {} # otherwise too many mark?
if ltkns:
ltkns = merge_markers(ltkns, marks, MARK_FIND_STYLE)
ltkns_s = {}
ltkns_a = {}
for rw, cl, ln, st in ltkns:
ex2: without changing color
if -1==-1 and app.app_api_version()>='1.0.310':# app 1.88.8
if marks:
rws, cls, lns = list(zip(*marks))
bpanel.bottom_ed.attr(app.MARKERS_ADD_MANY, x=cls, y=rws, len=lns, **MARK_FIND_STYLE)
- insert content into bottom panel.
bpanel.bottom_ed.insert( 0, 0, '\n'.join(body) + "\n" )
@@ -3677,10 +3819,21 @@ class Reporter:
set_text_all(ed_,'\n'.join(body))
ed_.set_prop(app.PROP_RO ,True)
+ bpanel.bottom_ed.insert( 0, 0, '\n'.join(body) + "\n" )
Q: How to add command in menu and Command Palette? A: add in install.inf