简体   繁体   中英

text editor using c

Hi i want to make a text editor using c. I don't want to make any GUI, the text editor is going to be a console application. I would like to ask if there are any libraries which implement some basic functionality for example, i want to execute a function when user presses ctr+s.

You're going to want to look into the curses library. There are versions of it for most Unix-like systems as well as for console programs in Windows (and probably programs running under PowerShell, but not sure).

This library has functions for reading key presses, moving around the screen, and drawing window-ish borders with either ASCII or terminal graphics characters in a platform/terminal independent way. Some versions even have the ability to work with mice.

There's lots more that curses can help you do, but you'll have trouble appreciating it until you read more in depth about it and see some examples in action (and actually realize that they are using curses).

The most popular version for free *nix systems is ncurses and the windows version is called pdcurses.

Curses and other such libraries are a good place to start.

http://en.wikipedia.org/wiki/Curses_%28programming_library%29

使用ncurses并查看vim的源代码

You can find a simple ncurses-based text editor on my webpage here:

http://www.melvilletheatre.com/articles/cstuff/1.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM