GithubHelp home page GithubHelp logo

arsenic-atg / jate Goto Github PK

View Code? Open in Web Editor NEW
15.0 1.0 2.0 109 KB

A text editor created in C which supports all features expected from a minimal text editor with no dependencies

License: GNU General Public License v3.0

C 99.30% CMake 0.70%
c text-editor vt100 escape-sequences editor terminal hacktoberfest

jate's Introduction

J.A.T.E.

Just Another Terminal-based Editor (JATE) is an attempt to make a fully functional bare bones text editor in C ( without any dependencies by directly manipulating terminal via V100 escape sequences )

Insipred from kilo text editor

Status : Beta Version

The editor can now :

  • View already existing file on the system.
  • Edit a text file
  • Check if the file is in modified state or not ( and warn if you try to exit a modified file without saving )
  • Save chagnes to the open file ( using Ctrl-s )
  • Quit (using Ctrl-q )

But still it can't :

  • Create a new file
  • Save a blank file ( Save-as feature )
  • support text highlithing for C/C++
⚠️ WARNING: The software is still in Beta version so if you planning to use it, I suggest making regular backups of your work in case you run into bugs in the editor.

Platform supported

Linux, macOS, windows(with cygwin)

Prerequisites

Get it running

  • git clone or download.

  • Navigate to the repository.

  • Run cmake . command and let CMake generate a Makefile according to your system configuration.

  • Run a make command on your terminal to compile source.

  • Run exectuatable with the name JATE.

$ cd text-editor
$ cmake .
$ make
$ ./JATE <optional: file name that you want to open>

Thank You for visiting

jate's People

Contributors

arsenic-atg avatar ashborn-sm avatar k10231 avatar sausagenoods avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

k10231 ashborn-sm

jate's Issues

cursor going out of screen bounds

Summary

cursor is not bound to the size to windows

Description

once the screen boundary is hit, the cursor is not visibly going out of the window but each attempt to go outside is being registered as a valid attempt and thus need double the amount of movement in reverse direction to move the cursor by one unit.

Steps to Reproduce

  1. Move the cursor to the end of the screen.
  2. Attempt to move it out of the screen via another keypress.
  3. now try to move it to one unit in opposite direction.

Test Results

the user would want additional amount of keypresses in order to move the cursor by one unit as the keypresses attempting to navigate the cursor out of the bounds is getting registered

Add functionality to `DEL_KEY`

Current status :

The DEL_KEY is already mapped to "delete" key on keyboard and the editor can read it properly, but unable to process it currently.

Desired result :

Upon pressing the delete key on keyboard, the editor should remove a character directly to it's right ( unlike BACKSPACE which delete's character directly to it's left )

Area of interest in source :

  • editor_process_keypress () : BACKSPACE_KEY is already implemented ( I guess implementing DEL_KEY would be very similar to it )

Warn about unsaved changes

Currently the editor partially supports saving to disk feature, but the editor doesn't give any warning whatsoever if the user tries to quit the application without saving and potentially loosing all their work.

Add "Save to disk" feature

Currently the editor is more like a scratch pad, which only saves the changes temporarily and they are lost after quitting.

A basic editor needs to have ability to save the edited file to the disk.

Welcome message

Add a welcome message on the startup to greet the user at startup

Build instructions

Build instructions do not work, Please rename "CmakeLists.txt" to "CMakeLists.txt"

navigation breaks when character is deleted at the starting of line

Steps to reproduce

  1. delete a character when the cursor is at the beginning of the line
  2. try to navigate to the other side ( along positive x-axis )

Ideally the cursor should move to the desired location in just one keypress, but now it takes more that one ( number of times we backspaced to be precise )

caused after :

commit ad92840

Status Bar

Add a status bar in the editor which will tell info about name, how many lines are in the file, and what line you’re currently on etc

Typo mistake

In readme the repository spelling is incorrect
Please correct it
Thanks

warnings while doing make [related to c99]

cc src/editor.c -o editor -Wall -Wextra -pedantic -std=c99
src/editor.c: In functioneditor_open’:
src/editor.c:377:16: warning: implicit declaration of functionstrdup’; did you meanstrcmp’? [-Wimplicit-function-declaration]
  377 |   E.filename = strdup(file_name);
      |                ^~~~~~
      |                strcmp
src/editor.c:377:14: warning: assignment tochar *fromintmakes pointer from integer without a cast [-Wint-conversion]
  377 |   E.filename = strdup(file_name);
      |              ^
src/editor.c:385:13: warning: implicit declaration of functiongetline’ [-Wimplicit-function-declaration]
  385 |   linelen = getline(&line, &linecap, fp);
      |             ^~~~~~~
src/editor.c: In functioneditor_save’:
src/editor.c:438:11: warning: implicit declaration of functionftruncate’; did you meanstrncat’? [-Wimplicit-function-declaration]
  438 |       if (ftruncate(file_descriptor, length) != -1)
      |           ^~~~~~~~~
      |           strncat

these warnings pop while using make of version 4.2.1 x86_64-pc-linux-gnu
as most of these warnings are related to c99 and posix. some quick #define would do the job

Buggy

Combinations of inserting and moving cursor cause crashes.

Program received signal SIGSEGV, Segmentation fault.
>                                                   ^[[D__GI___libc_realloc (oldmem=0x4b5b1b3e0a0d4b5b, bytes=1264261952) at malloc.c:3154
3154    malloc.c: No such file or directory.
(gdb) bt
#0  __GI___libc_realloc (oldmem=0x4b5b1b3e0a0d4b5b, bytes=1264261952) at malloc.c:3154
#1  0x0000555555556b36 in editor_row_insert_char ()
#2  0x0000555555556e1f in editor_insert_char ()
#3  0x0000555555557e43 in editor_process_keypress ()
#4  0x0000555555557f55 in main ()
(gdb) 
>

I tried to integrate this code into another project, also got some of these. This may be my doing as I made a number of terminal changes but I suspect it is an error in the core code.

free or corruption (!prev)

I am going to give up on using this project for now, promising start but very buggy and unclear about its own memory management.

I built it with gcc (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0) Linux Mint with the following options:

-O0 -Wall -g -fstack-protector-all

This seem to highlight some more bugs.

Make the editor render ordinary characters

Currently the editor is more like a text viewer and user can't do much apart from opening and navigating files.

Aim: Add enough functionality to the editor so that now user can type ordinary characters on the editor from their keyboards.

Editor confusing empty line with end of file

When navigating in the file, if an empty line is encountered, the cursor treats it as the end of file and navigates back to top of the page.

maybe this has to do with implementation of clipping cursor to the end of line in editor_navigate_cursor() function

Split the program across multiple files

  • Split the program across multiple files so that it becomes easier to work and debug.
  • update makefile to link the files together during building.

splitting is partially marked with comments in the main file.

move Cursor

give user the ability to move the cursor across the screen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.