Bug 95932 - Terminal Resize does not work
Summary: Terminal Resize does not work
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-28 16:17 UTC by Christopher Stone
Modified: 2005-03-29 01:25 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Stone 2004-12-28 16:17:20 UTC
Version:            (using KDE KDE 3.3.2)
Installed from:    RedHat RPMs
Compiler:          gcc-3.4.2 
OS:                Linux

After configuring konsole to allow applications to resize the window, konsole still does not all a resize to occur.  Here is my test application:

#include <stdio.h>
main() {
printf("\e[8;50;80t"); /* resize window */
}

Running this program on a plain xterm will cause the xterm to resize, however running under a konsole, no resize takes place.  I specifically made sure to configure the konsole and select the option to allow applications to resize.
Comment 1 Kurt Hindenburg 2004-12-28 19:27:03 UTC
I can confirmed that your program resizes xterm and not konsole.

konsole produces this debugging output:
undecodable token: \001b(hex)[8;50;80t
undecodable token: \001b(hex)[8;50;80t
undecodable token: \001b(hex)[8;50;80t

I wonder if konsole resizing every worked...
Comment 2 Kurt Hindenburg 2005-03-29 01:25:32 UTC
CVS commit by hindenburg: 

Allow xterm resize ESC code to work.  Not the easiest code to understand...

BUGS: 95932


  M +10 -0     TEmuVt102.cpp   1.114
  M +1 -0      TEmulation.h   1.36
  M +13 -1     konsole.cpp   1.523
  M +1 -0      konsole.h   1.203


--- kdebase/konsole/konsole/TEmuVt102.cpp  #1.113:1.114
@@ -257,4 +257,5 @@ void TEmuVt102::pushToToken(int cc)
 #define SCS 16
 #define GRP 32
+#define CPS 64
 
 void TEmuVt102::initTokenizer()
@@ -264,4 +265,6 @@ void TEmuVt102::initTokenizer()
   for(i = 32;                      i < 256; i++) tbl[ i] |= CHR;
   for(s = (UINT8*)"@ABCDGHILMPSTXZcdfry"; *s; s++) tbl[*s] |= CPN;
+// resize = \e[8;<row>;<col>t
+  for(s = (UINT8*)"t"; *s; s++) tbl[*s] |= CPS;
   for(s = (UINT8*)"0123456789"        ; *s; s++) tbl[*s] |= DIG;
   for(s = (UINT8*)"()+*%"             ; *s; s++) tbl[*s] |= SCS;
@@ -336,4 +339,8 @@ void TEmuVt102::onRcvChar(int cc)
     if (lec(3,1,'#')) { tau( TY_ESC_DE(s[2]),    0,   0);       resetToken(); return; }
     if (eps(    CPN)) { tau( TY_CSI_PN(cc), argv[0],argv[1]);   resetToken(); return; }
+
+// resize = \e[8;<row>;<col>t
+    if (eps(    CPS)) { tau( TY_CSI_PS(cc, argv[0]), argv[1], argv[2]);   resetToken(); return; }
+
     if (epe(       )) { tau( TY_CSI_PE(cc),      0,   0);       resetToken(); return; }
     if (ees(    DIG)) { addDigit(cc-'0');                                     return; }
@@ -506,4 +513,7 @@ switch( N )
     case TY_ESC_DE('8'      ) : scr->helpAlign            (          ); break;
 
+// resize = \e[8;<row>;<col>t
+    case TY_CSI_PS('t',    8) : changeColLin( q /* col */, p /* lin */ ); break;
+
     case TY_CSI_PS('K',    0) : scr->clearToEndOfLine     (          ); break;
     case TY_CSI_PS('K',    1) : scr->clearToBeginOfLine   (          ); break;

--- kdebase/konsole/konsole/TEmulation.h  #1.35:1.36
@@ -69,4 +69,5 @@ signals:
   void ImageSizeChanged(int lines, int columns);
   void changeColumns(int columns);
+  void changeColLin(int columns, int lines);
   void changeTitle(int arg, const char* str);
   void notifySessionState(int state);

--- kdebase/konsole/konsole/konsole.h  #1.202:1.203
@@ -157,4 +157,5 @@ private slots:
 
   void changeColumns(int);
+  void changeColLin(int columns, int lines);
   void notifySessionState(TESession* session,int state);
   void notifySize(int columns, int lines);

--- kdebase/konsole/konsole/konsole.cpp  #1.522:1.523
@@ -1947,6 +1947,14 @@ void Konsole::reparseConfiguration()
 }
 
-// --| color selection |-------------------------------------------------------
+// Called from emulation
+void Konsole::changeColLin(int columns, int lines)
+{
+  if (b_allowResize && !b_fixedSize) {
+    setColLin(columns, lines);
+    te->update();
+  }
+}
 
+// Called from emulation
 void Konsole::changeColumns(int columns)
 {
@@ -2624,4 +2632,6 @@ QString Konsole::newSession(KSimpleConfi
   connect( s->getEmulation(), SIGNAL(changeColumns(int)),
            this, SLOT(changeColumns(int)) );
+  connect( s->getEmulation(), SIGNAL(changeColLin(int,int)),
+           this, SLOT(changeColLin(int,int)) );
   connect( s->getEmulation(), SIGNAL(ImageSizeChanged(int,int)),
            this, SLOT(notifySize(int,int)));
@@ -3352,4 +3362,5 @@ void Konsole::detachSession(TESession* _
 
   disconnect( _se->getEmulation(),SIGNAL(ImageSizeChanged(int,int)), this,SLOT(notifySize(int,int)));
+  disconnect( _se->getEmulation(),SIGNAL(changeColLin(int, int)), this,SLOT(changeColLin(int,int)) );
   disconnect( _se->getEmulation(),SIGNAL(changeColumns(int)), this,SLOT(changeColumns(int)) );
 
@@ -3450,4 +3461,5 @@ void Konsole::attachSession(TESession* s
   connect( session->getEmulation(),SIGNAL(ImageSizeChanged(int,int)), this,SLOT(notifySize(int,int)));
   connect( session->getEmulation(),SIGNAL(changeColumns(int)), this,SLOT(changeColumns(int)) );
+  connect( session->getEmulation(),SIGNAL(changeColLin(int, int)), this,SLOT(changeColLin(int,int)) );
 
   activateSession(session);