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
Utilities
Kate
Commits
4ab70d77
Commit
4ab70d77
authored
Nov 01, 2022
by
Waqar Ahmed
Browse files
Fix removeDocument not called when removing widget
parent
a3179e18
Pipeline
#259242
failed with stage
in 4 minutes
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/lib/katetabbar.cpp
View file @
4ab70d77
...
...
@@ -387,7 +387,7 @@ void KateTabBar::setCurrentDocument(DocOrWidget docOrWidget)
setCurrentIndex
(
indexToReplace
);
}
void
KateTabBar
::
removeDocument
(
KTextEditor
::
Documen
t
*
doc
)
void
KateTabBar
::
removeDocument
(
DocOrWidge
t
doc
)
{
// purge LRU storage, must work
auto
erased
=
(
m_docToLruCounterAndHasTab
.
erase
(
doc
)
==
1
);
...
...
@@ -404,7 +404,7 @@ void KateTabBar::removeDocument(KTextEditor::Document *doc)
// if we have some tab limit, replace the removed tab with the next best document that has none!
if
(
m_tabCountLimit
>
0
)
{
quint64
maxCounter
=
0
;
DocOrWidget
docToReplace
=
static_cast
<
Q
Widget
*>
(
null
ptr
);
DocOrWidget
docToReplace
=
DocOr
Widget
::
null
(
);
for
(
const
auto
&
lru
:
m_docToLruCounterAndHasTab
)
{
// ignore stuff with tabs
if
(
lru
.
second
.
second
)
{
...
...
@@ -419,7 +419,7 @@ void KateTabBar::removeDocument(KTextEditor::Document *doc)
}
// any document found? replace the tab we want to close and be done
if
(
docToReplace
.
qobject
())
{
if
(
!
docToReplace
.
isNull
())
{
// mark the replace doc as "has a tab"
m_docToLruCounterAndHasTab
[
docToReplace
].
second
=
true
;
...
...
@@ -439,14 +439,10 @@ void KateTabBar::removeDocument(KTextEditor::Document *doc)
int
KateTabBar
::
documentIdx
(
DocOrWidget
doc
)
{
for
(
int
idx
=
0
;
idx
<
count
();
idx
++
)
{
QVariant
data
=
tabData
(
idx
);
if
(
!
data
.
isValid
())
{
continue
;
}
if
(
data
.
value
<
DocOrWidget
>
().
qobject
()
!=
doc
.
qobject
())
{
continue
;
const
QVariant
data
=
tabData
(
idx
);
if
(
data
.
value
<
DocOrWidget
>
().
qobject
()
==
doc
.
qobject
())
{
return
idx
;
}
return
idx
;
}
return
-
1
;
}
...
...
apps/lib/katetabbar.h
View file @
4ab70d77
...
...
@@ -63,7 +63,7 @@ public:
int
documentIdx
(
DocOrWidget
);
void
setTabDocument
(
int
idx
,
DocOrWidget
doc
);
DocOrWidget
tabDocument
(
int
idx
);
void
removeDocument
(
KTextEditor
::
Documen
t
*
doc
);
void
removeDocument
(
DocOrWidge
t
doc
);
void
setModifiedStateIcon
(
int
idx
,
KTextEditor
::
Document
*
doc
);
/**
...
...
apps/lib/kateviewspace.cpp
View file @
4ab70d77
...
...
@@ -727,7 +727,7 @@ void KateViewSpace::closeTabRequest(int idx)
m_registeredDocuments
.
removeOne
(
widget
);
m_tabBar
->
blockSignals
(
true
);
m_tabBar
->
remove
Tab
(
idx
);
m_tabBar
->
remove
Document
(
docOrWidget
);
m_tabBar
->
blockSignals
(
false
);
widget
->
deleteLater
();
...
...
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