rendered paste bodyIndex: render/katerenderer.cpp
===================================================================
--- render/katerenderer.cpp (revision 692937)
+++ render/katerenderer.cpp (working copy)
@@ -427,6 +427,13 @@
}
if (range->layout()) {
+
+
+ if(range->textLine()->attributesList().empty()) {
+ kDebug()<<"Help! No attribute!"<<endl;
+ }
+
+
QVector<QTextLayout::FormatRange> additionalFormats;
if (range->length() > 0) {
// Draw the text :)
Index: syntax/katehighlight.cpp
===================================================================
--- syntax/katehighlight.cpp (revision 692937)
+++ syntax/katehighlight.cpp (working copy)
@@ -252,8 +252,10 @@
textLine->clearAttributes ();
// no hl set, nothing to do more than the above cleaning ;)
- if (noHl)
+ if (noHl) {
+ textLine->addAttribute (0, textLine->length(), KateExtendedAttribute::dsNormal);
return;
+ }
// duplicate the ctx stack, only once !
QVector<short> ctx (prevLine->ctxArray());
@@ -485,6 +487,11 @@
}
textLine->setNoIndentBasedFolding(noindent);
}
+
+ //set the dsNormal attribute if we haven't found anything else
+ if(textLine->attributesList().empty()) {
+ textLine->addAttribute (0, textLine->length(), KateExtendedAttribute::dsNormal);
+ }
}
void KateHighlighting::getKateExtendedAttributeList (const QString &schema, QList<KateExtendedAttribute::Ptr> &list)
Index: utils/katestyletreewidget.cpp
===================================================================
--- utils/katestyletreewidget.cpp (revision 692937)
+++ utils/katestyletreewidget.cpp (working copy)
@@ -44,6 +44,7 @@
virtual void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
private:
+ QBrush getBrushForColorColumn(const QModelIndex& index, int column) const;
QWidget* m_widget;
};
//END
@@ -306,14 +307,40 @@
{
}
+QBrush KateStyleTreeDelegate::getBrushForColorColumn(const QModelIndex& index, int column) const
+{
+ QModelIndex colorIndex = index.sibling(index.row(), column);
+ QVariant displayData = colorIndex.model()->data(colorIndex);
+ return qVariantValue<QBrush>(displayData);
+}
+
void KateStyleTreeDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
static QSet<int> columns;
if (!columns.count())
columns << KateStyleTreeWidgetItem::Foreground << KateStyleTreeWidgetItem::SelectedForeground << KateStyleTreeWidgetItem::Background << KateStyleTreeWidgetItem::SelectedBackground;
- if (!columns.contains(index.column()))
+ if(index.column() == KateStyleTreeWidgetItem::Context) {
+ QStyleOptionViewItem styleContextItem(option);
+
+ QBrush brush = getBrushForColorColumn(index, KateStyleTreeWidgetItem::SelectedBackground);
+ if(brush != QBrush()) {
+ styleContextItem.palette.setBrush(QPalette::Highlight, brush);
+ } else {
+ styleContextItem.palette.setBrush(QPalette::Highlight, QBrush(KateRendererConfig::global()->selectionColor()));
+ }
+
+ brush = getBrushForColorColumn(index, KateStyleTreeWidgetItem::SelectedForeground);
+ if(brush != QBrush()) {
+ styleContextItem.palette.setBrush(QPalette::HighlightedText, brush);
+ }
+
+ return QItemDelegate::paint(painter, styleContextItem, index);
+ }
+
+ if (!columns.contains(index.column())) {
return QItemDelegate::paint(painter, option, index);
+ }
QVariant displayData = index.model()->data(index);
if (displayData.type() != QVariant::Brush)
@@ -531,21 +558,36 @@
void KateStyleTreeWidgetItem::changeProperty( int p )
{
- if ( p == Bold )
+ if( p == Context )
+ {
+ return;
+ }
+ else if ( p == Bold )
+ {
currentStyle->setFontBold( ! currentStyle->fontBold() );
+ setCheckState(Bold, currentStyle->fontBold() ? Qt::Checked : Qt::Unchecked );
+ }
else if ( p == Italic )
+ {
currentStyle->setFontItalic( ! currentStyle->fontItalic() );
+ setCheckState(Italic, currentStyle->fontItalic() ? Qt::Checked : Qt::Unchecked );
+ }
else if ( p == Underline )
+ {
currentStyle->setFontUnderline( ! currentStyle->fontUnderline() );
+ setCheckState(Underline, currentStyle->fontUnderline() ? Qt::Checked : Qt::Unchecked );
+ }
else if ( p == StrikeOut )
+ {
currentStyle->setFontStrikeOut( ! currentStyle->fontStrikeOut() );
+ setCheckState(StrikeOut, currentStyle->fontStrikeOut() ? Qt::Checked : Qt::Unchecked );
+ }
else if ( p == UseDefaultStyle )
toggleDefStyle();
else
setColor( p );
updateStyle ();
-
treeWidget()->emitChanged();
}
Index: TODO
===================================================================
--- TODO (revision 692937)
+++ TODO (working copy)
@@ -25,7 +25,6 @@
* current highlighter not selected (regression)
* 'use default' never checked
* wrong (can be illegible) color used for group headings
- * selected item uses system background color, not attribute color (regression)
* controls seem to need to be clicked twice?
* reimplement bracket matching
Index: view/kateviewhelpers.cpp
===================================================================
--- view/kateviewhelpers.cpp (revision 692937)
+++ view/kateviewhelpers.cpp (working copy)
@@ -879,6 +879,7 @@
h = m_view->renderer()->config()->fontMetrics().ascent();
+ //p.setPen(m_view->renderer()->config()->wordWrapMarkerColor());
p.setPen(m_view->renderer()->attribute(0)->foreground().color());
QPainterPath path;