[Github-comments] [geany/geany] Mark All - mistake (#1467)

bulkozavr notifications at xxxxx
Sat Apr 15 18:44:51 UTC 2017


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-11e7-85ac-d70375664c9a.PNG)


Correct highlight:
![correct_highlight](https://cloud.githubusercontent.com/assets/6382438/25066063/65e8fdac-2224-11e7-8428-8b499c113b94.PNG)

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 at mail.ru, I will clarify, honestly.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/1467
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20170415/32b4b2ea/attachment.html>


More information about the Github-comments mailing list