Skip to content

Commit

Permalink
Small tweaks...
Browse files Browse the repository at this point in the history
bindkey.py; Add docstring, and fix a docstring typo
completion.py: remove an unneeded parameter
  • Loading branch information
rocky committed Nov 12, 2024
1 parent 7ede68b commit 3657a35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 6 additions & 1 deletion mathicsscript/bindkeys.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""
Keyboard input binding routines for prompt_toolkit which are
analogous to GNU Readlines' parse_and_bind().
"""

from typing import Callable
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding import KeyBindings
Expand Down Expand Up @@ -136,7 +141,7 @@ def read_inputrc(read_init_file_fn: Callable, use_unicode: bool) -> None:
"""
Read GNU Readline style inputrc
"""
# GNU Readling inputrc $include's paths are relative to itself,
# GNU Readline inputrc $include's paths are relative to itself,
# so chdir to its directory before reading the file.
parent_dir = pathlib.Path(__file__).parent.absolute()
with parent_dir:
Expand Down
6 changes: 2 additions & 4 deletions mathicsscript/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def __init__(self, definitions):

self.escape_sequences = aliased_characters.keys()

def _is_space_before_cursor(self, document, text_before_cursor: str) -> bool:
def _is_space_before_cursor(self, text_before_cursor: str) -> bool:
"""Space before or no text before cursor."""
return text_before_cursor == "" or text_before_cursor[-1:].isspace()

Expand Down Expand Up @@ -135,9 +135,7 @@ def get_word_before_cursor_with_kind(

text_before_cursor = document.text_before_cursor

if self._is_space_before_cursor(
document=document, text_before_cursor=text_before_cursor
):
if self._is_space_before_cursor(text_before_cursor=text_before_cursor):
return WordToken("", TokenKind.Null)

start = (
Expand Down

0 comments on commit 3657a35

Please sign in to comment.