Summary:
Great part of the code inside saveShortcuts and saveFavorites
is similar, extract it to a new function and call it.
Test Plan: Edited shortcuts, saved, saves where correct.
Reviewers: hindenburg, #konsole
Reviewed By: hindenburg, #konsole
Subscribers: konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13539
Summary:
It hides the scrollbar when there isn't enough lines to scroll.
This also affects KParts like Yakuake or Dolphin and others.
Test Plan: {F5780078}
Reviewers: hindenburg, #konsole, #vdg
Reviewed By: hindenburg, #konsole, #vdg
Subscribers: konsole-devel, mglb, zzag, Pitel, ngraham, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D11843
Summary: This enables text below scrollbar.
Test Plan:
The new trial: {F5912720}
The current Master: {F5912721}
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: Fuchs, ngraham, abetts, konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13543
Summary: This enables text below scroolbar.
Test Plan:
The new trial: {F5912720}
The current Master: {F5912721}
Reviewers: #konsole, hindenburg
Subscribers: Fuchs, ngraham, abetts, konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13543
Summary:
If anything throwed we would have a memleak,
this is smaller and safer.
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13538
Summary:
Removed some calls that the only thing it did was to forward
with the same arguments the call to another object, call the
object directly
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: pedroarthurp, konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12967
Summary:
Uniquely iterate over the sessions instead of checking
for all sessions inside of a terminal window. The tabs in
split view will have duplicate sessions.
Test Plan:
Open Konsole, run any application that will not quit, like top
split screen, duplicating the Views, close konsole.
top will appear in the list of applications that are opened twice.
Reviewers: hindenburg, #konsole
Reviewed By: hindenburg, #konsole
Subscribers: konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13364
Summary:
Remove TerminalDisplay::sessionIsPrimaryScreen(), and use Q_ASSERT
instead, where if _sessionController is actually a nullptr it means
the current konsole process is doomed anyway. Better catch such cases in
debug builds.
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: konsole-devel, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13271
Summary:
Make it possible to extend the selection when selecting text in
column/block mode, by holding down Alt+Ctrl+Shift.
Commit e5b7480966 disabled text selection
in apps running on the Alternate screen buffer, when they tell the
terminal they're interested in Mouse Tracking events, unless only the Shift
key is pressed; this accidentally prevented block selection mode from
working in that case. Tweak the condition, to also allow block selection
mode to work when Shift is pressed. Note that the selection can't be
extended in programs while Mouse Tracking events are enabled.
BUG: 331034
FIXED-IN: 18.08
Test Plan:
- Open a new tab and `cat` some file to have some text on the screen:
a - Select text with no modifier keys pressed
b - Select some text, press and hold Shift and extend the selection
c - Press and hold Alt+Ctrl, to select text in block mode, and while
still pressing Alt+Ctrl, press Shift and extend the selection in
block mode
- Open some file in vim, with normal mode `:set mouse=`, and repeat a, b, c
- Switch to visual mode in vim `:set mouse=a`:
- Hold down Shift and select text
- Hold down Shift+Alt+Ctrl and select text in column mode
- Note that extending the selection doesn't work in vim visual mode
(i.e. after the app indicates it's interested in Mouse Tracking events)
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, anthonyfieroni, konsole-devel, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13356
The commit for https://phabricator.kde.org/D7451 changed DND to use
startDragDistance or startDragTime. This can cause accidently DND of
tabs which creates new windows.
Summary:
Previously the code enabled sending emulated up/down key press events to
the terminal only if the current screen is the alternate buffer. The
problem with this approach is that when detaching a tab/view, a new
TerminalDisplay is constructed and _isPrimaryScreen is initialized to
true even though the current screen in the detached tab is the alternate
one.
Since the Session is preserved when detaching a tab, move that bit of
code to Session, and query the Session about the currently used screen
buffer.
Test Plan:
Before:
- Open a window with two tabs, and in one of them execute `man man`
- Make sure "Enable Alternate screen buffer scrolling" is enabled in the
current profile, and that you can can scroll in the alternate buffer
- Detach the tab showing the manual page, now scrolling doesn't work in
the alternate buffer
With the patch applied, scrolling should work after detaching the tab.
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13217
Summary:
In normal usage Konsole offsets the position of the mouse
by half a char so that the user can extend the selection to
the last column. When using programs interested with
mouse (vim, mc, aptitude, etc...) Konsole shouldn't apply
the offset since mouse events should always apply to the
character cell under the pointer. This patch sets the 'edge'
flag of getCharacterPosition to !_usesMouseTracking.
Reviewers: hindenburg, ahmadsamir
Reviewed By: hindenburg
Subscribers: konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13089
Summary:
Session:setUserTitle() changes various attributes of the current
session/tab, not just the title; change the name from "Title" to
"sessionAttribute" as that's more representative of what the function
does. Propagate the change where appropriate throughout the code.
Remove Vt102Emulation::requestWindowAttribute(), as it's not used
anywhere.
Update a couple of links to Qt and XTerm documentation, respectively.
Test Plan:
Every thing should work as before, for example changing the window title:
- "Show window title on the titlebar" must be enabled
- unset PROMPT_COMMAND (in case it already sets the window title)
- Change the window title:
`printf "\033]2;%s\007" "testing"`
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, konsole-devel, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13147
Summary:
Previously the logic was to set "usesMouse" (Emulation
MODE_Mouse100{0,1,2,3}) to false to indicate that the program running
in the terminal supports handling mouse events itself, i.e. the program
is interested in receiving Mouse Tracking events; or set to true otherwise.
Since this was confusing, use the inverse logic by replacing "usesMouse"
with "usesMouseTracking".
"usesMouseTracking" is set to true when the program running in the shell
indicates it's interested in receiving Mouse Tracking events. Or false
otherwise.
For example, vim indicates it's interested in receiving Mouse Tracking
evnets when using visual mouse mode:
http://vimdoc.sourceforge.net/htmldoc/intro.html#Normal
Mouse Tracking is an XTerm extension, for more information examine:
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
Test Plan:
Before:
- Execute `printf '\e[?1003h'` to enable mouse tracking mode in konsole, now when you move the mouse events will be sent to the terminal when you move, click, drag the mouse
- Pressing and holding the Shift key should let the mouse act as normal
- Open a new tab or execute `printf 'e[?1003l'`, then open any file in vim, `:set mouse=a` then select some text with the mouse, note that VISUAL is displayed at the bottom of the window; right clicking _doesn't_ show the context menu as you'd expecte
- Pressing and holding the Shift key should let the mouse act as normal
Apply the diff, build, and try again, everything should work as before.
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, konsole-devel, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13134
Summary:
Make the Qt 5.9 sentence present tense since we already
passed that version, and add a minor grammar update.
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: ngraham, hindenburg, konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13125
Summary:
The key (the part before modifiers) is interpreted by QKeySequence.
For special keys (everything except printable characters), it uses names
from `Qt::Key` without `Key_` prefix. For character keys, it uses the
character itself, and it is not possible to use e.g. `Comma`. For this
reason limited set of characters limits possible key bindings.
BUG: 385380
FIXED-IN: 18.08
Test Plan:
* In profile's key bindings settings (or your keysym file) create entry:
```
key ,-Shift+Ctrl-Alt+Ansi : "Hello from keysym"
```
* Change `-Alt` to `+Alt` if you have a conflict. Do not change shift
(the shortcut would trigger on `<` instead of `,`). You can also use
e.g. ``;'[]=` instead of `,`. AltGr+letter works too, so `ą`, `á`, etc.
can be used.
* Save and close settings
* Press `Ctrl+,`
Expected result: "Hello from keysym" is typed
Actual result:
* the key binding does not work
* empty rows appear in key bindings table
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, konsole-devel, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13081
Summary:
Ignore control characters in the text part of Xpe (OSC, Operating System
Control) of the form "ESC]Pn;Pt\a" escape sequences; this matches what
XTerm docs say.
If userTitle is an empty string, set the window title to a blank space
when showWindowTitleOnTitleBar is enabled; basically if the user sets
the title to an empty string, leave it as-is.
BUG: 315581
FIXED-IN: 18.08
Test Plan:
- unset PROMPT_COMMAND, in case the shell is configured to set the
window title via that variable
- Make sure "Show window title on the title bar" is enabled
- Execute:
$ /usr/bin/echo -e 'j\e]2;\n\aj'
- The window title is changed to the tab title text; and the output
looks like this:
j
j
- Apply the diff, build, and try again, the window title should be
set to an empty string (really a blank space), and the output
should look like:
jj
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: konsole-devel, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13078
Summary:
Add a few bytes to a small arrays on stack in order to make compiler
happy. Those warnings are invalid in this context (as long as terminal
width and height are not larger than 8-digits-long number).
BUG: 394565
Test Plan:
* Build Konsole with GCC 8 and `-Wformat-truncation` flag
Expected result: no format-truncation warnings
Actual result: three format-truncation warnings appear
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, konsole-devel, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D13080
Summary:
StackedViewContainer is a plain view container with no navigiations.
It can be replaced using TabbedViewContainer and hiding the tabbar.
This will minimize duplicate code and allow easier control of code
in Konsole and KonsolePart.
Test Plan:
Run konsole and konsole part test, and then
use the shortcuts to create tab.
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: pedroarthurp, konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12964
Summary:
This is not userfully, only adds more code and
the code is happy without it.
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12965
Summary:
- Change updateKeyBindingsList() to select the last edited keybindings
scheme after closing the editor dialog
- Add a tooltip showing the path of each keybinding scheme, this should
lessen the confusion when the scheme description and the file name of
the .keytab file are different
- Add a button to the Keyboard tab to reset a scheme to its default
values, this is only applicable for schemes that exist in both
system-wide and user specific locations
- Move a lot of the construction of the keybinding editor widgets from
EditProfileDialog to KeyBindingEditor
- Change the wording from "key bindings list" to "key bindings scheme"
to differentiate between a keyboard translator "scheme" and the key
bindings "list" on the Keyboard tab
KeyBindingEditor:
- Make the KeyBindingEditor a QDialog and set Qt::WA_DeleteOnClose
- Disallow saving a scheme with an empty description
- Add a QLineEdit to show only the rows that have strings matching the
text entered in the line edit box
- Reimplement sizeHint() to make the dialog slightly smaller than the
Edit Profile dialog, for better visibility of the entries
KeyboardTranslatorManager:
- Make findTranslatorPath() const and public
- Make allTranslators() return type const
Test Plan:
- Editing a key bindings scheme works and closing the dialog selects the edited scheme
- Creating a new scheme works as before
- "Defaults" button works for system-wide schemes if they were previously edited and saved under the user's home dir
- Remove button is only enabled for schemes saved in a dir writable for the user
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: konsole-devel, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12981
Summary:
Use the new initialization syntax plus a initialization vector
to remove the need to call parser->addOption(QCommandLineOption
on every single command line option.
The code now store things in a vector, that is in fact slower
but this should be negligible, and the code is easier to extend
and to read.
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12966
Summary:
For debug builds, the function will fail when called with out of display
coordinates, allowing to spot addressing errors. For regular builds,
it will limit coordinates to valid area without triggering errors.
Depends on D12551
Test Plan: * Compiles, does not fail with use cases from previous commit
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: konsole-devel, hindenburg, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12553
The kmessagewidget was in the wrong location; instead of fixing that
just remove it in favor of using setPlaceholderText. The only way to
empty the profile name is from user interaction.
See https://phabricator.kde.org/D12523 for comments
Test Plan:
* run `printf '%.0skonsole ' $(seq 200)` to generate some words
* double click on the beginning of any word
* move mouse pointer right/bottom to extend selection
Expected result: the selection should extend word by word, with the
selection end being on the left or right side of a word located under
pointer
Actual result: right selection end extends character by character and
is located at fixed offset from the pointer
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, ngraham, konsole-devel, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12939
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:
This matches XTerm behaviour, so that pressing Alt+Backspace will send
\E + Del, which is the expected behaviour in some apps (e.g. emacs),
and it also matches the Konsole behaviour before commit
5345bbb0af
BUG: 394276
FIXED-IN: 18.04.2
Test Plan:
- Make sure you have the default .keytab file without any modifications
- Run `emacs -Q -nw`, press Ctrl+h k, to invoke the describe key functionality
- Press Alt+Backspace, it'll send C-M-h
- Apply the diff and test again, now it should send M-Del
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: konsole-devel, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12899
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:
Any process that is called in foreground with sudo (ex: sudo qtcreator) is identified by ProcessInfo::name only with the word sudo, being unable to identify which process it is. This fix makes it shows sudo along with the name of the process called.
Reviewers: #konsole, hindenburg
Reviewed by: #konsole, hindenburg
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12754
Summary:
Fixed cases mainly come from the fact that ScreenWindow can be
larger that TerminalDisplay's image, and the way how selection area is
bounded (character's left edge, not first/last character in selection).
Test Plan:
* Compile with ASAN
* Turn on blinking cursor
* Slowly change window size to less than 1 line or less than 1 column
* If everything is still ok, run `top` or anything that generates longer
output
Expected result: no overflows
* Random selections (normal/block/line/word):
* on screen in left/right direction
* on screen + in history
* selecting history up
* selecting history down
* first/last character → last/first character in the line
* first/last character → last/first character on the screen
* all above with wide characters
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: konsole-devel, hindenburg, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12551
Summary:
Move the Q_DECLARE_OPERATORS_FOR_FLAGS macro declaration for the
DecodingOption enum to the Konsole namespace. This should fix a bug that
happens when KeyboardTranslator.h is included in Screen.h (either
directly or indirectly), where the compiler doesn't find the |() operator
of the QFlags class.
I haven't pinpointed where the conflicting |() operator is coming from
exactly, but moving the macro declaration to the Konsole namespace
matches how other QFlags are used through out the code (and matches
upstream doc examples).
Test Plan:
- Add this include to Screen.h and try to compile:
#include "KeyboardTranslator.h"
- The compilation fails in SessionController.cpp:
error: invalid conversion from 'int' to 'Konsole::Screen::DecodingOption'
The line it fails on is 1200:
QString selectedText = _view->screenWindow()->selectedText(Screen::PreserveLineBreaks | Screen::TrimLeadingWhitespace | Screen::TrimTrailingWhitespace);
- Apply the diff and build again, the build should complete
I tested the options from the DecodingOption enum from the Screen class and they still work as before
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12797
Summary:
Prepend a 0 to the VERSION_MICRO part of the KONSOLE_VERSION string
to make the env var length consistent, so that conditions that depend
on it actually work.
For example, the second version should be higher than the first one:
18.04.12 -> 180412
18.08.1 -> 180801
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12733
Summary:
Before this commit when Konsole was trying to render a character that
didn't exist in the font selected by user, it'd fall back to default font provided
by font config without any hints that it needs monospace fonts which usually
would be a sans font.
Now Konsole hints system that it needs a monospace font.
BUG: 393620
Reviewers: hindenburg
Reviewed By: hindenburg
Subscribers: #konsole, hindenburg, mglb, ahmadsamir
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12614
Summary: {F5822474}
Test Plan:
* Turn on IME (tested with ibus+anthy)
* Type (without accepting) long text using IME
Expected result: text should not be drawn outside terminal
Actual result: text is drawn on terminal, margins, scrollbar
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12556
Summary:
The env var is exported as a numeric string (by removing the dots from
the version string), this has the benefit of making it simpler to compare
the version in shell arithmetic expressions.
This should help programms like neovim check if konsole has support
for terminal capabilities (e.g. DECSCUSR) by using a condition that
checks the konsole version. See also:
https://github.com/neovim/neovim/issues/8300
CCBUG: 347323
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12621
Summary:
When mouse pointer is mapped to character position, the algorithm
rounds the position to the nearest left edge of a character. This makes
sense for selections, but not for hotspots like links, where "character
under the pointer" is better solution. This patch adds edge mode as an
option to `getCharacterPosition` and disables it for hotspots.
Test Plan:
* Turn on "Underline links" option (Profile options → Mouse)
* Increase font size in Konsole so it will be easy to move mouse pointer
above left or right half of the character
* Run: `echo -e 'www.kde.org\033[31;41m \033[0m'`
* Place pointer on the right half of the 'g' character
Expected result: underline should have the same color as the link
Actual result: underline uses color from the next character on the right
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, #konsole
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12555
Summary:
When a user drags a file or folder onto the Konsole window, by far the
most common and likely thing they want to happen is for the path to
that item appear in the window. This is what virtually all other terminal
programs do by default. Konsole does not, and I suspect 99% of its
users do not know that this setting can be turned off, as I did not know
until I started digging through the code itself.
This patch makes the paste-as-text behavior happen by default for new
profiles. Super advanced users can re-enable the drag menu if they like it.
For most Konsole users, I think not having it presents vastly better
drag-and-drop usability and increases the speed of hybrid mouse+gui
operations. As such, I believe this is an important change for {T6831}.
I know changing defaults like this can be scary and controversial, but I
really do believe that the "paste as text" behavior is what 99% of drags
to konsole are intended for. It's not at all like Dolphin where a user may
reasonably want to copy or link instead of move.
FEATURE: 393523
FIXED-IN 18.08.0
Test Plan: Make a new user, open Konsole, drag a file or folder to the window; it's immediately pasted as text
Reviewers: #konsole, hindenburg, #vdg
Reviewed By: #konsole, hindenburg
Subscribers: abetts, hein, #plasma
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D12529