Skip to content

Commit cebf1b1

Browse files
committed
framework: add tabify-selection/reverse-choices to racket:text<%>
Add reverse-order tabbing for languages, like Rhombus, that support iterating through tabbing alteratives. Map "s:tab" to iterate through alternatives in reverse mode. Merge before racket/drracket#753
1 parent 2d322fc commit cebf1b1

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

gui-doc/scribblings/framework/racket.scrbl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@
8484
through @racket[end].
8585
}
8686

87+
@defmethod*[(((tabify-selection/reverse-choices (start exact-integer? (send this get-start-position))
88+
(end exact-integer? (send this get-end-position)))
89+
void?))]{
90+
Sets the tabbing for the lines containing positions @racket[start]
91+
through @racket[end], but if there are multiple valid tabbings to cycle through,
92+
this method should cycle through the choices in reverse order. The default
93+
implementation calls @method[racket:text<%> tabify-selection].
94+
95+
@history[#:added "1.77"]
96+
}
97+
8798
@defmethod*[(((tabify-all) void?))]{
8899
Tabs all lines.
89100

gui-lib/framework/private/racket.rkt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@
373373
tabify-on-return?
374374
tabify
375375
tabify-selection
376+
tabify-selection/reverse-choices
376377
tabify-all
377378
insert-return
378379

@@ -675,6 +676,10 @@
675676
(when (< first-para end-para)
676677
(end-busy-cursor)))))))
677678

679+
(define/public (tabify-selection/reverse-choices [start-pos (get-start-position)]
680+
[end-pos (get-end-position)])
681+
(tabify-selection start-pos end-pos))
682+
678683
(define/public (tabify-all) (tabify-selection 0 (last-position)))
679684
(define/public (insert-return)
680685
(begin-edit-sequence #t #f)
@@ -1714,6 +1719,8 @@
17141719
(λ (x) (send x select-up-sexp)))
17151720
(add-edit-function "tabify-at-caret"
17161721
(λ (x) (send x tabify-selection)))
1722+
(add-edit-function "tabify-at-caret/reverse-choices"
1723+
(λ (x) (send x tabify-selection/reverse-choices)))
17171724
(add-edit-function "do-return"
17181725
(λ (x) (send x insert-return)))
17191726
(add-edit-function "comment-out"
@@ -1827,6 +1834,7 @@
18271834
(send keymap map-function key func))
18281835

18291836
(map "TAB" "tabify-at-caret")
1837+
(map "s:TAB" "tabify-at-caret/reverse-choices")
18301838

18311839
(map "return" "do-return")
18321840
(map "s:return" "do-return")

gui-lib/info.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
(define pkg-authors '(mflatt robby))
3636

37-
(define version "1.76")
37+
(define version "1.77")
3838

3939
(define license
4040
'(Apache-2.0 OR MIT))

0 commit comments

Comments
 (0)