~ubuntu-branches/ubuntu/saucy/kate/saucy

« back to all changes in this revision

Viewing changes to part/vimode/katevikeyparser.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell, Rohan Garg, Jonathan Riddell
  • Date: 2013-06-21 00:48:29 UTC
  • mfrom: (1.1.28)
  • Revision ID: package-import@ubuntu.com-20130621004829-y2ui02eg0j47h94y
Tags: 4:4.10.80-0ubuntu1
[ Rohan Garg ]
* New upstream release
  - Update and sort install files
  - Drop kubuntu_pate_find_python.diff, kubuntu_kate_initial_preference.patch,
    kubuntu_find_python.diff from debian/patches , not required

[ Jonathan Riddell ]
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
515
515
      else {
516
516
        // contains modifiers
517
517
        if ( keys.mid( i ).indexOf( '-' ) != -1 && keys.mid( i ).indexOf( '-' ) < keys.mid( i ).indexOf( '>' ) ) {
518
 
          QStringList tokens = keys.mid( i, keys.mid( i ).indexOf( '>' ) ).toLower().split( '-' );
 
518
          // Perform something similar to a split on '-', except that we want to keep the occurrences of '-'
 
519
          // e.g. <c-s-a> will equate to the list of tokens "c-", "s-", "a".
 
520
          // A straight split on '-' would give us "c", "s", "a", in which case we lose the piece of information that
 
521
          // 'a' is just the 'a' key, not the 'alt' modifier.
 
522
          const QString untilClosing = keys.mid( i, keys.mid( i ).indexOf( '>' ) ).toLower();
 
523
          QStringList tokens;
 
524
          int currentPos = 0;
 
525
          int nextHypen = -1;
 
526
          while ((nextHypen = untilClosing.indexOf(QChar('-'), currentPos)) != -1)
 
527
          {
 
528
            tokens << untilClosing.mid(currentPos, nextHypen - currentPos + 1);
 
529
            currentPos = nextHypen + 1;
 
530
          }
 
531
          tokens << untilClosing.mid(currentPos);
519
532
 
520
533
          foreach ( const QString& str, tokens ) {
521
 
            if ( str == "s" && ( keyCodeTemp & 0x01 ) != 0x1  )
 
534
            if ( str == "s-" && ( keyCodeTemp & 0x01 ) != 0x1  )
522
535
              keyCodeTemp += 0x1;
523
 
            else if ( str == "c" && ( keyCodeTemp & 0x02 ) != 0x2 )
 
536
            else if ( str == "c-" && ( keyCodeTemp & 0x02 ) != 0x2 )
524
537
              keyCodeTemp += 0x2;
525
 
            else if ( str == "a" && ( keyCodeTemp & 0x04 ) != 0x4 )
 
538
            else if ( str == "a-" && ( keyCodeTemp & 0x04 ) != 0x4 )
526
539
              keyCodeTemp += 0x4;
527
 
            else if ( str == "m" && ( keyCodeTemp & 0x08 ) != 0x8 )
 
540
            else if ( str == "m-" && ( keyCodeTemp & 0x08 ) != 0x8 )
528
541
              keyCodeTemp += 0x8;
529
542
            else {
530
543
              if ( m_nameToKeyCode->contains( str ) || ( str.length() == 1 && str.at( 0 ).isLetterOrNumber() ) ) {
752
765
  }
753
766
 
754
767
  if ( text.isEmpty() || ( text.length() == 1 && text.at(0) < 0x20 )
755
 
      || ( mods != Qt::NoModifier && mods != Qt::ShiftModifier ) ) {
 
768
      || ( mods != Qt::NoModifier && mods != Qt::ShiftModifier && mods != Qt::KeypadModifier ) ) {
756
769
    QString keyPress;
757
770
 
758
771
    keyPress.append( '<' );
769
782
      //note that non-latin letter in Latin layout can be a punctuation character (also some punctuation differs too)
770
783
      QChar tempChar(text.at(0));
771
784
      //don't touch latin keys
 
785
      if (mods == Qt::KeypadModifier && keyCode >= Qt::Key_0 && keyCode <= Qt::Key_9)
 
786
      {
 
787
        // Keypad numbers to ordinary numbers.
 
788
        key = tempChar;
 
789
      }
772
790
      if ((keyCode < Qt::Key_A || keyCode > Qt::Key_Z) && tempChar.isLetter()) {
773
791
          char ch = scanCodeToChar(nativeScanCode, mods, tempChar.isLetter());
774
792
          if (ch != 0) {