Skip to content

Commit 2ec33f2

Browse files
committed
improv: show secondary labels only in multi-phase mode
In that case the user has some time to recognize the type of label, but in single-phase mode it seriously hurts the common case if one cannot rely on the fact that any label is readily usable - having to process two things simultaneously (the character and the highlighting style) is simply too much friction.
1 parent 24935d0 commit 2ec33f2

File tree

2 files changed

+50
-41
lines changed

2 files changed

+50
-41
lines changed

fnl/leap/beacons.fnl

+16-12
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,23 @@
3636
" "
3737
"")
3838
label (or (. opts.substitute_chars target.label) target.label)
39-
text (.. label pad)
4039
relative-group (- target.group (or ?group-offset 0))
41-
virttext
42-
(if (= relative-group 1) [[text hl.group.label-primary]]
43-
(= relative-group 2) [[text hl.group.label-secondary]]
44-
(> relative-group 2)
45-
(when (and ?phase (not opts.highlight_unlabeled_phase_one_targets))
46-
; In this case, "no highlight" should unambiguously signal
47-
; "no further keystrokes needed", so it is mandatory to
48-
; show all labeled positions in some way. (Note: We're
49-
; keeping this on even after phase one - sudden visual
50-
; changes should be avoided as much as possible.)
51-
[[(.. opts.concealed_label pad) hl.group.label-secondary]]))]
40+
virttext (if (= relative-group 1)
41+
[[(.. label pad) hl.group.label-primary]]
42+
43+
(= relative-group 2)
44+
[[(if ?phase (.. label pad) (.. opts.concealed_label pad))
45+
hl.group.label-secondary]]
46+
47+
(> relative-group 2)
48+
(when (and ?phase (not opts.highlight_unlabeled_phase_one_targets))
49+
; In this case, "no highlight" should unambiguously
50+
; signal "no further keystrokes needed", so it is
51+
; mandatory to show all labeled positions in some way.
52+
; (Note: We're keeping this on even after phase one -
53+
; sudden visual changes should be avoided as much as
54+
; possible.)
55+
[[(.. opts.concealed_label pad) hl.group.label-secondary]]))]
5256
; Set nil too (= switching off a beacon).
5357
(set target.beacon (when virttext [offset virttext]))))
5458

lua/leap/beacons.lua

+34-29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)