Auto-close bracker in raw strings
(event: KeyPressEvent)
| 63 | |
| 64 | |
| 65 | def raw_string_bracket(event: KeyPressEvent): |
| 66 | """Auto-close bracker in raw strings""" |
| 67 | matches = re.match( |
| 68 | r".*(r|R)[\"'](-*)", |
| 69 | event.current_buffer.document.current_line_before_cursor, |
| 70 | ) |
| 71 | dashes = matches.group(2) if matches else "" |
| 72 | event.current_buffer.insert_text("[]" + dashes) |
| 73 | event.current_buffer.cursor_left(len(dashes) + 1) |
| 74 | |
| 75 | |
| 76 | def raw_string_braces(event: KeyPressEvent): |