From: Abdelrazak Younes Date: Wed, 22 Aug 2007 14:36:18 +0000 (+0000) Subject: cosmetics: return early whenever possible to reduce indentation. X-Git-Tag: 1.6.10~8751 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=4c1144c1876776f52db68283ec9283f93911894a;p=lyx.git cosmetics: return early whenever possible to reduce indentation. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19724 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index f99febbadd..92e83f05cf 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -265,29 +265,32 @@ void LyXFunc::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer) return; } // open may fail, so we need to test it again - if (theBufferList().exists(file)) { - // if the current buffer is not that one, switch to it. - if (lyx_view_->buffer()->fileName() != file) { - if (switchToBuffer) - dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file)); - else - return; - } - // moveToPosition try paragraph id first and then paragraph (pit, pos). - if (!view()->moveToPosition(bm.bottom_pit, bm.bottom_pos, - bm.top_id, bm.top_pos)) - return; + if (!theBufferList().exists(file)) + return; - // Cursor jump succeeded! - Cursor const & cur = view()->cursor(); - pit_type new_pit = cur.pit(); - pos_type new_pos = cur.pos(); - int new_id = cur.paragraph().id(); + // if the current buffer is not that one, switch to it. + if (lyx_view_->buffer()->fileName() != file) { + if (!switchToBuffer) + return; + dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file)); + } + // moveToPosition try paragraph id first and then paragraph (pit, pos). + if (!view()->moveToPosition(bm.bottom_pit, bm.bottom_pos, + bm.top_id, bm.top_pos)) + return; - // if bottom_pit, bottom_pos or top_id has been changed, update bookmark - // see http://bugzilla.lyx.org/show_bug.cgi?id=3092 - if (bm.bottom_pit != new_pit || bm.bottom_pos != new_pos || bm.top_id != new_id ) - const_cast(bm).updatePos(new_pit, new_pos, new_id); + // Cursor jump succeeded! + Cursor const & cur = view()->cursor(); + pit_type new_pit = cur.pit(); + pos_type new_pos = cur.pos(); + int new_id = cur.paragraph().id(); + + // if bottom_pit, bottom_pos or top_id has been changed, update bookmark + // see http://bugzilla.lyx.org/show_bug.cgi?id=3092 + if (bm.bottom_pit != new_pit || bm.bottom_pos != new_pos + || bm.top_id != new_id) { + const_cast(bm).updatePos( + new_pit, new_pos, new_id); } }