[Konsole-devel] command handling

Tomáš Čech tcech at suse.cz
Thu Mar 17 18:24:33 UTC 2011


Hi,

as you probably noticed I created bug report #267100. I've already created
patch for xterm and rxvt and I would like do similar work for Konsole.

1] I read the code and found this (I'm using my 4.6.0 KDE version now,
so line numbers may differ a bit):

Vt102Emulation.cpp:949
// TODO command handling

TerminalDisplay.cpp:2487-2509
// Keyboard-based navigation
...

This feature doesn't work, because shift+pageup/pagedown/up/down
handling is done in TerminalDisplay.cpp and not in Vt102Emulation.cpp.

I already created ugly version doing what I want, but I'd like to do
it clearly and acceptable.

How do you want it have it done so it would be accepted?

----------------------------------------------------------------------------
My proposal is something like:

- create event derived class - QKeyEvent with current TerminalDisplay
   pointer and instead of handling scroll key combinations set
         if (( event->key() == Qt::Key_PageUp ) ||
             ( event->key() == Qt::Key_PageDown ) ||
             ( event->key() == Qt::Key_Up ) ||
             ( event->key() == Qt::Key_Down ))
             event->terminalDisplay = this;

- create public method for scrolling of ScreenWindow (something like
   this)

void TerminalDisplay::scrollScreenWindow( RelativeScrollMode mode , int amount )
{
  _screenWindow->scrollBy( mode , amount);
         _screenWindow->setTrackOutput( _screenWindow->atEndOfOutput());
            
         updateLineProperties();
         updateImage();
}

- in Vt102Emulation::sendKeyEvent add something like

if ( entry.command() & KeyboardTranslator::ScrollPageUpCommand )
   event->terminalDisplay->scrollScreenWindow( ScreenWindow::ScrollPages , -1 );
else if ( entry.command() & KeyboardTranslator::ScrollPageDownCommand )
   event->terminalDisplay->scrollScreenWindow( ScreenWindow::ScrollPages , 1 );
else if ( entry.command() & KeyboardTranslator::ScrollLineUpCommand )
   event->terminalDisplay->scrollScreenWindow( ScreenWindow::ScrollLines , -1 );
else if ( entry.command() & KeyboardTranslator::ScrollLineDownCommand )
   event->terminalDisplay->scrollScreenWindow( ScreenWindow::ScrollLines , 1 );


(I hope I don't get to hell with RelativeScrollMode)
----------------------------------------------------------------------------

2] I'm looking for proper character sequence which should be sent on
shift+pageup/pagedown/up/down. Do you have any idea?


Best regards,

Tomas Cech
Sleep_Walker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/konsole-devel/attachments/20110317/c213b2f4/attachment.sig>


More information about the konsole-devel mailing list