Skip to content

Commit

Permalink
Prevent error when getSelectedLines called and no lines selected
Browse files Browse the repository at this point in the history
Show a warning when trying to update the tag on filtered lines and none selected
  • Loading branch information
mitchcapper committed Aug 11, 2024
1 parent f3a7f33 commit e2e2e43
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/LogCatch.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,14 @@ proc UpdateNativeTagFilterForSelected {} {
}

set text [getSelectedLines]
if { [string length $text] == 0 } {
tk_messageBox \
-title "Error" \
-message "No lines selected make sure to highlight all or part of one or more lines" \
-type ok \
-icon error
return
}
set lines [split $text "\n"]
foreach line $lines {

Expand Down Expand Up @@ -1439,6 +1447,9 @@ proc getSelectedLines {} {
set el [lindex $rangenums 2]
set ec [lindex $rangenums 3]
puts "sel: $sl.$sc $el.$ec"
if { $sl == "" && $el == "" } {
return ""
}
set sdx "$sl.0"
set edx "$el.end"
return [getLogLines $sdx $edx]
Expand Down

0 comments on commit e2e2e43

Please sign in to comment.