Skip to content

Commit

Permalink
screen.prompt(): make file_glob mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
InsanePrawn committed Oct 6, 2023
1 parent bd003e1 commit 0541559
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions babi/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,11 @@ def prompt(
self,
prompt: str,
*,
file_glob: bool,
allow_empty: bool = False,
history: str | None = None,
default_prev: bool = False,
default: str | None = None,
file_glob: bool = False,
) -> str | PromptResult:
default = default or ''
self.status.clear()
Expand Down Expand Up @@ -425,7 +425,7 @@ def prompt(
return ret

def go_to_line(self) -> None:
response = self.prompt('enter line number')
response = self.prompt('enter line number', file_glob=False)
if response is not PromptResult.CANCELLED:
try:
lineno = int(response)
Expand Down Expand Up @@ -456,7 +456,9 @@ def uncut(self) -> None:
self.file.uncut(self.cut_buffer, self.layout.file)

def _get_search_re(self, prompt: str) -> Pattern[str] | PromptResult:
response = self.prompt(prompt, history='search', default_prev=True)
response = self.prompt(
prompt, history='search', default_prev=True, file_glob=False,
)
if response is PromptResult.CANCELLED:
return response
try:
Expand Down Expand Up @@ -495,7 +497,10 @@ def replace(self) -> None:
search_response = self._get_search_re('search (to replace)')
if search_response is not PromptResult.CANCELLED:
response = self.prompt(
'replace with', history='replace', allow_empty=True,
'replace with',
history='replace',
allow_empty=True,
file_glob=False,
)
if response is not PromptResult.CANCELLED:
try:
Expand Down Expand Up @@ -686,7 +691,7 @@ def _command_retheme(self, args: list[str]) -> None:
}

def command(self) -> EditResult | None:
response = self.prompt('', history='command')
response = self.prompt('', history='command', file_glob=False)
if response is PromptResult.CANCELLED:
return None

Expand Down

0 comments on commit 0541559

Please sign in to comment.