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
37218fe8
Commit
37218fe8
authored
Dec 31, 2020
by
Tomaz Canabrava
Browse files
Revert "Reflow when executing an app"
This reverts commit
876a1752
.
parent
876a1752
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/Screen.cpp
View file @
37218fe8
...
...
@@ -383,36 +383,6 @@ bool Screen::isResize()
return
_isResize
;
}
// Not to production auxiliar functions to show what is written in screen or history
void
toDebug
(
const
Character
s
[],
int
count
,
bool
wrapped
=
false
)
{
QString
out
;
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
out
+=
s
[
i
].
character
;
}
qDebug
()
<<
out
<<
(
wrapped
?
" wrapped"
:
""
);
}
void
toDebug
(
const
QVector
<
Character
>
&
s
,
bool
wrapped
=
false
)
{
toDebug
(
s
.
data
(),
s
.
size
(),
wrapped
);
}
/////
int
Screen
::
getCursorLine
()
{
if
(
_currentModes
[
MODE_AppScreen
]
==
1
)
{
return
_savedState
.
cursorLine
;
}
return
_cuY
;
}
void
Screen
::
setCursorLine
(
int
newLine
)
{
if
(
_currentModes
[
MODE_AppScreen
]
==
1
)
{
_savedState
.
cursorLine
=
newLine
;
}
else
{
_cuY
=
newLine
;
}
}
void
Screen
::
resizeImage
(
int
new_lines
,
int
new_columns
)
{
if
((
new_lines
==
_lines
)
&&
(
new_columns
==
_columns
))
{
...
...
@@ -423,47 +393,41 @@ void Screen::resizeImage(int new_lines, int new_columns)
_oldTotalLines
=
getLines
()
+
getHistLines
();
_isResize
=
true
;
int
cursorLine
=
getCursorLine
();
const
int
oldCursorLine
=
(
cursorLine
==
_lines
-
1
)
?
new_lines
-
1
:
cursorLine
;
// First join everything.
int
currentPos
=
0
;
while
(
currentPos
<
cursorLine
&&
currentPos
<
_screenLines
.
count
()
-
1
)
{
// if the line have the 'LINE_WRAPPED' property, concat with the next line and remove it.
if
((
_lineProperties
[
currentPos
]
&
LINE_WRAPPED
)
!=
0
)
{
_screenLines
[
currentPos
].
append
(
_screenLines
[
currentPos
+
1
]);
_screenLines
.
remove
(
currentPos
+
1
);
_lineProperties
.
remove
(
currentPos
);
cursorLine
--
;
continue
;
}
currentPos
++
;
}
// Then move the data to lines below.
currentPos
=
0
;
while
(
currentPos
<
cursorLine
&&
currentPos
<
_screenLines
.
count
())
{
// Ignore whitespaces at the end of the line
int
lineSize
=
_screenLines
[
currentPos
].
size
();
while
(
lineSize
>
0
&&
QChar
(
_screenLines
[
currentPos
][
lineSize
-
1
].
character
).
isSpace
())
{
lineSize
--
;
if
(
new_columns
!=
_columns
)
{
while
(
currentPos
<
_cuY
&&
currentPos
<
_screenLines
.
count
()
-
1
)
{
// if the line have the 'LINE_WRAPPED' property, concat with the next line and remove it.
if
((
_lineProperties
[
currentPos
]
&
LINE_WRAPPED
)
!=
0
)
{
_screenLines
[
currentPos
].
append
(
_screenLines
[
currentPos
+
1
]);
_screenLines
.
remove
(
currentPos
+
1
);
_lineProperties
.
remove
(
currentPos
);
_cuY
--
;
continue
;
}
currentPos
++
;
}
const
bool
shouldCopy
=
lineSize
>
new_columns
;
// Copy from the current line, to the next one.
if
(
shouldCopy
)
{
auto
values
=
_screenLines
[
currentPos
].
mid
(
new_columns
);
_screenLines
[
currentPos
].
remove
(
new_columns
,
values
.
size
());
_lineProperties
.
insert
(
currentPos
+
1
,
_lineProperties
[
currentPos
]);
_screenLines
.
insert
(
currentPos
+
1
,
values
);
_lineProperties
[
currentPos
]
|=
LINE_WRAPPED
;
cursorLine
++
;
// Then move the data to lines below.
currentPos
=
0
;
while
(
currentPos
!=
_screenLines
.
count
()
&&
currentPos
!=
_cuY
)
{
const
bool
shouldCopy
=
_screenLines
[
currentPos
].
size
()
>
new_columns
;
// Copy from the current line, to the next one.
if
(
shouldCopy
)
{
_cuY
++
;
auto
values
=
_screenLines
[
currentPos
].
mid
(
new_columns
);
_screenLines
[
currentPos
].
remove
(
new_columns
,
values
.
size
());
_lineProperties
.
insert
(
currentPos
+
1
,
_lineProperties
[
currentPos
]);
_screenLines
.
insert
(
currentPos
+
1
,
values
);
_lineProperties
[
currentPos
]
|=
LINE_WRAPPED
;
}
currentPos
+=
1
;
}
currentPos
+=
1
;
}
// Check if it need to move from _screenLine to _history
while
(
cu
rsorLine
>
new_lines
-
1
)
{
while
(
_
cu
Y
>
new_lines
-
1
)
{
fastAddHistLine
();
cursorLine
--
;
}
_lineProperties
.
resize
(
new_lines
+
1
);
_screenLines
.
resize
(
new_lines
+
1
);
...
...
@@ -473,7 +437,6 @@ void Screen::resizeImage(int new_lines, int new_columns)
// Join next line from _screenLine to _history
while
(
_history
->
isWrappedLine
(
_history
->
getLines
()
-
1
))
{
fastAddHistLine
();
cursorLine
--
;
}
currentPos
=
0
;
// Join everything in _history
...
...
@@ -531,7 +494,7 @@ void Screen::resizeImage(int new_lines, int new_columns)
// Check cursor position and send from _history to _screenLines
ImageLine
histLine
;
histLine
.
reserve
(
1024
);
while
(
cu
rsorLine
<
oldCursorLine
&&
_history
->
getLines
())
{
while
(
_
cu
Y
<
new_lines
-
1
&&
_history
->
getLines
())
{
int
histPos
=
_history
->
getLines
()
-
1
;
int
histLineLen
=
_history
->
getLineLen
(
histPos
);
int
isWrapped
=
_history
->
isWrappedLine
(
histPos
)
?
LINE_WRAPPED
:
LINE_DEFAULT
;
...
...
@@ -540,7 +503,7 @@ void Screen::resizeImage(int new_lines, int new_columns)
_screenLines
.
insert
(
0
,
histLine
);
_lineProperties
.
insert
(
0
,
isWrapped
);
_history
->
removeCells
(
histPos
);
cu
rsorLine
++
;
_
cu
Y
++
;
}
_lineProperties
.
resize
(
new_lines
+
1
);
...
...
@@ -553,8 +516,7 @@ void Screen::resizeImage(int new_lines, int new_columns)
_lines
=
new_lines
;
_columns
=
new_columns
;
_cuX
=
qMin
(
_cuX
,
_columns
-
1
);
cursorLine
=
qBound
(
0
,
cursorLine
,
_lines
-
1
);
setCursorLine
(
cursorLine
);
_cuY
=
qMin
(
_cuY
,
_lines
-
1
);
// FIXME: try to keep values, evtl.
setDefaultMargins
();
...
...
@@ -1609,7 +1571,7 @@ void Screen::writeLinesToStream(TerminalCharacterDecoder* decoder, int fromLine,
void
Screen
::
fastAddHistLine
()
{
const
bool
removeLine
=
_history
->
getLines
()
==
_history
->
getMaxLines
();
bool
removeLine
=
_history
->
getLines
()
==
_history
->
getMaxLines
();
_history
->
addCellsVector
(
_screenLines
[
0
]);
_history
->
addLine
((
_lineProperties
[
0
]
&
LINE_WRAPPED
)
!=
0
);
...
...
@@ -1621,6 +1583,7 @@ void Screen::fastAddHistLine()
_screenLines
.
pop_front
();
_lineProperties
.
remove
(
0
);
_cuY
--
;
}
void
Screen
::
addHistLine
()
...
...
src/Screen.h
View file @
37218fe8
...
...
@@ -25,8 +25,7 @@
#define MODE_Screen 3
#define MODE_Cursor 4
#define MODE_NewLine 5
#define MODE_AppScreen 6
#define MODES_SCREEN 7
#define MODES_SCREEN 6
namespace
Konsole
{
class
TerminalCharacterDecoder
;
...
...
@@ -654,11 +653,6 @@ private:
// should be as minimal as possible
static
Character
*
getCharacterBuffer
(
const
int
size
);
// Get the cursor line after checking if its app mode or not
int
getCursorLine
();
// Set the cursor line after checking if its app mode or not
void
setCursorLine
(
int
newLine
);
int
getLineLength
(
const
int
line
)
const
;
// screen image ----------------
...
...
src/Vt102Emulation.cpp
View file @
37218fe8
...
...
@@ -1464,8 +1464,8 @@ void Vt102Emulation::resetMode(int m)
setScreen
(
0
);
break
;
}
// FIXME: Currently this has a redundant condition as MODES_SCREEN is
7
//
MODE_AppScreen is 6
and MODE_NewLine is 5
// FIXME: Currently this has a redundant condition as MODES_SCREEN is
6
// and MODE_NewLine is 5
if
(
m
<
MODES_SCREEN
||
m
==
MODE_NewLine
)
{
_screen
[
0
]
->
resetMode
(
m
);
_screen
[
1
]
->
resetMode
(
m
);
...
...
src/Vt102Emulation.h
View file @
37218fe8
...
...
@@ -20,21 +20,22 @@
class
QTimer
;
class
QKeyEvent
;
#define MODE_AppCuKeys (MODES_SCREEN+0) // Application cursor keys (DECCKM)
#define MODE_AppKeyPad (MODES_SCREEN+1) //
#define MODE_Mouse1000 (MODES_SCREEN+2) // Send mouse X,Y position on press and release
#define MODE_Mouse1001 (MODES_SCREEN+3) // Use Hilight mouse tracking
#define MODE_Mouse1002 (MODES_SCREEN+4) // Use cell motion mouse tracking
#define MODE_Mouse1003 (MODES_SCREEN+5) // Use all motion mouse tracking
#define MODE_Mouse1005 (MODES_SCREEN+6) // Xterm-style extended coordinates
#define MODE_Mouse1006 (MODES_SCREEN+7) // 2nd Xterm-style extended coordinates
#define MODE_Mouse1007 (MODES_SCREEN+8) // XTerm Alternate Scroll mode; also check AlternateScrolling profile property
#define MODE_Mouse1015 (MODES_SCREEN+9) // Urxvt-style extended coordinates
#define MODE_Ansi (MODES_SCREEN+10) // Use US Ascii for character sets G0-G3 (DECANM)
#define MODE_132Columns (MODES_SCREEN+11) // 80 <-> 132 column mode switch (DECCOLM)
#define MODE_Allow132Columns (MODES_SCREEN+12) // Allow DECCOLM mode
#define MODE_BracketedPaste (MODES_SCREEN+13) // Xterm-style bracketed paste mode
#define MODE_total (MODES_SCREEN+14)
#define MODE_AppScreen (MODES_SCREEN+0) // Mode #1
#define MODE_AppCuKeys (MODES_SCREEN+1) // Application cursor keys (DECCKM)
#define MODE_AppKeyPad (MODES_SCREEN+2) //
#define MODE_Mouse1000 (MODES_SCREEN+3) // Send mouse X,Y position on press and release
#define MODE_Mouse1001 (MODES_SCREEN+4) // Use Hilight mouse tracking
#define MODE_Mouse1002 (MODES_SCREEN+5) // Use cell motion mouse tracking
#define MODE_Mouse1003 (MODES_SCREEN+6) // Use all motion mouse tracking
#define MODE_Mouse1005 (MODES_SCREEN+7) // Xterm-style extended coordinates
#define MODE_Mouse1006 (MODES_SCREEN+8) // 2nd Xterm-style extended coordinates
#define MODE_Mouse1007 (MODES_SCREEN+9) // XTerm Alternate Scroll mode; also check AlternateScrolling profile property
#define MODE_Mouse1015 (MODES_SCREEN+10) // Urxvt-style extended coordinates
#define MODE_Ansi (MODES_SCREEN+11) // Use US Ascii for character sets G0-G3 (DECANM)
#define MODE_132Columns (MODES_SCREEN+12) // 80 <-> 132 column mode switch (DECCOLM)
#define MODE_Allow132Columns (MODES_SCREEN+13) // Allow DECCOLM mode
#define MODE_BracketedPaste (MODES_SCREEN+14) // Xterm-style bracketed paste mode
#define MODE_total (MODES_SCREEN+15)
namespace
Konsole
{
extern
unsigned
short
vt100_graphics
[
32
];
...
...
Write
Preview
Supports
Markdown
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