From 2faa06b829b08ec2321590dccf24cfff262ea470 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Thu, 4 Sep 2003 14:33:16 +0000 Subject: [PATCH] have row information on state line + one more bformat variant git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7663 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++++ src/bufferview_funcs.C | 2 ++ src/support/ChangeLog | 4 ++++ src/support/lstrings.C | 16 ++++++++++++++++ src/support/lstrings.h | 2 ++ 5 files changed, 28 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 37e4989ef8..741491691f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -10,6 +10,10 @@ up the dialogs. Cursor has to be in front of the inset (i.e. start of row) for this to function. +2003-09-04 Lars Gullik Bjønnes + + * bufferview_funcs.C (currentState): output row information + 2003-09-04 Lars Gullik Bjønnes * bufferview_funcs.C (currentState): output paragraph position diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index 6dc8b3fff8..8896f345b6 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -364,6 +364,8 @@ string const currentState(BufferView * bv) #ifdef DEVEL_VERSION state << _(", Paragraph: ") << text->cursor.par()->id(); state << _(", Position: ") << text->cursor.pos(); + RowList::iterator rit = text->cursorRow(); + state << bformat(_(", Row b:%1$d e:%2$d"), rit->pos(), rit->end()); state << _(", Inset: ") << (text->cursor.par()->inInset() ? text->cursor.par()->inInset()->id() : -1); #endif diff --git a/src/support/ChangeLog b/src/support/ChangeLog index a8a4424459..25583f252e 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,7 @@ +2003-09-04 Lars Gullik Bjønnes + + * lstrings.[Ch] (bformat): add a variant taking two ints. + 2003-09-04 Angus Leeming * filetools.h: diff --git a/src/support/lstrings.C b/src/support/lstrings.C index 5cf4c4b8e2..2654413b38 100644 --- a/src/support/lstrings.C +++ b/src/support/lstrings.C @@ -627,6 +627,12 @@ string bformat(string const & fmt, string const & arg1, string const & arg2) } +string bformat(string const & fmt, int arg1, int arg2) +{ + return STRCONV((boost::format(STRCONV(fmt)) % arg1 % arg2).str()); +} + + string bformat(string const & fmt, string const & arg1, string const & arg2, string const & arg3) { @@ -671,6 +677,16 @@ string bformat(string const & fmt, string const & arg1, string const & arg2) } +string bformat(string const & fmt, int arg1, int arg2) +{ + Assert(contains(fmt, "%1$d")); + Assert(contains(fmt, "%2$d")); + string str = subst(fmt, "%1$d", arg1); + str = subst(str, "%2$d", arg2); + return subst(str, "%%", "%"); +} + + string bformat(string const & fmt, string const & arg1, string const & arg2, string const & arg3) { diff --git a/src/support/lstrings.h b/src/support/lstrings.h index 5dd8cfd02c..837658a13d 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -206,6 +206,8 @@ string const getStringFromVector(std::vector const & vec, string bformat(string const & fmt, string const & arg1); // arguments %1$s and %2$s string bformat(string const & fmt, string const & arg1, string const & arg2); +// arguments %1$d and %2$d +string bformat(string const & fmt, int arg1, int arg2); // arguments %1$s and %2$s and %3$s string bformat(string const & fmt, string const & arg1, string const & arg2, string const & arg3); -- 2.39.2