Commit Graph

106 Commits

Author SHA1 Message Date
Friedrich W. H. Kossebau
451ed33d63 Add explicit moc includes to sources for moc-covered headers
* speeds up incremental builds as changes to a header will not always
  need the full mocs_compilation.cpp for all the target's headers rebuild,
  while having a moc file sourced into a source file only adds minor
  extra costs, due to small own code and the used headers usually
  already covered by the source file, being for the same class/struct
* seems to not slow down clean builds, due to empty mocs_compilation.cpp
  resulting in those quickly processed, while the minor extra cost of the
  sourced moc files does not outweigh that in summary.
  Measured times actually improved by some percent points.
  (ideally CMake would just skip empty mocs_compilation.cpp & its object
  file one day)
* enables compiler to see all methods of a class in same compilation unit
  to do some sanity checks
* potentially more inlining in general, due to more in the compilation unit
* allows to keep using more forward declarations in the header, as with the
  moc code being sourced into the cpp file there definitions can be ensured
  and often are already for the needs of the normal class methods
2023-07-28 12:17:12 +00:00
Waqar Ahmed
a1d24f6da2 Default to Utf8 on windows
ConPty expects utf8
2023-03-09 11:16:35 +05:00
Ahmad Samir
4ad22a7f98 Initialize members in-class where possible 2022-06-20 20:59:34 +00:00
Ahmad Samir
1be4689de4 Remove redundant assignment
These two QTimer members were initilized in-class, since they aren't
pointers, and then assigned to in the constructor initializer list.
2022-06-20 20:59:34 +00:00
Grider Li
dd52d72264 Fix z-modem detection by using proper string index 2022-06-17 17:59:39 +00:00
Waqar Ahmed
34fdfb4812 Guard against negative value 2022-01-25 19:24:13 +05:00
Luis Javier Merino Morán
830f416850 Fix copying one single char
Regression introduced by 5919c1fd.  The selection range is inclusive in
both ends.

Thanks to Chiitoo for reporting and to Yerrey Dev for proposing a
solution.

BUG: 448144
2022-01-11 15:44:21 +00:00
Luis Javier Merino Morán
5919c1fd0a Don't get the selection to check if it is empty
Every time the selection is changed, the selection text is retrieved to
check whether to enable or disable the copy actions. Besides that, the
selection text is also used for the web search context menu entries.

Better just check if the selection is empty and make a note that the
selection changed, so the next time the context menu is invoked it can
retrieve the current selection text, which should happen much less often
than selection changes.
2021-12-28 10:59:33 +00:00
Waqar Ahmed
5557840822 Use memchr to look for zmodem indicator 2021-12-12 11:15:02 +00:00
Waqar Ahmed
cd5988058d Emulation: change receiveChar to receiveChars
No functional change.

Instead of sending one char at a time through a virtual function, send
all at once and process them in a loop inside the function. The perf
improvement is not that big from this (+100ms), but it lays down path
for more possible optimizations
2021-11-29 10:41:28 +00:00
Ahmad Samir
d1c826adc8 Tweak formatting after running clang-format
GIT_SILENT
2021-09-06 12:51:53 +02:00
Ahmad Samir
97569b764c Run clang-format on the whole repo
Also install the relevant git hook.

GIT_SILENT
2021-09-06 12:51:39 +02:00
Martin T. H. Sandsmark
7a35124f4f Implement actual testing of Vt102 emulator 2021-07-16 10:53:06 +00:00
Luis Javier Merino Morán
877a5128cb Fix assert _currentTerminalDisplay in Screen::setTextSelectionRendition
_currentTerminalDisplay was not set until some interaction was made with
the TerminalDisplay widget.  Set it as soon as Session->addView() is
called.

BUG: 439529
2021-07-08 20:42:30 +00: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
d06ea23903 Use Q_EMIT instead of emit
In C++20 there are new classes that have member functions named emit().
c.f.:
https://lists.qt-project.org/pipermail/development/2020-February/038812.html
https://en.cppreference.com/w/cpp/io/basic_osyncstream/emit

A similar change was done in the Frameworks:
https://invent.kde.org/frameworks/kio/-/merge_requests/315
2021-02-15 23:52:07 +00:00
Kurt Hindenburg
78a0092522 Convert src to use SPDX license/copyright
https://community.kde.org/Policies/Licensing_Policy#SPDX_Statements
https://community.kde.org/Guidelines_and_HOWTOs/Licensing
2020-11-12 22:17:06 -05:00
Gustavo Carneiro
44ea930770 Remove not implemented method. 2020-10-20 02:18:51 +00:00
Martin T. H. Sandsmark
e45cda9579 Add possibility of peeking primary screen
Good explanation from Tomaz (he's better with words than me):
    I think he wants to quick swap the text from primary and secondary screens:
        ls folder
        vim somefile.txt
        - mmm, what's the name of the file I need, I just did the LS for that reason -
        peek into primary screen, note the file name, go back to secondary screen

Merge request:
https://invent.kde.org/utilities/konsole/-/merge_requests/210
2020-10-03 16:22:53 +02:00
Martin T. H. Sandsmark
90808b8c28 Minor performance increase when receiving characters
zmodem up/download loop changes

part of !211
2020-09-26 10:48:17 -04:00
Tomaz Canabrava
ba91583f64 Add new Library keyboardtranslator 2020-07-29 16:49:30 +02:00
Mariusz Glebocki
9855b2c125 Use flags for each session notification type
Replaces single-value session state with separate flags for each
possible notification (silence, activity, bell). This will allow for
more flexible control over how specific notifications are displayed.
2020-04-10 13:51:07 -04:00
Ahmad Samir
c83bb19a68 Port away from deprecated foreach, use for-range instead, first take
The code compiles and konsole loads and seems to work as before.
2019-11-24 19:24:12 +02:00
Kurt Hindenburg
7bc9794503 For returns use a braced initializer list 2018-10-27 22:37:16 -04:00
Ahmad Samir
a2ad2d70d4 Invert the logic for Mouse Tracking events
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
2018-05-28 09:27:48 -04:00
Mariusz Glebocki
5128781a82 Change internal character type size to 32 bit
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
2018-05-16 10:03:57 -04:00
Kurt Hindenburg
8b6be52ba2 Handle the zmodem upload indicator B01
When the correct code is given to receive a zmodem upload (rz), open
the file dialog.

FEATURE: 328691
2018-02-18 21:41:36 -05:00
Kurt Hindenburg
59cce871a8 remove commented out code 2018-01-13 18:52:36 -05:00
Kurt Hindenburg
7f35a5af09 initialize members in the initialization list 2018-01-04 09:14:55 -05:00
Kurt Hindenburg
2e86be05dc Implement support for trimming leading whitespace
There's already an option for removing trailing whitespace.

Combining both pulls since the later makes the code easier to read.

Patches by sandsmark

Differential Revision: https://phabricator.kde.org/D8381
Differential Revision: https://phabricator.kde.org/D8417
2017-12-25 11:30:35 -05:00
Kurt Hindenburg
2a2a56d73c modernize use nullptr 2017-07-15 23:28:32 -04:00
Kurt Hindenburg
78a81b8e5b uncrustify using kf5 config 2017-06-19 09:48:21 -04:00
Kurt Hindenburg
eade05a4bd Do not specify Qt modules in includes 2017-04-26 21:33:34 -04:00
Kurt Hindenburg
a540e6fdd0 Fix readability-implicit-bool-cast issues using nullptr 2017-04-21 10:51:31 -04:00
Kurt Hindenburg
5a15d20def use auto range loops 2017-03-31 22:21:10 -04:00
Kurt Hindenburg
2b586e6ff8 use auto 2017-03-28 11:25:26 -04:00
Kurt Hindenburg
49f6216e6a Add static_cast to show conversions 2017-02-18 15:18:07 -05:00
Martin T. H. Sandsmark
b84c0f49a9 Remove hack for ensuring window size is correct before starting session
Instead of using a hardcoded delay and hope that the signals are handled
in the right order just use a direct connection for the first signal so
we can guarantee that it is handled before the execution continues to
the emission of the second signal.

REVIEW: 127724
2016-05-04 11:08:31 +02:00
Montel Laurent
83515eafbc Port to new connect api 2014-10-18 14:11:18 +02:00
Alex Richardson
a3ce74d4eb Convert to Qt5 signal slot syntax
REVIEW: 117482
2014-04-30 19:16:54 +02:00
Kurt Hindenburg
707f341de3 Change constuctor - calls now have to give Screen
new ScreenWindow() is only called from emulation - might as well
pass the Screen to it

(cherry picked from commit ffeaf3a33f)
2014-04-16 21:40:15 -04:00
Kurt Hindenburg
886f12d730 Add xterm's bracketed paste mode
Allow xterm's bracketed paste mode to work

When enabled by '\e[?2004h', pasted data is surrounded by \e[200~ and
\e[201~. This is mainly for text editors to temporarily switch off
autoindent and line wrapping.

http://invisible-island.net/xterm/ctlseqs/ctlseqs.html

This page have a .vimrc that will trigger this
https://bugzilla.gnome.org/show_bug.cgi?id=605299

Thanks to Egmont Koblinger for patch
BUG: 324946
FEATURE: 4.13

(cherry picked from commit 8082bcd2ef)
2014-01-11 18:46:03 -05:00
Kurt Hindenburg
1ea501da62 remove include moc from .cpp files - removes build warnings 2013-10-22 20:07:23 -04:00
Alex Richardson
a83db71590 Port to KF5/Qt5
TerminalDisplayAccessible is disabled for Qt5 currently since I don't
have any experience with accessible stuff and it is more complicated
than just changing a few includes

REVIEW: 111937
2013-08-20 23:34:35 +02:00
Alex Richardson
ab5e15b1b7 Revert "Port to KF5/Qt5"
This reverts commit 4adfbe84bd.

This work will go into a new branch instead
2013-08-13 23:26:19 +02:00
Alex Richardson
4adfbe84bd Port to KF5/Qt5
To build for KF5 pass the option -DQT5_BUILD=ON to CMake

TerminalDisplayAccessible is disabled for Qt5 currently since I don't
have any experience with accessible stuff and it is more complicated
than just changing a few includes

REVIEW: 111937
2013-08-13 21:26:59 +02:00
Kurt Hindenburg
bee9aa8f78 minor style fixes - remove empty lines start/end code blocks 2012-05-13 10:08:05 -04:00
Jekyll Wu
3c958a2c97 Rename and remove the no longer needed signal relayer 2012-04-21 11:41:31 +08:00
Kurt Hindenburg
5b083640ce whitespace and style fixes
Use 'git diff -w --ignore-all-space' to see non-whitespace changes
2012-04-05 11:08:53 -04:00
Jekyll Wu
5c28f79f0e Revert "Rename: defaultTranslator ==> fallbackTranslator"
I was stupid

This reverts commit 912e52b12a.
2012-03-21 03:41:06 +08:00