Changeset View
Changeset View
Standalone View
Standalone View
src/TerminalDisplay.cpp
Show First 20 Lines • Show All 2718 Lines • ▼ Show 20 Line(s) | 2713 | if (((modifiers & Qt::ControlModifier) != 0u) && mouseWheelZoom()) { | |||
---|---|---|---|---|---|
2719 | for (;steps < 0; ++steps) { | 2719 | for (;steps < 0; ++steps) { | ||
2720 | // wheel-down for decreasing font size | 2720 | // wheel-down for decreasing font size | ||
2721 | decreaseFontSize(); | 2721 | decreaseFontSize(); | ||
2722 | } | 2722 | } | ||
2723 | 2723 | | |||
2724 | return; | 2724 | return; | ||
2725 | } | 2725 | } | ||
2726 | 2726 | | |||
2727 | // if the terminal program is not interested with mouse events: | 2727 | // If the program running in the terminal is not interested in mouse events: | ||
2728 | // * send the event to the scrollbar if the slider has room to move | 2728 | // - Send the event to the scrollbar if the slider has room to move | ||
2729 | // * otherwise, send simulated up / down key presses to the terminal program | 2729 | // - Otherwise, send simulated up / down key presses to the terminal program | ||
2730 | // for the benefit of programs such as 'less' | 2730 | // for the benefit of programs such as 'less' (which use the alternate screen) | ||
2731 | if (_mouseMarks) { | 2731 | if (_mouseMarks) { | ||
2732 | const bool canScroll = _scrollBar->maximum() > 0; | 2732 | const bool canScroll = _scrollBar->maximum() > 0; | ||
2733 | if (canScroll) { | 2733 | if (canScroll) { | ||
2734 | _scrollBar->event(ev); | 2734 | _scrollBar->event(ev); | ||
2735 | _sessionController->setSearchStartToWindowCurrentLine(); | 2735 | _sessionController->setSearchStartToWindowCurrentLine(); | ||
2736 | _scrollWheelState.clearAll(); | 2736 | _scrollWheelState.clearAll(); | ||
2737 | } else { | 2737 | } else if (!_isPrimaryScreen) { | ||
2738 | // assume that each Up / Down key event will cause the terminal application | 2738 | // assume that each Up / Down key event will cause the terminal application | ||
2739 | // to scroll by one line. | 2739 | // to scroll by one line. | ||
2740 | // | 2740 | // | ||
2741 | // to get a reasonable scrolling speed, scroll by one line for every 5 degrees | 2741 | // to get a reasonable scrolling speed, scroll by one line for every 5 degrees | ||
2742 | // of mouse wheel rotation. Mouse wheels typically move in steps of 15 degrees, | 2742 | // of mouse wheel rotation. Mouse wheels typically move in steps of 15 degrees, | ||
2743 | // giving a scroll of 3 lines | 2743 | // giving a scroll of 3 lines | ||
2744 | 2744 | | |||
2745 | const int lines = _scrollWheelState.consumeSteps(static_cast<int>(_fontHeight * qApp->devicePixelRatio()), ScrollState::degreesToAngle(5)); | 2745 | const int lines = _scrollWheelState.consumeSteps(static_cast<int>(_fontHeight * qApp->devicePixelRatio()), ScrollState::degreesToAngle(5)); | ||
▲ Show 20 Lines • Show All 307 Lines • ▼ Show 20 Line(s) | 3045 | if ((chars != nullptr) && extendedCharLength > 0) { | |||
3053 | } | 3053 | } | ||
3054 | return letterOrNumber ? QLatin1Char('a') : s.at(0); | 3054 | return letterOrNumber ? QLatin1Char('a') : s.at(0); | ||
3055 | } | 3055 | } | ||
3056 | return 0; | 3056 | return 0; | ||
3057 | } else { | 3057 | } else { | ||
3058 | const QChar qch(ch.character); | 3058 | const QChar qch(ch.character); | ||
3059 | if (qch.isSpace()) { | 3059 | if (qch.isSpace()) { | ||
3060 | return QLatin1Char(' '); | 3060 | return QLatin1Char(' '); | ||
3061 | } | 3061 | } | ||
hindenburg: remove return | |||||
3062 | 3062 | | |||
3063 | if (qch.isLetterOrNumber() || _wordCharacters.contains(qch, Qt::CaseInsensitive)) { | 3063 | if (qch.isLetterOrNumber() || _wordCharacters.contains(qch, Qt::CaseInsensitive)) { | ||
3064 | return QLatin1Char('a'); | 3064 | return QLatin1Char('a'); | ||
3065 | } | 3065 | } | ||
3066 | 3066 | | |||
3067 | return qch; | 3067 | return qch; | ||
3068 | } | 3068 | } | ||
3069 | } | 3069 | } | ||
Show All 11 Lines | 3080 | { | |||
3081 | _mouseMarks = on; | 3081 | _mouseMarks = on; | ||
3082 | setCursor(_mouseMarks ? Qt::IBeamCursor : Qt::ArrowCursor); | 3082 | setCursor(_mouseMarks ? Qt::IBeamCursor : Qt::ArrowCursor); | ||
3083 | } | 3083 | } | ||
3084 | bool TerminalDisplay::usesMouse() const | 3084 | bool TerminalDisplay::usesMouse() const | ||
3085 | { | 3085 | { | ||
3086 | return _mouseMarks; | 3086 | return _mouseMarks; | ||
3087 | } | 3087 | } | ||
3088 | 3088 | | |||
3089 | | ||||
3090 | void TerminalDisplay::usingPrimaryScreen(bool use) | ||||
3091 | { | ||||
3092 | _isPrimaryScreen = use; | ||||
3093 | } | ||||
3094 | | ||||
3089 | void TerminalDisplay::setBracketedPasteMode(bool on) | 3095 | void TerminalDisplay::setBracketedPasteMode(bool on) | ||
3090 | { | 3096 | { | ||
3091 | _bracketedPasteMode = on; | 3097 | _bracketedPasteMode = on; | ||
3092 | } | 3098 | } | ||
3093 | bool TerminalDisplay::bracketedPasteMode() const | 3099 | bool TerminalDisplay::bracketedPasteMode() const | ||
3094 | { | 3100 | { | ||
3095 | return _bracketedPasteMode; | 3101 | return _bracketedPasteMode; | ||
3096 | } | 3102 | } | ||
▲ Show 20 Lines • Show All 717 Lines • Show Last 20 Lines |
remove return