Skip to content

Developers 

MovingRanges moving on ;)

Friday, 23 July 2010  | Christoph Cullmann | Tags:  planet

As with any new code, during adoption bottlenecks show up.

For example the rendering of text lines with many ranges inside was quiet slow. This is now partly addressed by Milian Wolff, thanks a lot.

An other bottleneck was the assumption, that it is fast enough to hash the ranges just by their block and iterate over all of them to search the ranges matching a specific line. This does scale well enough for KatePart itself, but KDevelop creates multi-thousand ranges for small documents. To improve this, an internal special mapping was implemented by David Nolden for ranges which don’t span more than one line. For them an efficient line => range mapping is easy and not to costly.

Read More

KDE 4.5: SmartRange => MovingRange

Tuesday, 13 July 2010  | Christoph Cullmann | Tags:  planet

Dominik already blogged about the issues we have in KatePart with the current SmartRange/SmartCursor/Smart* interfaces that were designed during the early KDE 4.0 release.

Given that large amounts of the internal implementation are exposed to the outside in the interfaces, there was no feasible way to fix the issues with them. The problem with the not thread-safe behaviour could have been prevented by just stating the plain fact that multi-threaded access to the ranges doesn’t work, even thought there is a mutex in the interface exposed which should be locked to gain this safety. Still the real problems of the unchangable bad implemenation and design choices would have remained.

Read More

GSoC – Swap Files for Kate

Monday, 12 July 2010  | dianat | Tags:  planet

Hello,

As mid-term evaluations have started, I would like to show my current state of GSoC project, because I’ve never found the time to do it.

The swap file feature is implemented, except for the view differences feature and few TODOs. Some more testing need to be done, though. Below are some screenshots of how it works.

When you start editing in a document, a swap file for the document is created (“.swp.originalFileName”). If Kate crashes and the user didn’t save the changes, the swap file remains on the disk.

Read More

Kate: Scripted Actions

Friday, 9 July 2010  | Dominik Haumann

Finally, I came around to implement scripted actions for Kate in KDE SC 4.6. Let’s take a look at how this works. When Kate starts, it searches for $KDEDIRS/share/apps/katepart/script/ for *.js files. As example, let’s take a look at utils.js there:

/* kate-script
 * author: Dominik Haumann Haumann
 * license: LGPL
 * revision: 3
 * kate-version: 3.4
 * type: commands
 * functions: moveLinesDown
 */

function moveLinesDown() { var fromLine = -1; var toLine = -1;

var selectionRange = view.selection(); if (selectionRange.isValid() && selectionRange.end.line < document.lines() - 1) { toLine = selectionRange.start.line; fromLine = selectionRange.end.line + 1; } else if (view.cursorPosition().line < document.lines() - 1) { toLine = view.cursorPosition().line; fromLine = toLine + 1; }

if (fromLine != -1 && toLine != -1) { var text = document.line(fromLine);

document.editBegin();
document.removeLine(fromLine);
document.insertLine(toLine, text);
document.editEnd();

} }

function action(cmd) { var a = new Object(); if (cmd == "moveLinesDown") { a.text = i18n("Move Lines Down"); a.icon = ""; a.category = ""; a.interactive = false; a.shortcut = ""; }

return a; }

function help(cmd) { if (cmd == "moveLinesDown") { return i18n("Move selected lines down."); } }</pr

Read More

A Flashback of Kate in Gitorious

Thursday, 24 June 2010  | Dominik Haumann
Back in February, I blogged about Kate’s move to gitorious. The main reason for this move was to make building Kate as easy as possible. If you want to build Kate as part of KDE, (as of now) you have to compile kdesupport, phonon, dbusmenu-qt, kdelibs, kdepimlibs, kdebase for kwrite and kdesdk for the kate application. Getting all this done is a huge effort, especially if you are new to KDE development (I very well remember my own times spending weeks to get everything going. Be aware of new contributors might now close to nothing about KDE and all the dependencies!).
As getting new contributors is essential for keeping a project alive, the barrier to get involved should be as low as possible. And exactly this was achieved by moving all pieces to one place (this was gitorious for us). Building Kate is so simple right now that we can even make bug reporters build Kate out of the box. This helps a lot, and even results in patches from time to time. We also got quite some merge requests.
There were several voices at that time that considered moving “away from KDE” was very bad. However, this is not the case, as Christoph is synchronizing all the changes in KDE’s subversion and gitorious almost every day. This is certainly not optimal, but looking back at the last months, we can say it was worth it.
KDE is moving to git.kde.org in the near future. This also raises the discussion about how KDE’s source code will be organized. Speaking for Kate, we certainly want to have all of Kate’s code in one place, just as it is now with gitorious, no matter what :) I hope we can find a solution the KDE community can live with. To be discussed, maybe in Tampere in two weeks? :) Read More

Debugging Kate with Qt Creator

Saturday, 19 June 2010  | Dominik Haumann

Let’s have a quick look at how to debug Kate and KWrite with Qt Creator. First, make sure you meet the requirements:

  1. build Kate according to this tutorial
  2. install Qt-Creator (in my case this is version 2.0.0)

Setup the Kate project Qt-Creator once like this

  1. start Qt-Creator like this (important to get all environment variables right):
    ~/kde/run.sh qtcreator
  2. invoke File > Open File or Project and choose ~/kde/kate/CMakeLists.txt
  3. Build Location: choose ~/kde/build
  4. Run CMake arguments: type
    ../kate -DCMAKE_BUILD_TYPE=debugfull -DCMAKE_INSTALL_PREFIX=~/kde/usr
  5. click the button “Run CMake” and then “Finish”

Start debugging like this

Read More

Kate: Code Folding Crash

Thursday, 10 June 2010  | Dominik Haumann

We still have a crash in Kate’s code folding code; no one was able to find a proper fix, yet. So if you want to get your hands dirty, just build Kate, find a fix and be the hero of all Kate developers :)

Update: Fixed by Stefan Schenk in this commit for KDE 4.5. Awesome! :)

Kate Internals: Smart Cursors and Smart Ranges

Wednesday, 28 April 2010  | Dominik Haumann

SmartCursors and SmartRanges in KDE 4.0 – KDE 4.4

Since KDE 4.0 the KTextEditor interfaces have so called SmartCursors and SmartRanges. A SmartCursor is a text cursor (i.e. a line/column tuple) , which is bound to a text document. When editing the text document, the cursor is automatically moved such that it maintains its position. You need this for the displayed text cursor in a view for instance. If you type text, the cursor automatically moves.
A SmartRange consists of two SmartCursors: start and end. We use that for instance for the text selection or the inline spell checking, or KDevelop uses it to add arbitrary highlighting to parsed C/C++ code. Again, if you modify text in the document, the text range automatically moves, expands or shrinks.

Read More

Kate XML Completion Plugin

Tuesday, 27 April 2010  | Dominik Haumann
A while ago I’ve blogged about the Kate’s most powerful plugins: the XML completion plugin. Thanks to Tomáš Trnka this plugin is back alive with all its features since today and compiled by default in trunk: It will be included in KDE 4.5. Yay! :) And if you need it already now for KDE 4.4, you can build Kate yourself very easily according to this howto, without touching your global KDE installation (probably interesting for KDE documentation writers!). Have fun! Read More

Quick Compiling Kate in a stable KDE Environment

Saturday, 17 April 2010  | Dominik Haumann

Since all of the Kate code is now co-hosted on gitorious, it became very easy to build Kate in your stable KDE >= 4.4 environment. This means you can run the newest version of Kate with very few effort. Just give it a try and do the following steps:

  1. make sure you have the following packages installed: git, cmake and kdelibs development package (on openSUSE this is git, cmake and libkde4-devel)
  2. create and change into a KDE development directory:
    mkdir ~/kde; cd ~/kde
  3. get a copy of the Kate code:
    git clone git://gitorious.org/kate/kate.git
  4. create and change into a build directory for compilation:
    mkdir build; cd build
  5. run the configure process with cmake:
    cmake ../kate -DCMAKE_BUILD_TYPE=debugfull <br /> -DCMAKE_INSTALL_PREFIX=~/kde/usr
  6. compile Kate:
    make
  7. finally install Kate:
    make install

That’s all! This installs Kate locally into the separate directory ~/kde/usr, so that your global KDE installation will not be touched at all.

Read More