Description
Changelog
Reviews (0)

GoteEdit

GoteEdit 是一个带查找替换栏和其他扩展功能的 Godot 文本编辑控件。

GoteEdit is a Godot text editing control with a built-in Find & Replace bar and other extended features.

特色功能 Features

GoteEdit 的功能分4个模块:

  • 文件模块:自带打开、保存文件的文件对话框,未保存提示对话框;提供封装好的新建、打开、保存文件函数
  • 查看模块:自带查找替换栏、行号栏,行号使用Sprite实现,可以做出CodeEdit行号没有的效果,比如真正的右对齐、高亮当前行
  • 行模块:提供处理文本行、显示行的函数
  • 边栏模块:提供处理边栏的函数
  • 其他:一个信号 lines_column_edited_from,会在文本改变时发出,传递编辑前后的行列位置

GoteEdit's features are divided into four modules:

  • File Module: Includes open and save file dialogs and an unsaved check dialog; provides built-in functions for New, Open, and Save file operations
  • View Module: Includes a Find & Replace bar and a line number gutter. Line numbers are implemented using Sprites, allowing for effects not available in CodeEdit’s line number gutter, such as true right-alignment and highlighting the current line
  • Line Module: Provides functions for handling text lines or visual lines
  • Gutter Module: Provides functions for handling gutters
  • Others: A signal named lines_column_edited_from which is emitted when the text changes, passing the line and column positions before and after the edit

截图 Screenshots

截图来自范例项目 GotePad。

Screenshots are from the example project GotePad.

使用方式 Usage

  1. 将 gote_edit 文件夹添加到您的Godot项目中。
  2. 将 GoteEdit.tscn 添加到场景树中。
  3. Add the gote_edit folder to your Godot project.
  4. Add GoteEdit.tscn to the scene tree.

项目链接 Links

GoteEdit - Godot Asset Store

GoteEdit - GitHub

GotePad - GitHub (范例项目)(Example project)

授权协议 License

本项目以 MIT 协议发布。

第三方资源:

部分图标来自 Godot 引擎,GoteEdit logo 使用了 Godot 引擎 logo 元素。

Godot Engine from https://godotengine.org/ under the MIT license

This project is licensed under the MIT license.

Third-party resources:

Some icons are from the Godot Engine. The GoteEdit logo incorporates elements of the Godot engine logo.

Godot Engine from https://godotengine.org/ under the MIT license

API 参考 API Reference

模块 类型 接口 说明 备注
文件 方法 new_file() -> void 新建 会做未保存检查
文件 方法 open_file() -> void 打开 打开自带的文件对话框,会做未保存检查
文件 方法 save_file() -> void 保存
文件 方法 save_file_as() -> void 保存为 打开自带的文件对话框
文件 方法 unsaved_check(callback: Callable) 未保存检查
文件 方法 formatted_title(app_name: String) -> String 格式化标题
文件 属性 file_path: String 文件路径
文件 属性 is_unsaved: bool 是否未保存
文件 属性 use_native_dialog: bool 是否使用原生文件对话框 作用于打开和保存文件对话框
文件 属性 file_filters: PackedStringArray 可用的文件类型筛选器 作用于打开和保存文件对话框
查看 方法 zoom_in() -> void 放大
查看 方法 zoom_out() -> void 缩小
查看 方法 zoom_reset() -> void 重置缩放
查看 方法 show_search() -> void 打开查找
查看 方法 show_replace() -> void 打开替换
查看 属性 default_font_size: int 默认字体大小
查看 属性 font_size 字体大小
查看 属性 draw_line_numbers: bool 显示行号 行号使用Sprite实现,可以做出CodeEdit行号没有的效果,比如真正的右对齐、高亮当前行
方法 get_line_length(line: int) -> int 获取文本行长度
方法 get_line_wrap_index_first_column(line: int, wrap_index: int) -> int 获取文本行位于换行索引的第一个字符的列号
方法 get_line_wrap_index_length(line: int, wrap_index: int) -> int 获取文本行位于换行索引的文本的长度
方法 line_to_visual_line(line: int, wrap_index: int) -> int 文本行号转显示行号
方法 visual_line_to_line(visual_line: int) -> LineWrapIndex 显示行号转文本行号
方法 get_visual_line_length(visual_line: int) -> int 获取显示行长度
方法 line_column_to_visual_line_column(line_column: LineColumn) -> LineColumn 文本行行列位置转显示行行列位置
方法 visual_line_column_to_line_column(visual_line_column: LineColumn) -> LineColumn 显示行行列位置转文本行行列位
边栏 方法 get_gutter_by_name(gutter_name: String) -> int 根据名称获取边栏
边栏 方法 remove_gutter_by_name(gutter_name: String) -> void 根据名称移除边栏
边栏 方法 get_gutter_ract(gutter: int) -> Rect2 获取边栏边界矩形
边栏 方法 get_gutter_ract_by_name(gutter_name: String) -> Rect2 根据名称获取边栏边界矩形
边栏 方法 get_visual_line_in_gutter(gutter: int, pos: Vector2) -> int 获取边栏中位置对应的显示行
边栏 方法 get_line_in_gutter(gutter: int, pos: Vector2) -> int 获取边栏中位置对应的文本行
其他 信号 lines_column_edited_from(_from_line: int, _from_column: int, _to_line: int, _to_column: int) 文本改变时发出,传递编辑前后位置
其他 属性 addon_path: String 插件的根目录
Module Type Interface Description Remark
File Method new_file() -> void New Performs an unsaved check
File Method open_file() -> void Open Opens file dialog, Performs an unsaved check
File Method save_file() -> void Save
File Method save_file_as() -> void Save as Opens file dialog
File Method unsaved_check(callback: Callable) Unsaved check
File Method formatted_title(app_name: String) -> String Formatted title
File Property file_path: String File path
File Property is_unsaved: bool Whether the text is unsaved
File Property use_native_dialog: bool Whether to use native file dialog Applies to Open and Save file dialogs
File Property file_filters: PackedStringArray The available file type filters
View Method zoom_in() -> void Zoom in
View Method zoom_out() -> void Zoom out
View Method zoom_reset() -> void Reset zoom
View Method show_search() -> void Show the search bar
View Method show_replace() -> void Show the replace bar
View Property default_font_size: int Default font size
View Property font_size Font size
View Property draw_line_numbers: bool Whether to draw line numbers Line numbers are implemented using Sprites, allowing for effects not available in CodeEdit’s line number gutter, such as true right-alignment and highlighting the current line
Line Method get_line_length(line: int) -> int Get text line length
Line Method get_line_wrap_index_first_column(line: int, wrap_index: int) -> int Get first character column at the wrap index in the text line
Line Method get_line_wrap_index_length(line: int, wrap_index: int) -> int Get the text length at the wrap index of a text line
Line Method line_to_visual_line(line: int, wrap_index: int) -> int Line number to visual line number
Line Method visual_line_to_line(visual_line: int) -> LineWrapIndex Visual line number to text line number
Line Method get_visual_line_length(visual_line: int) -> int Get visual line length
Line Method line_column_to_visual_line_column(line_column: LineColumn) -> LineColumn Text line and column position to visual line and column position
Line Method visual_line_column_to_line_column(visual_line_column: LineColumn) -> LineColumn Visual line and column position to text line and column position
Gutter Method get_gutter_by_name(gutter_name: String) -> int Get the gutter by name
Gutter Method remove_gutter_by_name(gutter_name: String) -> void Remove the gutter by name
Gutter Method get_gutter_ract(gutter: int) -> Rect2 Get the gutter bounding rectangle
Gutter Method get_gutter_ract_by_name(gutter_name: String) -> Rect2 Get the gutter bounding rectangle by name
Gutter Method get_visual_line_in_gutter(gutter: int, pos: Vector2) -> int Get the visual line corresponding to the position in the gutter
Gutter Method get_line_in_gutter(gutter: int, pos: Vector2) -> int Get the text line corresponding to the position in the gutter
Other Signal lines_column_edited_from(_from_line: int, _from_column: int, _to_line: int, _to_column: int) Emitted when the text changes; passes the positions before and after editing
Other Property addon_path: String The root path of the addon

Changelog for version v0.2.1

No changelog provided for this version.

Reviews

GoteEdit has no reviews yet.

Login to write a review.

Consider supporting the creators!

If you enjoyed this asset consider supporting its creator. Follow the link below.