Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-13192

Copy string to variable truncates it

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • Qt Creator 3.2.0, Qt Creator 4.4.0-rc1
    • Debugger
    • None

    Description

      If we have some long strings they may not be able to be displayed in the debug window. That is ok, but it is an unpleasant suprise that the value cannot be copied into the clipboard without being elided (truncated).

      For example:

      void doSomething()
      {
      
      }
      
      int main(int argc, char *argv[]) {
      
          QString someSql = "select column1, column2, column3, column4, column5 from someOwner.someTable "
               " where aQuiteLongTextCol1a = :aNotsThatShortTextVar1a "
               " and aQuiteLongTextCol2a = :aNotsThatShortTextVar2a "
               " and aQuiteLongTextCol3a = :aNotsThatShortTextVar3a "
               " and aQuiteLongTextCol4a = :aNotsThatShortTextVar4a "
               " and aQuiteLongTextCol5a = :aNotsThatShortTextVar5a "
               " and aQuiteLongTextCol6a = :aNotsThatShortTextVar6a "
               " and aQuiteLongTextCol7a = :aNotsThatShortTextVar7a "
               " and aQuiteLongTextCol8a = :aNotsThatShortTextVar8a "
               " and aQuiteLongTextCol9a = :aNotsThatShortTextVAr9a ";
      
           doSomething(); // <- right click variable + copy value to clip board
      }
      

      The clipboard only contains:

      "select column1, column2, column3, column4, column5 from someOwner.someTable  where aQuiteLongTextCol1a = :aNotsThatShortTextVar1a  and aQuiteLongTextCol2a = :aNotsThatShortTextVar2a  and aQuiteLongTextCol3a = :aNotsThatShortTextVar3a  and aQuiteLongTextCol4a = :aNotsThatShortTextVar4a  and aQuiteLongTextCol5a = :aNotsThatShortTextVar5a  and aQuiteLongTextCol6a = :aNotsThatShortTextVar6a  and aQuiteLongTextCol7a = :aNotsThatShortTextVar7a  and aQuiteLongTextCol8a = :aNotsThatShortTextVar8a  and aQuiteLongTe..."
      

      It is elided and truncated.

      I expect to be able to paste the whole (!) string value into an editor.

      In https://qt.gitorious.org/qt-creator/krishnaas-qt-creator/commit/55b4e6d I suspect that the following code makes the code goes wrong:

      // Truncate value for item view, maintaining quotes
      static inline QString truncateValue(QString v)
      {
        enum { maxLength = 512 };
        if (v.size() < maxLength)
      }
      

      It seems like we copy a truncated value - rather than doing a re-evaluate. The truncate is also a 512 constant and has nothing to do with the string settings under tool->options->debugger.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              hjk hjk
              tmartsum Thorbjørn Lund Martsum
              Votes:
              23 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes