#7740 Add undo for change of text language with LFUN_BUFFER_LANGUAGE

When a document is not multi-lingual the text contents is changed
to the new language. This should be recorded for Undo.
Because Undo wants a cursor the implemantation has to be
moved to the BufferView class.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@39594 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stephan Witt 2011-09-05 18:41:39 +00:00
parent ee8f64e112
commit fd2a6bb3da
3 changed files with 16 additions and 12 deletions

View File

@ -2212,18 +2212,6 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
break;
}
case LFUN_BUFFER_LANGUAGE: {
Language const * oldL = params().language;
Language const * newL = languages.getLanguage(argument);
if (!newL || oldL == newL)
break;
if (oldL->rightToLeft() == newL->rightToLeft() && !isMultiLingual()) {
changeLanguage(oldL, newL);
dr.forceBufferUpdate();
}
break;
}
default:
dispatched = false;
break;

View File

@ -1884,6 +1884,19 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
break;
}
case LFUN_BUFFER_LANGUAGE: {
Language const * oldL = buffer_.params().language;
Language const * newL = languages.getLanguage(argument);
if (!newL || oldL == newL)
break;
if (oldL->rightToLeft() == newL->rightToLeft() && !buffer_.isMultiLingual()) {
cur.recordUndoFullDocument();
buffer_.changeLanguage(oldL, newL);
dr.forceBufferUpdate();
}
break;
}
default:
// OK, so try the Buffer itself...
buffer_.dispatch(cmd, dr);

View File

@ -49,6 +49,9 @@ What's new
- Group correctly Koma Book environments inside environment combo-box listing.
- Add undo for change of text language when document language is changed.
When a document is not multi-lingual the text contents is changed to the
new language. This should be recorded for Undo (bug 7740).
* ADVANCED FIND AND REPLACE