{"id":15720817,"url":"https://github.com/drankinatty/gtkwrite","last_synced_at":"2025-05-13T02:50:02.145Z","repository":{"id":184331888,"uuid":"82444606","full_name":"drankinatty/gtkwrite","owner":"drankinatty","description":"GtkWrite Text Editor written in C and Gtk+2.","archived":false,"fork":false,"pushed_at":"2020-04-28T08:45:48.000Z","size":476,"stargazers_count":12,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T06:02:45.382Z","etag":null,"topics":["c","editor","gtk2","linux","windows"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drankinatty.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}},"created_at":"2017-02-19T08:09:00.000Z","updated_at":"2023-10-30T11:30:49.000Z","dependencies_parsed_at":"2023-07-28T01:44:34.377Z","dependency_job_id":null,"html_url":"https://github.com/drankinatty/gtkwrite","commit_stats":null,"previous_names":["drankinatty/gtkwrite"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drankinatty%2Fgtkwrite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drankinatty%2Fgtkwrite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drankinatty%2Fgtkwrite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drankinatty%2Fgtkwrite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drankinatty","download_url":"https://codeload.github.com/drankinatty/gtkwrite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253862740,"owners_count":21975583,"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":["c","editor","gtk2","linux","windows"],"created_at":"2024-10-03T22:00:21.161Z","updated_at":"2025-05-13T02:50:02.121Z","avatar_url":"https://github.com/drankinatty.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gtkwrite\n\nA small fast standalone text editor written in C using Gtk+2 and optionally GtkSourceView2 to provide syntax highlighting and word-completion (and other niceties). The editor is implemented with GtkTextView and *does not* rely on any third-party editor component such as Scintilla. The included Makefile handles the build (details below) and packages are available for [OpenSuSE 13.1 through Leap 15.0](http://download.opensuse.org/repositories/home:/drankinatty/) and the current release and development branch builds are available for Archlinux [gtkwrite](https://aur.archlinux.org/packages/gtkwrite/) and [gtkwrite-git](https://aur.archlinux.org/packages/gtkwrite-git/). The editor can be compiled *with or without* GtkSourceView. Without GtkSourceView it will compile as `gtkedit`. With GtkSourceView it compiles as `gtkwrite` (requires GtkSourceView 2.x). Both gtkedit and gtkwrite compile and run under RaspberryPi/ARM and windows as well. (the Win-key accelerators are disabled on windows). gtkwrite is Licensed under GPLv2.\n\n### Feature Summary\n\nFeatures include Open Recent Files listing, Reload Saved File, Print (with print to .pdf provided by native print dialog), Undo/Redo, Select All, robust Find/Replace, Goto Line, Font Selection, Increase/Decreate Indent, Fixed width Indent/Unindent, current line auto-indent, smart home/end, smart backspace, Current Line Highlight, Show/Hide Right Margin at any column, Syntax Highlight, Line Numbering, Comment/Uncomment, Change Case (upper, lower, title), Join Lines, File Statistics (characters, words, whitespace, non-whitespace and line count), on-save trailing whitespace removal and POSIX end-of-line insertion. Basic word-completion is provided by GtkSourceView. Custom keypress handlers for `Ctrl+Shift` selection to avoid default textview handling annoyances. End-of-line detection and conversion between LF, CRLF and CR with persistent setting to use file EOL or Operating System default EOL with prompt for conversion on file open. External File Insertion within an open buffer, Insert of Date/Time both as a menu-iterm \u0026 tool-button. GIO File Monitoring for modification by foreign process. Interface provdes menu, configurable toolbar that can be shown/hidden and statusbar. Syntax language and style selection when compiled with GtkSourceView2. Correctly detects all Byte Order Marks, but currently handles only ASCII/UTF-8 character sets.\n\n### Menu Layout/Use\n\nThe editor has the following menu layout and shortcut key layout (if you are comfortable with the layout of KDE3 kwrite/kate, you will be right at home with this Gtk variant):\n\n    File\n      - New                               Ctrl+N\n      - Open                              Ctrl+O\n      + Open Recent File\n          - recent_file_1\n          - recent_file_2\n          - ...\n      - Save                              Ctrl+S\n      - Save As                     Shift+Ctrl+A\n      - Reload Saved File                     F5\n      - Page Setup                   Shift+Alt+P\n      - Print Preview               Shift+Ctrl+P *\n      - Print                             Ctrl+P\n      - Close                             Ctrl+W\n      - Quit                              Ctrl+Q\n\n    Edit\n      - Undo                              Ctrl+Z\n      - Redo                        Shift+Ctrl+Z\n      - Cut                               Ctrl+X\n      - Copy                              Ctrl+C\n      - Paste                             Ctrl+V\n      - Delete\n      - Select All                        Ctrl+A\n      - Deselect All                Shift+Ctrl+A\n      - Find                              Ctrl+F\n      - Find \u0026 Replace                    Ctrl+R\n      - Goto Line                         Ctrl+G\n      - Preferences                        Alt+P\n\n    View\n      - Font Selection                     Alt+T\n      - Show/Hide Toolbar                 Ctrl+T\n      + Toolbar Appearance\n          - Text Only\n          - Icons Only\n          - Text \u0026 Icons\n      - Show/Hide Right Margin            Ctrl+M *\n      - Current Line Highlight      Shift+Ctrl+H *\n      - Syntax Highlight             Shift+Alt+H *\n      + Syntax Language                          *\n          - None\n          + Markup\n          + ...\n          + Sources\n              - Ada\n              - C\n              - ...\n      + Syntax Color Scheme\n          - classic\n          - cobalt\n          - ...\n      - Line Numbers                         F11 *\n      - Word Wrap (on/off)                   F12\n\n    Tools\n      + End of Line Selection\n          - Linux / Unix / OSX\n          - DOS / Windows\n          - Machintosh (Pre-OSX)\n      - Increase Indent                   Ctrl+I\n      - Decrease Indent             Shift+Ctrl+I\n      - Indent Fixed Width               Super+I\n      - Unindent Fixed Width       Shift+Super+I\n      - Insert File at Cursor...\n      - Insert Date/Time at Cursor  Shift+Ctrl+T\n      - Comment                           Ctrl+D\n      - Uncomment                   Shift+Ctrl+D\n      - Uppercase                         Ctrl+U\n      - Lowercase                         Ctrl+L\n      - Titlecase                    Shift+Alt+U\n      - Join Lines                        Ctrl+J\n      - Word/Char Statistics               Alt+R\n\n    Help\n      - About\n\n    * (option in work, or only available with GtkSourceView)\n\n### Features\n\nThe editor has a full menubar and toolbar that can be shown/hidden and set to display icons, text or both as desired. The editor provides robust find/replace dialog functionality with forward/reverse whole-document, from cursor and selection-limited search ability with configurable case sensitive/insensitive searches and the ability to limit selection/replacement to whole words. Search and replace terms are remembered between searches. (planned REGEX search/replace remains to be implemented)\n\nThe editor at present operates in a single-document-interface manner where requesting a 'New' document from the File menu will open another copy of the editor in its very own and separate window. Development is working toward a multi-document-interface where multiple files/buffers can be open within a single application window with the current document determined by selecting a document list on the left side of the edit window.\n\nConfigurable indent/unindent with align to softtab and separate indent/unindent by an absolute number of characters are provided. Default settings provide auto-indent for code layout and smart_backspace (unindent in leading whitespace). Selected sections of code can be commented/uncommented based on the string set in Preferences-\u003eEditing-\u003eSingle-line comment or with autorecognition of file-type using multi-line block comemnt syntax for the appropriate language. A configurable right-margin visible guide can be shown/hidden at any column based on the value set in Settings-\u003eAppearence-\u003eVisual aids. (defautl 80 column, min 1, max 120 column) It has no effect on word-wrap, it is just a convenient visual reference for the column.\n\nThe editor provides case-conversion, lower-to-upper, upper-to-lower, and title-case. Join lines will join any number of selected lines replacing all intervening whitespace with a single space. Current window size can be saved (if clicked), otherwise the window size on exit is saved for next use if restore window size at start is selected.\n\nWord-completion is provided by GtkSourceView. [Return] is used to activate the selected proposal. Word-completion can be enabled/disabed in Settings-\u003eFile Load/Save-\u003eWord-completion. The settings dialog allows setting the minimum number of characters typed before the word-completion dialog appears. (default: 3)\n\nA custom keypress input handler for `Ctrl+Shift+Right-Arrow` and `Ctrl+Shift+Left-Arrow` to correct the annoying default gtk handler that will *select-to-end-of-next-word* when used in leading whitespace instead of the desired behavior of *select-to-beginning-of-next-word*. A cusom keypress hanlder for `Shift+Left-Arrow` is also included as part of the fix to allow reduction of the selection original selection on a per-character basis by releasing the `Ctrl` key and using `Shift+Left-Arrow`. (no corresponding `Shift+Right-Arrow` is required as the default behavior handles reduction of the slection started with `Ctrl+Shift+Right-Arrow` just fine. A configuration option in Settings, `Appearance-\u003eCursor \u0026 Selection-\u003eCtrl + Shift + Right-Arrow fix`. This enables a corresponding keypress handler for `Ctrl+Shift+Left-Arrow` and small stack to track sequential `Ctrl+Shift+Left/Right` events. This is set on by default. To restore default gtk handling, simply uncheck the box in settings.\n\nEnd-of-line detection (`LF`, `CRLF` and `CR`) is provided on file-open and can be selected in the `Tools` menu. Default EOL for new files on each operating system except DOS/Windows is `LF` (line-feed), with the DOS/Windows default being `CRLF`. Pre-OSX `CR` will be detected and set on File-Open, but no specific pre-processor check tests for earlier MacOS. After open, or change of any new file, selecting a different EOL (from the `Tools menu` or within `Settings`) will convert the file to the selected EOL. `Settings-\u003eFile Load/Save-\u003eEnd-of-Line Handling/Selection` allows for a persistent EOL to be selected along with options for `Use EOL from File` or `Use OS Default` (default). When set to anything other than `Use EOL from File`, a prompt on file-open is presented to convert to the persistent EOL setting if the file EOL differs from the persistent setting. Once open, the `Tools-\u003eEnd of Line Selection` operates independent of the persistent setting allowing conversion to/from any of the line endings without affecting the persistent setting.\n\nByte Order Mark (BOM) detection of all (UTF-8, UTF-16 (BE/LE), UTF-32 (BE/LE), UTF-7, UTF-1, UTF-EBCDIC, SCSU, BOCU-1, and GB-18030), but currently ASCII/UTF-8 is the only encoding handled by the editor. Work is progressing on character set handling for UTF-16/32 as well as on conversion routines between the different encodings.\n\nWhen compiled with GtkSourceView, syntax highlighting, syntax language selection and selectable syntax style (color schemes) are enabled in the View menu. The provided custom styles, 'styles/gtkwrite.xml' and 'styles/gtkwrite_light.xml' provide an alternative to the default styles and works well for C or bash. Both styles are continually being refined. You may install the syles folder in the normal global search location of '/usr/share/gtksourceview-2.0/' or on a per-user basis in '~/.local/share/gtksourceview-2.0/'. (for win32, install in the gtk-runtime directory structure) Single line and block-comemnts are automatically set and functional based on the sourceview language. At present all single-line comments (which can be applied to a selected block of text as well) and multi-line comment blocks are automatically handled for `ada asp awk c c-sharp cmake cpp desktop diff dosbatch erlang fortran gtkrc haskell html java js lua makefile objc octave pascal perl php python rpmspec ruby sql sh vbnet xml`. Multi-line block comment start and end strings are also set based on language detected and used by default when text is selected on the screen. (this behavior is configurable in Settings (edit)). You can check Settings page to verify whether comment syntax was automatically determined for your language. If not, you can set the single-line comment to be applied as needed by your project.\n\n(*Note:* for builds without GtkSourceView2, the single line comment can be set in Settings and it will be applied with the comment/uncomment commands. The automatic table lookup provided by GtkSourceView2 simply overrides this setting for the current file based on the language)\n\nAn active window title displays file/save status along with the current filename. A status bar tracks the `line x/total col: y | INS/OVR | EOL | CharSet | Language` state as well as displaying various operational messages. Print capabilities used the native print dialog making print/print to .pdf, etc. available. Page Setup provides access to the native printer page setup dialog. Current document content statistics are available though the Tools menu via the 'Word/Char Statistics' menuitem to display the number of whitespace, non-whitespace and other character counts, along with the word and line counts for the current contents of the editor. (this is more useful for general text documents rather than for coding).\n\nGIO File Monitoring added to monitor for source modification by a foreign process. File modify, move and delete are currently monitored. Attribute changes are ignored. If a file modification occurs not commanded by the user (e.g. by issuing a file-save or save-as), the user is prompted to either save the current document overwriting any changes or to reload and incorporate the foreign modifications to allow source additions/modifications from the command-line.\n\n### Code Layout/Approach\n\nThe code is in relatively good shape and reasonably commented. The code is separated into files by functionality, but a more modular rewrite is planned. There are parts that are newer than others leaving some areas of the code that may still be tidied up and separated further. The options handling throughout the code is done via a central struct that is passed by parameter as required. The goal being to store routinely used information to cut down on the number of function calls. All in all, the code builds into a single executable of roughly 130K (stripped), 170K otherwise, and builds Intel/AMD, raspberryPi/ARM and Windows (tested on Archlinux, openSuSE, Debian, Ubuntu, Windows 7 \u0026 10).\n\n### Building\n\nI recommend using a build directory to maintain a clean source tree. (although the object files and executables are generated under separate subdirectores, e.g. `obj/` and `bin/` should you choose to build in the source directory) To perform an **out-of-source** build, simply create a 'gtkwrite.build' directory at the same level as your repository and then soft-link the sources and Makefile in the build directory, e.g.:\n\n    $ mkdir gtkwrite.build \u0026\u0026 cd gtkwrite.build\n    $ for i in ../gtkwrite/*.[ch] ../gtkwrite/Makefile; do ln -s \"$i\"; done\n    $ make\n\nThe default build is ***without*** GtkSourceView. If you have **GtkSourceView 2.x** installed, simply pass the `with=-DWGTKSOURCEVIEW2` as an argument to make. For example, to build without GtkSourceView, simply type:\n\n    $ make\n\nTo enable GtkSourceView and syntax highlighting (with GtkSourceView 2.x installed), build with:\n\n    $ make clean\n    $ make with=-DWGTKSOURCEVIEW2\n\n**Note:** you must use `make clean` before calling `make` when switching back and forth between versions ***and*** after each `git pull`.\n\nTo build either on win32 and enable the `-subsystem,windows` link option, add\n\n    $ make ss=-DWIN\n\nBoth **GtkEdit** and **GtkWrite** will compile with either MinGW or TDM-MinGW compilers. If you choose TDM-MinGW (separately or as part of CodeBlocks for windows), you will need to adjust the Makefile as the windows version of mkdir is used. After installing MinGW, the packages required to compile on windows are:\n\n * [https://download.gnome.org/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip](https://download.gnome.org/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip)\n * [https://download.gnome.org/binaries/win32/gtksourceview/2.10/gtksourceview-2.10.0.zip](https://download.gnome.org/binaries/win32/gtksourceview/2.10/gtksourceview-2.10.0.zip)\n * [https://download.gnome.org/binaries/win32/gtksourceview/2.10/gtksourceview-dev-2.10.0.zip](https://download.gnome.org/binaries/win32/gtksourceview/2.10/gtksourceview-dev-2.10.0.zip)\n * [http://xmlsoft.org/sources/win32/libxml2-2.7.8.win32.zip](http://xmlsoft.org/sources/win32/libxml2-2.7.8.win32.zip)\n * [https://download.gnome.org/binaries/win32/dependencies/libxml2_2.9.0-1_win32.zip](https://download.gnome.org/binaries/win32/dependencies/libxml2_2.9.0-1_win32.zip)\n *[hicolor-icon-theme-0.17.tar.gz](http://icon-theme.freedesktop.org/releases/hicolor-icon-theme-0.17.tar.xz)\n\n(Msys has `libxml2` available, but it requires adding it to your path if you use it. The hicolor-icon-theme is not required, but is helpful to eliminate a runtime warning on windows if you have no default Gtk+2 icon theme set when using the File-open/save dialogs -- simply place the resulting 'hicolor' directory below 'share/icon` in the same location you installed the required gtk2 libraries/headers, e.g. `c:\\gtk2\\share\\icons\\hicolor`. I generally put all Linux additions to windows under `c:\\opt`, e.g. `c:\\opt\\gtk2\\...`)\n\nJust unzip `gtk+-bundle_2.24.10-20120208_win32.zip` to a directory of your choice. (e.g. `c:\\opt\\gtk2`), then unzip and add the files from the other packages to the appropriate directores (e.g. `bin, include, lib, etc..`). Don't forget to **add the path to the MinGW and gtk2** `bin` directores to your windows `PATH` variable. (e.g. `rt-click My Computer -\u003e Properties -\u003e Advanced Settings -\u003e Environment Variables` and add the paths to your personal environment (e.g. **the TOP section**) and then start Msys, Command Prompt (cmd.exe) or powershell to compile.\n\nRegardless which OS you are compiling on, the package should compile without any warnings. If you receive a warning, something is wrong, fix it before proceeding. It is currently compiled on Archlinux, openSuSE, debian/raspberryPi, Ubuntu, Win_7 and Win_10. (**note:** on windows, after mingw update to gcc 6.3, a deprecated warning is displayed from the gobject library (due to its use of `1 \u003c\u003c 31` not being an integer value) -- it's not our warning, remove -pedantic to suppress)\n\n### Configuration \u0026 Custom Style Locations\n\nOn Linux, the default location for the configuration file is `$HOME/.config/gtkwrite`. On windows it is `%LOCALAPPDATA%\\gtkwrite`.\n\nOn Linux system wide syntax color-schemes (styles) are found in `/usr/share/gtksourceview-2.0/styles` and personal styles can be added in `$HOME/.local/share/gtksourceview-2.0/styles`. On win32, the system wide style directory will depend on where you installed the gtksourceview2 files, any personal styles can be placed in `%LOCALAPPDATA%\\gtksourceview-2.0\\styles`.\n\nOn Linux, a `gtkrc-2.0_gtkwrite` file to reduce the button-spacing for GtkInfoBar is installed to /usr/share/gtkwrite.\n\nOn Windows, where you install the gtkwrite.exe executable is irrelevant to the operation of the editor. However, until an installer is created, to have the GPL license and logo displayed in help-about you should install to `C:/Program Files/GtkWrite` (on 32-bit versions) or to `C:/Program Files (x86)/GtkWrite` for 64-bit versions. (include the `gtkrc-2.0_gtkwrite`, `gpl-2.0.txt` files and the `img` directory in that the same location)\n\nGive it a try, help make it better. Drop me a line if you have any questions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrankinatty%2Fgtkwrite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrankinatty%2Fgtkwrite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrankinatty%2Fgtkwrite/lists"}