Project

General

Profile

0001-prevent-automatic-pastes-instead-just-display-the-w.patch

admin, 07/05/2008 02:23 PM

View differences:

src/uisupport/inputline.cpp
57 57
}
58 58

  
59 59
void InputLine::on_returnPressed() {
60
  history << text();
61
  idx = history.count();
62
  emit sendText(text());
60
  foreach(QString newText, text().split(QRegExp("[\\r\\n]+"))) {
61
    history << newText;
62
    idx = history.count();
63
    emit sendText(newText);
64
  }
63 65
  clear();
64 66
}
65 67

  
66 68
void InputLine::on_textChanged(QString newText) {
67
  QStringList lineSeperators;
68
  lineSeperators << QString("\r\n")
69
		 << QString('\n')
70
		 << QString('\r');
71
  
72
  QString lineSep;
73
  foreach(QString seperator, lineSeperators) {
74
    if(newText.contains(seperator)) {
75
      lineSep = seperator;
76
      break;
77
    }
78
  }
79

  
80
  if(lineSep.isEmpty())
81
    return;
82
  
83
  if(newText.contains(lineSep)) {
84
    clear();
85
    QString line = newText.section(lineSep, 0, 0);
86
    QString remainder = newText.section(lineSep, 1);
87
    insert(line);
88
    emit returnPressed();
89
    insert(remainder);
90
  }
91
  
69
  return;
92 70
}
93 71

  
94
-