Auto-close parenthesis in raw strings
(event: KeyPressEvent)
| 52 | |
| 53 | |
| 54 | def raw_string_parenthesis(event: KeyPressEvent): |
| 55 | """Auto-close parenthesis in raw strings""" |
| 56 | matches = re.match( |
| 57 | r".*(r|R)[\"'](-*)", |
| 58 | event.current_buffer.document.current_line_before_cursor, |
| 59 | ) |
| 60 | dashes = matches.group(2) if matches else "" |
| 61 | event.current_buffer.insert_text("()" + dashes) |
| 62 | event.current_buffer.cursor_left(len(dashes) + 1) |
| 63 | |
| 64 | |
| 65 | def raw_string_bracket(event: KeyPressEvent): |