Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
16de34e5
Commit
16de34e5
authored
14 years ago
by
Leandro Melo
Browse files
Options
Downloads
Patches
Plain Diff
No need to set format when text is normal.
parent
1ce3eb38
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/genericeditor/highlighter.cpp
+26
-27
26 additions, 27 deletions
src/plugins/genericeditor/highlighter.cpp
with
26 additions
and
27 deletions
src/plugins/genericeditor/highlighter.cpp
+
26
−
27
View file @
16de34e5
...
@@ -300,35 +300,36 @@ void Highlighter::applyFormat(int offset,
...
@@ -300,35 +300,36 @@ void Highlighter::applyFormat(int offset,
try
{
try
{
itemData
=
definition
->
itemData
(
itemDataName
);
itemData
=
definition
->
itemData
(
itemDataName
);
}
catch
(
const
HighlighterException
&
)
{
}
catch
(
const
HighlighterException
&
)
{
// Although the formatting is skipped this case does not break the highlighter. In fact,
// There are broken files which Kate can cope with. For instance the Printf context in
// currently there are broken xml definition files which Kate can cope with. For instance,
// java.xml points to an inexistent Printf item data. These are taken as normal text.
// the Printf context in java.xml points to an inexistent Printf item data.
return
;
return
;
}
}
QTextCharFormat
format
=
m_genericFormats
.
value
(
itemData
->
style
());
if
(
itemData
->
style
()
!=
ItemData
::
kDsNormal
)
{
QTextCharFormat
format
=
m_genericFormats
.
value
(
itemData
->
style
());
if
(
itemData
->
isCustomized
())
{
// Please notice that the following are applied every time for item datas which have
if
(
itemData
->
isCustomized
())
{
// customizations. The configureFormats method could be used to provide a "one time"
// Please notice that the following are applied every time for item datas which have
// configuration, but it would probably require to traverse all item datas from all
// customizations. The configureFormats method could be used to provide a "one time"
// definitions available/loaded (either to set the values or for some "notifying"
// configuration, but it would probably require to traverse all item datas from all
// strategy). This is because the highlighter does not really know on which definition(s)
// definitions available/loaded (either to set the values or for some "notifying"
// it is working. Since not many item datas specify customizations I think this approach
// strategy). This is because the highlighter does not really know on which
// would fit better. If there are other ideas...
// definition(s) it is working. Since not many item datas specify customizations I
if
(
itemData
->
color
().
isValid
())
// think this approach would fit better. If there are other ideas...
format
.
setForeground
(
itemData
->
color
());
if
(
itemData
->
color
().
isValid
())
if
(
itemData
->
isItalicSpecified
())
format
.
setForeground
(
itemData
->
color
());
format
.
setFontItalic
(
itemData
->
isItalic
());
if
(
itemData
->
isItalicSpecified
())
if
(
itemData
->
isBoldSpecified
())
format
.
setFontItalic
(
itemData
->
isItalic
());
format
.
setFontWeight
(
toFontWeight
(
itemData
->
isBold
()));
if
(
itemData
->
isBoldSpecified
())
if
(
itemData
->
isUnderlinedSpecified
())
format
.
setFontWeight
(
toFontWeight
(
itemData
->
isBold
()));
format
.
setFontUnderline
(
itemData
->
isUnderlined
());
if
(
itemData
->
isUnderlinedSpecified
())
if
(
itemData
->
isStrikedOutSpecified
())
format
.
setFontUnderline
(
itemData
->
isUnderlined
());
format
.
setFontStrikeOut
(
itemData
->
isStrikedOut
());
if
(
itemData
->
isStrikedOutSpecified
())
}
format
.
setFontStrikeOut
(
itemData
->
isStrikedOut
());
}
setFormat
(
offset
,
count
,
format
);
setFormat
(
offset
,
count
,
format
);
}
}
}
void
Highlighter
::
applyVisualWhitespaceFormat
(
const
QString
&
text
)
void
Highlighter
::
applyVisualWhitespaceFormat
(
const
QString
&
text
)
...
@@ -443,8 +444,6 @@ void Highlighter::configureFormats(const TextEditor::FontSettings & fs)
...
@@ -443,8 +444,6 @@ void Highlighter::configureFormats(const TextEditor::FontSettings & fs)
m_visualWhitespaceFormat
=
fs
.
toTextCharFormat
(
m_visualWhitespaceFormat
=
fs
.
toTextCharFormat
(
QLatin1String
(
TextEditor
::
Constants
::
C_VISUAL_WHITESPACE
));
QLatin1String
(
TextEditor
::
Constants
::
C_VISUAL_WHITESPACE
));
m_genericFormats
[
ItemData
::
kDsNormal
]
=
fs
.
toTextCharFormat
(
QLatin1String
(
TextEditor
::
Constants
::
C_TEXT
));
m_genericFormats
[
ItemData
::
kDsKeyword
]
=
fs
.
toTextCharFormat
(
m_genericFormats
[
ItemData
::
kDsKeyword
]
=
fs
.
toTextCharFormat
(
QLatin1String
(
TextEditor
::
Constants
::
C_KEYWORD
));
QLatin1String
(
TextEditor
::
Constants
::
C_KEYWORD
));
m_genericFormats
[
ItemData
::
kDsDataType
]
=
fs
.
toTextCharFormat
(
m_genericFormats
[
ItemData
::
kDsDataType
]
=
fs
.
toTextCharFormat
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment