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
27ef2148
Commit
27ef2148
authored
Dec 08, 2021
by
Waqar Ahmed
Committed by
Tomaz Canabrava
Dec 12, 2021
Browse files
Inline EscapeSequenceUrlExtractor::appendUrlText
parent
e76442a5
Pipeline
#108790
passed with stage
in 2 minutes and 3 seconds
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/EscapeSequenceUrlExtractor.cpp
View file @
27ef2148
...
...
@@ -6,6 +6,7 @@
*/
#include
"EscapeSequenceUrlExtractor.h"
#include
"Screen.h"
#include
<QUrl>
...
...
@@ -19,22 +20,13 @@ void Konsole::EscapeSequenceUrlExtractor::setScreen(Konsole::Screen *screen)
clear
();
}
bool
EscapeSequenceUrlExtractor
::
reading
()
const
{
return
_reading
;
}
void
EscapeSequenceUrlExtractor
::
beginUrlInput
()
{
_reading
=
true
;
}
void
EscapeSequenceUrlExtractor
::
appendUrlText
(
QChar
c
)
void
EscapeSequenceUrlExtractor
::
appendUrlText
_impl
(
QChar
c
)
{
if
(
!
reading
())
{
return
;
}
if
(
_currentUrl
.
text
.
isEmpty
())
{
// We need to on getCursorX because we want the position of the
// last printed character, not the cursor.
...
...
src/EscapeSequenceUrlExtractor.h
View file @
27ef2148
...
...
@@ -8,12 +8,12 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include
"Screen.h"
#include
<QObject>
#include
<QPointer>
namespace
Konsole
{
class
Screen
;
/* Like QPoint, but with Row / Col
* easier to read than x / y
*/
...
...
@@ -64,6 +64,8 @@ private:
/* Pointer to the Screen, that actually holds the text data. */
Screen
*
_screen
;
void
appendUrlText_impl
(
QChar
c
);
public:
/* This needs to have access to the Session
* calculate the row / col of the current URL.
...
...
@@ -78,7 +80,10 @@ public:
void
setScreen
(
Screen
*
screen
);
/* If we are parsing a URL */
bool
reading
()
const
;
bool
reading
()
const
{
return
_reading
;
}
/* We found an URL, starting to parse */
void
beginUrlInput
();
...
...
@@ -91,7 +96,13 @@ public:
/* The URL is parsed at once, but not the text. We received
* one character per time until we hit the end byte. */
void
appendUrlText
(
QChar
c
);
void
appendUrlText
(
QChar
c
)
{
if
(
!
reading
())
{
return
;
}
appendUrlText_impl
(
c
);
}
/* The URL is parsed at once, store it at once. */
void
setUrl
(
const
QString
&
url
);
...
...
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