Did you ever realize how GB32 defines a word? Is it consistent across the different editor operations? Does a Ctrl-Left keyboard shortcut point to same word start as Ctrl-F? The Ctrl-F accelerator shows the Find Dialog Box where the Find What edit text control defaults to the current word. Is this the same word that is used in Ctrl-Left and Ctrl-Right actions? And what about the mouse double-click? What word does the editor use for the FindNextWord, to locate the next occurrence of that word? An example.
Global iVar1% = $4DC41C Dim dd As Double = 2.45!
The next table shows the result of the 'current word' used to start the operation.
Word | Ctrl Right | Find Dlg | Double Click |
Global | Global | Global | Global |
iVar1% | iVar1% | iVar1 | iVar1% |
$4DC41C | 4DC41C | 4DC41C | $4DC41C |
2.45! | 2.45! | 2 | 2 or 45, depending on the position of the caret |
Disturbing? At least confusing, because it isn't consistent. To me the whole module containing the editor's find and replace code seems a bit clumsy. (Maybe Frank Ostrowski was somewhat distracted during its development.) I can only guess what leaded to this inconsistency. The $AutoPostFix directive may have caused the decision to use the variable name without a postfix with the Find Dialog. Anyway, I don't like it. In my opinion all operations that determine a word should select the same word and the green marked words seem to be best candidate.
If there would be separate functions that return the current word, it would give me a starting point. Unfortunately, all operations mentioned above have their own getcurrentword algorithm. Another set back, by now I hoped to have had implemented the COM support I promised.
No comments:
Post a Comment