Simplify and add debug message

This commit is contained in:
Guillaume Munch 2016-10-11 11:22:20 +02:00
parent e1492a3ab1
commit 2e45bade7a
5 changed files with 12 additions and 14 deletions

View File

@ -2344,15 +2344,9 @@ int BufferView::scrollUp(int offset)
bool BufferView::setCursorFromRow(int row)
{
return setCursorFromRow(row, buffer_.texrow());
}
bool BufferView::setCursorFromRow(int row, TexRow const & texrow)
{
TextEntry start, end;
tie(start,end) = texrow.getEntriesFromRow(row);
tie(start,end) = buffer_.texrow().getEntriesFromRow(row);
LYXERR(Debug::LATEX,
"setCursorFromRow: for row " << row << ", TexRow has found "
"start (id=" << start.id << ",pos=" << start.pos << "), "

View File

@ -164,8 +164,6 @@ public:
/// set the cursor based on the given TeX source row.
bool setCursorFromRow(int row);
///
bool setCursorFromRow(int row, TexRow const & texrow);
/// set the cursor based on the given start and end TextEntries.
bool setCursorFromEntries(TextEntry start, TextEntry end);

View File

@ -299,10 +299,15 @@ FuncRequest TexRow::goToFunc(TextEntry start, TextEntry end)
}
//static
FuncRequest TexRow::goToFunc(std::pair<TextEntry,TextEntry> entries)
FuncRequest TexRow::goToFuncFromRow(int const row) const
{
return goToFunc(entries.first, entries.second);
TextEntry start, end;
tie(start,end) = getEntriesFromRow(row);
LYXERR(Debug::LATEX,
"goToFuncFromRow: for row " << row << ", TexRow has found "
"start (id=" << start.id << ",pos=" << start.pos << "), "
"end (id=" << end.id << ",pos=" << end.pos << ")");
return goToFunc(start, end);
}

View File

@ -168,7 +168,8 @@ public:
// A FuncRequest to select from start to end
static FuncRequest goToFunc(TextEntry start, TextEntry end);
static FuncRequest goToFunc(std::pair<TextEntry,TextEntry> entries);
// A FuncRequest to select a row
FuncRequest goToFuncFromRow(int const row) const;
/**
* getDocIteratorFromRow - find pids and positions for a given row

View File

@ -330,7 +330,7 @@ void ViewSourceWidget::goToCursor() const
if (!texrow_)
return;
int row = viewSourceTV->textCursor().blockNumber() + 1;
dispatch(TexRow::goToFunc(texrow_->getEntriesFromRow(row)));
dispatch(texrow_->goToFuncFromRow(row));
}