1# git-gui diff viewer
2# Copyright (C) 2006, 2007 Shawn Pearce
34
proc apply_tab_size {{firsttab {}}} {
5global have_tk85 repo_config ui_diff
67
set w [font measure font_diff "0"]
8if {$have_tk85 && $firsttab != 0} {
9$ui_diff configure -tabs [list [expr {$firsttab * $w}] [expr {($firsttab + $repo_config(gui.tabsize)) * $w}]]
10} elseif {$have_tk85 || $repo_config(gui.tabsize) != 8} {
11$ui_diff configure -tabs [expr {$repo_config(gui.tabsize) * $w}]
12} else {
13$ui_diff configure -tabs {}
14}
15}
1617
proc clear_diff {} {
18global ui_diff current_diff_path current_diff_header
19global ui_index ui_workdir
2021
$ui_diff conf -state normal
22$ui_diff delete 0.0 end
23$ui_diff conf -state disabled
2425
set current_diff_path {}
26set current_diff_header {}
2728
$ui_index tag remove in_diff 0.0 end
29$ui_workdir tag remove in_diff 0.0 end
30}
3132
proc reshow_diff {{after {}}} {
33global file_states file_lists
34global current_diff_path current_diff_side
35global ui_diff
3637
set p $current_diff_path
38if {$p eq {}} {
39# No diff is being shown.
40} elseif {$current_diff_side eq {}} {
41clear_diff
42} elseif {[catch {set s $file_states($p)}]
43|| [lsearch -sorted -exact $file_lists($current_diff_side) $p] == -1} {
4445
if {[find_next_diff $current_diff_side $p {} {[^O]}]} {
46next_diff $after
47} else {
48clear_diff
49}
50} else {
51set save_pos [lindex [$ui_diff yview] 0]
52show_diff $p $current_diff_side {} $save_pos $after
53}
54}
5556
proc force_diff_encoding {enc} {
57global current_diff_path
5859
if {$current_diff_path ne {}} {
60force_path_encoding $current_diff_path $enc
61reshow_diff
62}
63}
6465
proc handle_empty_diff {} {
66global current_diff_path file_states file_lists
67global diff_empty_count
6869
set path $current_diff_path
70set s $file_states($path)
71if {[lindex $s 0] ne {_M} || [has_textconv $path]} return
7273
# Prevent infinite rescan loops
74incr diff_empty_count
75if {$diff_empty_count > 1} return
7677
info_popup [mc "No differences detected.
7879
%s has no changes.
8081
The modification date of this file was updated by another application, but the content within the file was not changed.
8283
A rescan will be automatically started to find other files which may have the same state." [short_path $path]]
8485
clear_diff
86display_file $path __
87rescan ui_ready 0
88}
8990
proc show_diff {path w {lno {}} {scroll_pos {}} {callback {}}} {
91global file_states file_lists
92global is_3way_diff is_conflict_diff diff_active repo_config
93global ui_diff ui_index ui_workdir
94global current_diff_path current_diff_side current_diff_header
95global current_diff_queue
9697
if {$diff_active || ![lock_index read]} return
9899
clear_diff
100if {$lno == {}} {
101set lno [lsearch -sorted -exact $file_lists($w) $path]
102if {$lno >= 0} {
103incr lno
104}
105}
106if {$lno >= 1} {
107$w tag add in_diff $lno.0 [expr {$lno + 1}].0
108$w see $lno.0
109}
110111
set s $file_states($path)
112set m [lindex $s 0]
113set is_conflict_diff 0
114set current_diff_path $path
115set current_diff_side $w
116set current_diff_queue {}
117ui_status [mc "Loading diff of %s..." [escape_path $path]]
118119
set cont_info [list $scroll_pos $callback]
120121
apply_tab_size 0
122123
if {[string first {U} $m] >= 0} {
124merge_load_stages $path [list show_unmerged_diff $cont_info]
125} elseif {$m eq {_O}} {
126show_other_diff $path $w $m $cont_info
127} else {
128start_show_diff $cont_info
129}
130}
131132
proc show_unmerged_diff {cont_info} {
133global current_diff_path current_diff_side
134global merge_stages ui_diff is_conflict_diff
135global current_diff_queue
136137
if {$merge_stages(2) eq {}} {
138set is_conflict_diff 1
139lappend current_diff_queue \
140[list [mc "LOCAL: deleted\nREMOTE:\n"] d= \
141[list ":1:$current_diff_path" ":3:$current_diff_path"]]
142} elseif {$merge_stages(3) eq {}} {
143set is_conflict_diff 1
144lappend current_diff_queue \
145[list [mc "REMOTE: deleted\nLOCAL:\n"] d= \
146[list ":1:$current_diff_path" ":2:$current_diff_path"]]
147} elseif {[lindex $merge_stages(1) 0] eq {120000}
148|| [lindex $merge_stages(2) 0] eq {120000}
149|| [lindex $merge_stages(3) 0] eq {120000}} {
150set is_conflict_diff 1
151lappend current_diff_queue \
152[list [mc "LOCAL:\n"] d= \
153[list ":1:$current_diff_path" ":2:$current_diff_path"]]
154lappend current_diff_queue \
155[list [mc "REMOTE:\n"] d= \
156[list ":1:$current_diff_path" ":3:$current_diff_path"]]
157} else {
158start_show_diff $cont_info
159return
160}
161162
advance_diff_queue $cont_info
163}
164165
proc advance_diff_queue {cont_info} {
166global current_diff_queue ui_diff
167168
set item [lindex $current_diff_queue 0]
169set current_diff_queue [lrange $current_diff_queue 1 end]
170171
$ui_diff conf -state normal
172$ui_diff insert end [lindex $item 0] [lindex $item 1]
173$ui_diff conf -state disabled
174175
start_show_diff $cont_info [lindex $item 2]
176}
177178
proc show_other_diff {path w m cont_info} {
179global file_states file_lists
180global is_3way_diff diff_active repo_config
181global ui_diff ui_index ui_workdir
182global current_diff_path current_diff_side current_diff_header
183184
# - Git won't give us the diff, there's nothing to compare to!
185#
186if {$m eq {_O}} {
187set max_sz 100000
188set type unknown
189if {[catch {
190set type [file type $path]
191switch -- $type {
192directory {
193set type submodule
194set content {}
195set sz 0
196}
197link {
198set content [file readlink $path]
199set sz [string length $content]
200}
201file {
202set fd [open $path r]
203fconfigure $fd \
204-eofchar {} \
205-encoding [get_path_encoding $path]
206set content [read $fd $max_sz]
207close $fd
208set sz [file size $path]
209}
210default {
211error "'$type' not supported"
212}
213}
214} err ]} {
215set diff_active 0
216unlock_index
217ui_status [mc "Unable to display %s" [escape_path $path]]
218error_popup [strcat [mc "Error loading file:"] "\n\n$err"]
219return
220}
221$ui_diff conf -state normal
222if {$type eq {submodule}} {
223$ui_diff insert end [append \
224"* " \
225[mc "Git Repository (subproject)"] \
226"\n"] d_info
227} elseif {![catch {set type [exec file $path]}]} {
228set n [string length $path]
229if {[string equal -length $n $path $type]} {
230set type [string range $type $n end]
231regsub {^:?\s*} $type {} type
232}
233$ui_diff insert end "* $type\n" d_info
234}
235if {[string first "\0" $content] != -1} {
236$ui_diff insert end \
237[mc "* Binary file (not showing content)."] \
238d_info
239} else {
240if {$sz > $max_sz} {
241$ui_diff insert end [mc \
242"* Untracked file is %d bytes.
243* Showing only first %d bytes.
244" $sz $max_sz] d_info
245}
246$ui_diff insert end $content
247if {$sz > $max_sz} {
248$ui_diff insert end [mc "
249* Untracked file clipped here by %s.
250* To see the entire file, use an external editor.
251" [appname]] d_info
252}
253}
254$ui_diff conf -state disabled
255set diff_active 0
256unlock_index
257set scroll_pos [lindex $cont_info 0]
258if {$scroll_pos ne {}} {
259update
260$ui_diff yview moveto $scroll_pos
261}
262ui_ready
263set callback [lindex $cont_info 1]
264if {$callback ne {}} {
265eval $callback
266}
267return
268}
269}
270271
proc get_conflict_marker_size {path} {
272set size 7
273catch {
274set fd_rc [eval [list git_read check-attr "conflict-marker-size" -- $path]]
275set ret [gets $fd_rc line]
276close $fd_rc
277if {$ret > 0} {
278regexp {.*: conflict-marker-size: (\d+)$} $line line size
279}
280}
281return $size
282}
283284
proc start_show_diff {cont_info {add_opts {}}} {
285global file_states file_lists
286global is_3way_diff is_submodule_diff diff_active repo_config
287global ui_diff ui_index ui_workdir
288global current_diff_path current_diff_side current_diff_header
289290
set path $current_diff_path
291set w $current_diff_side
292293
set s $file_states($path)
294set m [lindex $s 0]
295set is_3way_diff 0
296set is_submodule_diff 0
297set diff_active 1
298set current_diff_header {}
299set conflict_size [get_conflict_marker_size $path]
300301
set cmd [list]
302if {$w eq $ui_index} {
303lappend cmd diff-index
304lappend cmd --cached
305if {[git-version >= "1.7.2"]} {
306lappend cmd --ignore-submodules=dirty
307}
308} elseif {$w eq $ui_workdir} {
309if {[string first {U} $m] >= 0} {
310lappend cmd diff
311} else {
312lappend cmd diff-files
313}
314}
315if {![is_config_false gui.textconv] && [git-version >= 1.6.1]} {
316lappend cmd --textconv
317}
318319
if {[string match {160000 *} [lindex $s 2]]
320|| [string match {160000 *} [lindex $s 3]]} {
321set is_submodule_diff 1
322323
if {[git-version >= "1.6.6"]} {
324lappend cmd --submodule
325}
326}
327328
lappend cmd -p
329lappend cmd --color
330set cmd [concat $cmd $repo_config(gui.diffopts)]
331if {$repo_config(gui.diffcontext) >= 1} {
332lappend cmd "-U$repo_config(gui.diffcontext)"
333}
334if {$w eq $ui_index} {
335lappend cmd [PARENT]
336}
337if {$add_opts ne {}} {
338eval lappend cmd $add_opts
339} else {
340lappend cmd --
341lappend cmd $path
342}
343344
if {$is_submodule_diff && [git-version < "1.6.6"]} {
345if {$w eq $ui_index} {
346set cmd [list submodule summary --cached -- $path]
347} else {
348set cmd [list submodule summary --files -- $path]
349}
350}
351352
if {[catch {set fd [eval git_read --nice $cmd]} err]} {
353set diff_active 0
354unlock_index
355ui_status [mc "Unable to display %s" [escape_path $path]]
356error_popup [strcat [mc "Error loading diff:"] "\n\n$err"]
357return
358}
359360
set ::current_diff_inheader 1
361fconfigure $fd \
362-blocking 0 \
363-encoding [get_path_encoding $path] \
364-translation lf
365fileevent $fd readable [list read_diff $fd $conflict_size $cont_info]
366}
367368
proc parse_color_line {line} {
369set start 0
370set result ""
371set markup [list]
372set regexp {\033\[((?:\d+;)*\d+)?m}
373set need_reset 0
374while {[regexp -indices -start $start $regexp $line match code]} {
375foreach {begin end} $match break
376append result [string range $line $start [expr {$begin - 1}]]
377set pos [string length $result]
378set col [eval [linsert $code 0 string range $line]]
379set start [incr end]
380if {$col eq "0" || $col eq ""} {
381if {!$need_reset} continue
382set need_reset 0
383} else {
384set need_reset 1
385}
386lappend markup $pos $col
387}
388append result [string range $line $start end]
389if {[llength $markup] < 4} {set markup {}}
390return [list $result $markup]
391}
392393
proc read_diff {fd conflict_size cont_info} {
394global ui_diff diff_active is_submodule_diff
395global is_3way_diff is_conflict_diff current_diff_header
396global current_diff_queue
397global diff_empty_count
398399
$ui_diff conf -state normal
400while {[gets $fd line] >= 0} {
401foreach {line markup} [parse_color_line $line] break
402set line [string map {\033 ^} $line]
403404
set tags {}
405406
# -- Check for start of diff header.
407if { [string match {diff --git *} $line]
408|| [string match {diff --cc *} $line]
409|| [string match {diff --combined *} $line]} {
410set ::current_diff_inheader 1
411}
412413
# -- Check for end of diff header (any hunk line will do this).
414#
415if {[regexp {^@@+ } $line]} {set ::current_diff_inheader 0}
416417
# -- Automatically detect if this is a 3 way diff.
418#
419if {[string match {@@@ *} $line]} {
420set is_3way_diff 1
421apply_tab_size 1
422}
423424
if {$::current_diff_inheader} {
425426
# -- These two lines stop a diff header and shouldn't be in there
427if { [string match {Binary files * and * differ} $line]
428|| [regexp {^\* Unmerged path } $line]} {
429set ::current_diff_inheader 0
430} else {
431append current_diff_header $line "\n"
432}
433434
# -- Cleanup uninteresting diff header lines.
435#
436if { [string match {diff --git *} $line]
437|| [string match {diff --cc *} $line]
438|| [string match {diff --combined *} $line]
439|| [string match {--- *} $line]
440|| [string match {+++ *} $line]
441|| [string match {index *} $line]} {
442continue
443}
444445
# -- Name it symlink, not 120000
446# Note, that the original line is in $current_diff_header
447regsub {^(deleted|new) file mode 120000} $line {\1 symlink} line
448449
} elseif { $line eq {\ No newline at end of file}} {
450# -- Handle some special lines
451} elseif {$is_3way_diff} {
452set op [string range $line 0 1]
453switch -- $op {
454{ } {set tags {}}
455{@@} {set tags d_@}
456{ +} {set tags d_s+}
457{ -} {set tags d_s-}
458{+ } {set tags d_+s}
459{- } {set tags d_-s}
460{--} {set tags d_--}
461{++} {
462set regexp [string map [list %conflict_size $conflict_size]\
463{^\+\+([<>=]){%conflict_size}(?: |$)}]
464if {[regexp $regexp $line _g op]} {
465set is_conflict_diff 1
466set line [string replace $line 0 1 { }]
467set tags d$op
468} else {
469set tags d_++
470}
471}
472default {
473puts "error: Unhandled 3 way diff marker: {$op}"
474set tags {}
475}
476}
477} elseif {$is_submodule_diff} {
478if {$line == ""} continue
479if {[regexp {^Submodule } $line]} {
480set tags d_info
481} elseif {[regexp {^\* } $line]} {
482set line [string replace $line 0 1 {Submodule }]
483set tags d_info
484} else {
485set op [string range $line 0 2]
486switch -- $op {
487{ <} {set tags d_-}
488{ >} {set tags d_+}
489{ W} {set tags {}}
490default {
491puts "error: Unhandled submodule diff marker: {$op}"
492set tags {}
493}
494}
495}
496} else {
497set op [string index $line 0]
498switch -- $op {
499{ } {set tags {}}
500{@} {set tags d_@}
501{-} {set tags d_-}
502{+} {
503set regexp [string map [list %conflict_size $conflict_size]\
504{^\+([<>=]){%conflict_size}(?: |$)}]
505if {[regexp $regexp $line _g op]} {
506set is_conflict_diff 1
507set tags d$op
508} else {
509set tags d_+
510}
511}
512default {
513puts "error: Unhandled 2 way diff marker: {$op}"
514set tags {}
515}
516}
517}
518set mark [$ui_diff index "end - 1 line linestart"]
519$ui_diff insert end $line $tags
520if {[string index $line end] eq "\r"} {
521$ui_diff tag add d_cr {end - 2c}
522}
523$ui_diff insert end "\n" $tags
524525
foreach {posbegin colbegin posend colend} $markup {
526set prefix clr
527foreach style [lsort -integer [split $colbegin ";"]] {
528if {$style eq "7"} {append prefix i; continue}
529if {$style != 4 && ($style < 30 || $style > 47)} {continue}
530set a "$mark linestart + $posbegin chars"
531set b "$mark linestart + $posend chars"
532catch {$ui_diff tag add $prefix$style $a $b}
533}
534}
535}
536$ui_diff conf -state disabled
537538
if {[eof $fd]} {
539close $fd
540541
if {$current_diff_queue ne {}} {
542advance_diff_queue $cont_info
543return
544}
545546
set diff_active 0
547unlock_index
548set scroll_pos [lindex $cont_info 0]
549if {$scroll_pos ne {}} {
550update
551$ui_diff yview moveto $scroll_pos
552}
553ui_ready
554555
if {[$ui_diff index end] eq {2.0}} {
556handle_empty_diff
557} else {
558set diff_empty_count 0
559}
560561
set callback [lindex $cont_info 1]
562if {$callback ne {}} {
563eval $callback
564}
565}
566}
567568
proc apply_hunk {x y} {
569global current_diff_path current_diff_header current_diff_side
570global ui_diff ui_index file_states
571572
if {$current_diff_path eq {} || $current_diff_header eq {}} return
573if {![lock_index apply_hunk]} return
574575
set apply_cmd {apply --cached --whitespace=nowarn}
576set mi [lindex $file_states($current_diff_path) 0]
577if {$current_diff_side eq $ui_index} {
578set failed_msg [mc "Failed to unstage selected hunk."]
579lappend apply_cmd --reverse
580if {[string index $mi 0] ne {M}} {
581unlock_index
582return
583}
584} else {
585set failed_msg [mc "Failed to stage selected hunk."]
586if {[string index $mi 1] ne {M}} {
587unlock_index
588return
589}
590}
591592
set s_lno [lindex [split [$ui_diff index @$x,$y] .] 0]
593set s_lno [$ui_diff search -backwards -regexp ^@@ $s_lno.0 0.0]
594if {$s_lno eq {}} {
595unlock_index
596return
597}
598599
set e_lno [$ui_diff search -forwards -regexp ^@@ "$s_lno + 1 lines" end]
600if {$e_lno eq {}} {
601set e_lno end
602}
603604
if {[catch {
605set enc [get_path_encoding $current_diff_path]
606set p [eval git_write $apply_cmd]
607fconfigure $p -translation binary -encoding $enc
608puts -nonewline $p $current_diff_header
609puts -nonewline $p [$ui_diff get $s_lno $e_lno]
610close $p} err]} {
611error_popup [append $failed_msg "\n\n$err"]
612unlock_index
613return
614}
615616
$ui_diff conf -state normal
617$ui_diff delete $s_lno $e_lno
618$ui_diff conf -state disabled
619620
if {[$ui_diff get 1.0 end] eq "\n"} {
621set o _
622} else {
623set o ?
624}
625626
if {$current_diff_side eq $ui_index} {
627set mi ${o}M
628} elseif {[string index $mi 0] eq {_}} {
629set mi M$o
630} else {
631set mi ?$o
632}
633unlock_index
634display_file $current_diff_path $mi
635# This should trigger shift to the next changed file
636if {$o eq {_}} {
637reshow_diff
638}
639}
640641
proc apply_range_or_line {x y} {
642global current_diff_path current_diff_header current_diff_side
643global ui_diff ui_index file_states
644645
set selected [$ui_diff tag nextrange sel 0.0]
646647
if {$selected == {}} {
648set first [$ui_diff index "@$x,$y"]
649set last $first
650} else {
651set first [lindex $selected 0]
652set last [lindex $selected 1]
653}
654655
set first_l [$ui_diff index "$first linestart"]
656set last_l [$ui_diff index "$last lineend"]
657658
if {$current_diff_path eq {} || $current_diff_header eq {}} return
659if {![lock_index apply_hunk]} return
660661
set apply_cmd {apply --cached --whitespace=nowarn}
662set mi [lindex $file_states($current_diff_path) 0]
663if {$current_diff_side eq $ui_index} {
664set failed_msg [mc "Failed to unstage selected line."]
665set to_context {+}
666lappend apply_cmd --reverse
667if {[string index $mi 0] ne {M}} {
668unlock_index
669return
670}
671} else {
672set failed_msg [mc "Failed to stage selected line."]
673set to_context {-}
674if {[string index $mi 1] ne {M}} {
675unlock_index
676return
677}
678}
679680
set wholepatch {}
681682
while {$first_l < $last_l} {
683set i_l [$ui_diff search -backwards -regexp ^@@ $first_l 0.0]
684if {$i_l eq {}} {
685# If there's not a @@ above, then the selected range
686# must have come before the first_l @@
687set i_l [$ui_diff search -regexp ^@@ $first_l $last_l]
688}
689if {$i_l eq {}} {
690unlock_index
691return
692}
693# $i_l is now at the beginning of a line
694695
# pick start line number from hunk header
696set hh [$ui_diff get $i_l "$i_l + 1 lines"]
697set hh [lindex [split $hh ,] 0]
698set hln [lindex [split $hh -] 1]
699700
# There is a special situation to take care of. Consider this
701# hunk:
702#
703# @@ -10,4 +10,4 @@
704# context before
705# -old 1
706# -old 2
707# +new 1
708# +new 2
709# context after
710#
711# We used to keep the context lines in the order they appear in
712# the hunk. But then it is not possible to correctly stage only
713# "-old 1" and "+new 1" - it would result in this staged text:
714#
715# context before
716# old 2
717# new 1
718# context after
719#
720# (By symmetry it is not possible to *un*stage "old 2" and "new
721# 2".)
722#
723# We resolve the problem by introducing an asymmetry, namely,
724# when a "+" line is *staged*, it is moved in front of the
725# context lines that are generated from the "-" lines that are
726# immediately before the "+" block. That is, we construct this
727# patch:
728#
729# @@ -10,4 +10,5 @@
730# context before
731# +new 1
732# old 1
733# old 2
734# context after
735#
736# But we do *not* treat "-" lines that are *un*staged in a
737# special way.
738#
739# With this asymmetry it is possible to stage the change "old
740# 1" -> "new 1" directly, and to stage the change "old 2" ->
741# "new 2" by first staging the entire hunk and then unstaging
742# the change "old 1" -> "new 1".
743#
744# Applying multiple lines adds complexity to the special
745# situation. The pre_context must be moved after the entire
746# first block of consecutive staged "+" lines, so that
747# staging both additions gives the following patch:
748#
749# @@ -10,4 +10,6 @@
750# context before
751# +new 1
752# +new 2
753# old 1
754# old 2
755# context after
756757
# This is non-empty if and only if we are _staging_ changes;
758# then it accumulates the consecutive "-" lines (after
759# converting them to context lines) in order to be moved after
760# "+" change lines.
761set pre_context {}
762763
set n 0
764set m 0
765set i_l [$ui_diff index "$i_l + 1 lines"]
766set patch {}
767while {[$ui_diff compare $i_l < "end - 1 chars"] &&
768[$ui_diff get $i_l "$i_l + 2 chars"] ne {@@}} {
769set next_l [$ui_diff index "$i_l + 1 lines"]
770set c1 [$ui_diff get $i_l]
771if {[$ui_diff compare $first_l <= $i_l] &&
772[$ui_diff compare $i_l < $last_l] &&
773($c1 eq {-} || $c1 eq {+})} {
774# a line to stage/unstage
775set ln [$ui_diff get $i_l $next_l]
776if {$c1 eq {-}} {
777set n [expr $n+1]
778set patch "$patch$pre_context$ln"
779set pre_context {}
780} else {
781set m [expr $m+1]
782set patch "$patch$ln"
783}
784} elseif {$c1 ne {-} && $c1 ne {+}} {
785# context line
786set ln [$ui_diff get $i_l $next_l]
787set patch "$patch$pre_context$ln"
788# Skip the "\ No newline at end of
789# file". Depending on the locale setting
790# we don't know what this line looks
791# like exactly. The only thing we do
792# know is that it starts with "\ "
793if {![string match {\\ *} $ln]} {
794set n [expr $n+1]
795set m [expr $m+1]
796}
797set pre_context {}
798} elseif {$c1 eq $to_context} {
799# turn change line into context line
800set ln [$ui_diff get "$i_l + 1 chars" $next_l]
801if {$c1 eq {-}} {
802set pre_context "$pre_context $ln"
803} else {
804set patch "$patch $ln"
805}
806set n [expr $n+1]
807set m [expr $m+1]
808} else {
809# a change in the opposite direction of
810# to_context which is outside the range of
811# lines to apply.
812set patch "$patch$pre_context"
813set pre_context {}
814}
815set i_l $next_l
816}
817set patch "$patch$pre_context"
818set wholepatch "$wholepatch@@ -$hln,$n +$hln,$m @@\n$patch"
819set first_l [$ui_diff index "$next_l + 1 lines"]
820}
821822
if {[catch {
823set enc [get_path_encoding $current_diff_path]
824set p [eval git_write $apply_cmd]
825fconfigure $p -translation binary -encoding $enc
826puts -nonewline $p $current_diff_header
827puts -nonewline $p $wholepatch
828close $p} err]} {
829error_popup [append $failed_msg "\n\n$err"]
830}
831832
unlock_index
833}