~ubuntu-branches/ubuntu/trusty/kate/trusty-proposed

« back to all changes in this revision

Viewing changes to part/vimode/katevireplacemode.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2014-06-04 16:48:44 UTC
  • mfrom: (1.1.46)
  • Revision ID: package-import@ubuntu.com-20140604164844-dqgx2g13surkmfhd
Tags: 4:4.13.1-0ubuntu0.1
New upstream bugfix release (LP: #1318142)

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
bool KateViReplaceMode::commandInsertFromLine( int offset )
40
40
{
41
 
  KTextEditor::Cursor c( m_view->cursorPosition() );
42
 
  KTextEditor::Cursor c2( c.line(), c.column()+1 );
 
41
  KTextEditor::Cursor c(m_view->cursorPosition());
 
42
  KTextEditor::Cursor c2(c.line(), c.column() + 1);
43
43
 
44
 
  if ( c.line()+offset > doc()->lines() || c.line()+offset < 0 ) {
 
44
  if (c.line() + offset >= doc()->lines() || c.line() + offset < 0) {
45
45
    return false;
46
46
  }
47
47
 
48
 
  QString line = doc()->line( c.line()+offset );
 
48
  QString line = doc()->line(c.line() + offset);
49
49
  int tabWidth = doc()->config()->tabWidth();
50
 
  QChar ch = getCharAtVirtualColumn( line, m_view->virtualCursorColumn(), tabWidth );
51
 
  QChar removed = doc()->line( c.line() ).at( c.column() );
 
50
  QChar ch = getCharAtVirtualColumn(line, m_view->virtualCursorColumn(), tabWidth);
52
51
 
53
 
  if ( ch == QChar::Null ) {
 
52
  if (ch == QChar::Null) {
54
53
    return false;
55
54
  }
56
55
 
57
 
  if ( doc()->replaceText( KTextEditor::Range( c, c2 ), ch ) ) {
58
 
    overwrittenChar( removed );
 
56
  if (c.column() == doc()->lineLength(c.line())) {
 
57
    return doc()->insertText(c, ch);
 
58
  }
 
59
 
 
60
  QChar removed = doc()->line(c.line()).at(c.column());
 
61
  if (doc()->replaceText(KTextEditor::Range(c, c2), ch)) {
 
62
    overwrittenChar(removed);
59
63
    return true;
60
64
  }
61
65