@ -98,6 +98,37 @@ proc bind_widget_after_class {widget} {
bindtags $widget $newList
}
#
# M a k e s u r e l i n e n u m b e r $ L I N E i s v i s i b l e i n t h e t e x t w i d g e t . B u t b e
# m o r e c l e v e r t h a n t h e " s e e " c o m m a n d : i f L I N E i s n o t c u r r e n t l y
# d i s p l a y e d , a r r a n g e f o r L I N E t o b e c e n t e r e d . T h e r e a r e c a s e s i n
# w h i c h t h i s d o e s n o t w o r k , s o a s a l a s t r e s o r t w e r e v e r t t o " s e e " .
#
# T h i s i s i n e f f i c i e n t , b u t p r o b a b l y n o t s l o w e n o u g h t o a c t u a l l y
# n o t i c e .
#
proc ensure_line_visible { text line} {
set pixHeight [ winfo height $text ]
# C o m p u t e h e i g h t o f w i d g e t i n l i n e s . T h i s f a i l s i f a l i n e i s w i d e r
# t h a n t h e s c r e e n . F I X M E .
set topLine [ lindex [ split [ $text index @ 0 , 0 ] .] 0 ]
set botLine [ lindex [ split [ $text index @ 0 , $ { pixHeight } ] .] 0 ]
if { $line > $topLine && $line < $botLine } then {
# O n s c r e e n , a n d n o t o n t h e v e r y e d g e .
return
}
set newTop [ expr { $line - ( $botLine - $topLine ) } ]
if { $newTop < 0 } then {
set newTop 0
}
$text yview moveto $newTop
# I n c a s e t h e a b o v e f a i l e d .
$text see $ { line } .0
}
if { [ info exists env( EDITOR ) ] } then {
set editor $env ( EDITOR )
} else {
@ -1245,10 +1276,19 @@ proc create_file_win {filename debug_file} {
% W tag remove sel $last end
% W tag add sel anchor @ % x, % y
}
$win tag bind sel < 1 > do_nothing
$win tag bind sel < Double-Button-1> { display_expression [ selection get] }
$win tag raise sel
$win tag bind sel < 1 > break
$win tag bind sel < Double-Button-1> {
display_expression [ selection get]
break
}
$win tag bind sel < B1-Motion> break
$win tag lower sel
# M a k e t h e s e b i n d i n g s d o n o t h i n g o n t h e t e x t w i n d o w - - t h e y
# a r e c o m p l e t e l y h a n d l e d b y t h e t a g b i n d i n g s a b o v e .
bind $win < 1 > break
bind $win < B1-Motion> break
bind $win < Double-Button-1> break
# S c a n t h o u g h t h e b r e a k p o i n t d a t a b a s e a n d i n s t a l l a n y d e s t i n e d f o r t h i s f i l e
@ -1300,8 +1340,9 @@ proc create_asm_win {funcname pc} {
# S e t u p a l l t h e b i n d i n g s
bind $win < Enter> { focus % W}
bind $win < 1 > { asm_window_button_1 % W % X % Y % x % y}
bind $win < B1-Motion> do_nothing
bind $win < 1 > { asm_window_button_1 % W % X % Y % x % y; break }
bind $win < B1-Motion> break
bind $win < Double-Button-1> break
bind $win < Key-Alt_R> do_nothing
bind $win < Key-Alt_L> do_nothing
@ -1431,7 +1472,8 @@ proc update_listing {linespec} {
.src.scroll configure - command " $ w i n s ( $ c f i l e ) y v i e w "
$wins ( $cfile ) see " $ { l i n e } . 0 l i n e s t a r t "
# $ w i n s ( $ c f i l e ) s e e " $ { l i n e } . 0 l i n e s t a r t "
ensure_line_visible $wins ( $cfile ) $line
}
# U p d a t e t h e l a b e l w i d g e t i n c a s e t h e f i l e n a m e o r f u n c t i o n n a m e h a s c h a n g e d
@ -1458,7 +1500,7 @@ proc update_listing {linespec} {
$wins ( $cfile ) delete $pointer_pos " $ p o i n t e r _ p o s + 2 c h a r "
$wins ( $cfile ) insert $pointer_pos " - > "
$wins ( $cfile ) see " $ { l i n e } . 0 l i n e s t a r t "
ensure_line_visible $wins ( $cfile ) $line
$wins ( $cfile ) configure - state disabled
}
}
@ -1837,7 +1879,7 @@ proc update_assembly {linespec} {
-after .asm.scroll
.asm.scroll configure - command " $ w i n y v i e w "
set line [ pc_to_line $pclist ( $cfunc ) $pc ]
$win see " $ { l i n e } . 0 l i n e s t a r t "
ensure_line_visible $win $line
update
}
@ -1872,7 +1914,7 @@ proc update_assembly {linespec} {
$win delete $pointer_pos " $ p o i n t e r _ p o s + 2 c h a r "
$win insert $pointer_pos " - > "
$win yview " $ { l i n e } . 0 l i n e s t a r t "
ensure_line_visible $win $line
$win configure - state disabled
}
}
@ -2293,6 +2335,8 @@ proc create_command_window {} {
append command_line [ selection get]
break
}
bind .cmd.text < B2-Motion> break
bind .cmd.text < ButtonRelease-2> break
bind .cmd.text < Key-Tab> {
set choices [ gdb_cmd " c o m p l e t e $ c o m m a n d _ l i n e " ]
set choices [ string trimright $choices \ n]
@ -3022,6 +3066,7 @@ proc create_copyright_window {} {
pack .c.m
bind .c.m < 1 > { destroy .c}
bind .c < Leave> { destroy .c}
# " s u i t a b l e p e r i o d " c u r r e n t l y m e a n s " 1 5 s e c o n d s " .
after 15000 {
if { [ winfo exists .c] } then {