mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-22 12:58:39 +00:00
Fix: custom commands in keytab were ignored. Removed hardcoded key combinations.
This commit is contained in:
parent
09df72c3d2
commit
46edda6d18
@ -1358,3 +1358,13 @@ void Screen::fillWithDefaultChar(Character* dest, int count)
|
|||||||
for (int i=0;i<count;i++)
|
for (int i=0;i<count;i++)
|
||||||
dest[i] = defaultChar;
|
dest[i] = defaultChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Screen::setCurrentTerminalDisplay(KTerminalDisplay* display)
|
||||||
|
{
|
||||||
|
_currentTerminalDisplay = display;
|
||||||
|
}
|
||||||
|
|
||||||
|
KTerminalDisplay* Screen::currentTerminalDisplay()
|
||||||
|
{
|
||||||
|
return _currentTerminalDisplay;
|
||||||
|
}
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class TerminalCharacterDecoder;
|
class TerminalCharacterDecoder;
|
||||||
|
class KTerminalDisplay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief An image of characters with associated attributes.
|
\brief An image of characters with associated attributes.
|
||||||
@ -543,6 +544,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
static void fillWithDefaultChar(Character* dest, int count);
|
static void fillWithDefaultChar(Character* dest, int count);
|
||||||
|
|
||||||
|
//cool-old-term: added to allow scrolling from commands
|
||||||
|
void setCurrentTerminalDisplay(KTerminalDisplay* display);
|
||||||
|
KTerminalDisplay* currentTerminalDisplay();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//copies a line of text from the screen or history into a stream using a
|
//copies a line of text from the screen or history into a stream using a
|
||||||
@ -666,6 +672,8 @@ private:
|
|||||||
int lastPos;
|
int lastPos;
|
||||||
|
|
||||||
static Character defaultChar;
|
static Character defaultChar;
|
||||||
|
|
||||||
|
KTerminalDisplay* _currentTerminalDisplay;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -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){
|
void KTerminalDisplay::setUsesMouse(bool usesMouse){
|
||||||
_mouseMarks = !usesMouse;
|
_mouseMarks = !usesMouse;
|
||||||
}
|
}
|
||||||
@ -2144,44 +2153,10 @@ void KTerminalDisplay::drawInputMethodPreeditString(QPainter *painter , const QR
|
|||||||
|
|
||||||
void KTerminalDisplay::keyPressEvent(QKeyEvent *event)
|
void KTerminalDisplay::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
|
_screenWindow->screen()->setCurrentTerminalDisplay(this);
|
||||||
|
|
||||||
bool emitKeyPressSignal = true;
|
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
|
_actSel=0; // Key stroke implies a screen update, so TerminalDisplay won't
|
||||||
// know where the current selection is.
|
// know where the current selection is.
|
||||||
|
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
#include "Filter.h"
|
#include "Filter.h"
|
||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
#include "ksession.h"
|
#include "ksession.h"
|
||||||
|
#include "ScreenWindow.h"
|
||||||
|
#include "Screen.h"
|
||||||
//#include "konsole_export.h"
|
//#include "konsole_export.h"
|
||||||
#define KONSOLEPRIVATE_EXPORT
|
#define KONSOLEPRIVATE_EXPORT
|
||||||
|
|
||||||
@ -47,8 +49,6 @@ class QTimerEvent;
|
|||||||
|
|
||||||
extern unsigned short vt100_graphics[32];
|
extern unsigned short vt100_graphics[32];
|
||||||
|
|
||||||
class ScreenWindow;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A widget which displays output from a terminal emulation and sends input keypresses and mouse activity
|
* A widget which displays output from a terminal emulation and sends input keypresses and mouse activity
|
||||||
* to the terminal.
|
* to the terminal.
|
||||||
@ -317,6 +317,8 @@ public slots:
|
|||||||
void mouseDoubleClick(qreal x, qreal y);
|
void mouseDoubleClick(qreal x, qreal y);
|
||||||
void mouseRelease(qreal x, qreal y);
|
void mouseRelease(qreal x, qreal y);
|
||||||
|
|
||||||
|
void scrollScreenWindow(enum ScreenWindow::RelativeScrollMode mode, int amount);
|
||||||
|
|
||||||
void setUsesMouse(bool usesMouse);
|
void setUsesMouse(bool usesMouse);
|
||||||
|
|
||||||
bool autoFocus() { return m_focusOnClick; }
|
bool autoFocus() { return m_focusOnClick; }
|
||||||
|
@ -940,8 +940,17 @@ void Vt102Emulation::sendKeyEvent( QKeyEvent* event )
|
|||||||
|
|
||||||
if ( entry.command() != KeyboardTranslator::NoCommand )
|
if ( entry.command() != KeyboardTranslator::NoCommand )
|
||||||
{
|
{
|
||||||
|
KTerminalDisplay* currentView = _currentScreen->currentTerminalDisplay();
|
||||||
if (entry.command() & KeyboardTranslator::EraseCommand)
|
if (entry.command() & KeyboardTranslator::EraseCommand)
|
||||||
textToSend += eraseChar();
|
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
|
// TODO command handling
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
// Konsole
|
// Konsole
|
||||||
#include "Emulation.h"
|
#include "Emulation.h"
|
||||||
#include "Screen.h"
|
#include "Screen.h"
|
||||||
|
#include "ScreenWindow.h"
|
||||||
|
#include "TerminalDisplay.h"
|
||||||
|
|
||||||
#define MODE_AppScreen (MODES_SCREEN+0) // Mode #1
|
#define MODE_AppScreen (MODES_SCREEN+0) // Mode #1
|
||||||
#define MODE_AppCuKeys (MODES_SCREEN+1) // Application cursor keys (DECCKM)
|
#define MODE_AppCuKeys (MODES_SCREEN+1) // Application cursor keys (DECCKM)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user