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
0dafd316
Commit
0dafd316
authored
Aug 22, 2022
by
Christoph Cullmann
🍨
Browse files
nicer caption for full path output of local files
show file @ directory this leads to better elide behavior
BUG: 441929
parent
a1a08e1c
Pipeline
#221351
passed with stage
in 5 minutes and 13 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
apps/lib/katemainwindow.cpp
View file @
0dafd316
...
...
@@ -1071,18 +1071,25 @@ void KateMainWindow::updateCaption(KTextEditor::Document *doc)
}
QString
c
;
const
auto
url
=
m_viewManager
->
activeView
()
->
document
()
->
url
();
if
(
m_viewManager
->
activeView
()
->
document
()
->
url
().
isEmpty
()
||
(
!
m_paShowPath
||
!
m_paShowPath
->
isChecked
()))
{
c
=
m_viewManager
->
activeView
()
->
document
()
->
documentName
();
}
else
{
c
=
m_viewManager
->
activeView
()
->
document
()
->
url
().
toString
(
QUrl
::
PreferLocalFile
);
const
QString
homePath
=
QDir
::
homePath
();
if
(
c
.
startsWith
(
homePath
))
{
c
=
QLatin1String
(
"~"
)
+
c
.
right
(
c
.
length
()
-
homePath
.
length
());
// we want some filename @ folder output to have chance to keep important stuff even on elide
if
(
url
.
isLocalFile
())
{
// perhaps shorten the path
const
QString
homePath
=
QDir
::
homePath
();
QString
path
=
url
.
toString
(
QUrl
::
RemoveFilename
|
QUrl
::
PreferLocalFile
|
QUrl
::
StripTrailingSlash
);
if
(
path
.
startsWith
(
homePath
))
{
path
=
QLatin1String
(
"~"
)
+
path
.
right
(
path
.
length
()
-
homePath
.
length
());
}
c
=
url
.
fileName
()
+
QStringLiteral
(
" @ "
)
+
path
;
}
else
{
c
=
url
.
toDisplayString
();
}
}
setWindowFilePath
(
m_viewManager
->
activeView
()
->
document
()
->
url
()
.
toString
(
QUrl
::
PreferLocalFile
));
setWindowFilePath
(
url
.
toString
(
QUrl
::
PreferLocalFile
));
QString
sessName
=
KateApp
::
self
()
->
sessionManager
()
->
activeSession
()
->
name
();
if
(
!
sessName
.
isEmpty
())
{
...
...
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