{"id":13741537,"url":"https://github.com/ikskuh/TextEditor","last_synced_at":"2025-05-08T21:34:17.334Z","repository":{"id":45373511,"uuid":"492773082","full_name":"ikskuh/TextEditor","owner":"ikskuh","description":"A backbone for text editors. No rendering, no input, but everything else.","archived":false,"fork":false,"pushed_at":"2024-06-20T22:31:51.000Z","size":29,"stargazers_count":46,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-08T14:05:04.551Z","etag":null,"topics":["text","text-editor","unicode","zig","zig-package"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ikskuh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"MasterQ32"}},"created_at":"2022-05-16T09:45:21.000Z","updated_at":"2024-07-27T18:43:28.000Z","dependencies_parsed_at":"2024-01-25T04:47:34.820Z","dependency_job_id":"e1a4706a-b38a-4bca-9d5f-a9b2eb0a8482","html_url":"https://github.com/ikskuh/TextEditor","commit_stats":null,"previous_names":["ikskuh/texteditor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikskuh%2FTextEditor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikskuh%2FTextEditor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikskuh%2FTextEditor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikskuh%2FTextEditor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ikskuh","download_url":"https://codeload.github.com/ikskuh/TextEditor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224774878,"owners_count":17367812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["text","text-editor","unicode","zig","zig-package"],"created_at":"2024-08-03T04:01:00.075Z","updated_at":"2024-11-15T11:31:25.788Z","avatar_url":"https://github.com/ikskuh.png","language":"Zig","funding_links":["https://github.com/sponsors/MasterQ32"],"categories":["Libraries"],"sub_categories":[],"readme":"# TextEditor\n\nA backend for text editors. It implements the common textbox editing options, but is both rendering and input agnostic.\n\nKeyboard input must be translated into operations like `editor.delete(.right, .word)` to emulate what a typical text box implementation would do when `CTRL DELETE` is pressed.\n\nFor mouse input, the editor component needs to be made aware about the font that is used. For this, an abstract font interface is required.\n\n## API\n\n```zig\nconst TextEditor = @import(\"src/TextEditor.zig\");\n\nfn init(TextEditor.Buffer, initial_text: []const u8) InsertError!TextEditor {\nfn deinit(*TextEditor) void;\nfn setText(*TextEditor, text: []const u8) InsertError!void;\nfn getText(TextEditor) []const u8;\nfn getSubString(editor: TextEditor, start: usize, length: ?usize) []const u8;\nfn setCursor(*TextEditor, offset: usize) SetCursorError!void;\nfn moveCursor(*TextEditor, direction: EditDirection, unit: EditUnit) void;\nfn delete(*TextEditor, direction: EditDirection, unit: EditUnit) void;\nfn insertText(*TextEditor, text: []const u8) InsertError!void;\nfn graphemeCount(TextEditor) usize;\n```\n\n## Common Key Mappings\n\n| Keyboard Input   | Editor Call                          |\n| ---------------- | ------------------------------------ |\n| `Left`           | `editor.moveCursor(.left, .letter)`  |\n| `Right`          | `editor.moveCursor(.right, .letter)` |\n| `Ctrl+Left`      | `editor.moveCursor(.left, .word)`    |\n| `Ctrl+Right`     | `editor.moveCursor(.right, .word)`   |\n| `Home`           | `editor.moveCursor(.left, .line)`    |\n| `End`            | `editor.moveCursor(.right, .line)`   |\n| `Backspace`      | `editor.delete(.left, .letter)`      |\n| `Delete`         | `editor.delete(.right, .letter)`     |\n| `Ctrl+Backspace` | `editor.delete(.left, .word)`        |\n| `Ctrl+Delete`    | `editor.delete(.right, .word)`       |\n| _text input_     | `try editor.insert(\"string\")`        |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikskuh%2FTextEditor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fikskuh%2FTextEditor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikskuh%2FTextEditor/lists"}