bytesclub / chalk Goto Github PK
View Code? Open in Web Editor NEWCommand line text editor written in C
Command line text editor written in C
Clear the screen on the Exit.
We need to print the elements of any file on our screen.
Fix inconsistency of tab and space in Makefile
Read low-level keypresses from the keyboard in two separate functions like:
editorReadKey()
: whose job will be to wait for one keypress and return it
editorProcessKeypress()
: waits for a keypress and handles it
and stop printing the keypress as of now
Cursor appearance in the middle of the screen while the screen is being drawn may cause flicker effect.
So,hide the cursor while repainting. And clear each line separately (Not all at once).
Enable raw mode
on entering the program
Disable ECHO
Disable Raw mode
on program termination.
By,defauult ctrl-c
sends a signal to the current process which causes it to terminate, amnd ctrl-z
sends a signal ti current process which causes it to suspend. We need to turn off the sending of both the signals for proper functioning of our text viewer(text editor in original).
We are going to add some error handling to our program such that , if anything unexpected happens, our program will give a brief error message and will terminate.
currently , what is happening is that read(), is waiting for infinite period of time for input from keyboard before it returns.
We need to set a timeout, so that read() will terminate if input is not provided for certain period of time.
Reposition the cursor at the top left corner of the screen , on the execution of the program.
Clear the screen before reading key presses
Display the key presses, as we are providing the input.
Basic format:
The program is terminating as soon as we are are entering 'q', but program should quit whenever we will type ctrl-Q
instead of 'q'.
The screen should be cleared both at the starting and termination of the program.
Currently, the entire codebase is a one single file. Separate it into multiple modules and create the makefile accordingly
As , we are working in canonical mode, so the inpur we are providing is processed line by line. It means that the input is processed only after the line is completed( when \n or EOF is found). But we want to process our input word by word. so we need to turn off the canonical mode.
Store the state of the terminal, mainly the width and the height
Draw tildes on the left hand side of the screen , just as the vim does
We need to disable all other ctrl
signals which have their own instructions to the terminal.
disable ctrl-S
and ctrl-Q
as ctrl-S
stops data from being transmitted to the terminal until we press ctrl-Q
disable ctrl-V
as ctrl-V
when typed, makes to terminal to wait for user to type another character and then sends the characters literally.
disable ctrl-M
.
We are using small write() functions each time we are refreshing the screen. We have to add all this small write() functions to a buffer and then we will write this buffer at the end.It will help preventing annoying flicker effect.
set tabstop=8
set shiftwidth=8
set expandtab
Documentation is currently done via Sphinx
Terminal translates each new line we print ("\n") into a carriage return followed by a new line("\r\n").
we need to turn off all output processing such that in order in print new line we will have to use carriage return followed by new line("\r\n"), instead of new line("\n") only. And we need to turn off all other miscellaneous flags, although these do not have any visible effect on these modern days terminals.
Upto now our cursor is stable at a point where we have initialized it. Now we need to work on moving it.
Currently, we enter the raw mode whenever the program starts, but it needs to be disabled when
the program terminates, either via the main()
method or via an exit()
call. The initial properties of
the terminal should be stored on entering the raw mode and it should be reset when the program exits.
Change:
git add .
to git add <files>
to avoid adding the unnecessary files (if any)
For git commit --signoff
, add the additional option:
git commit --signoff -v
which also displays the diff of the commit to be made
after "add the commit message" add a link to the Contributing Guidlines
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.