git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] gitk: Stop clobbering "Remember This View" setting

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Mar 6, 2010, 22:58 UTC
Message-ID
<20100306225842.GC7064@progeny.tock>
In-Reply-To
<20100306224605.GA7064@progeny.tock>

In the View → Edit View... dialog, the "Remember this view" option always starts out unset. Using the dialog to change an existing view and ignoring the parts of the dialog that aren’t relevant results in both the old and new versions of the view being lost.

The cause: right after newviewopts($curview,perm) is set to an appropriate value, decode_view_opts is clobbering it with the default value. If that call is moved a little earlier, the "Remember this view" option gets properly set to its previous value, fixing the problem.

Reported-by: Steve Cotton <steve0001@s.cotton.clara.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 gitk |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gitk b/gitk
index 7f498b5..c3ef275 100755
--- a/gitk
+++ b/gitk
@@ -3805,10 +3805,10 @@ proc newview {ishighlight} {
 	raise $top
 	return
     }
+    decode_view_opts $nextviewnum $revtreeargs
     set newviewname($nextviewnum) "[mc "View"] $nextviewnum"
     set newviewopts($nextviewnum,perm) 0
     set newviewopts($nextviewnum,cmd)  $viewargscmd($curview)
-    decode_view_opts $nextviewnum $revtreeargs
     vieweditor $top $nextviewnum [mc "Gitk view definition"]
 }
 
@@ -3962,10 +3962,10 @@ proc editview {} {
 	raise $top
 	return
     }
+    decode_view_opts $curview $viewargs($curview)
     set newviewname($curview)      $viewname($curview)
     set newviewopts($curview,perm) $viewperm($curview)
     set newviewopts($curview,cmd)  $viewargscmd($curview)
-    decode_view_opts $curview $viewargs($curview)
     vieweditor $top $curview "[mc "Gitk: edit view"] $viewname($curview)"
 }
 
-- 
1.7.0
Previous: Jonathan Nieder
Message 3 of 3 in “stop clobbering "Remember This View" setting”
  1. 0/2 stop clobbering "Remember This View" settingJonathan Nieder, Mar 6, 2010
  2. 1/2 gitk: Add comments to explain encode_view_opts and decode_view_optsJonathan Nieder, Mar 6, 2010
  3. 2/2 gitk: Stop clobbering "Remember This View" settingJonathan Nieder, Mar 6, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.