Hello! Your finction "Mark All - Shift + Ctrl + M" have some mistaken behaviour:
``` // code example /* Initialize index array. */ for (int i = 0; i < IndexSize; i++) for (int j = 0; j < IndexSize; j++) for (int k = 0; k < OriSize; k++) index[i][j][k] = 0.0;
```
when I select "i" in 'for (int i' (yes, I want to see where 'i' used in the loop), and press Shift + Ctrl + M not only 'i' will be highlighted. This functionality will highlight ALL 'i' occurences in document including occurences inside words. I mean words Initialize, int, Size, index will be highlighting too, but I've selected only 'i', just a variable name consisting of one letter, so I expect highlight only single 'i', not 'i' inside words. Just try and you will understand what I mean, I guess. Look at pictures in attach.
Incorrect highlight: ![incorrect_highlight](https://cloud.githubusercontent.com/assets/6382438/25066064/65eb2bfe-2224-11...)
Correct highlight: ![correct_highlight](https://cloud.githubusercontent.com/assets/6382438/25066063/65e8fdac-2224-11...)
So, I've found how to fix this issue: geany-master\src\keybindings.c : line 1570
just replace this
``` if (sci_has_selection(sci)) search_mark_all(doc, text, GEANY_FIND_MATCHCASE); else search_mark_all(doc, text, GEANY_FIND_MATCHCASE | GEANY_FIND_WHOLEWORD);
``` to this
``` /* if (sci_has_selection(sci)) search_mark_all(doc, text, GEANY_FIND_MATCHCASE); else */ search_mark_all(doc, text, GEANY_FIND_MATCHCASE | GEANY_FIND_WHOLEWORD);
```
key flag GEANY_FIND_WHOLEWORD will highlight only selected occurences and do not highlight it inside words. I've compiled this variant, it is work!
Request: please, add optional button "Mark All - Shift + Ctrl + M" to Toolbar, and make it is can be added to Toolbar by "Preferences -> Interface -> Toolbar -> Customise Toolbar". As for me it is very usefull feature, many other texteditors have no such feature, Geany has - and it is cool!
P.S. Sorrrrry for my english. And if you will need more details - you can write to i_am_mole@mail.ru, I will clarify, honestly.
It definitively seems like a bug, but I don't think it is. "Mark All" is a search feature (see Search->Find->Mark All), it follows the given GUI search options, so I don't think we can really hardcode them, although for this particular case it does seem to make some sense.
This is not a bug. As @codebrainz said, the mark all function is a text match function, it operates the same as the equivalent functionality in applications such as firefox or chrome. This default behaviour should not change (at least without the user changing settings).
The "mark all" keybinding does not follow the options set in the find dialog box, it has fixed options. This makes sense since the search dialog options are retained from the last search and the user can't see the options when they press the mark all keybinding, so if it followed the dialog settings they would not know exactly what the keypress will do. So it is better that the keybinding does not follow the search dialog settings.
The options for the "mark all" keybinding could be set in the preferences dialog separate from the search dialog.
Or an alternative keybinding added for the "Mark all words" function.
Pull requests are welcome.
I don't understand you at all.
The "mark all" keybinding does not follow the options set in the find dialog box
but it makes the same as "Find -> Mark".
The options for the "mark all" keybinding could be set in the preferences dialog separate from the search dialog.
Really? How to do this? In geany 1.30 it is the same functionality, it doesn't work separatelly.
If to do as I request it will be two different functions, as for me - Mark All very usefull. And now I have to use Find with preferences, but it can be done a little easy.
The "mark all" keybinding does not follow the options set in the find dialog box
but it makes the same as "Find -> Mark".
Mark all activated from the find dialog obeys the options on the dialog, in particular "match whole word" and "match at start of word" which is what you want to happen. Mark all activated from the keybinding ignores the settings in the find dialog.
The options for the "mark all" keybinding could be set in the preferences dialog separate from the search dialog.
Really? How to do this? In geany 1.30 it is the same functionality, it doesn't work separatelly.
I meant they could be set from the dialog if somebody writes the code to do it.
Mark all activated from the keybinding ignores the settings in the find dialog.
If it ignores the settings from the dialog, it ought to do the most expected thing, which would be to behave like similar feature in most editors (ie. match whole word), IMO.
Mark all activated from the keybinding ignores the settings in the find dialog.
If it ignores the settings from the dialog, it ought to do the most expected thing, which would be to behave like similar feature in most editors (ie. match whole word), IMO.
Yes, though that wouldn't be useful if a part of a word not a whole word had not been selected.
Yes, though that wouldn't be useful if a part of a word not a whole word had not been selected.
You could still use the find dialog if the default behavior of the keybinding doesn't fit. I don't think "Mark All" a with a non-word selection is major use case to justify more complexity, given the availability of an alternative. Therefore I agree with @codebrainz
@kugel- you mean if a whole word is not selected when the mark-all keybinding is selected it should expand the selection to a word and mark all occurrences of that?
Does mean you can't use mark-all keybinding on anything but words.
It should be an additional action, instead of removing the existing functionality, even if the default keybinding binding is to the new action.
What @codebrainz suggested, simply always match whole word. I.e. if a substring is selected, only mark whole words that match the substring.
I disagree that yet another action is needed, since there is still the find dialog, that offers the current functionality as well. I don't want Geany's menu become a complete mess just because of actions that are barely different from each other when there is already method that offers both functionalities (and more). Menu items should cover the most-used actions.
@bulkozavr and everyone: isn’t the problem solved simply by placing the cursor *on* `i` without *selecting* `i`?
![mark-word](https://cloud.githubusercontent.com/assets/300211/25223917/836ad5ae-25c5-11e...)
I agree this behavior is not very obvious, and maybe it should be documented more clearly. But once you know of it, it’s intuitive and convenient. Please do not just remove it without providing some other way (such as another keybinding).
Menu items should cover the most-used actions.
Agree, but a function that does not exist in Geany is suddenly the "most used" ? :-S
@vfaronov wow, didn't know that before!!! Indeed if NOTHING is selected when the keybinding is activated the word under the cursor and all occurrences of that word are selected.
So both functionalities already exist, and technically are documented (the last entry in the table [here](http://www.geany.org/manual/current/index.html#search-keybindings)) by "current word/selection" but indeed should possibly be more obvious.
So I don't think any change is needed, just some extra words.
**@vfaronov** wow, I am don't know this feache too! Dude, thanks a lot! At this case nothing to fix, I agree. And I agree that documentation need to be more clear, at least for such users as me. Thank you all! The problem is solved.
Closed #1467.
github-comments@lists.geany.org