Editor modifications... ('home' key behavior)
Chet Simpson
digitalasp at yahoo.com
Mon Jul 8 08:34:03 UTC 2002
Greetings!
I just started using KDevelop today and have already made a modification :)
Since I didn't find it in the buglist or wishlist, I thought I would post it here for others to
play around with and give opinions.....
The change is applied to KWriteView::home() and changes the behavior to move to the first
non-space character of the line. If the cursor is already at the first non-space character in the
line, it will default to it's original behavior and move to the zero position.
Enjoy!
...Chet...
New code:
void KWriteView::home(VConfig &c) {
int length;
int xpos;
TextLine* currLine;
currLine = kWriteDoc->textLine(cursor.y);
length = kWriteDoc->textLength(cursor.y);
xpos = 0;
if(0 != length) {
// Find the first non-space character in the line
while(xpos < length && isspace(currLine->getChar(xpos))) {
xpos++;
}
// If the entire line is blank or the cursor is already at the first
// non-space character in the line, go to the zero-position
if(xpos == length || xpos == cursor.x) {
xpos = 0;
}
}
// Set the new cursor position
cursor.x = xpos;
cOldXPos = cXPos = kWriteDoc->textWidth(cursor);
update(c);
}
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
More information about the KDevelop-devel
mailing list