To fix whitespace, go to: header > format > convert whitespace
Here is an example how to extend the find panel:
bl_info = {
"name": "Extended Find Panel",
"description": "add a extended find & replace panel to the text editor sidebar",
"author": "MKB",
"version": (0, 0, 1),
"blender": (2, 80, 0),
"location": "Text editor > toolbar",
"warning": "",
"wiki_url": "",
"category": "Text Editor" }
import bpy
# draw the panel
class EXTENDED_FIND_PT_ui_panel(bpy.types.Panel):
"""creates a panel the text editor sidebar"""
bl_idname = 'EXTENDED_FIND_PT_ui_panel'
bl_space_type = "TEXT_EDITOR"
bl_region_type = "UI"
bl_label = "Extended"
bl_category = "T+"
def draw(self, context):
layout = self.layout
st = context.space_data
# find
col = layout.column(align=True)
row = col.row(align=True)
row.prop(st, "find_text", text="")
row.operator("text.find_set_selected", text="", icon='TEXT')
col.operator("text.find")
col.separator()
# duplicate
col = layout.column(align=True)
row = col.row(align=True)
row.operator("text.jump", text=" ", icon='FRAME_NEXT')
row.operator("text.convert_whitespace", text=" ", icon='SHORTDISPLAY').type='SPACES'
row.operator("text.uncomment", text=" ", icon='RESTRICT_VIEW_OFF')
row.operator("text.comment", text="#", icon='RESTRICT_VIEW_ON')
col.operator("text.duplicate_line", text="Duplicate")
col.separator()
# replace
col = layout.column(align=True)
row = col.row(align=True)
row.prop(st, "replace_text", text="")
row.operator("text.replace_set_selected", text="", icon='TEXT')
col.operator("text.replace")
# settings
row = layout.row(align=True)
row.prop(st, "use_match_case", text="Match")
row.prop(st, "use_find_all", text="All")
row = layout.row(align=True)
row.prop(st, "use_find_wrap", text="Wrap")
row = layout.row(align=True)
st = context.space_data
row.prop(st, "show_margin", text="")
row.prop(st, "margin_column", text="Margin")
layout.separator()
wm = context.window_manager
row = layout.column(align=True)
row.operator("screen.userpref_show", text="UserPref", icon='PREFERENCES')
row.operator("wm.save_userpref", text="SavePref", icon='FILE_TICK')
row.separator()
#row.prop(context.scene, "debug_mode", text="Debug Mode", icon='SCRIPT')
row.operator("wm.console_toggle", text="Open Console", icon='CONSOLE')
row = layout.row(align=True)
row.operator("text.save", text="Save File", icon='FILE_TICK')
row.operator("text.save_as", text="Save As", icon='FILE_TICK')
row.operator("text.unlink", text="", icon='PANEL_CLOSE')
layout.separator()
classes = (
EXTENDED_FIND_PT_ui_panel,
)
def register():
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()