Skip to content
GitLab
Menu
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
e1fb41a8
Commit
e1fb41a8
authored
Jun 08, 2021
by
Carlos Alves
Committed by
Kurt Hindenburg
Jun 15, 2021
Browse files
Access changes in CompactHistoryScroll
Added access changes using 'at()' at reflow code to avoid deep copy.
parent
4ce6ea91
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/history/compact/CompactHistoryScroll.cpp
View file @
e1fb41a8
/*
SPDX-FileCopyrightText: 2021-2021 Carlos Alves <cbcalves@gmail.com>
SPDX-FileCopyrightText: 1997, 1998 Lars Doelle <lars.doelle@on-line.de>
SPDX-License-Identifier: GPL-2.0-or-later
...
...
@@ -6,7 +7,6 @@
// Own
#include "CompactHistoryScroll.h"
#include "CompactHistoryType.h"
using
namespace
Konsole
;
...
...
@@ -43,16 +43,6 @@ void CompactHistoryScroll::removeFirstLine()
}
}
inline
int
CompactHistoryScroll
::
lineLen
(
const
int
line
)
const
{
return
line
==
0
?
_index
[
0
]
:
_index
[
line
]
-
_index
[
line
-
1
];
}
inline
int
CompactHistoryScroll
::
startOfLine
(
const
int
line
)
const
{
return
line
==
0
?
0
:
_index
[
line
-
1
];
}
void
CompactHistoryScroll
::
addCells
(
const
Character
a
[],
const
int
count
)
{
std
::
copy
(
a
,
a
+
count
,
std
::
back_inserter
(
_cells
));
...
...
@@ -132,13 +122,13 @@ void CompactHistoryScroll::removeCells()
bool
CompactHistoryScroll
::
isWrappedLine
(
const
int
lineNumber
)
const
{
Q_ASSERT
(
lineNumber
<
_index
.
size
());
return
(
_flags
[
lineNumber
]
&
LINE_WRAPPED
)
>
0
;
return
(
_flags
.
at
(
lineNumber
)
&
LINE_WRAPPED
)
>
0
;
}
LineProperty
CompactHistoryScroll
::
getLineProperty
(
const
int
lineNumber
)
const
{
Q_ASSERT
(
lineNumber
<
_index
.
size
());
return
_flags
[
lineNumber
]
;
return
_flags
.
at
(
lineNumber
)
;
}
int
CompactHistoryScroll
::
reflowLines
(
const
int
columns
)
...
...
src/history/compact/CompactHistoryScroll.h
View file @
e1fb41a8
/*
SPDX-FileCopyrightText: 2021-2021 Carlos Alves <cbcalves@gmail.com>
SPDX-FileCopyrightText: 1997, 1998 Lars Doelle <lars.doelle@on-line.de>
SPDX-License-Identifier: GPL-2.0-or-later
...
...
@@ -7,11 +8,7 @@
#ifndef COMPACTHISTORYSCROLL_H
#define COMPACTHISTORYSCROLL_H
// STD
#include <deque>
#include "konsoleprivate_export.h"
#include "history/HistoryScroll.h"
namespace
Konsole
...
...
@@ -49,8 +46,16 @@ private:
int
_maxLineCount
;
void
removeFirstLine
();
inline
int
lineLen
(
const
int
line
)
const
;
inline
int
startOfLine
(
const
int
line
)
const
;
inline
int
lineLen
(
const
int
line
)
const
{
return
line
==
0
?
_index
.
at
(
0
)
:
_index
.
at
(
line
)
-
_index
.
at
(
line
-
1
);
}
inline
int
startOfLine
(
const
int
line
)
const
{
return
line
==
0
?
0
:
_index
.
at
(
line
-
1
);
}
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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