#include "support/lassert.h"
#include "support/lstrings.h"
#include "support/lyxalgo.h"
+#include "support/lyxtime.h"
#include "support/textutils.h"
#include <sstream>
-// TODO: replace if in Text::readParToken() with compile time switch
-#if 0
-
-#include "support/metahash.h"
-
-typedef boost::mpl::string<'\\end','_lay','out'> end_layout;
-typedef boost::mpl::string<'\\end','in','set'> end_inset;
-
-void foo()
-{
- std::string token = "\\end_layout";
-
- switch (boost::hash_value(token)) {
- case lyx::support::hash_string<end_layout>::value:
- return;
- case lyx::support::hash_string<end_inset>::value:
- return;
- default: ;
- };
-
-}
-#endif
-
-
using namespace std;
using namespace lyx::support;
ParagraphList & pars, pit_type par_offset, pos_type pos)
{
// create a new paragraph
- Paragraph & tmp = *pars.insert(next(pars.begin(), par_offset + 1),
+ Paragraph & tmp = *pars.insert(lyx::next(pars.begin(), par_offset + 1),
Paragraph());
Paragraph & par = pars[par_offset];
ParagraphList & pars = text.paragraphs();
// create a new paragraph, and insert into the list
ParagraphList::iterator tmp =
- pars.insert(next(pars.begin(), par_offset + 1),
+ pars.insert(lyx::next(pars.begin(), par_offset + 1),
Paragraph());
Paragraph & par = pars[par_offset];
pos_type pos = cur.pos();
if (!cur.paragraph().isPassThru() && owner_->lyxCode() != IPA_CODE &&
- cur.current_font.fontInfo().family() != TYPEWRITER_FAMILY &&
+ cur.real_current_font.fontInfo().family() != TYPEWRITER_FAMILY &&
c == '-' && pos > 0) {
if (par.getChar(pos - 1) == '-') {
// convert "--" to endash
Paragraph const & par = cur.paragraph();
// Paragraph boundary is a word boundary
- if (pos == lastpos) {
+ if (pos == lastpos || (pos + 1 == lastpos && par.isEnvSeparator(pos))) {
if (pit != cur.lastpit())
return setCursor(cur, pit + 1, 0);
else
++pos;
}
+ // Don't skip a separator inset at the end of a paragraph
+ if (pos == lastpos && pos && par.isEnvSeparator(pos - 1))
+ --pos;
+
return setCursor(cur, pit, pos);
}
Paragraph & par = cur.paragraph();
// Paragraph boundary is a word boundary
- if (pos == 0 && pit != 0)
- return setCursor(cur, pit - 1, getPar(pit - 1).size());
+ if (pos == 0 && pit != 0) {
+ Paragraph & prevpar = getPar(pit - 1);
+ pos = prevpar.size();
+ // Don't stop after an environment separator
+ if (pos && prevpar.isEnvSeparator(pos - 1))
+ --pos;
+ return setCursor(cur, pit - 1, pos);
+ }
if (lyxrc.mac_like_cursor_movement) {
// Skip through punctuation and spaces.
if (cur.lastpos() == 0
|| (cur.lastpos() == 1 && par.isSeparator(0))) {
cur.recordUndo(prevcur.pit());
- plist.erase(next(plist.begin(), cur.pit()));
+ plist.erase(lyx::next(plist.begin(), cur.pit()));
needsUpdate = true;
}
// is previous par empty?
else if (prevcur.lastpos() == 0
|| (prevcur.lastpos() == 1 && prevpar.isSeparator(0))) {
cur.recordUndo(prevcur.pit());
- plist.erase(next(plist.begin(), prevcur.pit()));
+ plist.erase(lyx::next(plist.begin(), prevcur.pit()));
needsUpdate = true;
}
// Pasting is not allowed, if the paragraphs have different
Change change = par.lookupChange(cur.pos());
if (change.changed()) {
- Author const & a = buf.params().authors().get(change.author);
- os << _("Change: ") << a.name();
- if (!a.email().empty())
- os << " (" << a.email() << ")";
- // FIXME ctime is english, we should translate that
- os << _(" at ") << ctime(&change.changetime);
- os << " : ";
+ docstring const author =
+ buf.params().authors().get(change.author).nameAndEmail();
+ docstring const date = formatted_datetime(change.changetime);
+ os << bformat(_("Changed by %1$s[[author]] on %2$s[[date]]. "),
+ author, date);
}
// I think we should only show changes from the default