MCPcopy Index your code
hub / github.com/bpython/bpython / insert_char_pair_end

Method insert_char_pair_end

bpython/curtsiesfrontend/repl.py:862–878  ·  view source on GitHub ↗

Accepts character which is a part of CHARACTER_PAIR_MAP like brackets and quotes, and checks whether it should be inserted to the line or overwritten e.x. if you type ")" (rparen) , and your cursor is directly above another ")" (rparen) in the cmd, this will just ski

(self, e)

Source from the content-addressed store, hash-verified

860 self._cursor_offset -= 1
861
862 def insert_char_pair_end(self, e):
863 """Accepts character which is a part of CHARACTER_PAIR_MAP
864 like brackets and quotes, and checks whether it should be
865 inserted to the line or overwritten
866
867 e.x. if you type ")" (rparen) , and your cursor is directly
868 above another ")" (rparen) in the cmd, this will just skip
869 it and move the cursor.
870 If there is no same character underneath the cursor, the
871 character will be printed/appended to the line
872 """
873 if self.config.brackets_completion:
874 if self.cursor_offset < len(self._current_line):
875 if self._current_line[self.cursor_offset] == e:
876 self.cursor_offset += 1
877 return
878 self.add_normal_character(e)
879
880 def get_last_word(self):
881 previous_word = _last_word(self.rl_history.entry)

Callers 1

process_key_eventMethod · 0.95

Calls 1

add_normal_characterMethod · 0.95

Tested by

no test coverage detected