Category Archives: Developers

Kate in KDE 4.9

With KDE SC 4.9 around the corner and according to tradition, it’s time to have a look at what’s new in Kate.

Improved Support for Custom Color Schemas

  • improved “Colors” tab in the “Fonts & Colors” config page
  • configurable colors: search & replace, code folding, indentation line,
  • schema export and import honor background colors (bug #291868) and font
  • “highlight selection” plugin and “search and replace” plugin now use search & replace colors from Kate’s color schema

Line Modification System

  • new option to disable in the editor settings: Appearance > Borders > [ ] Show line modification markers
  • colors of the line modification system are configurable

Build Plugin

  • reworked config page (including advanced settings for remote debugging)
  • support for remote debugging

Further Changes

  • new option in Open/Save config page: [ ] Add newline at end of file on save
  • all fixes in the bug tracker

GSoC 2012: Vi Input Mode

Like last summer I am mentoring a student working on Kate’s Vi mode this summer. This year’s student is Vegard Øye from Oslo, Norway. I’ll let him introduce himself:

My name is Vegard Øye. I am a computer science student at the University of Oslo, Norway. I also have a bachelor’s degree in electrical engineering from Sør-Trøndelag University College in Trondheim, where I programmed for integrated circuits. It was a lot of fun, so I decided to embark on a grade with an even larger emphasis on programming.

My goal is to make modal editing more widespread outside of Vim. There is a Zen-like benefit to using a tool that does just what you tell it to – slicing and dicing text with surgical precision. My focus is not on adding new features to Kate (although I have implemented a few), but on sharpening existing functionality. In particular, I want to improve the integration between Kate’s vi mode and its extension system, as well as sort out various bugs pertaining to the vi mode.

Vegard has already done some really great work, and his changes should be trickling in to Kate’s git repository the next weeks. You can follow his work at http://quickgit.kde.org/index.php?p=clones%2Fkate%2Fvegardoye%2Fvegard_gsoc_2012.git.

RFC: Exporting JavaScript API

Since quite some time, Kate Part has build-in scripting support through JavaScript. Our plan is to make this API public, so other applications like Kile, Kate App and KDevelop can use it. However, we are currently unsure how to best implement it, so this is a rfc to get feedback.

The bindings for a Kate Document are for instance located in part/script/katescriptdocument.h (header, implementation). As you can see, there are functions like

Q_INVOKABLE bool insertLine(int line, const QString &s),

which can be invoked in our scripting by a call of ‘document.insertLine(5, “hello world”)’. The API only contains basic functions. But for instance Kile maybe also wants to provide a function called ‘document.insertSection()’ or similar LaTeX related functions. The question now is as follows: How can Kile extend our QObject based prototype with their own QObject based classes?

We do not want to make the class KateScriptDocument public. Instead, we just want to return a QScriptValue containing a QObject based KateScriptDocument. You can think of the problem also as follows:

// in Kile:
QScriptEngine *engine = ...;
KTextEditor::Document *kteDocument = ...;

QObject* kateScriptDocument = kteDocument->scriptDocument();
engine->globalObject().setProperty("document", engine->newQObject(kateScriptDocument));
// at this point, the JavaScript object 'document' contains all KateScriptDocument functions

// next, we want to add the Kile related document functions
KileTextDocument* kileDocument = ...;
QObject* kileScriptDocument = kileDocument->...(); // some function that returns the binginds object

// now: how can we populate the 'document' property with the functions in kileScriptDocument?
engine->globalObject().setProperty("document", ? );

If you have any idea or other solutions how to do it right, please let us know!