Delegate PgUp/Down and Up/Down +Shift+AppScreen to terminal application.

After this patch, the following in the .keytab will work:

key Up+Shift+AppScreen : "appup"
key Down+Shift+AppScreen : "appdown"
key PgUp+Shift+AppScreen : "apppgup"
key PgDown+Shift+AppScreen : "apppgdown"

Patch by Tomáš Čech tcech@suse.cz

FEATURE: 267100
FIXED-IN: 4.7
wilder-portage
Kurt Hindenburg 15 years ago
parent 467fb1edcb
commit b88dfb402a
  1. 14
      src/Screen.h
  2. 50
      src/TerminalDisplay.cpp
  3. 8
      src/TerminalDisplay.h
  4. 15
      src/Vt102Emulation.cpp

@ -44,6 +44,7 @@ namespace Konsole
{
class TerminalCharacterDecoder;
class TerminalDisplay;
/**
\brief An image of characters with associated attributes.
@ -545,6 +546,16 @@ public:
*/
static void fillWithDefaultChar(Character* dest, int count);
void setCurrentTerminalDisplay(TerminalDisplay *terminal_display)
{
_currentTerminalDisplay = terminal_display;
}
TerminalDisplay *currentTerminalDisplay()
{
return _currentTerminalDisplay;
}
private:
//copies a line of text from the screen or history into a stream using a
@ -581,6 +592,9 @@ private:
// scroll down 'i' lines in current region, clearing the top 'i' lines
void scrollDown(int from, int i);
//when we handle scroll commands, we need to know which screenwindow will scroll
TerminalDisplay *_currentTerminalDisplay;
void addHistLine();
void initTabStops();

@ -19,6 +19,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
*/
#include "ScreenWindow.h"
// Own
#include "TerminalDisplay.h"
@ -57,8 +58,9 @@
//#include <config-apps.h>
#include "Filter.h"
#include "konsole_wcwidth.h"
#include "ScreenWindow.h"
#include "TerminalCharacterDecoder.h"
#include "Screen.h"
#include "ScreenWindow.h"
using namespace Konsole;
@ -2480,46 +2482,20 @@ void TerminalDisplay::setFlowControlWarningEnabled( bool enable )
outputSuspended(false);
}
void TerminalDisplay::scrollScreenWindow( enum ScreenWindow::RelativeScrollMode mode, int amount )
{
_screenWindow->scrollBy( mode, amount);
_screenWindow->setTrackOutput( _screenWindow->atEndOfOutput() );
updateLineProperties();
updateImage();
}
void TerminalDisplay::keyPressEvent( QKeyEvent* event )
{
bool emitKeyPressSignal = true;
// Keyboard-based navigation
if ( event->modifiers() == Qt::ShiftModifier )
{
bool update = true;
if ( event->key() == Qt::Key_PageUp )
{
_screenWindow->scrollBy( ScreenWindow::ScrollPages , -1 );
}
else if ( event->key() == Qt::Key_PageDown )
{
_screenWindow->scrollBy( ScreenWindow::ScrollPages , 1 );
}
else if ( event->key() == Qt::Key_Up )
{
_screenWindow->scrollBy( ScreenWindow::ScrollLines , -1 );
}
else if ( event->key() == Qt::Key_Down )
{
_screenWindow->scrollBy( ScreenWindow::ScrollLines , 1 );
}
else
update = false;
if ( update )
{
_screenWindow->setTrackOutput( _screenWindow->atEndOfOutput() );
updateLineProperties();
updateImage();
// do not send key press to terminal
emitKeyPressSignal = false;
}
}
_screenWindow->screen()->setCurrentTerminalDisplay(this);
_actSel=0; // Key stroke implies a screen update, so TerminalDisplay won't
// know where the current selection is.

@ -30,6 +30,7 @@
#include "Filter.h"
#include "Character.h"
#include "konsole_export.h"
#include "ScreenWindow.h"
class QDrag;
class QDragEnterEvent;
@ -52,7 +53,6 @@ namespace Konsole
extern unsigned short vt100_graphics[32];
class ScreenWindow;
/**
* A widget which displays output from a terminal emulation and sends input keypresses and mouse activity
@ -410,6 +410,12 @@ public:
static bool HAVE_TRANSPARENCY;
public slots:
/**
* Scrolls current ScreenWindow
*
* it's needed for proper handling scroll commands in the Vt102Emulation class
*/
void scrollScreenWindow( enum ScreenWindow::RelativeScrollMode mode , int amount );
/**
* Causes the terminal display to fetch the latest character image from the associated

@ -54,6 +54,7 @@
// Konsole
#include "KeyboardTranslator.h"
#include "Screen.h"
#include "TerminalDisplay.h"
using namespace Konsole;
@ -943,10 +944,18 @@ void Vt102Emulation::sendKeyEvent( QKeyEvent* event )
if ( entry.command() != KeyboardTranslator::NoCommand )
{
if (entry.command() & KeyboardTranslator::EraseCommand)
bool update = true;
if (entry.command() & KeyboardTranslator::EraseCommand) {
textToSend += eraseChar();
// TODO command handling
update = false;
} else if ( entry.command() & KeyboardTranslator::ScrollPageUpCommand )
_currentScreen->currentTerminalDisplay()->scrollScreenWindow( ScreenWindow::ScrollPages , -1 );
else if ( entry.command() & KeyboardTranslator::ScrollPageDownCommand )
_currentScreen->currentTerminalDisplay()->scrollScreenWindow( ScreenWindow::ScrollPages , 1 );
else if ( entry.command() & KeyboardTranslator::ScrollLineUpCommand )
_currentScreen->currentTerminalDisplay()->scrollScreenWindow( ScreenWindow::ScrollLines , -1 );
else if ( entry.command() & KeyboardTranslator::ScrollLineDownCommand )
_currentScreen->currentTerminalDisplay()->scrollScreenWindow( ScreenWindow::ScrollLines , 1 );
}
else if ( !entry.text().isEmpty() )
{

Loading…
Cancel
Save