[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdevelop/parts/qeditor
From: Falk Brettschneider <falk.brettschneider () gmx ! de>
Date: 2003-01-24 0:17:17
[Download RAW message or body]
CVS commit by falkbr:
bugfix: now Ctrl+Left and Ctrl+Right behaves more correctly
M +33 -2 qeditor.cpp 1.38
--- kdevelop/parts/qeditor/qeditor.cpp #1.37:1.38
@@ -97,5 +97,5 @@ int QEditor::backspace_indentation( cons
int QEditor::backspace_indentForLine( int line )
{
- int tabwidth = tabStop();
+//unused int tabwidth = tabStop();
int line_ind = backspace_indentation( text(line) );
line_ind = line_ind > 0 ? line_ind-1 : 0;
@@ -226,4 +226,35 @@ void QEditor::keyPressEvent( QKeyEvent*
removeSelectedText();
break;
+ case Qt::Key_Left: {
+ QTextCursor* cur = textCursor();
+ if (cur->index() > 0 && \
cur->paragraph()->at(cur->index()-1)->c.isSpace()) { + moveCursor( \
MoveWordBackward, false ); + }
+ // end of previous word
+ bool firstMove = true; // make sure we do move
+ while (cur->index() > 0 && \
(!isDelimiter(cur->paragraph()->at(cur->index()-1)->c)) || firstMove) { + \
moveCursor( MoveBackward, false ); firstMove = false; cur = textCursor(); + \
} + while (cur->index() > 0 && \
isDelimiter(cur->paragraph()->at(cur->index()-1)->c)) { + moveCursor( \
MoveBackward, false ); cur = textCursor(); + }
+ }
+ break;
+ case Qt::Key_Right: {
+ QTextCursor* cur = textCursor();
+ if (cur->paragraph()->at(cur->index())->c.isSpace()) {
+ moveCursor( MoveWordForward, false );
+ break;
+ }
+ // beginning of next word
+ bool firstMove = true; // make sure we do move
+ while ((!isDelimiter(cur->paragraph()->at(cur->index())->c) || \
firstMove) && !cur->atParagEnd()) { + moveCursor( MoveForward, false \
); firstMove = false; cur = textCursor(); + }
+ while (isDelimiter(cur->paragraph()->at(cur->index())->c) && \
!cur->atParagEnd()) { + moveCursor( MoveForward, false ); cur = \
textCursor(); + }
+ }
+ break;
default:
KTextEdit::keyPressEvent( e );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic