From dff0fe48592f229375d33cd9c0e97b1fc2d4718a Mon Sep 17 00:00:00 2001 From: Lars Doelle Date: Wed, 3 Feb 1999 21:09:23 +0000 Subject: [PATCH] fixed -caption svn path=/trunk/kdebase/konsole/; revision=16391 --- ChangeLog | 2 ++ src/TEWidget.C | 69 +++++++++++++++++++++++++------------------------- src/main.C | 14 +++++----- 3 files changed, 44 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0bcd168f..768c7c00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +03 Feb 1999 +- fixed -caption 01 Feb 1999 Matt Gerassimoff - scroll line wise through the history buffer using Shift-Up/Down 31 Jan 1998 diff --git a/src/TEWidget.C b/src/TEWidget.C index dc238866..bfaa1c70 100644 --- a/src/TEWidget.C +++ b/src/TEWidget.C @@ -550,40 +550,41 @@ void TEWidget::mouseMoveEvent(QMouseEvent* ev) QPoint ohere; bool swapping = FALSE; - if ( word_selection_mode ) { - // Extend to word boundaries - int i; - int selClass; + if ( word_selection_mode ) + { + // Extend to word boundaries + int i; + int selClass; - bool left_not_right = ( here.y() < iPntSel.y() || + bool left_not_right = ( here.y() < iPntSel.y() || here.y() == iPntSel.y() && here.x() < iPntSel.x() ); - bool old_left_not_right = ( pntSel.y() < iPntSel.y() || + bool old_left_not_right = ( pntSel.y() < iPntSel.y() || pntSel.y() == iPntSel.y() && pntSel.x() < iPntSel.x() ); - swapping = left_not_right != old_left_not_right; - - // Find left (left_not_right ? from here : from start) - QPoint left = left_not_right ? here : iPntSel; - i = loc(left.x(),left.y()); - selClass = charClass(image[i].c); - while ( left.x() > 0 && charClass(image[i-1].c) == selClass ) - { i--; left.rx()--; } - - // Find left (left_not_right ? from start : from here) - QPoint right = left_not_right ? iPntSel : here; - i = loc(right.x(),right.y()); - selClass = charClass(image[i].c); - while ( right.x() < columns-1 && charClass(image[i+1].c) == selClass ) - { i++; right.rx()++; } - - // Pick which is start (ohere) and which is extension (here) - if ( left_not_right ) - { - here = left; - ohere = right; - } else { - here = right; - ohere = left; - } + swapping = left_not_right != old_left_not_right; + + // Find left (left_not_right ? from here : from start) + QPoint left = left_not_right ? here : iPntSel; + i = loc(left.x(),left.y()); + selClass = charClass(image[i].c); + while ( left.x() > 0 && charClass(image[i-1].c) == selClass ) + { i--; left.rx()--; } + + // Find left (left_not_right ? from start : from here) + QPoint right = left_not_right ? iPntSel : here; + i = loc(right.x(),right.y()); + selClass = charClass(image[i].c); + while ( right.x() < columns-1 && charClass(image[i+1].c) == selClass ) + { i++; right.rx()++; } + + // Pick which is start (ohere) and which is extension (here) + if ( left_not_right ) + { + here = left; ohere = right; + } + else + { + here = right; ohere = left; + } } if (here == pntSel && scroll == scrollbar->value()) return; // not moved @@ -658,7 +659,7 @@ void TEWidget::mouseDoubleClickEvent(QMouseEvent* ev) // set the start... int x = bgnSel.x(); while ( x > 0 && charClass(image[i-1].c) == selClass ) - { i--; x--; } + { i--; x--; } bgnSel.setX(x); emit beginSelectionSignal( bgnSel.x(), bgnSel.y() ); @@ -666,7 +667,7 @@ void TEWidget::mouseDoubleClickEvent(QMouseEvent* ev) i = loc( endSel.x(), endSel.y() ); x = endSel.x(); while( x < columns-1 && charClass(image[i+1].c) == selClass ) - { i++; x++ ; } + { i++; x++ ; } endSel.setX(x); emit extendSelectionSignal( endSel.x(), endSel.y() ); emit endSelectionSignal(preserve_line_breaks); @@ -684,7 +685,7 @@ int TEWidget::charClass(char ch) const static char *word_characters = "@-./_~"; if ( isalnum(ch) || strchr(word_characters, ch) ) - return 'a'; + return 'a'; // Everything else is weird return 1; diff --git a/src/main.C b/src/main.C index b2167b86..dfeef883 100644 --- a/src/main.C +++ b/src/main.C @@ -161,11 +161,10 @@ TEDemo::TEDemo(QStrList & _args, int login_shell) : KTMainWindow(), args(_args) TESession* initial = new TESession(this,te,args,"xterm",login_shell); initial->setFontNo(n_font); initial->setSchemaNo(ColorSchema::find(s_schema)->numb); - if (args.count()) - title = args.at(0); // display program executed in the title bar - else - title = PACKAGE; + title = (args.count() && !strcmp(kapp->getCaption(),PACKAGE)) + ? args.at(0) // program executed in the title bar + : kapp->getCaption(); // `konsole' or -caption initial->setTitle(title); // start first session ///////////////////////////////////////////////////// @@ -945,9 +944,10 @@ int main(int argc, char* argv[]) else { TEDemo* m = new TEDemo(eargs,login_shell); if (strcmp("",sz) !=0) m->setColLin(c,l); - if (welcome) { - m->setCaption(i18n("Welcome to the console")); - QTimer::singleShot(5000,m,SLOT(setHeader())); + if (welcome) + { + m->setCaption(i18n("Welcome to the console")); + QTimer::singleShot(5000,m,SLOT(setHeader())); } m->show(); }