1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798
|
/* This file is part of the KDE libraries
* Copyright (C) 2008 - 2009 Erlend Hamberg <ehamberg@gmail.com>
* Copyright (C) 2009 Paul Gideon Dann <pdgiddie@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "katevimodebase.h"
#include "katevirange.h"
#include "kateglobal.h"
#include "kateviglobal.h"
#include "katevivisualmode.h"
#include "katevinormalmode.h"
#include "katevireplacemode.h"
#include "kateviinputmodemanager.h"
#include <QString>
#include <QRegExp>
#include "kateconfig.h"
#include "katedocument.h"
#include "kateviewinternal.h"
#include "katevimodebar.h"
// TODO: the "previous word/WORD [end]" methods should be optimized. now they're being called in a
// loop and all calculations done up to finding a match are wasted when called with a count > 1
// because they will simply be called again from the last found position.
// They should take the count as a parameter and collect the positions in a QList, then return
// element (count - 1)
////////////////////////////////////////////////////////////////////////////////
// HELPER METHODS
////////////////////////////////////////////////////////////////////////////////
bool KateViModeBase::deleteRange( KateViRange &r, bool linewise, bool addToRegister)
{
r.normalize();
bool res = false;
QString removedText = getRange( r, linewise );
if ( linewise ) {
doc()->editStart();
for ( int i = 0; i < r.endLine-r.startLine+1; i++ ) {
res = doc()->removeLine( r.startLine );
}
doc()->editEnd();
} else {
res = doc()->removeText( KTextEditor::Range( r.startLine, r.startColumn, r.endLine, r.endColumn) );
}
if ( addToRegister ) {
if ( r.startLine == r.endLine ) {
fillRegister( getChosenRegister( '-' ), removedText );
} else {
fillRegister( getChosenRegister( '0' ), removedText );
}
}
return res;
}
const QString KateViModeBase::getRange( KateViRange &r, bool linewise) const
{
r.normalize();
QString s;
if ( linewise ) {
r.startColumn = 0;
r.endColumn = getLine( r.endLine ).length();
}
if ( r.motionType == ViMotion::InclusiveMotion ) {
r.endColumn++;
}
KTextEditor::Range range( r.startLine, r.startColumn, r.endLine, r.endColumn);
if ( linewise ) {
s = doc()->textLines( range ).join( QChar( '\n' ) );
s.append( QChar( '\n' ) );
} else {
s = doc()->text( range );
}
return s;
}
const QString KateViModeBase::getLine( int lineNumber ) const
{
QString line;
if ( lineNumber == -1 ) {
KTextEditor::Cursor cursor ( m_view->cursorPosition() );
line = m_view->currentTextLine();
} else {
line = doc()->line( lineNumber );
}
return line;
}
const QChar KateViModeBase::getCharUnderCursor() const
{
KTextEditor::Cursor c( m_view->cursorPosition() );
QString line = getLine( c.line() );
if ( line.length() == 0 && c.column() >= line.length() ) {
return QChar::Null;
}
return line.at( c.column() );
}
KTextEditor::Cursor KateViModeBase::findNextWordStart( int fromLine, int fromColumn, bool onlyCurrentLine ) const
{
QString line = getLine( fromLine );
// the start of word pattern need to take m_extraWordCharacters into account if defined
QString startOfWordPattern("\\b(\\w");
if ( m_extraWordCharacters.length() > 0 ) {
startOfWordPattern.append( QLatin1String( "|[" )+m_extraWordCharacters+']' );
}
startOfWordPattern.append( ')' );
QRegExp startOfWord( startOfWordPattern ); // start of a word
QRegExp nonSpaceAfterSpace( "\\s\\S" ); // non-space right after space
QRegExp nonWordAfterWord( "\\b(?!\\s)\\W" ); // word-boundary followed by a non-word which is not a space
int l = fromLine;
int c = fromColumn;
bool found = false;
while ( !found ) {
int c1 = startOfWord.indexIn( line, c + 1 );
int c2 = nonSpaceAfterSpace.indexIn( line, c );
int c3 = nonWordAfterWord.indexIn( line, c + 1 );
if ( c1 == -1 && c2 == -1 && c3 == -1 ) {
if ( onlyCurrentLine ) {
return KTextEditor::Cursor( l, c );
} else if ( l >= doc()->lines()-1 ) {
c = line.length()-1;
return KTextEditor::Cursor( l, c );
} else {
c = 0;
l++;
line = getLine( l );
if ( line.length() == 0 || !line.at( c ).isSpace() ) {
found = true;
}
continue;
}
}
c2++; // the second regexp will match one character *before* the character we want to go to
if ( c1 <= 0 )
c1 = line.length()-1;
if ( c2 <= 0 )
c2 = line.length()-1;
if ( c3 <= 0 )
c3 = line.length()-1;
c = qMin( c1, qMin( c2, c3 ) );
found = true;
}
return KTextEditor::Cursor( l, c );
}
KTextEditor::Cursor KateViModeBase::findNextWORDStart( int fromLine, int fromColumn, bool onlyCurrentLine ) const
{
KTextEditor::Cursor cursor ( m_view->cursorPosition() );
QString line = getLine();
KateViRange r( cursor.line(), cursor.column(), ViMotion::ExclusiveMotion );
int l = fromLine;
int c = fromColumn;
bool found = false;
QRegExp startOfWORD("\\s\\S");
while ( !found ) {
c = startOfWORD.indexIn( line, c+1 );
if ( c == -1 ) {
if ( onlyCurrentLine ) {
return KTextEditor::Cursor( l, c );
} else if ( l >= doc()->lines()-1 ) {
c = line.length()-1;
break;
} else {
c = 0;
l++;
line = getLine( l );
if ( line.length() == 0 || !line.at( c ).isSpace() ) {
found = true;
}
continue;
}
} else {
c++;
found = true;
}
}
return KTextEditor::Cursor( l, c );
}
KTextEditor::Cursor KateViModeBase::findPrevWordEnd( int fromLine, int fromColumn, bool onlyCurrentLine ) const
{
QString line = getLine( fromLine );
QString endOfWordPattern = "\\S\\s|\\S$|\\w\\W|\\S\\b|^$";
if ( m_extraWordCharacters.length() > 0 ) {
endOfWordPattern.append( "|["+m_extraWordCharacters+"][^" +m_extraWordCharacters+']' );
}
QRegExp endOfWord( endOfWordPattern );
int l = fromLine;
int c = fromColumn;
bool found = false;
while ( !found ) {
int c1 = endOfWord.lastIndexIn( line, c-1 );
if ( c1 != -1 && c-1 != -1 ) {
found = true;
c = c1;
} else {
if ( onlyCurrentLine ) {
return KTextEditor::Cursor( l, c );
} else if ( l > 0 ) {
line = getLine( --l );
c = line.length();
continue;
} else {
c = 0;
return KTextEditor::Cursor( l, c );
}
}
}
return KTextEditor::Cursor( l, c );
}
KTextEditor::Cursor KateViModeBase::findPrevWORDEnd( int fromLine, int fromColumn, bool onlyCurrentLine ) const
{
QString line = getLine( fromLine );
QRegExp endOfWORDPattern( "\\S\\s|\\S$|^$" );
QRegExp endOfWORD( endOfWORDPattern );
int l = fromLine;
int c = fromColumn;
bool found = false;
while ( !found ) {
int c1 = endOfWORD.lastIndexIn( line, c-1 );
if ( c1 != -1 && c-1 != -1 ) {
found = true;
c = c1;
} else {
if ( onlyCurrentLine ) {
return KTextEditor::Cursor( l, c );
} else if ( l > 0 ) {
line = getLine( --l );
c = line.length();
continue;
} else {
c = 0;
return KTextEditor::Cursor( l, c );
}
}
}
return KTextEditor::Cursor( l, c );
}
KTextEditor::Cursor KateViModeBase::findPrevWordStart( int fromLine, int fromColumn, bool onlyCurrentLine ) const
{
QString line = getLine( fromLine );
// the start of word pattern need to take m_extraWordCharacters into account if defined
QString startOfWordPattern("\\b(\\w");
if ( m_extraWordCharacters.length() > 0 ) {
startOfWordPattern.append( QLatin1String( "|[" )+m_extraWordCharacters+']' );
}
startOfWordPattern.append( ')' );
QRegExp startOfWord( startOfWordPattern ); // start of a word
QRegExp nonSpaceAfterSpace( "\\s\\S" ); // non-space right after space
QRegExp nonWordAfterWord( "\\b(?!\\s)\\W" ); // word-boundary followed by a non-word which is not a space
QRegExp startOfLine( "^\\S" ); // non-space at start of line
int l = fromLine;
int c = fromColumn;
bool found = false;
while ( !found ) {
int c1 = startOfWord.lastIndexIn( line, -line.length()+c-1 );
int c2 = nonSpaceAfterSpace.lastIndexIn( line, -line.length()+c-2 );
int c3 = nonWordAfterWord.lastIndexIn( line, -line.length()+c-1 );
int c4 = startOfLine.lastIndexIn( line, -line.length()+c-1 );
if ( c1 == -1 && c2 == -1 && c3 == -1 && c4 == -1 ) {
if ( onlyCurrentLine ) {
return KTextEditor::Cursor( l, c );
} else if ( l <= 0 ) {
return KTextEditor::Cursor( 0, 0 );
} else {
line = getLine( --l );
c = line.length()-1;
if ( line.length() == 0 ) {
c = 0;
found = true;
}
continue;
}
}
c2++; // the second regexp will match one character *before* the character we want to go to
if ( c1 <= 0 )
c1 = 0;
if ( c2 <= 0 )
c2 = 0;
if ( c3 <= 0 )
c3 = 0;
if ( c4 <= 0 )
c4 = 0;
c = qMax( c1, qMax( c2, qMax( c3, c4 ) ) );
found = true;
}
return KTextEditor::Cursor( l, c );
}
KTextEditor::Cursor KateViModeBase::findPrevWORDStart( int fromLine, int fromColumn, bool onlyCurrentLine ) const
{
QString line = getLine( fromLine );
QRegExp startOfWORD("\\s\\S");
QRegExp startOfLineWORD("^\\S");
int l = fromLine;
int c = fromColumn;
bool found = false;
while ( !found ) {
int c1 = startOfWORD.lastIndexIn( line, -line.length()+c-2 );
int c2 = startOfLineWORD.lastIndexIn( line, -line.length()+c-1 );
if ( c1 == -1 && c2 == -1 ) {
if ( onlyCurrentLine ) {
return KTextEditor::Cursor( l, c );
} else if ( l <= 0 ) {
return KTextEditor::Cursor( 0, 0 );
} else {
line = getLine( --l );
c = line.length()-1;
if ( line.length() == 0 ) {
c = 0;
found = true;
}
continue;
}
}
c1++; // the startOfWORD pattern matches one character before the word
c = qMax( c1, c2 );
if ( c <= 0 )
c = 0;
found = true;
}
return KTextEditor::Cursor( l, c );
}
KTextEditor::Cursor KateViModeBase::findWordEnd( int fromLine, int fromColumn, bool onlyCurrentLine ) const
{
QString line = getLine( fromLine );
QString endOfWordPattern = "\\S\\s|\\S$|\\w\\W|\\S\\b";
if ( m_extraWordCharacters.length() > 0 ) {
endOfWordPattern.append( "|["+m_extraWordCharacters+"][^" +m_extraWordCharacters+']' );
}
QRegExp endOfWORD( endOfWordPattern );
int l = fromLine;
int c = fromColumn;
bool found = false;
while ( !found ) {
int c1 = endOfWORD.indexIn( line, c+1 );
if ( c1 != -1 ) {
found = true;
c = c1;
} else {
if ( onlyCurrentLine ) {
return KTextEditor::Cursor( l, c );
} else if ( l >= doc()->lines()-1 ) {
c = line.length()-1;
return KTextEditor::Cursor( l, c );
} else {
c = -1;
line = getLine( ++l );
continue;
}
}
}
return KTextEditor::Cursor( l, c );
}
KTextEditor::Cursor KateViModeBase::findWORDEnd( int fromLine, int fromColumn, bool onlyCurrentLine ) const
{
QString line = getLine( fromLine );
QRegExp endOfWORD( "\\S\\s|\\S$" );
int l = fromLine;
int c = fromColumn;
bool found = false;
while ( !found ) {
int c1 = endOfWORD.indexIn( line, c+1 );
if ( c1 != -1 ) {
found = true;
c = c1;
} else {
if ( onlyCurrentLine ) {
return KTextEditor::Cursor( l, c );
} else if ( l >= doc()->lines()-1 ) {
c = line.length()-1;
return KTextEditor::Cursor( l, c );
} else {
c = -1;
line = getLine( ++l );
continue;
}
}
}
return KTextEditor::Cursor( l, c );
}
// FIXME: i" won't work if the cursor is on one of the chars
KateViRange KateViModeBase::findSurrounding( const QChar &c1, const QChar &c2, bool inner ) const
{
KTextEditor::Cursor cursor( m_view->cursorPosition() );
QString line = getLine();
int col1 = line.lastIndexOf( c1, cursor.column() );
int col2 = line.indexOf( c2, cursor.column() );
KateViRange r( cursor.line(), col1, cursor.line(), col2, ViMotion::InclusiveMotion );
if ( col1 == -1 || col2 == -1 || col1 > col2 ) {
r.valid = false;
}
if ( inner ) {
r.startColumn++;
r.endColumn--;
}
return r;
}
KateViRange KateViModeBase::findSurrounding( const QRegExp &c1, const QRegExp &c2, bool inner ) const
{
KTextEditor::Cursor cursor( m_view->cursorPosition() );
QString line = getLine();
int col1 = line.lastIndexOf( c1, cursor.column() );
int col2 = line.indexOf( c2, cursor.column() );
KateViRange r( cursor.line(), col1, cursor.line(), col2, ViMotion::InclusiveMotion );
if ( col1 == -1 || col2 == -1 || col1 > col2 ) {
r.valid = false;
}
if ( inner ) {
r.startColumn++;
r.endColumn--;
}
return r;
}
int KateViModeBase::findLineStartingWitchChar( const QChar &c, unsigned int count, bool forward ) const
{
int line = m_view->cursorPosition().line();
int lines = doc()->lines();
unsigned int hits = 0;
if ( forward ) {
line++;
} else {
line--;
}
while ( line < lines && line > 0 && hits < count ) {
QString l = getLine( line );
if ( l.length() > 0 && l.at( 0 ) == c ) {
hits++;
}
if ( hits != count ) {
if ( forward ) {
line++;
} else {
line--;
}
}
}
if ( hits == getCount() ) {
return line;
}
return -1;
}
void KateViModeBase::updateCursor( const KTextEditor::Cursor &c ) const
{
m_viewInternal->updateCursor( c );
}
/**
* @return the register given for the command. If no register was given, defaultReg is returned.
*/
QChar KateViModeBase::getChosenRegister( const QChar &defaultReg ) const
{
QChar reg = ( m_register != QChar::Null ) ? m_register : defaultReg;
return reg;
}
QString KateViModeBase::getRegisterContent( const QChar ® ) const
{
QString r = KateGlobal::self()->viInputModeGlobal()->getRegisterContent( reg );
if ( r.isNull() ) {
error( i18n( "Nothing in register %1" ,reg ));
}
return r;
}
void KateViModeBase::fillRegister( const QChar ®, const QString &text )
{
KateGlobal::self()->viInputModeGlobal()->fillRegister( reg, text );
}
KateViRange KateViModeBase::goLineDown()
{
return goLineUpDown( getCount() );
}
KateViRange KateViModeBase::goLineUp()
{
return goLineUpDown( -getCount() );
}
/**
* method for moving up or down one or more lines
* note: the sticky column is always a virtual column
*/
KateViRange KateViModeBase::goLineUpDown( int lines )
{
KTextEditor::Cursor c( m_view->cursorPosition() );
KateViRange r( c.line(), c.column(), ViMotion::InclusiveMotion );
int tabstop = doc()->config()->tabWidth();
// if in an empty document, just return
if ( lines == 0 ) {
return r;
}
r.endLine += lines;
// limit end line to be from line 0 through the last line
if ( r.endLine < 0 ) {
r.endLine = 0;
} else if ( r.endLine > doc()->lines()-1 ) {
r.endLine = doc()->lines()-1;
}
KateTextLine::Ptr startLine = doc()->plainKateTextLine( c.line() );
KateTextLine::Ptr endLine = doc()->plainKateTextLine( r.endLine );
int endLineLen = doc()->lineLength( r.endLine )-1;
if ( endLineLen < 0 ) {
endLineLen = 0;
}
int endLineLenVirt = endLine->toVirtualColumn(endLineLen, tabstop);
int virtColumnStart = startLine->toVirtualColumn(c.column(), tabstop);
// if sticky column isn't set, set end column and set sticky column to its virtual column
if ( m_stickyColumn == -1 ) {
r.endColumn = endLine->fromVirtualColumn( virtColumnStart, tabstop );
m_stickyColumn = virtColumnStart;
} else {
// sticky is set - set end column to its value
r.endColumn = endLine->fromVirtualColumn( m_stickyColumn, tabstop );
}
// make sure end column won't be after the last column of a line
if ( r.endColumn > endLineLen ) {
r.endColumn = endLineLen;
}
// if we move to a line shorter than the current column, go to its end
if ( virtColumnStart > endLineLenVirt ) {
r.endColumn = endLineLen;
}
return r;
}
bool KateViModeBase::startNormalMode()
{
// store the key presses for this "insert mode session" so that it can be repeated with the
// '.' command
if (!m_viInputModeManager->isRunningMacro()) {
m_viInputModeManager->storeChangeCommand();
m_viInputModeManager->clearLog();
}
m_viInputModeManager->viEnterNormalMode();
m_view->doc()->setMergeAllEdits(false);
m_view->updateViModeBarMode();
return true;
}
bool KateViModeBase::startInsertMode()
{
m_viInputModeManager->viEnterInsertMode();
m_view->doc()->setMergeAllEdits(true);
m_view->updateViModeBarMode();
return true;
}
bool KateViModeBase::startReplaceMode()
{
m_view->doc()->setMergeAllEdits(true);
m_viInputModeManager->viEnterReplaceMode();
m_view->updateViModeBarMode();
return true;
}
bool KateViModeBase::startVisualMode()
{
if ( m_view->getCurrentViMode() == VisualLineMode ) {
m_viInputModeManager->getViVisualMode()->setVisualLine( false );
m_viInputModeManager->changeViMode(VisualMode);
} else if (m_view->getCurrentViMode() == VisualBlockMode ) {
m_viInputModeManager->getViVisualMode()->setVisualBlock( false );
m_viInputModeManager->changeViMode(VisualMode);
} else {
m_viInputModeManager->viEnterVisualMode();
}
m_view->updateViModeBarMode();
return true;
}
bool KateViModeBase::startVisualBlockMode()
{
if ( m_view->getCurrentViMode() == VisualMode ) {
m_viInputModeManager->getViVisualMode()->setVisualBlock( true );
m_viInputModeManager->changeViMode(VisualBlockMode);
} else {
m_viInputModeManager->viEnterVisualMode( VisualBlockMode );
}
m_view->updateViModeBarMode();
return true;
}
bool KateViModeBase::startVisualLineMode()
{
if ( m_view->getCurrentViMode() == VisualMode ) {
m_viInputModeManager->getViVisualMode()->setVisualLine( true );
m_viInputModeManager->changeViMode(VisualLineMode);
} else {
m_viInputModeManager->viEnterVisualMode( VisualLineMode );
}
m_view->updateViModeBarMode();
return true;
}
void KateViModeBase::error( const QString &errorMsg ) const
{
m_view->viModeBar()->showErrorMessage(errorMsg);
}
void KateViModeBase::message( const QString &msg ) const
{
m_view->viModeBar()->showMessage(msg);
}
QString KateViModeBase::getVerbatimKeys() const
{
return m_keysVerbatim;
}
const QChar KateViModeBase::getCharAtVirtualColumn( QString &line, int virtualColumn,
int tabWidth ) const
{
int column = 0;
int tempCol = 0;
// sanity check: if the line is empty, there are no chars
if ( line.length() == 0 ) {
return QChar::Null;
}
while ( tempCol < virtualColumn ) {
if ( line.at( column ) == '\t' ) {
tempCol += tabWidth - ( tempCol % tabWidth );
} else {
tempCol++;
}
if ( tempCol <= virtualColumn ) {
column++;
if ( column >= line.length() ) {
return QChar::Null;
}
}
}
if ( line.length() > column )
return line.at( column );
return QChar::Null;
}
|