Commit Graph

4910 Commits

Author SHA1 Message Date
Nicolas Fella
562f8e444f Port from KIconLoader::loadIcon to KIconUtils::addOverlay + QIcon::fromTheme
This fixes the rendering on highdpi screens
2021-04-27 01:12:26 +02:00
Jan Blackquill
9f7cb32dc2 Use inverted colours when calculated fancy BG has too low contrast
BUG: 435309
2021-04-26 13:33:55 +00:00
Lucas Biaggi
29e86ddeb7 Add ability to load/save session layouts(split views) and add default layouts
Add three layouts to the toolbar; add --layout <file> to the command line.
The 3 defaults layouts are 2x2, 2x1, 1x2

GUI:
2021-04-24 21:30:11 +00:00
Kurt Hindenburg
4227a7bccb Port away from from deprecated QPrinter::pageRect() 2021-04-17 16:00:05 -04:00
Kurt Hindenburg
bd3de37467 Add a TODO about Qt6 removing QFont::ForceIntegerMetrics 2021-04-17 14:27:54 -04:00
Kurt Hindenburg
68e9f474d1 Add comment in this file so it is in the generated file 2021-04-17 13:16:28 -04:00
Kurt Hindenburg
70ffd75e24 Remove code for pre Qt 5.15.0 versions 2021-04-17 10:31:17 -04:00
Luis Javier Merino Morán
fd1612ba3b Keep track of line properties for image update
Konsole wasn't really keeping track of changes to line rendition
attributes, and was just always marking for update the top line of
double-height lines. This didn't account for double-width lines, changes
back to single-width single-height, and did not provide proper support for
separate rendering of the bottom of double-height lines.

The effect can be seen on vttest "Test of known bugs" (9) -> "Erase
right half of double-width lines" (8), where a line is changed from
single-width to double-width and back. The line wasn't re-rendered on
each change, as it should.

Can also be tested with:

echo -e "\e[2J\e[1;1HTEST\n"; sleep 1; echo -e "\e[1;1H\e#6\e[2;1H"
2021-04-17 14:01:06 +00:00
Luis Javier Merino Morán
05d81656f2 Do not reflow double-height lines
Double height lines are actually two lines, the first with the top part
of the characters, the second with the bottom part. Reflowing could lead
to situations where we render a top part, a double height line with its
top and bottom parts, and a bottom part, which looks weird.
2021-04-17 14:01:06 +00:00
Luis Javier Merino Morán
3cd160f5a0 Prevent selecting beyond last column on double-width lines
There is a difference with xterm behavior: when the screen width is an
odd number of columns, xterm allows selecting up to columns/2+1, we just
allow selecting up to columns/2.
2021-04-17 14:01:06 +00:00
Luis Javier Merino Morán
9771b1d99d Make reflow aware of line rendition attributes
While DECDHL/DECDWL lines are not wrapped at the correct column, now at
least reflowing doesn't clear line rendition attributes, so resizing
Konsole and going back to the original size always recovers the original
content, including double-height/double-width status of each line.

Reflowing double-height lines doesn't make much sense, since a
double-height line actually consists of a top (T) and a bottom (B)
line. Shrinking them could lead to TTBB lines, which look weird. At
least now going back to the original size brings back the original
content in all its glory.
2021-04-17 14:01:06 +00:00
Luis Javier Merino Morán
57ce654da5 Support scrolling double-height/width lines
The scrollback buffer has support for a wrapped property for every line.
Extend it to support the line rendition attributes.
2021-04-17 14:01:06 +00:00
Luis Javier Merino Morán
c61e4cacb6 Allow writing only half of a double-height line
While DECHDL sequences should be used in pairs on adjacent lines, the
first line drawing the top half, and the second line drawing the bottom
half, apparently real VTxxx (or at least the VT220) terminals did draw
only the top or bottom of characters when confronted with an isolated
DECDHL line (https://retrocomputing.stackexchange.com/questions/18023/).
xterm has that same behavior. So behave likewise.
2021-04-17 14:01:06 +00:00
Luis Javier Merino Morán
2232ed6746 Fix selection on double width lines
TerminalDisplay::getCharacterPosition() should take double-width lines
into account to return the right column.
2021-04-17 14:01:06 +00:00
Luis Javier Merino Morán
e1e832f586 Don't clear line rendition on EL and partial ED
EL (Erase Line) should not reset the line rendition attribute to
single-width. ED (Erase Display) should only reset it for completely
cleared lines. ECH (Erase CHaracters) should obviously not reset it.
DECSED and DECSEL (Selective Erase, not supported by Konsole) should not
reset it.

This fixes a vttest test where a line is set to double-height-top and
then EL before writing its text and the double-height-bottom line below.

Can also be tested with:

echo -e "\e[2J\e[4;1HNormal\n\e#6DOUBLE\n\e#6DOUBLE\nNormal" &&
sleep 2; echo -e "\e[5;3H\e[1J\e[8;1H"
2021-04-17 14:01:06 +00:00
Luis Javier Merino Morán
4352df00d9 Use the correct last column for double-width lines
Some control functions special case the last column. When a line has
been set to double-width via DECDWL or DECDHL (double-height and
double-width), the correcr last column for that line should be used.
Control functions which special case the last column include TAB, CUF,
ICH and DECRC.

Can be tested with:

perl -E '$r=join "", map{$_%10}1..80; say "\e<\e[?40h\e[?3l\e[?7l$r";
         $s="L"."\tx"x4 ."\t\tR"; say "\e#3$s\n\e#4$s"'

The above tests that tabs don't travel beyond the last column in
double-width lines.  The last column (below columns 79 and 80 of
the previous line) should have an "R".

perl -E '$r=join "", map{$_%10}1..80; say "\e<\e[?40h\e[?3l\e[?7h$r";
         $s="L"."X"x36 ."\e[6C"."R"; say "\e#3$s\n\e#4$s"'

The above tests that CUF (Cursor Forward) doesn't travel beyond the last
column in double-width lines.  The last column (below columns 79 and 80
of the previous line) should have an "R".

perl -E '$r=join "", map{$_%10}1..80; say "\e<\e[?40h\e[?3l\e[?7h$r";
         $s="L"."X"x22 ."R"."x"x8 ."r"."\e[17D\e[16@";
         say "\e#3$s\n\e#4$s"'

The above tests that ICH (Insert CHaracters; VT200+) doesn't write past
the last column, visible on repaints (switch to another window and
back).

perl -E '$r=join "", map{$_%10}1..80; say "\e<\e[?40h\e[?3l\e[?7h$r";
         $s="L"."X"x38 ."r\e7\e[H\e8R"; say "\e#3$s\n\e#4$s"'

The above tests that DECRC (Restore Cursor) doesn't restore the cursor
to a position beyond the last column on double-width lines.  The last
column should have an "R", "r" should not be visible.

perl -E '$r=join "", map{$_%10}1..80; say "\e<\e[?40h\e[?3l\e[?7l$r";
         $s="L"."X"x38 ."R"; print "\e#6$s"'; sleep 5; echo

The above tests that the cursor stays at the rightmost column. The
cursor should stay over the "R" for 5 seconds.
2021-04-17 14:01:06 +00:00
Luis Javier Merino Morán
9ffe33a27a Fix appending characters at end of line in double width lines
Since double-width/double-height lines have room for just half the
characters, take that into account.

Can be tested with:

perl -E '$r=join "", map{$_%10}1..80; say "\e<\e[?40h\e[?3l\e[?7h$r";
         $s="L"."X"x38 ."RL"; say "\e#6$s"'

The above tests that appending characters to double-width lines in
DECAWM (Auto Wrap Mode) wraps at the correct last column. There should
appear a second line (single-width) with a single "L".

perl -E '$r=join "", map{$_%10}1..80; say "\e<\e[?40h\e[?3l\e[?7l$r";
         $s="L"."X"x42 ." TEST FAILED OUTOFBOUNDS R"; say "\e#6$s"'

The above tests that appending characters to double-width lines in
non-DECAWM (Auto Wrap Mode) doesn't write past the last column (visible
on repaints - switch to another window and back). The last column (below
columns 79 and 80 of prev line) should have an "R".
2021-04-17 14:01:06 +00:00
Luis Javier Merino Morán
398a665793 Fix positioning of double width/double height runs
When there were several runs of double width/double height runs with
differing color/rendition/line draw/..., the second and subsequent runs
were positioned wrong. Fix the calculation of the starting x position to
account for double width, and fix a bug were the y position was
incremented for every run instead of for every line.

Can be tested with:
perl -E '$s="\e[0mTEST\e[32mTEST\e[0m"; say "\e#3$s\n\e#4$s"'
2021-04-17 14:01:06 +00:00
Ahmad Samir
053a07ca7a FileFilter: match filename:lineNumber in current dir 2021-04-16 13:54:17 +00:00
Laurent Montel
6d3cbbb2dc GIT_SILENT: not necessary to forward class when we already include file 2021-04-12 07:14:13 +02:00
Ahmad Samir
c413d543c1 Fix QDialogButtonBox connections in the edit profile dialog
KPageDialog already creates the accepted()/rejected() connections, since
the code here created another connection, the accept() slot was being
called twice for each OK button click, with e.g. the profile name empty,
clicking Ok:
- the first time isProfileNameValid() would return false, and the saving
  would abort, as it should
- the second time around, isProfileNameValid() would return true since
  the name has been reverted to the original value in the Name line edit

The same goes for the reject() slot.

Also use a lambda instead of apply(), it's a very small method and this
was the code is more readable, since we don't need to jump back and forth.
2021-04-06 12:52:07 +02:00
Nate Graham
1c8db8a3fc Correct corrected string
It needed a few more tweaks to be fully consistent and gramatically
correct in English.
2021-04-05 08:27:50 -06:00
Nate Graham
a7efdb650f Correct gammar in "profile with this name already exists" message 2021-04-05 08:16:47 -06:00
Ahmad Samir
acd265efab Less delete calls in destructors
- If the QObject has a parent, the parent will take care of deleting it
- Use std::unique_ptr to manage pointer member variable
- Use '= default' with empty destructors
- Fix initialization of QTimer in constructor initialization list
2021-04-04 17:21:22 +00:00
Ahmad Samir
a7363fa53f Better management of member variables destruction in TerminalDisplay
Always pass a parent to a QObject constructor; this is always a good
idea, as it enforces the parent/child relationship, and it also means
the parent QObject will take care of deleting its children, less manual
'delete' calls.

_terminalPainter already has a TerminalDisplay parent object.

Use a std::unique_ptr to manage _printManager (it's not a QObject).
2021-04-04 15:33:05 +00:00
Ahmad Samir
46b56ecfa5 Use a KMessageWidget for profile-name related errors in the Edit dialog
A KMessageWidget is nicer than a modal dialog, and now we also
automatically switch to the General page when the user tries to save
the settings while there is an issue with the profile name.
2021-04-04 14:40:30 +00:00
Ahmad Samir
e805f086fe Change EditProfileDialog window title when creating a new profile
Now when creating a new profile, the title will be "Create new profile",
this is less confusing when the user tries to edit e.g. the Fallback profile,
which in effect will create a new profile as the Fallback one is immutable.
2021-04-04 14:40:30 +00:00
Tomaz Canabrava
ba81c56a5b Let the QObject hierarchy delete a QObject child
The terminalColor is a QWidget, created with the terminal display
as parent. if we are in the destructor that means that the
TerminalDisplay will delete this object when it's needed,
do not call delete directly.
2021-03-31 22:50:44 +00:00
Kai Uwe Broulik
c3982cfb12 Show display title in notifications
Makes it easier to identify the tab the notification came from, rather than
the usual "Session Default" or "Session Profile 1"
2021-03-31 19:49:52 +00:00
Ahmad Samir
4b3dca80f3 Port away from KInit, which is going to be removed in KF6
For details see: https://phabricator.kde.org/T12140
2021-03-28 21:29:04 +02:00
Carlos Alves
ec170136cc Fix comparing different types
Warns while comparing int and size_t
2021-03-26 06:22:24 -03:00
Carlos Alves
3b0a81feed Screen and HistoryScroll pointers to smart pointer
Those Classes are not QObject, so most of it's pointers could be changed
 to smart pointers with no problems.
Problem found when using QList<std::unique_ptr>: it wasn't possible to
use it. I'm using std containers instead.
2021-03-26 06:22:24 -03:00
Carlos Alves
73dabe19a2 Pointer to smart pointer in HighlighScrolledLines
Using std::unique_ptr
2021-03-26 06:22:24 -03:00
Carlos Alves
93380119ce Pointer to smart pointer in ColorSchemeWallpaper
Using std::unique_ptr
2021-03-26 06:22:24 -03:00
Carlos Alves
3bfe6125bd Change CompactHistoryBlockList pointer to unique pointer
Obs.: Qt containers can't use unique_ptr, I'm using std container.
2021-03-26 06:22:24 -03:00
Ahmad Samir
94505d94d4 Make the "Edit Current Profile" dialog modal
This should prevent opening two instance of the EditProfileDialog in the
same process, i.e. if "run all konsole windows in a single process" option is:
- Enabled, then opening the dialog will block user interaction with all
  other konsole windows (including tabs).
- Disabled, then open the dialog will block user interactin with all
  other tabs in the same window

This simplifies the code since it checked if such a dialog was open
somewhere else to prevent crashes.
2021-03-23 16:55:35 +00:00
Ahmad Samir
61a7947adb Show dialogs with show() rather than exec()
exec() creates a nested eventloop, which could lead to some nasty
crashes ...etc.

ProfileSettings::editSelected(): since the dialog is modal, the user
can't interact with the konsole window at all, so no chance of opening
another instance of the EditProfileDialog.
2021-03-23 16:55:35 +00:00
Kurt Hindenburg
9ec6f0aac0 Add a bunch of authors to the credits
This is long overdue as I haven't been keeping this up to date.
2021-03-23 11:11:25 -04:00
Ahmad Samir
1f480e36c7 Always sort the profiles by name in 'File -> New Tab'
With the Fallback profile always sorted at the top.
2021-03-19 02:18:23 +00:00
Ahmad Samir
bc41efd855 Fix crash in ProfileSettings; clone selected profile settings to new profile
- If there is no selection only enable the "New" button, this fixes a
  crash if you select a profile, then Ctrl+Click to unselect it, the set
  as default button would still be enabled and clicking it caused a crash

- If a profile is selected, clone its properties, otherwise the fallback
  profile properties will be used, this more expected
2021-03-19 02:13:20 +00:00
Carlos Alves
27cedc46e2 Change the content of HistoryLine using setCellsVectorAt
In compact history, instead of delete and add a new line, it will try
to change the line before delete and allocate memory.
2021-03-18 14:44:05 +00:00
Jan Paul Batrina
9d4df20536 Unmaximize terminal before moving to new tab
This ensures that all the other terminals (in other splits)
will still be visible after moving the maximized terminal
to a new tab.
2021-03-18 03:02:57 +00:00
Ahmad Samir
9cab175859 ProfileSettings: use generateUniqueName() when creating new profiles
This makes new profile name generation consistent everywhere.
2021-03-18 02:47:57 +00:00
Ahmad Samir
238a8b45ed ProfileManager: remove some fallback-profile-related code
After the previous commit the Fallback profile shouldn't be editable
at all.
2021-03-18 02:47:57 +00:00
Ahmad Samir
5ab8423139 Don't edit the Fallback profile, instead create a new one
This is a first step in simplifying the code; since the Fallback profile
doesn't have a file on disk, it's basically a corner-case that we have to
babysit in various places in the code.

Now when the user tries to "Edit current profile", if it's the Fallback
profile, a new profile is created, with a unique name "Profile 1",
"Profile 2" ...etc. This is similar to using the "New" button in the
ProfileSettings dialog.
2021-03-18 02:47:57 +00:00
Ahmad Samir
646408dd97 Clean up some more "favourite profile"-related code
- Since the favourite profile feature was removed in commit 28ba920c82,
there is no need to sort profiles by menu index, this simlifies the code
some more.

- Remove Profile::menuIndexAsInt() method, now it's not used anywhere

- This also fixes an issue with sorting the the Default/fallback profile,
since commit ce31d0e235 it would be always sorted at the top of the
list (to signify that it's a special, read-only profile...etc), sorting
by menu index breaks that behaviour:
 - create a new profile by editing the Defualt/fallback profile, and give
   the new profile a name (Defualt is reserved of course)
 - open the profile manager dialog, you'll find the Default/fallback
   profile not at the top of the list, until you restart Konsole

This issue was reported by Kurt in
https://invent.kde.org/utilities/konsole/-/merge_requests/351#note_197432
2021-03-18 02:39:40 +00:00
Kurt Hindenburg
7c38e53290 Fix spelling error 2021-03-10 10:00:19 -05:00
Carlos Alves
34f85cecea Fix Bookmark all tabs as a folder crash
The list of active sessions needs to be refreshed when a session is
destroyed. It was being refreshed only on creation.

BUG: 432327
FIXED-IN: 21.04
2021-03-07 20:50:10 +00:00
Ahmad Samir
ce31d0e235 Always sort the Default/fallback profile first
As suggested by Kurt in
https://invent.kde.org/utilities/konsole/-/merge_requests/351
2021-03-07 20:43:38 +00:00
Ahmad Samir
88c58a853d Show the Default/fallback profile in the profile manager dialog
Let the Default/fallback profile be shown in the Profile Manager dialog,
and disable the Edit and Delete buttons for it, it can be "cloned" by
using the New button.

BUG: 433210
FIXED-IN: 21.04
2021-03-07 20:43:38 +00:00