Skip to content

Commit c3d9ac2

Browse files
committed
Restrict max/min volume bounds
1 parent e98880b commit c3d9ac2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

plugin/vimedia.vim

+12-2
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,19 @@ fu! s:ToggleVolume() abort
294294
let l:selected_opt = expand("<cword>")
295295

296296
if l:selected_opt == s:toggle_volume_opt_up
297-
let l:next_volume = s:previous_volume + 0.1
297+
let l:next = s:previous_volume + 0.1
298+
if l:next > 0.9
299+
let l:next_volume = 1.0
300+
else
301+
let l:next_volume = l:next
302+
endif
298303
elseif l:selected_opt == s:toggle_volume_opt_down
299-
let l:next_volume = s:previous_volume - 0.1
304+
let l:next = s:previous_volume - 0.1
305+
if l:next < 0.1
306+
let l:next_volume = 0.0
307+
else
308+
let l:next_volume = l:next
309+
endif
300310
elseif l:selected_opt == s:toggle_volume_opt_done
301311
close
302312
endif

0 commit comments

Comments
 (0)