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
Konsole
Commits
274ebb98
Commit
274ebb98
authored
Sep 01, 2022
by
Matan Ziv-Av
Committed by
Tomaz Canabrava
Sep 05, 2022
Browse files
Add keyboard shortcut for toggling display of semantic hints
parent
660b78f7
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/Enumeration.h
View file @
274ebb98
...
...
@@ -61,10 +61,10 @@ public:
/** This enum describes semantic hints appearance
*/
enum
Semantic
Hints
{
Semantic
HintsNever
=
0
,
Semantic
HintsURL
=
1
,
Semantic
HintsAlways
=
2
,
enum
Hints
{
HintsNever
=
0
,
HintsURL
=
1
,
HintsAlways
=
2
,
};
/** This enum describes the shapes used to draw the cursor in terminal
...
...
src/ViewManager.cpp
View file @
274ebb98
...
...
@@ -288,6 +288,12 @@ void ViewManager::setupActions()
connect
(
action
,
&
QAction
::
triggered
,
this
,
&
ViewManager
::
semanticSetupBash
);
_viewContainer
->
addAction
(
action
);
action
=
new
QAction
(
i18nc
(
"@action Shortcut entry"
,
"Toggle semantic hints display"
),
this
);
collection
->
addAction
(
QStringLiteral
(
"toggle-semantic-hints"
),
action
);
collection
->
setDefaultShortcut
(
action
,
Qt
::
CTRL
|
Qt
::
ALT
|
Qt
::
Key_BracketLeft
);
connect
(
action
,
&
QAction
::
triggered
,
this
,
&
ViewManager
::
toggleSemanticHints
);
_viewContainer
->
addAction
(
action
);
action
=
new
QAction
(
this
);
action
->
setText
(
i18nc
(
"@action:inmenu"
,
"Equal size to all views"
));
collection
->
setDefaultShortcut
(
action
,
Konsole
::
ACCEL
|
Qt
::
SHIFT
|
Qt
::
Key_Backslash
);
...
...
@@ -500,6 +506,22 @@ void ViewManager::semanticSetupBash()
QChar
());
}
void
ViewManager
::
toggleSemanticHints
()
{
int
currentSessionId
=
currentSession
();
Q_ASSERT
(
currentSessionId
>=
0
);
Session
*
activeSession
=
SessionManager
::
instance
()
->
idToSession
(
currentSessionId
);
Q_ASSERT
(
activeSession
);
auto
profile
=
SessionManager
::
instance
()
->
sessionProfile
(
activeSession
);
profile
->
setProperty
(
Profile
::
SemanticHints
,
(
profile
->
semanticHints
()
+
1
)
%
3
);
auto
activeTerminalDisplay
=
_viewContainer
->
activeViewSplitter
()
->
activeTerminalDisplay
();
const
char
*
names
[
3
]
=
{
"Never"
,
"Sometimes"
,
"Always"
};
activeTerminalDisplay
->
showNotification
(
i18n
(
"Semantic hints "
)
+
i18n
(
names
[
profile
->
semanticHints
()]));
activeTerminalDisplay
->
update
();
}
QHash
<
TerminalDisplay
*
,
Session
*>
ViewManager
::
forgetAll
(
ViewSplitter
*
splitter
)
{
splitter
->
setParent
(
nullptr
);
...
...
src/ViewManager.h
View file @
274ebb98
...
...
@@ -402,6 +402,8 @@ private Q_SLOTS:
void
semanticSetupBash
();
void
toggleSemanticHints
();
private:
Q_DISABLE_COPY
(
ViewManager
)
...
...
src/terminalDisplay/TerminalDisplay.cpp
View file @
274ebb98
...
...
@@ -2867,7 +2867,6 @@ void TerminalDisplay::applyProfile(const Profile::Ptr &profile)
_bidiLineLTR
=
profile
->
bidiLineLTR
();
_bidiTableDirOverride
=
profile
->
bidiTableDirOverride
();
_semanticUpDown
=
profile
->
semanticUpDown
();
_semanticHints
=
profile
->
semanticHints
();
_semanticInputClick
=
profile
->
semanticInputClick
();
_trimLeadingSpaces
=
profile
->
property
<
bool
>
(
Profile
::
TrimLeadingSpacesInSelectedText
);
_trimTrailingSpaces
=
profile
->
property
<
bool
>
(
Profile
::
TrimTrailingSpacesInSelectedText
);
...
...
src/terminalDisplay/TerminalDisplay.h
View file @
274ebb98
...
...
@@ -340,11 +340,6 @@ public:
return
_semanticUpDown
;
}
int
semanticHints
()
const
{
return
_semanticHints
;
}
ColorSchemeWallpaper
::
Ptr
wallpaper
()
const
{
return
_wallpaper
;
...
...
@@ -790,7 +785,6 @@ private:
std
::
unique_ptr
<
KonsolePrintManager
>
_printManager
;
int
_semanticHints
;
bool
_semanticUpDown
;
bool
_semanticInputClick
;
};
...
...
src/terminalDisplay/TerminalPainter.cpp
View file @
274ebb98
...
...
@@ -66,12 +66,6 @@ static inline bool isLineCharString(const QString &string)
return
LineBlockCharacters
::
isLegacyComputingSymbol
(
ucs4
);
}
bool
isInvertedRendition
(
const
TerminalDisplay
*
display
)
{
auto
currentProfile
=
SessionManager
::
instance
()
->
sessionProfile
(
display
->
session
());
return
currentProfile
?
currentProfile
->
property
<
bool
>
(
Profile
::
InvertSelectionColors
)
:
false
;
}
void
TerminalPainter
::
drawContents
(
Character
*
image
,
QPainter
&
paint
,
const
QRect
&
rect
,
...
...
@@ -81,7 +75,9 @@ void TerminalPainter::drawContents(Character *image,
QVector
<
LineProperty
>
lineProperties
,
CharacterColor
const
*
ulColorTable
)
{
const
bool
invertedRendition
=
isInvertedRendition
(
m_parentDisplay
);
auto
currentProfile
=
SessionManager
::
instance
()
->
sessionProfile
(
m_parentDisplay
->
session
());
const
bool
invertedRendition
=
currentProfile
?
currentProfile
->
property
<
bool
>
(
Profile
::
InvertSelectionColors
)
:
false
;
const
Enum
::
Hints
semanticHints
=
currentProfile
?
static_cast
<
Enum
::
Hints
>
(
currentProfile
->
semanticHints
())
:
Enum
::
HintsNever
;
QVector
<
uint
>
univec
;
univec
.
reserve
(
m_parentDisplay
->
usedColumns
());
...
...
@@ -249,8 +245,7 @@ void TerminalPainter::drawContents(Character *image,
paint
.
setRenderHint
(
QPainter
::
Antialiasing
,
false
);
paint
.
setWorldTransform
(
textScale
.
inverted
(),
true
);
if
((
lineProperty
&
LINE_PROMPT_START
)
&&
((
m_parentDisplay
->
semanticHints
()
==
Enum
::
SemanticHintsURL
&&
m_parentDisplay
->
filterChain
()
->
showUrlHint
())
||
m_parentDisplay
->
semanticHints
()
==
Enum
::
SemanticHintsAlways
))
{
&&
((
semanticHints
==
Enum
::
HintsURL
&&
m_parentDisplay
->
filterChain
()
->
showUrlHint
())
||
semanticHints
==
Enum
::
HintsAlways
))
{
QPen
pen
(
m_parentDisplay
->
terminalColor
()
->
foregroundColor
());
paint
.
setPen
(
pen
);
paint
.
drawLine
(
leftPadding
,
textY
,
m_parentDisplay
->
contentRect
().
right
(),
textY
);
...
...
src/widgets/EditProfileDialog.cpp
View file @
274ebb98
...
...
@@ -489,9 +489,9 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr &profile)
false
,
// preview
{
// buttons
{
_generalUi
->
semanticHintsNever
,
Enum
::
Semantic
HintsNever
},
{
_generalUi
->
semanticHintsURL
,
Enum
::
Semantic
HintsURL
},
{
_generalUi
->
semanticHintsAlways
,
Enum
::
Semantic
HintsAlways
},
{
_generalUi
->
semanticHintsNever
,
Enum
::
HintsNever
},
{
_generalUi
->
semanticHintsURL
,
Enum
::
HintsURL
},
{
_generalUi
->
semanticHintsAlways
,
Enum
::
HintsAlways
},
},
};
setupButtonGroup
(
semanticHints
,
profile
);
...
...
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