The selection point coordinates are relative to the start of the
scrollback, so when the scrollback shrinks, either because it is limited
to some amount of lines, or because it is cleared, we could end up with
stale coordinates which could cause a crash on a subsequent selection
extend operation.
BUG: 470346
VS16 (emoji presentation variation) may change the width of some
emoji characters from 1 to 2. With this commit, konsole changes the
character width in those cases.
Add a profile option to follow Unicode standard for the display width of
characters, where this width differs from glibc's wcwidth.
Currently the only character affected by this is soft hyphen (unicode 0x00ad).
Konsole generally follows wcwidth() function when determining the display
width of characters, since this is behaviour expected by libreadline, and
doing otherwise corrupts lines containing problematic characters. When such
characters are used more for display, then on the command line, following
the Unicode standard may be prefferable.
The default for this option is disabled - that is follow wcwidth().
CCBUG: 464823
Qt6 added assert for qBound when min > max.
This can happen if you try to select text that's after whitespace
because then length will be before start causing negative max.
Commits 4e69f47b and 9046680f where using an incorrect start of buffer
when trimming trailing spaces and trailing empty cells in a line from
the scrollback buffer. This could cause too short of a text to be
copied from the selection when there were trailing spaces in the
selection.
BUG: 461542
CCBUG: 455165
Similar to screen copy/scrollback mode it allows browsing the scrollback
and selecting text.
Selection is done either by standard GUI shift+arrows, or `vi` style with
`v` starting/ending selection.
BUG: 100317
QT can't be made to draw monospaced text (if the font does not cooperate),
so avoid combining characters, using a QPainter::drawText() call for each
character.
For bidi text support this change requires konsole to reorder and reshape
the characters. This is done using the ICU library (which QT also uses).
This change allows for some improvements related to text rendering:
- More precise bidi reordering, which is no longer changed by characters'
attributes and selection.
- underlines drawn separately from the text, allowing for differing
underline modes (double, curly, dashed, dotted, colored).
- Overriding font for emoji characters.
This commit fixes a few bugs and addresses a lot more:
Feature requests: More standard conforming RTL and various underlines:
BUG: 403729
BUG: 387811
Using non-monospace font:
BUG: 416508
BUG: 452087
BUG: 425973
BUG: 430822
BUG: 442742
BUG: 441037
BUG: 430822
Emoji:
BUG: 440070
CCBUG: 450017
CCBUG: 445846
CCBUG: 453086
Regression: devanagari rendering
CCBUG: 381593
CCBUG: 451716
Reported here:
https://mail.kde.org/pipermail/konsole-devel/2022-July/041429.html
- Use delete[] to free array allocated with new.
- Don't separate two cases which are handled identically.
- In vt100 parsing state machine no need to handle in specific states
characters which are handles identically in all states.
- Selecting Copy (or pressing ctrl-shift-c) when there is no selection
selects current output if current mode is output, current input if
current mode is input and input is non-empty, and last output if current
input is empty.
- Ctrl + mouse triple click selects the pointed input/output/prompt.
- There is also a fix that was missed in previous patch for keeping
track of current semantic mode through scrolls.
Bugs reported here:
https://invent.kde.org/utilities/konsole/-/merge_requests/691#note_480025
- Properly ignore OSC parameters for now. (later we'll support some).
- Handle Input end for when command gets shorter.
- Always draw separating line in foreground color
- Don't group characters of different REPL type.
- Don't reset double width/height attributes of erased lines.
- Add `OSC 133 ; *` escape sequences (where * stands for one of
A,B,C,D,L,P. For the shell to report text mode
(one of prompt/input/output).
- Store the mode of each character written to the screen.
- Replace isRealCharacter field in Character with flags.
- Store line length in _lineProperties array.
This flag is used for cells where the background is not drawn
unlike RE_CONCEAL, which draws background, but not foreground.
This flag is used for cells where an unmanaged image is placed.
When a line is reflowed then the vertical position of all
graphics placements above or below it (as appropriate) are
adjusted, so they remain in the same place relative to the
text lines.
When selecting past the last character, extend the selection to the last
column. This allows the user to know when the selection has extended
past the last character on a line, even in the presence of trailing
spaces, and will get a newline added to the last line.
This is the behavior of xterm, VTE and rxvt. mlterm doesn't allow
selections to extend past the last non-space character on a line.
BUG: 413426
CCBUG: 158726
Commit d37d3ac1 "CompactHistoryScroll: Remove _maxLineCount + 5 lines at
a time" caused a regression: addHistLine queried the number of lines in
history before and after adding a line, and if it had not incremented it
assumed one line entered history and another was dropped at the other
end. Now, lines are dropped from history in batches, so take care of
that.
Very similar to the regression fixed at 7a1e4768, only this one is about
keeping the scroll position on the presence of scroll, and that other
one is about keeping the selection.
Thanks to the bug reporters Michael and Luke-Jr for the heads-up.
BUG: 452955
BUG: 453112
When selecting, the last line gets an added newline if the characters
returned from copyLineToStream() are less than the cells selected on that
last line.
A weird behaviour was that after running:
printf ' v\n'
printf '\e[KSELECT ME\n'
printf '\e[31m\e[Kselect me\n'
printf '\e[0m ^\n'
selecting "SELECT ME " would add a newline, while
selecting "select me " would not add a newline.
This is a side-effect of clearImage() resizing lines which end with
spaces with the default rendition, so selecting the "SELECT ME" line
would get a count of 9 characters, which would make selecting more than
the initial 9 characters add a newline, while the "select me" line would
have additional spaces with isRealCharacter == false and a non-default
rendition.
Solve it but making copyLineToStream() not count and not pass to
PlainTextDecoder trailing characters where isRealCharacter == false.
Otherwise, weirdness ensues. e.g. if you do:
seq 1 $((LINES)); printf '\e[31m\ec'
and try to select the blank lines, the selection shows the previous
rendition color.
Commit c3b3ef19 introduced a regression when invoking the
clear-history-and-reset action. While RIS (Reset to Initial State) is
specified in DEC STD-070 as homing the cursor, konsole has grown some
hacks in the name of usability to preserve the command prompt line.
For a long time, it has sent two SIGWINCH with changed sizes after clear
and reset actions to force the shell to redraw the prompt (see d346a2cc,
temporarily disabled on 5d61b69e and re-added on 82778e87), which works
for bash, zsh, ksh, ...
tcsh doesn't redraw its prompt on SIGWINCH, but commit b8e96bcd modified
Screen::refresh() so instead of clearing the entire screen and homing
the cursor, it scrolled up everything but the last (usually the prompt)
line.
So, keep that last hack when called from clear-history-and-reset, and
behave as specified on DEC STD-070 otherwise.
Note that other ways of clearing the screen don't need hacks, e.g.
Ctrl-L, if handled at all, is handled by the shell, which then redraws
its prompt. Calling "clear" or invoking "printf '\ec'" will result in
the shell redrawing its prompt in the usual way.
BUG: 453568
malloc_trim is indeed a GNU extension, but an extension of glibc.
Relying on __GNUC__ unfortunately doesn't help with that. Check for
the actual presence of malloc_trim with cmake's check_function_exists
instead.
This fixes the build with musl libc, which doesn't come with
malloc_trim.
Co-authored-by: Ahmad Samir <a.samirh78@gmail.com>
Moving all cursor and scroll handling to addPlacement.
This requires the moveCursor parameter to have three possible values,
since Sixel cursor movement is not the same as Kitty/iterm2. This also
unnecessitates addPlacement return value.
BUG: 452476
(cherry picked from commit 9ae57f4e1d)
- Better handling of data pointer and errors for compressed data in kitty protocol
- Correct handling of iterator when erasing a placement.
- Use midRef() instead of mid().