Last night Leo got into a state in which the Find code's .reverse ivar got
reversed ;-) So F3 worked like F2, and vice versa.
I have since upped a change that makes this impossible. Init code now
always inits .reverse to False at the outer level. This could have been
done at any time after the "Reverse" checkbox was discarded. It's a good
change.
After reviewing the code, I believe the culprit is the find-def code. This
supposedly saves and restores find settings, but *it doesn't do that* until
the find fails. And why, I ask myself, is the user necessarily going to run
the search until it fails? Here is setFindDefOptions:
def setFindDefOptions(self, p):
'''Set the find options needed for the find-def command.'''
self.ignore_case = False
self.p = p.copy()
self.pattern_match = False
self.reverse = False
self.search_body = True
self.search_headline = False
self.whole_word = True
If these options don't match the users previous settings, not restoring the
previous settings is going to cause the user *no end of confusion*. I've
been bitten recently. Suddenly the find commands seems to miss things. In
other words, the find command seems to break.
This must be fixed! Let's look at the options and constraints.
1. Remove find-def. Use cff instead.
I'm tempted :-) But this is throwing the baby out with the bathwater.
2. Find some way to read user's mind.
Is the next find a continuation of find-def, or not? Well, that's
impossible.
All heroic solutions will break the fundamental simplifying principle of
the find code: the code must maintain as little state as possible. Even
with this principle, the code is way too complex. Don't even *think* of
proposing a baroque set of rules that will supposedly read the user's mind.
3. Have find-def use the present settings.
I think this is the only safe way. It's certainly the simplest thing that
could possibly work.
*Important*: The find-def command will still remain useful: it searches the
entire outline (once). I don't think it can skip @ignore and @all trees as
cff does, because that requires a batch search in order to handle internal
search state.
4. Create a redo-find-def command.
This would work. It requires only some "benign" search state, namely the
last find-def search string.
*Summary*At present, find-def can cause massive confusion. This must stop
today.
There are only two real options:
1. Have find-def use the users present options. Searches would start at the
start of the outline. Thereafter, F2, F3, etc work as always.
2. Force the user to continue find-def with redo-find-def. It's the only
way to know what the user intends. Alas, this seems clumsy to me.
In short, #1 seem best. cff is the power-user way.
Your comments, please. We aren't going to keep the present code.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.