Circle Device


Techie Stuff


Quick Reference

Will be moved to Quick Reference soon


Alert: This is a work in progress!

I wanted a Twitter client that would work in the console. I threw one together in Java but I was not too happy with it, it was quite simple and only allowed one to tweet but did not allow one to see tweets on the account (i.e. from the people you are following). I decided to write one in C with ncurses... it needs to support unicode, spellchecking and tell me how many characters I have typed.


Any Linux geek knows about ncurses so I will not go into it. I always wanted to write a simple ncurses programme that would allow a user to edit text (like nano) but never got around to it. Well, this is my chance. I have some experience with foreign character sets (Hiragana, Katakana and Kanji) so I wanted my client to be able to handle this kind of text as well as normal western/latin characters. UTF-8 is the future but not without it's problems.

Unicode TextArea in UTF-8 Console

I would have preferred to make use of the text area in nano but it turns out that it is just too complicated and cooked right into the functionality, I will have to put together my own. Some might call it fun...

Some UNICODE characters take two spaces on a normal UTF-8 console (you probably use an XTerm compatible one that supports UTF-8 if you are using Linux, I use rxvt-unicode). To make matters worse, a UTF-8 character can take up to 6 bytes (input from keyboard and when displaying the character on the screen). In my editor I am storing all characters as single wchar_t's and when I need to render them converting them from that into their UTF-8 representation (or to pass a word to aspell).

Spellchecking Functionality

To implement spell checking functionality in CursesTwitter I will be using aspell. Aspell supports a C API and interaction through a pipe... I have chosen the pipe option. API information to interact with aspell through a pipe is available on the aspell website.

The interface to the user should be compatible with many other cool console utities that are in use every day by your average computer nerd, I have thus chosen Control-T ^C-T (the key combination that is used for GNU Nano). The spell checking will be performed live a-la spell checking on BlackBerry and Microsoft Word since '97. The functionality will degrade gracefully with a nice message telling the use that no spellchecking will be available.

Quick implementation of the interface to aspell over a pipe complete! Should be able to remove the testing functions and use this in the main programme. I will place the various options (or rather suggestions) in a pop-up menu when ^C-T is pressed.


By default when you move the cursor around the screen, to draw the characters, you can see it. This is fine but when you are rendering a menu it sort of gets in the way and makes the selection a little ugly. To counteract this I have used an escape sequence to hide the cursor when the user is to select an item from the menu.

fprintf(stdout, "\033[?25l"); /* Hide Cursor */
fprintf(stdout, "\033[?25h"); /* Show Cursor */

It should be noted that this is very bad and that the cursor should be hidden using an ncurses API call. When I find out the API call(s) to hide the cursor I will update this page.


This is a cool Library for using OAuth 1.0a in your C applications. I am using this library in CursesTwitter and am looking to make sure my code will still work well when OAuth 2.0 is in use.

Streaming API

Although it will not be present in the first iteration of my programme I need to know how to use the sreaming API with OAuth so this is a good link that I am sure will help me.


Here are some links I found useful for this project


Quick Links: Techie Stuff | General | Personal | Quick Reference