mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
dolphin: do not re-set the diff document text if it is the same
so many little details to code.. Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
e7262fc7ab
commit
e52432efae
1 changed files with 9 additions and 6 deletions
|
@ -87,12 +87,15 @@ void GitCommitDialog::setupWidgets(const QStringList &changedfiles, const QStrin
|
|||
{
|
||||
m_changedfiles->setText(changedfiles.join(QLatin1String("\n")));
|
||||
if (m_diffdocument) {
|
||||
// NOTE: can't set the text in read-only mode
|
||||
m_diffdocument->setReadWrite(true);
|
||||
m_diffdocument->setText(diff);
|
||||
// NOTE: after KTextEditor::Document::setText() the cursor is at the end
|
||||
m_diffdocument->activeView()->setCursorPosition(KTextEditor::Cursor::start());
|
||||
m_diffdocument->setReadWrite(false);
|
||||
// by not re-setting the text the cursor position and selection is preserved
|
||||
if (m_diffdocument->text() != diff) {
|
||||
// NOTE: can't set the text in read-only mode
|
||||
m_diffdocument->setReadWrite(true);
|
||||
m_diffdocument->setText(diff);
|
||||
// NOTE: after KTextEditor::Document::setText() the cursor is at the end
|
||||
m_diffdocument->activeView()->setCursorPosition(KTextEditor::Cursor::start());
|
||||
m_diffdocument->setReadWrite(false);
|
||||
}
|
||||
} else {
|
||||
m_difffiles->setText(diff);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue