[prev in list] [next in list] [prev in thread] [next in thread]
List: lyx-cvs
Subject: [LyX/master] refactor: keep meaning of a variable consistent
From: Scott Kostyshak <skostysh () lyx ! org>
Date: 2021-07-16 19:40:54
Message-ID: 20210716194054.7AC7328020E () lyx ! lyx ! org
[Download RAW message or body]
commit abc65d4700c688b2261a2a8ca11df0f76fcf380f
Author: Scott Kostyshak <skostysh@lyx.org>
Date: Tue Jun 1 23:59:40 2021 -0400
refactor: keep meaning of a variable consistent
We now use a new variable, "wrap", to track if a wrap should be
done, which is true either if "auto_wrap" is true or if the user
chooses to wrap in the dialog.
This preserves the meaning of the "auto_wrap" variable and also
removes the confusion of why the previous code of
if (!auto_wrap) {
...
}
if (auto_wrap) {
did not use an "else" instead of the second "if".
No change in functionality.
---
src/lyxfind.cpp | 7 ++++---
src/lyxfind.h | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index 6aa39aa..1760c94 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -276,7 +276,7 @@ bool searchAllowed(docstring const & str)
bool findOne(BufferView * bv, docstring const & searchstr,
bool case_sens, bool whole, bool forward,
- bool find_del, bool check_wrap, bool auto_wrap,
+ bool find_del, bool check_wrap, bool const auto_wrap,
bool instant, bool onlysel)
{
// Clean up previous selections with empty searchstr on instant
@@ -338,6 +338,7 @@ bool findOne(BufferView * bv, docstring const & searchstr,
}
else if (check_wrap) {
DocIterator cur_orig(bv->cursor());
+ bool wrap = auto_wrap;
if (!auto_wrap) {
docstring q;
if (forward)
@@ -348,9 +349,9 @@ bool findOne(BufferView * bv, docstring const & searchstr,
"Continue searching from the end?");
int wrap_answer = frontend::Alert::prompt(_("Wrap search?"),
q, 0, 1, _("&Yes"), _("&No"));
- auto_wrap = wrap_answer == 0;
+ wrap = wrap_answer == 0;
}
- if (auto_wrap) {
+ if (wrap) {
if (forward) {
bv->cursor().clear();
bv->cursor().push_back(CursorSlice(bv->buffer().inset()));
diff --git a/src/lyxfind.h b/src/lyxfind.h
index f79ef24..b700e0c 100644
--- a/src/lyxfind.h
+++ b/src/lyxfind.h
@@ -74,7 +74,7 @@ bool lyxfind(BufferView * bv, FuncRequest const & ev);
bool findOne(BufferView * bv, docstring const & searchstr,
bool case_sens, bool whole, bool forward,
bool find_del = true, bool check_wrap = false,
- bool auto_wrap = false, bool instant = false,
+ bool const auto_wrap = false, bool instant = false,
bool onlysel = false);
/** Parse the string encoding of the replace request that is found in
--
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic