Some QEditor-Related Stuff

Milo Hoffman Milo at NG-Projekt.ORG
Tue Jan 14 01:25:05 UTC 2003


Hi,
there are still some other small bugs in qEditor while tab-Size is not set to 
8 chars. When i select some text and the last line of that selection begins 
with a '\t', the selection is 4 chars to long (does not matter which tab 
stops are set).

This could be related to QEditorView::cursorColumn()
I think, 
    const int tabwidth = 4;
should better read
    /*const ? */ int tabwidth = tabStop();

Just did a frech checkout and it's compiling next two hours - so cannot test 
this.

Further, the current column display in the lower right corner of gideon 
displays the distance of the cursor from beginning of the current line in 
chars. Assumed to be in the line "\t\tbreak;", this means after pressing 
Pos1, it shows 0. Going one char right, it displays 1 - but cursor gets to 
the fourth postion. (IIRC every other editor would display 1 in the first 
column and 4, when the cursor is behind the first tab)
This should be related to the function QEditorView::cursorColumn(), but i 
think it doesn't get called at all. I'll investigate this, too.

Another point is indentation of preproccessor directives. I'd like the editor 
to kill all leading whitespace on the current line, if i enter a '#'. This i 
could realize very quick, by adding this logic to CIndent::indentForLine() 
and adding the '#' to the electric keys.
But i'd like it further to insert white space after the '#', if i'm in context 
of an #if etc. example:

#if defined(HAVE_FOO)
#  define BAR 1
#else
#  define BAR 0
#endif

If i wanted to do this, i would have to touch the yyindent.cpp. Am i right on 
this?

Is it planned to sync qEditor's c++/c/c#/java indenters to parts/astyle in 
points of configuration or execution? Although, i see, these are totally 
different implementations - i don't really understand, why there must be two 
indenters.

Another point, i'd like to have implemented is: configuration of colors. The 
selection and paranthesis-context-highlight-color are currently hard coded. I 
yet haven't found out, 1) where i can change the background color for the 
KTextEditor? 2) where do the contents of qEditor get drawn to the screen?
Maybe someone can point me there.

Milo

btw.: in the autoexpand.path, i sent some time ago:

@@ -228,6 +234,10 @@

 bool QEditorView::setCursorPositionReal(unsigned int line, unsigned int col)
 {
+    QTextParagraph* p = m_editor->document()->paragAt( line );
+
+    ensureTextIsVisible( p );
+

should better read like:

+    QTextParagraph* p = m_editor->document()->paragAt( line );
+
+    if ( p ) {
+        ensureTextIsVisible( p );
+    }
+

(Otherwise it will crash on every open of a file; my appologies for forgetting 
to mention this little bug)






More information about the KDevelop-devel mailing list