You are not logged in.

#1 2010-08-16 21:53:57

LeafStorm
Member
From: North Carolina
Registered: 2009-05-20
Posts: 51
Website

Inkpad - a text editor

After seeing a demonstration file of how to use Pygments to highlight code in a gtk.TextView, I thought it would be cool to make a simple Notepad-like editor with Pygments syntax highlighting. (Because in my opinion, most GTK-based editors have subpar syntax highlighting in terms of consistency and accuracy. Pygments, on the other hand, gives you loads of accurate lexers with a variety of output formats.) It took about three days, and I ended up adding tab support, but the result is Inkpad.

(No screenshots yet, maybe later.)

You can download Inkpad from its Bitbucket repository at http://bitbucket.org/leafstorm/inkpad/. It requires Python 2.6 (it will probably work with 2.5 if you install simplejson, but I haven't tested it) and PyGTK. Once you have the download, run "make pygments" to download a copy of Pygments for it, and then "bin/inkpad" to start. You can save preferences in ~/.config/inkpad/config.json. (The most important one is pygments_style, which is the name of the Pygments style to use, but you can also set window_height and window_width, as well as default_encoding [which right now means the ONLY encoding, properly handling encoding isn't implemented yet].) If you want to install it, "make install" will put it in /usr/local. (There's not going to be a PKGBUILD until it's at least good enough for a first release.)

Obviously, there is much work to be done, as enumerated in the TODO file. At this point, it's really more of a proof-of-concept than something practical, and it's certainly not suitable for heavy programming use. But if you could check it out and let me know your initial impressions, that would be much appreciated.


Thanks,
Matthew Frazier

Offline

#2 2010-08-17 11:11:38

FSX
Member
Registered: 2009-08-06
Posts: 57

Re: Inkpad - a text editor

That's pretty neat. It's a bit slow with big files though.

Maybe it's possible to re-highlight the part that has been changed or the area around the part that has been modified.

Last edited by FSX (2010-08-17 11:15:22)

Offline

#3 2010-08-17 13:48:05

LeafStorm
Member
From: North Carolina
Registered: 2009-05-20
Posts: 51
Website

Re: Inkpad - a text editor

FSX wrote:

That's pretty neat. It's a bit slow with big files though.

Maybe it's possible to re-highlight the part that has been changed or the area around the part that has been modified.

That's one of the things in the TODO list - see if it can rehighlight just the part that was changed. The trick, though, would be deciding what sections to rehighlight, especially since some minute changes can completely change what needs to be highlighted (for example, adding a triple-quote early in the file using the Python lexer - if it was set to rehighlight in a range of 10 tokens, only part of the string would be properly highlighted). This is made more difficult by the fact that the "changed" handler doesn't describe exactly what was changed when it's fired.


Thanks,
Matthew Frazier

Offline

Board footer

Powered by FluxBB