1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-02-20 20:09:14 +00:00

Fix: custom commands in keytab were ignored. Removed hardcoded key combinations.

This commit is contained in:
Filippo Scognamiglio 2014-08-22 13:20:42 +02:00
parent 09df72c3d2
commit 46edda6d18
6 changed files with 44 additions and 38 deletions

View File

@ -1358,3 +1358,13 @@ void Screen::fillWithDefaultChar(Character* dest, int count)
for (int i=0;i<count;i++)
dest[i] = defaultChar;
}
void Screen::setCurrentTerminalDisplay(KTerminalDisplay* display)
{
_currentTerminalDisplay = display;
}
KTerminalDisplay* Screen::currentTerminalDisplay()
{
return _currentTerminalDisplay;
}

View File

@ -42,6 +42,7 @@
class TerminalCharacterDecoder;
class KTerminalDisplay;
/**
\brief An image of characters with associated attributes.
@ -543,6 +544,11 @@ public:
*/
static void fillWithDefaultChar(Character* dest, int count);
//cool-old-term: added to allow scrolling from commands
void setCurrentTerminalDisplay(KTerminalDisplay* display);
KTerminalDisplay* currentTerminalDisplay();
private:
//copies a line of text from the screen or history into a stream using a
@ -666,6 +672,8 @@ private:
int lastPos;
static Character defaultChar;
KTerminalDisplay* _currentTerminalDisplay;
};

View File

@ -536,6 +536,15 @@ void KTerminalDisplay::mouseRelease(qreal x, qreal y){
}
}
void KTerminalDisplay::scrollScreenWindow(enum ScreenWindow::RelativeScrollMode mode, int amount)
{
_screenWindow->scrollBy(mode, amount);
_screenWindow->setTrackOutput(_screenWindow->atEndOfOutput());
updateLineProperties();
updateImage();
}
void KTerminalDisplay::setUsesMouse(bool usesMouse){
_mouseMarks = !usesMouse;
}
@ -2144,44 +2153,10 @@ void KTerminalDisplay::drawInputMethodPreeditString(QPainter *painter , const QR
void KTerminalDisplay::keyPressEvent(QKeyEvent *event)
{
_screenWindow->screen()->setCurrentTerminalDisplay(this);
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;
}
}
_actSel=0; // Key stroke implies a screen update, so TerminalDisplay won't
// know where the current selection is.

View File

@ -33,6 +33,8 @@
#include "Filter.h"
#include "Character.h"
#include "ksession.h"
#include "ScreenWindow.h"
#include "Screen.h"
//#include "konsole_export.h"
#define KONSOLEPRIVATE_EXPORT
@ -47,8 +49,6 @@ class QTimerEvent;
extern unsigned short vt100_graphics[32];
class ScreenWindow;
/**
* A widget which displays output from a terminal emulation and sends input keypresses and mouse activity
* to the terminal.
@ -317,6 +317,8 @@ public slots:
void mouseDoubleClick(qreal x, qreal y);
void mouseRelease(qreal x, qreal y);
void scrollScreenWindow(enum ScreenWindow::RelativeScrollMode mode, int amount);
void setUsesMouse(bool usesMouse);
bool autoFocus() { return m_focusOnClick; }

View File

@ -940,8 +940,17 @@ void Vt102Emulation::sendKeyEvent( QKeyEvent* event )
if ( entry.command() != KeyboardTranslator::NoCommand )
{
KTerminalDisplay* currentView = _currentScreen->currentTerminalDisplay();
if (entry.command() & KeyboardTranslator::EraseCommand)
textToSend += eraseChar();
else if (entry.command() & KeyboardTranslator::ScrollPageUpCommand)
currentView->scrollScreenWindow(ScreenWindow::ScrollPages, -1);
else if (entry.command() & KeyboardTranslator::ScrollPageDownCommand)
currentView->scrollScreenWindow(ScreenWindow::ScrollPages, 1);
else if (entry.command() & KeyboardTranslator::ScrollLineUpCommand)
currentView->scrollScreenWindow(ScreenWindow::ScrollLines, -1);
else if (entry.command() & KeyboardTranslator::ScrollLineDownCommand)
currentView->scrollScreenWindow(ScreenWindow::ScrollLines, 1);
// TODO command handling
}

View File

@ -34,6 +34,8 @@
// Konsole
#include "Emulation.h"
#include "Screen.h"
#include "ScreenWindow.h"
#include "TerminalDisplay.h"
#define MODE_AppScreen (MODES_SCREEN+0) // Mode #1
#define MODE_AppCuKeys (MODES_SCREEN+1) // Application cursor keys (DECCKM)