mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
Allow for browsing of other man pages in the "SEE ALSO" section.
This commit is contained in:
@@ -753,7 +753,7 @@ proc CreateCalWindow { dayNames } {
|
||||
balloon_add_help .b.queue "See the queue of pending reminders (debugging purposes only)"
|
||||
button .b.quit -text {Quit} -command {Quit} -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
balloon_add_help .b.quit "Quit TkRemind"
|
||||
button .b.help -text {Help} -command ShowManPage -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
button .b.help -text {Help} -command [list ShowManPage tkremind 1 1] -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
balloon_add_help .b.help "Show TkRemind manual"
|
||||
label .b.status -text "" -width 25 -relief flat -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 0
|
||||
bind .b.status <ButtonPress-1> [list ShowTodaysReminders 1 ""]
|
||||
@@ -4878,35 +4878,60 @@ proc set_button_to_errors {} {
|
||||
.b.queue configure -text {Errors...} -command {ShowErrors} -bg #FF5555 -fg black
|
||||
}
|
||||
|
||||
proc ShowManPage {} {
|
||||
proc ShowManPage { cmd jump destroy } {
|
||||
global Option env
|
||||
set w ".man"
|
||||
catch { destroy $w }
|
||||
toplevel $w -background $Option(WinBackground)
|
||||
text $w.t -width 84 -height 30 -wrap none -yscrollcommand "$w.sb set" -foreground $Option(TextColor) -background $Option(BackgroundColor) -font CalBoxFont
|
||||
$w.t tag configure bold -font {-weight bold}
|
||||
$w.t tag configure italic -font {-slant italic}
|
||||
scrollbar $w.sb -orient vertical -command "$w.t yview"
|
||||
button $w.ok -text OK -command [list destroy $w] -foreground $Option(TextColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
grid $w.t -row 0 -column 0 -sticky nsew
|
||||
grid $w.sb -row 0 -column 1 -sticky ns
|
||||
grid $w.ok -row 1 -column 0 -stick w
|
||||
grid columnconfigure $w 0 -weight 1
|
||||
grid columnconfigure $w 1 -weight 0
|
||||
grid rowconfigure $w 0 -weight 1
|
||||
grid rowconfigure $w 1 -weight 0
|
||||
if { $destroy != 0 } {
|
||||
catch { destroy $w }
|
||||
toplevel $w -background $Option(WinBackground)
|
||||
text $w.t -width 84 -height 30 -wrap none -yscrollcommand "$w.sb set" -foreground $Option(TextColor) -background $Option(BackgroundColor) -font CalBoxFont
|
||||
$w.t tag configure bold -font {-weight bold}
|
||||
$w.t tag configure italic -font {-slant italic}
|
||||
$w.t tag configure underline -underline 1
|
||||
scrollbar $w.sb -orient vertical -command "$w.t yview"
|
||||
button $w.ok -text OK -command [list destroy $w] -foreground $Option(TextColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
grid $w.t -row 0 -column 0 -sticky nsew
|
||||
grid $w.sb -row 0 -column 1 -sticky ns
|
||||
grid $w.ok -row 1 -column 0 -stick w
|
||||
grid columnconfigure $w 0 -weight 1
|
||||
grid columnconfigure $w 1 -weight 0
|
||||
grid rowconfigure $w 0 -weight 1
|
||||
grid rowconfigure $w 1 -weight 0
|
||||
|
||||
$w.t tag bind man <ButtonPress-1> [list NavigateToManPage $w.t %x %y]
|
||||
$w.t tag bind man <Enter> [list ManEnter $w.t %x %y]
|
||||
$w.t tag bind man <Leave> [list ManLeave $w.t %x %y]
|
||||
$w.t tag bind man <Motion> [list ManMove $w.t %x %y]
|
||||
} else {
|
||||
$w.t configure -state normal
|
||||
$w.t delete 1.0 end
|
||||
}
|
||||
set env(COLUMNS) 80
|
||||
set env(MANWIDTH) 80
|
||||
set env(MAN_KEEP_FORMATTING) 1
|
||||
set taglist {}
|
||||
set seealso 0
|
||||
if {[catch {
|
||||
set fp [open "|man tkremind" "r+"]
|
||||
set fp [open "|man $cmd" "r+"]
|
||||
while {[gets $fp line] >= 0} {
|
||||
set old_taglist $taglist
|
||||
if {[regexp -- {THE CALENDAR WINDOW} $line]} {
|
||||
$w.t yview moveto 1
|
||||
if {$jump != 0} {
|
||||
if {[regexp -- {THE CALENDAR WINDOW} $line]} {
|
||||
$w.t yview moveto 1
|
||||
}
|
||||
}
|
||||
if {[regexp -- {SEE ALSO} $line]} {
|
||||
set seealso 1
|
||||
} else {
|
||||
if {$seealso != 0} {
|
||||
set seealso 0
|
||||
lappend taglist man
|
||||
} else {
|
||||
set idx [lsearch -exact $taglist "man"]
|
||||
set taglist [lreplace $taglist $idx $idx]
|
||||
}
|
||||
}
|
||||
set old_taglist $taglist
|
||||
|
||||
$w.t insert end " ";
|
||||
set indexes [regexp -indices -inline -all -- {\e\[[0-9]+m} $line]
|
||||
if {[llength $indexes] > 0} {
|
||||
@@ -4917,7 +4942,10 @@ proc ShowManPage {} {
|
||||
set esc_seq [string range $line [expr $first+2] [expr $last-1]]
|
||||
switch -- $esc_seq {
|
||||
"0" {
|
||||
set taglist {}
|
||||
set idx [lsearch -exact $taglist "bold"]
|
||||
set taglist [lreplace $taglist $idx $idx]
|
||||
set idx [lsearch -exact $taglist "italic"]
|
||||
set taglist [lreplace $taglist $idx $idx]
|
||||
}
|
||||
"1" {
|
||||
lappend taglist "bold"
|
||||
@@ -4956,6 +4984,25 @@ proc ShowManPage {} {
|
||||
CenterWindow $w .
|
||||
raise $w
|
||||
}
|
||||
|
||||
proc ManEnter { t x y } {
|
||||
$t tag add underline [list @$x,$y wordstart] [list @$x,$y wordend]
|
||||
}
|
||||
proc ManLeave { t x y } {
|
||||
$t tag remove underline 1.0 end
|
||||
}
|
||||
|
||||
proc ManMove { t x y } {
|
||||
ManLeave $t $x $y
|
||||
ManEnter $t $x $y
|
||||
}
|
||||
|
||||
proc NavigateToManPage { t x y } {
|
||||
set text [$t get [list @$x,$y wordstart] [list @$x,$y wordend]]
|
||||
if {[regexp -nocase -- {[a-z0-9_]+} $text man]} {
|
||||
ShowManPage $man 0 0
|
||||
}
|
||||
}
|
||||
proc ShowErrors {} {
|
||||
global RemindErrors Option
|
||||
set w ".errors"
|
||||
|
||||
Reference in New Issue
Block a user