Re: [Geany-devel] save find settings - regex case sensitive

2011-04-05 Thread Nick Treleaven
On Sun, 6 Mar 2011 15:53:48 +0100
Enrico Tröger enrico.troe...@uvena.de wrote:

 Note that when you check regular expressions, Geany remembers the
 case sensitive state, and restores it when regex is unchecked. This
 remembered state is not saved, so after restart, you'll get regular
 expressions and case sensitive as you see them.
 
 This remembered state was partially wrong, shared between the Find and
 Replace dialogs (their settings are separate), so I created separate
 states. Truth to be said, I can't grasp why regex and case are bound
 like that.
 
 I'm not sure too why they are bound so closely but I know they are
 already for a long time (since sometime 2006, revision 700).

The idea was that most regex searches are case-sensitive so it would
save time auto-enabling case-sensitive.

Now that the options are saved  restored I've removed this behaviour,
as it can be confusing and/or annoying.

Regards,
Nick
___
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] save find settings - regex case sensitive

2011-04-05 Thread Dimitar Zhekov
On Tue, 5 Apr 2011 17:19:29 +0100
Nick Treleaven nick.trelea...@btinternet.com wrote:

 On Sun, 6 Mar 2011 15:53:48 +0100
 Enrico Tröger enrico.troe...@uvena.de wrote:
 
  Note that when you check regular expressions, Geany remembers the
  case sensitive state, [...]
  
 The idea was that most regex searches are case-sensitive so it would
 save time auto-enabling case-sensitive.
 
 Now that the options are saved  restored I've removed this behaviour,
 as it can be confusing and/or annoying.

The last message (from 2011-03-09) from the save find settings thread
includes a patch that implements this behaviour accross restarts, but I
really prefer it removed altogether. So here is a few lines patch that
deletes the now useless comment about the stash prefs order, and moves
case prefs after regex, as it should be. Case closed. :)

-- 
E-gards: Jimmy
--- ./src/search.c.orig	2011-04-05 19:51:03.0 +0300
+++ ./src/search.c	2011-04-05 20:00:24.0 +0300
@@ -221,11 +221,10 @@
 	group = stash_group_new(search);
 	find_prefs = group;
 	configuration_add_pref_group(group, FALSE);
-	/* if case is moved after regexp, the first regexp uncheck will clear it */
-	stash_group_add_toggle_button(group, settings.find_case_sensitive,
-		find_case_sensitive, FALSE, check_case);
 	stash_group_add_toggle_button(group, settings.find_regexp,
 		find_regexp, FALSE, check_regexp);
+	stash_group_add_toggle_button(group, settings.find_case_sensitive,
+		find_case_sensitive, FALSE, check_case);
 	stash_group_add_toggle_button(group, settings.find_escape_sequences,
 		find_escape_sequences, FALSE, check_escape);
 	stash_group_add_toggle_button(group, settings.find_match_whole_word,
@@ -238,10 +237,10 @@
 	group = stash_group_new(search);
 	replace_prefs = group;
 	configuration_add_pref_group(group, FALSE);
-	stash_group_add_toggle_button(group, settings.replace_case_sensitive,
-		replace_case_sensitive, FALSE, check_case);
 	stash_group_add_toggle_button(group, settings.replace_regexp,
 		replace_regexp, FALSE, check_regexp);
+	stash_group_add_toggle_button(group, settings.replace_case_sensitive,
+		replace_case_sensitive, FALSE, check_case);
 	stash_group_add_toggle_button(group, settings.replace_escape_sequences,
 		replace_escape_sequences, FALSE, check_escape);
 	stash_group_add_toggle_button(group, settings.replace_match_whole_word,
___
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] save find settings

2011-03-08 Thread Enrico Tröger
On Sun, 6 Mar 2011 18:12:25 +0200, Dimitar wrote:

On Sun, 6 Mar 2011 15:53:48 +0100
Enrico Tröger enrico.troe...@uvena.de wrote:

 Anyway, your patch is committed, thanks a bunch.
 
 I added another small change afterwards which should remain the saved
 state for 'case sensitive' even if regex is checked. Hope that won't
 break anything.

Well, it does; the initial stash group display is a bit tricky:

- Case sensitive is restored.
- Regexp is restored. If checked, that causes a signal, which remembers
  the case state.

Your patch ignores this exact signal, so the first-regexp-uncheck-
after-restart clears the case instead of leaving it as-is (I tested

Yeah. But why should it be left as-is?

This leads again to the question why these two options are bound
together so closely. I still don't have an answer, to be honest.

Anyone?

Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc


pgp45KV1p24Kw.pgp
Description: PGP signature
___
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] save find settings

2011-03-07 Thread Lex Trotman
On 8 March 2011 04:33, Dimitar Zhekov dimitar.zhe...@gmail.com wrote:
 On Mon, 7 Mar 2011 11:15:27 +1100
 Lex Trotman ele...@gmail.com wrote:

 It just occurred to me that the case insensitive setting for regex
 search and the case insensitive setting for non-regex search are
 separate settings.  I don't know if that is really clear.

 One makes the non-regex search case insensitive, the other adds the i
 modifier to the regex and they don't have to be the same.

 To me, this is a technical difference, and I'm not sure why it should
 be exposed to the user. I often search (insensitive) sql scripts for
 regex, or C-language-family files for plain text.


Yes for the user its just a part of the particular search, but I see
it as two different settings one that goes with regex search and one
that goes with non-regex.

 But they use the same UI element, which could be considered bad
 design.  Even so they should be saved/restored when the dialog is
 switched to/from regex and they should both be saved to disk
 independently.

 In fact they are implemented in search.c as current UI state and
 static function-local previous UI state if regex is checked...


Of course it should always use the displayed value, the point is when
to save and restore that value.


 But I am not sure that the current code achieves this.

 It doesn't: the previous state is not saved, I was explicit about
 that. But the patch at least separates the find-previous-state and
 replace-previous-state, which were improperly using the same variable.

I'm not criticising the patch, its a worthwhile fix.  I'm just
pointing out an extra improvement if someone has the time and
inclination to work on it.


 In fact case sensitivity and other settings should also be saved as
 part of previous searches, so if I pick a previous search from the
 list I get the right settings too.

 As of me, the full searches should put in history, saved and restored,

Agree, thats what I was pointing out in the hope that someone has the
time too look at it.


 but I followed the existing Find in Files settings save. It's better to
 at least have Find, Replace and FIF in sync for now.

Certainly.

Cheers
Lex


 --
 E-gards: Jimmy

___
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] save find settings

2011-03-06 Thread Enrico Tröger
On Tue, 22 Feb 2011 19:47:56 +0200, Dimitar wrote:

Hi,

It's one month since I initially sent this, and the main developers
seem more or less online now, so I'm resending it.

Haha, this doesn't mean anything, in my case :D.


On several occasions, we discussed that it would be a good thing to
save the find/replace settings. So I wrote it.

Note that when you check regular expressions, Geany remembers the
case sensitive state, and restores it when regex is unchecked. This
remembered state is not saved, so after restart, you'll get regular
expressions and case sensitive as you see them.

This remembered state was partially wrong, shared between the Find and
Replace dialogs (their settings are separate), so I created separate
states. Truth to be said, I can't grasp why regex and case are bound
like that.

I'm not sure too why they are bound so closely but I know they are
already for a long time (since sometime 2006, revision 700).
Anyway, your patch is committed, thanks a bunch.

I added another small change afterwards which should remain the saved
state for 'case sensitive' even if regex is checked. Hope that won't
break anything.


BTW, is there any reason to stash_group_display(fif_prefs) each time
the FiF dialog is shown, instead of doing it once on dialog creation?
The fif settings won't change between invokations.

I guess because of stash_group_update() after the dialog is closed but
not completely sure. Nick will know better.

Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc


pgpBo0GwLyPHQ.pgp
Description: PGP signature
___
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] save find settings

2011-03-06 Thread Lex Trotman
On 7 March 2011 03:12, Dimitar Zhekov dimitar.zhe...@gmail.com wrote:
 On Sun, 6 Mar 2011 15:53:48 +0100
 Enrico Tröger enrico.troe...@uvena.de wrote:

 Anyway, your patch is committed, thanks a bunch.

 I added another small change afterwards which should remain the saved
 state for 'case sensitive' even if regex is checked. Hope that won't
 break anything.

 Well, it does; the initial stash group display is a bit tricky:

 - Case sensitive is restored.
 - Regexp is restored. If checked, that causes a signal, which remembers
  the case state.

 Your patch ignores this exact signal, so the first-regexp-uncheck-
 after-restart clears the case instead of leaving it as-is (I tested
 that to be sure). If we prefer clear-case, it can be done by simply
 moving the find_case_sensitive setting after find_regexp, as noted in
 the patch; same for the replace_ settings.


It just occurred to me that the case insensitive setting for regex
search and the case insensitive setting for non-regex search are
separate settings.  I don't know if that is really clear.

One makes the non-regex search case insensitive, the other adds the i
modifier to the regex and they don't have to be the same.

But they use the same UI element, which could be considered bad
design.  Even so they should be saved/restored when the dialog is
switched to/from regex and they should both be saved to disk
independently.

But I am not sure that the current code achieves this.

Cheers
Lex





 --
 E-gards: Jimmy
 ___
 Geany-devel mailing list
 Geany-devel@uvena.de
 http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

___
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] save find settings

2011-03-06 Thread Lex Trotman
On 7 March 2011 11:15, Lex Trotman ele...@gmail.com wrote:
 On 7 March 2011 03:12, Dimitar Zhekov dimitar.zhe...@gmail.com wrote:
 On Sun, 6 Mar 2011 15:53:48 +0100
 Enrico Tröger enrico.troe...@uvena.de wrote:

 Anyway, your patch is committed, thanks a bunch.

 I added another small change afterwards which should remain the saved
 state for 'case sensitive' even if regex is checked. Hope that won't
 break anything.

 Well, it does; the initial stash group display is a bit tricky:

 - Case sensitive is restored.
 - Regexp is restored. If checked, that causes a signal, which remembers
  the case state.

 Your patch ignores this exact signal, so the first-regexp-uncheck-
 after-restart clears the case instead of leaving it as-is (I tested
 that to be sure). If we prefer clear-case, it can be done by simply
 moving the find_case_sensitive setting after find_regexp, as noted in
 the patch; same for the replace_ settings.


 It just occurred to me that the case insensitive setting for regex
 search and the case insensitive setting for non-regex search are
 separate settings.  I don't know if that is really clear.

 One makes the non-regex search case insensitive, the other adds the i
 modifier to the regex and they don't have to be the same.

 But they use the same UI element, which could be considered bad
 design.  Even so they should be saved/restored when the dialog is
 switched to/from regex and they should both be saved to disk
 independently.

 But I am not sure that the current code achieves this.

 Cheers
 Lex


In fact case sensitivity and other settings should also be saved as
part of previous searches, so if I pick a previous search from the
list I get the right settings too.

Cheers
Lex





 --
 E-gards: Jimmy
 ___
 Geany-devel mailing list
 Geany-devel@uvena.de
 http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


___
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel