{"id":15690082,"url":"https://github.com/ibara/edx","last_synced_at":"2025-06-24T16:32:41.673Z","repository":{"id":80378243,"uuid":"229386023","full_name":"ibara/edx","owner":"ibara","description":"Small Wordstar-like text editor for X11.","archived":false,"fork":false,"pushed_at":"2023-08-12T18:40:31.000Z","size":81,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-20T04:34:19.241Z","etag":null,"topics":["c","editor","openbsd","text-editor","wordstar","x11"],"latest_commit_sha":null,"homepage":null,"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/ibara.png","metadata":{"files":{"readme":"README.edx","changelog":"CHANGELOG","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}},"created_at":"2019-12-21T06:16:43.000Z","updated_at":"2024-10-29T18:28:17.000Z","dependencies_parsed_at":"2024-10-23T22:03:08.967Z","dependency_job_id":null,"html_url":"https://github.com/ibara/edx","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"16653c52ff248fa60d89f5905788da26f08eb47c"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibara%2Fedx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibara%2Fedx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibara%2Fedx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibara%2Fedx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ibara","download_url":"https://codeload.github.com/ibara/edx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252973622,"owners_count":21834105,"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","openbsd","text-editor","wordstar","x11"],"created_at":"2024-10-03T18:07:13.608Z","updated_at":"2025-05-07T23:47:43.957Z","avatar_url":"https://github.com/ibara.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"Edx - a small Wordstar/mini Emacs clone for the X Window system\nCopyright (C) 2002, Terry Loveall, email: \u003cloveall@qwest.net\u003e\nThis program is released into the public domain.\n\nTHIS PROGRAM COMES WITH ABSOLUTELY NO WARRANTY OR BINARIES. COMPILE AND USE \nAT YOUR OWN RISK.\n\nTo select either wordstar or emacs key bindings, uncomment the appropriate\nTYPE define in Makefile. Specific key bindings for each are listed in\nMANUAL.ws and MANUAL.emacs. Default setting is wordstar.\n\nTo build all: run 'make'. For specifics see Makefile.\nTo generate patches use 'diff -pru ref-directory target-directory \u003e patchfile'\nTo patch use 'patch -p1 \u003c patchfile' in the directory to be patched.\n\nPlease send any questions, bug fixes or improvements to the above email.\n\nEdx includes code from Jean-Pierre Demailly \u003cdemailly@ujf-grenoble.fr\u003e.\nThank you, Jean-Pierre, for the excellent code! See CHANGELOG for specifics.\nFor Jean-Pierre's full-featured emacs oriented version, see:\nftp://ftp.ac-grenoble.fr/ge/Office/editkit-1.00.tgz\n\n------------------------------------------------------------------------\n                   ASCII Text Editor to X Conversion\n                        and theory of operation\n\nThe purpose of the edx.c/eeng.c package is a proof of concept for converting a\n'standard' ASCII terminal based text editor to the GUI X windows.\n\nUsing a text editor as a native window application enables the user to have \nmultiple applications open simultaneously on screen. Yet the available X text\neditors have always left something to be desired. Usually an incomplete or \nhostile UI coupled with one or more of the following: written in C++\npreventing easy modification, over-sized binaries which are slow to load and\nrespond or just plain buggy code.\n\nIn the interest of attempting to alleviate some, if not all, of the above\ncomplaints, the edx text editor is presented. It is composed of three files:\nedx.c which provides the direct interface to X windows, eeng.c, which provides\na relatively simple basic text editor engine and either ws.c or emacs.c which\nprovide the selected key bindings.\n\nMye.c is still wordstar only.\n\nEdx is a _programming_ text editor. Real programs are written in ASCII text.\nIf you want/need a locale sensitive editor get a word processor.\n\nGENERIC/PERSONAL Customization:\n\nThere is a compile option at the beginning of edx.c for either a generic full\nblown version or personal configuration.\n\nThe generic includes white horizontal cursor under the character with yellow\nchars on black background, the user programmable edxrc file for Alt-[a..z]\nkeys, bak file creation, standard three button mouse operation and dynamic\nmemory allocation for the edit, undo and block buffers.\n\nThe personal settings are a red vertical cursor on the left of the char with\nblack chars on a linen background, no edxrc file (explicitly coded key\nfunctions obviate the need for secondary files), no bak file littering (save\nfrequently, save often destroys bak file effectiveness), a two button\nmouse strategy (left button hilites, right button pastes from clipboard on\nclick, copies selection to clipboard on drag) and static pre-allocated edit,\nundo and block buffers.\n\nDifferent fixed fonts are commented out. Choose others as you desire. \nProportional fonts are _not_ recommended.\n\nEdx.c description:\n\nThe functions provided by edx.c are a generic set designed to provide all \nnecessary functions that are not inherent to the text editor engine.\n\nEdx.c provides the basic X windows initialization code, character/mouse input,\ncharacter/string output, cursor positioning, X clipboard selection and the\nmain event driven executive loop.\n\nThese are:\n\nCursor:\n\nvoid gotoxy(int horz,int vert);\nvoid cursor_draw(unsigned long color);\nvoid draw_cursor();\nvoid undraw_cursor();\n\nCharacter:\n\nvoid drawstring(char *str, int len);\nvoid cputs(char *prntstr);\nint putch(char chr);\nvoid clreol();\nvoid highvideo();\nvoid lowvideo();\nvoid clrscr();\n\nWindow support:\n\nvoid bell();\nvoid update();\nvoid sig_handler(int);\nvoid font_height(void);\n\nX clipboard selection\n\nint paste_primary(int win, int property, int Delete);\nint request_selection(int time);\nchar *mrealloc(char *s, int len);\nvoid set_selection();\nvoid send_selection(XSelectionRequestEvent * rq);\nvoid moveto();\nvoid do_paste();\nvoid do_select(int delete);\n\nApp Initialization and execution:\n\nvoid init(int argc,char *argv[]);\nvoid handle_key(char *astr, int skey, int state);\nint main(int argc,char *argv[]);\n\n--------------------------\nTerminal X app conversion:\n\nConverting an ASCII text editor, that runs in a terminal environment, to an\nevent driven windowed GUI app is fairly straight forward in concept.\n\nThe analysis results in a seperation of functions into window dependent and\nwindow independent.\n\nFor window dependent functions, analysis produces the following 6 categories:\n\n1. Window creation and application initialization.\n2. Executive loop and function dispatch.\n3. Window support.\n4. Character display\n5. Cursor management\n6. X clipboard/selection\n\nA potential 7th category, dialogs, is not included in X for the sake of\nprogram simplicity. Dialogs are presented and controlled in the context of the\nASCII status bar by the editor engine in eeng.c.\n\n1. Window creation and application initialization:\n\nThe function 'main(argc, argv)' is where window creation and initialization is\ncontrolled. The sequence is as follows:\n\n    disconnect from the console\n\n    call init:\n      open the display\n      setup to gracefully respond to exit requests from X\n      establish window manager hints data structure\n      setup font(s)\n      setup window dimensions\n      initialize clreol string to all blanks\n      create the only window\n      setup window hints\n      setup window class resource names\n      notify X on how to force the app to exit\n      specify accepted XEvent loop events\n      make the window real by mapping it\n      create the Graphic Context for drawing purposes\n      allocate required colors\n      apply colors to window\n      set the font\n\n    App init in main()\n      get command line options\n      open a (possibly) named file for editing\n      request/create WM_PROTOCOLS atom\n      set up the signal handler response\n      display the initial cursor\n\n2. Executive loop and function dispatch:\n\nAt the successful completion of window creation and app initialization, \nexecution enters the main() event loop, where requested events are decoded and\ndispatched to the appropriate functions.\n\nThe event categories decoded are as follows:\n\n    Expose\n    MotionNotify\n    ButtonPress\n      Button1\n      Button2\n      Button3\n    ButtonRelease\n      Button1\n      Button2\n      Button3\n    KeyPress\n    ConfigureNotify\n    ClientMessage\n    DestroyNotify\n\nThe four event categories of concern are ButtonPress, ButtonRelease,\nMotionNotify and KeyPress. \n\nThe button and motion events call the editor functions which:\n\n    set the cursor position, \n    select text with highlights and \n    insert text from a buffer.\n\nKeyPress calls one of several key decoding functions that are mode specific in\nthe text editor engine. These modes correspond to:\n\n    normal editor cursor and text input, \n    file and search string dialogs and \n    option settings.\n\n3. Window support:\n\nWindow support amounts to only 5 functions that are broken out to improve\nreadability. They are:\n\n    bell: make noise for incorrect input.\n    update: redraw the screen.\n    sig_handler: handle signal events from the OS.\n    font_height: calculate font height.\n\n4. Character display:\n\n    drawstring is the basic text output.\n    cputs outputs an ASCIIZ string.\n    putch just outputs one char.\n    lowvideo sets output to normal mode.\n    highvideo sets output to highligted mode.\n    clreol erases from the current output position to the right edge.\n    clrscr erases the entire window.\n\n5. Cursor management:\n\n    gotoxy positions the cursor relative to the upper left window corner.\n    cursor_draw draws a cursor at current location in the specified color.\n    draw_cursor draws a cursor in the foreground color.\n    undraw_cursor draws a cursor in the background color.\n    show_vbar draws a vertical scrollbar.\n    scroll_text positions the text and updates the scrollbar position.\n\n6. X clipboard/selection:\n\n    mrealloc manages the buffer size for X selection\n    paste_primary sequentially feeds chars to handle_char for pasting\n    request_selection requests the current selection from XA_CUT_BUFFER0 if any\n    set_selection processes and sends the marked block to XA_CUT_BUFFER0\n    send_selection posts an event saying selection is available\n\tmoveto mouse support convenience function for multiple calls\n\tdo_paste paste function for both keyboard and mouse\n\tdo_select also for both keyboard and mouse\n\n-------------------\nEeng.c description:\n\nEeng.c provides window independent functions and is derived from a functional\nASCII text editor in a non-windowed environment. Changes made to eeng.c amount\nto converting the following functions from loop form to single pass character\ndecoding: \n\nmain executive:\n    main_exec: dispatch ASCII characters and function keys for processing.\n\nall ASCII text dialogs:\n    file_save: file open/save/new.\n    goto_line: request specified line number to goto.\n    goto_col: request goto column in current line\n    goto_search: request string to search for.\n    goto_replace: request search string for search\u0026replace operation.\n    doSAR: request replace string for search\u0026replace operation.\n    tab_size: request new tab size.\n    window_size: request new right margin for block reformat.\n    block_read: request file name to insert at current position.\n    block_write: request file name to write marked block to.\n\nselect and set options:\n    show_mode: \n\nAn additional change to the text dialogs was to use a generic string input\nwith prompt format and a callback. The callback provides specific processing\nof the input string.\n\nThe change to a windowed environment also required replacing all terminal I/O\nwith equivalent X functions. This code did not change, but rather was replaced\nby the same named X functions. These functions are comprised of the X cursor\nand character groups. The major source difference was specifying function and\ncontrol keys from \u003cX11/keysymdef.h\u003e.\n\n-----------------------------\nBasic eeng.c code structures:\n\nThe center of the editor engine is the char* pointer 'line_start'. All \noperations center around it. cur_pos is calculated by 'line_start+x_offset'.\nConversion from screen x co-ordinate is accomplished with 'get_tru'. Moving\naround within the text file always requires moving line_start and counting\nEOLs.\n\nText display counts back 'y' number of lines to generate a complete screen in\nthe function 'show_scr'. There, the left margin display offset 'lxo' is used \nto determine the start of each display line. lxo is primarily maintained by\ncursor_left and cursor_right functions.\n\nText insertion and deletion is provided by the function 'file_resize', which,\nwhen destination address is greater than source, opens a gap for insert\noperations, or deletes when destination address is less than source. Undo\nrecording basically monitors 'file_resize' plus a few special cases such as\nblock_fill and others.\n\nMain program execution is controlled by the function 'main_exec' which is \nbasically just a conditional state test to select the proper 'switch(key)'\nfunction from one of key_normal, key_control, ctrlk_key, ctrlq_key, func_key\nand key_alt. Each one of these decodes for a specific set of keys and the\nkey state from the global key event data structure 'keve'. From there, the\nindividual key functions are invoked.\n\nX windows just passes basic key values and keyboard state. The difference\nbetween an ASCII 'A' and a control 'A' is only in the bit indicating the\ncontrol key is pressed. The bad part is the program has to decode this in\norder to respond reasonably. The good part is the program gets to decode this\nin order to respond reasonably and controls _all_ decoding. If you do not like\nthe way edx operates you _can_ change it.\n\nMarked block operation is comprised of flag[BLK], the char pointer 'mk' and\ncur_pos. If flag[BLK] is set, only then can you have a marked block.\n\nFile operations are basically treated as block operations, and do very\nconventional file I/O.\n\nExternal program execution:\n\nSYSTEM forks a new process to run '/bin/sh $@'\ngorun invokes a dialog to get a command line from the user to execute\nnewedx invokes a new instance of edx\nmterm opens an rxvt terminal in the current directory\n\nFor more detailed operation of the edx editor see the files 'MANUAL' and\n'eeng.c'.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibara%2Fedx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibara%2Fedx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibara%2Fedx/lists"}