Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
b1a024e5
Commit
b1a024e5
authored
Apr 29, 2009
by
mae
Browse files
some corner cases fixing
parent
cbd85651
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/texteditor/basetexteditor.cpp
View file @
b1a024e5
...
...
@@ -2378,8 +2378,8 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
extraAreaHighlightCollapseEndBlockNumber
=
d
->
m_highlightBlocksInfo
.
close
.
first
();
endIsVisible
=
doc
->
findBlockByNumber
(
extraAreaHighlightCollapseEndBlockNumber
).
isVisible
();
if
(
TextBlock
UserData
::
hasCollapseAfter
(
doc
->
findBlockByNumber
(
extraAreaHighlightCollapseBlockNumber
-
1
)
))
{
Q
TextBlock
before
=
doc
->
findBlockByNumber
(
extraAreaHighlightCollapseBlockNumber
-
1
);
if
(
TextBlockUserData
::
hasCollapseAfter
(
before
))
{
extraAreaHighlightCollapseBlockNumber
--
;
}
}
...
...
@@ -2698,12 +2698,15 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e)
int
collapseBoxWidth
=
fontMetrics
().
lineSpacing
()
+
1
;
if
(
e
->
pos
().
x
()
>
extraArea
()
->
width
()
-
collapseBoxWidth
)
{
d
->
extraAreaHighlightCollapseBlockNumber
=
cursor
.
blockNumber
();
if
(
!
TextBlockUserData
::
hasClosingCollapse
(
cursor
.
block
()))
if
(
TextBlockUserData
::
canCollapse
(
cursor
.
block
())
||
!
TextBlockUserData
::
hasClosingCollapse
(
cursor
.
block
()))
d
->
extraAreaHighlightCollapseColumn
=
cursor
.
block
().
length
()
-
1
;
if
(
!
d
->
m_displaySettings
.
m_fancyFoldingBar
&&
TextBlockUserData
::
hasCollapseAfter
(
cursor
.
block
()))
{
d
->
extraAreaHighlightCollapseBlockNumber
++
;
if
(
!
TextBlockUserData
::
hasClosingCollapse
(
cursor
.
block
().
next
()))
d
->
extraAreaHighlightCollapseColumn
=
-
1
;
if
(
TextBlockUserData
::
canCollapse
(
cursor
.
block
().
next
())
||
!
TextBlockUserData
::
hasClosingCollapse
(
cursor
.
block
().
next
()))
d
->
extraAreaHighlightCollapseColumn
=
cursor
.
block
().
next
().
length
()
-
1
;
}
}
...
...
@@ -3299,8 +3302,9 @@ bool TextBlockUserData::findPreviousBlockOpenParenthesis(QTextCursor *cursor, bo
if
(
block
==
cursor
->
block
())
{
if
(
position
-
block
.
position
()
<=
paren
.
pos
+
(
paren
.
type
==
Parenthesis
::
Closed
?
1
:
0
))
continue
;
if
(
checkStartPosition
&&
paren
.
type
==
Parenthesis
::
Opened
&&
p
osition
==
cursor
->
position
())
if
(
checkStartPosition
&&
paren
.
type
==
Parenthesis
::
Opened
&&
p
aren
.
pos
==
cursor
->
position
())
{
return
true
;
}
}
if
(
paren
.
type
==
Parenthesis
::
Closed
)
{
++
ignore
;
...
...
@@ -3820,6 +3824,10 @@ void BaseTextEditor::setDisplaySettings(const DisplaySettings &ds)
}
d
->
m_displaySettings
=
ds
;
d
->
extraAreaHighlightCollapseBlockNumber
=
d
->
extraAreaHighlightCollapseColumn
=
-
1
;
d
->
m_highlightBlocksInfo
=
BaseTextEditorPrivateHighlightBlocks
();
viewport
()
->
update
();
extraArea
()
->
update
();
}
void
BaseTextEditor
::
setStorageSettings
(
const
StorageSettings
&
storageSettings
)
...
...
src/plugins/texteditor/basetexteditor.h
View file @
b1a024e5
...
...
@@ -143,10 +143,12 @@ public:
inline
static
bool
hasCollapseAfter
(
const
QTextBlock
&
block
)
{
if
(
!
block
.
isValid
())
return
false
;
TextBlockUserData
*
data
=
static_cast
<
TextBlockUserData
*>
(
block
.
userData
());
if
(
data
&&
data
->
collapseMode
()
!=
NoCollapse
)
{
return
(
data
->
collapseMode
()
==
CollapseAfter
)
;
}
else
if
(
!
data
)
{
return
false
;
}
else
if
(
block
.
next
().
isValid
()
)
{
data
=
static_cast
<
TextBlockUserData
*>
(
block
.
next
().
userData
());
if
(
data
&&
data
->
collapseMode
()
==
TextBlockUserData
::
CollapseThis
&&
!
data
->
m_ifdefedOut
)
return
true
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment