_lineProperties is something that existed before. And in some Terminal
emulators it was used to wrap lines, I'm using it now to wrap lines
while resizing.
And improved the _history flux control when resizing.
There are plenty of bugs here, this is a *serious* wip.
This is also the biggest feature that is missing from konsole for
years and years.
todo:
- Handle history
- Handle increase of columns in terminal size
- handle new lines
Some improvements in calculations and safeguards when changing
cursor position, using defined value in Vt102Emulation.cpp to
protect the integers.
Added cursor position tests to ScreenTest.
Vt102Emulation MAX_ARGUMENT calculation wasn't correct, it was
sending an argument bigger than max argument.
The code commented with `nowrap!` has no use: `_cuX` and `_cuY` get
updated to this value on image resize. This code also appeared in
functions unrelated to horizontal wrapping.
I also took the liberty to update the conditions which determine whether
to use "default values". Before, the conditions only checked for zero
instead of (invalid) negative numbers (maybe a few Q_ASSERT's are
desired here?).
This path adds a new feature for konsole, in the form of URL Escaped
Sequences. It allows programs to embbed URL's on texts much like
the anchor tag in html does
There's a allowed list of possible schemas for links, by default
it only accepts http://, https:// and file:// but the user can
add more if he wants.
The maximum amount of URL's accepted is 200, to prevent OOM
History is taken into account while scrooling
This also allowed me to remove a few includes of Profile.h
around the codebase, that used Profile::Ptr. now the compilation
is a bit faster and also does not recompile things as often.
- It implements Cursor Next Line (CNL) sequence.
- It implments Cursor Previous Line (CPL) sequence.
- Ex: echo -e "Hello\e[3EWorld" or echo -e "Hello\e[3FWorld"
BUG: 418519
FIXED-IN: 20.08
https://invent.kde.org/utilities/konsole/-/merge_requests/116
'Konsole::Screen` defined an array of 1024 elements, where user
may resize the konsole to have more columns than this array can handle.
Selecting a row in such case, is going to cause a buffer-overflow.
Bug: 330066
Before we opened a link via mousePress but if we want to make a
selection that will open a file and drag.
Now we check if there is a selection before trying to open something.
So if you click and drag a url, it will not open. If you directly
click and release without dragging, it will open.
FIXED-IN: 20.08
https://invent.kde.org/utilities/konsole/-/merge_requests/9
Summary:
This behavior is present in e.g. xterm and linux console.
Currently when using CSI 2J escape sequence, screen contents are
appended to scrollback (including bottom empty lines). This is breaking
`clear` command, which replaces scrollback with current screen contents.
BUG: 384218
Test Plan:
* Start Konsole with a shell
* `clear`
**Expected result:**
Cleared display, empty scrollback.
**Actual result:**
Cleared display, but scrollback contains previous display contents.
---
* Start Konsole with a shell
* seq 1000
* `echo -ne '\033[2J`
**Expected result:**
Cleared display, numbers in last scrollback lines.
**Actual result:**
Cleared display, but scrollback contains previous display contents
(i.e. shell prompt in last lines)
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, konsole-devel, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D21282
Summary:
Replaces direct konsole_wcwidth() calls with Character object property
and the class static function, which internally still use
konsole_wcwidth().
The change also prepares the codebase for a new code for determining
character width. This way the change will barely touch existing code.
CCBUG: 396435
Test Plan:
konsole_wcwidth() is still used, just in one central place. Passed
compilation and CharacterWidthTest should be enough.
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D15756
Summary:
When there was at least one search attempt, search box is still opened,
and the screen and/or history is cleared, there is a high chance that
the line number remembered by the search is invalid. The line number is
used as the lines array index, so this can lead to overflow and crash.
This is at this moment fixed with a check in `copyLineToStream()`, which
is a generic function that happens to be used by search function and
where the line number is used. There still is an `assert` which is
triggered in debug builds.
The patch moves the check directly to a search function, where the line
number is initialized before first search.
Test Plan:
You have to do the test in debug build - there is a hack in
`copyLineToStream()` which prevents crash, but `assert` before it
catches an error condition.
* Run `seq 5000`
* Open search box, search for `000`
* Clear screen/history
* Search up/down
Actual result: Crash
Expected result: Search should begin from last/first visible line
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D14106
Summary:
Currently Unicode uses 0x10FFFF code points. It is possible to represent
all of them with up to two 16 bit values (UTF-16), but this makes it
harder to e.g. check for their width.
Some test cases were changed. Originally they were added with an
assumption that the code point will be truncated to 16 bit value and
as a result changed to another code point.
Test Plan:
* All code points <= 0xFFFF should work as before
* Start the same tmux session in two Konsoles
* Change background to fully transparent in one of them and put it in
front of the other one, so that all text will overlap
* Generate characters with (you can pipe it to `fold -s | less -r`):
```
perl -XCSDL -e 'print map{chr($_), " "} 1..0xffff'
```
* Compare output visually.
* Code points > 0xFFFF should not be truncated to 16 bits
* "𝐀" and "퐀" should be different characters
* Some code points > 0xFFFF should have single width
* Vertical lines below should align:
```
|𝐀 |
|𠀋|
```
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: konsole-devel, hindenburg, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12236
Summary:
Until now, the cursor was moved from last column to the next column
outside the screen. Since screen array is linear, it partially worked
like it was on the beginning of a next line (as long as it was not the
last line).
Test Plan:
* Run `cat > /dev/null` (shells do their own line wrapping, so will
not work)
* Move cursor to terminal's last visible line using enter
* Move cursor to terminal's last visible column by typing something
* Type one more character
Expected result: new line should appear with the cursor on the beginning
Actual result: cursor disappears, no new line
* Turn on blinking cursor
* Run `cat > /dev/null`
* Move cursor to terminal's last visible column by typing something
* Type one more character
Expected result: the cursor should move to new line's first column
and blink
Actual result: the cursor "moves" but does not blink
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: konsole-devel, hindenburg, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12554
Summary:
The lines are resized when something is put in them. Resizing them
here filled them with spaces (default value), later those trailing
spaces were put into history, and eventually into saved output or
clipboard (because it is assumed lines in history do not contain
trailing spaces).
BUG: 392419
Test Plan:
* Enable "Trim trailing spaces" in Profile Settings → Mouse
* Set window size to about 100x100px
* Clear terminal (Ctrl-Shift-K by default)
* Run:
```
seq $(( $(tput lines) * 2 )); \
printf '*** resize ***'; read -s; printf '\n'; \
seq $(( $(tput lines) * 2 ))
```
* When "resize" show up, resize the window to about 500x500px
* Press enter
* Select and copy lines below `*** resize ***`
* Paste it in a text editor which allows to show trailing spaces
Expected result: lines should not contain trailing spaces
Actual result: lines added when resizing the window have trailing spaces
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D11893
Patch by btown using lxde/qtermwidget@60221da by @yan12125
ECMA-48 8.3.103 describes the sequence CSI Pn b for repeating the
previous character in the data stream. This sequence has been present
in XTerm since January 1997 and has been added to the latest terminfo
entry for xterm-new and derived entries such as xterm-256color.
https://phabricator.kde.org/D10064