Fix get input: returning invalid response (#151)

* Fix get input: returning invalid response

* Remove buff from args
This commit is contained in:
Nameless 2020-07-21 21:38:21 +08:00 committed by GitHub
parent ecb8afb4ef
commit 31cd7d3908
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View file

@ -29,12 +29,14 @@ TODO:
- [ ] create new chat
- [ ] bots (bot keyboard)
## Requirements
To use tg, you'll need to have the following installed:
- [Python 3.8](https://www.python.org/downloads/release/python-380/)
## Optional dependencies
- [terminal-notifier](https://github.com/julienXX/terminal-notifier) for Mac (used by default). You can change it to [dunst](https://github.com/dunst-project/dunst) for Linux or any other notifications program (see `NOTIFY_CMD` in configuration)
@ -53,6 +55,7 @@ To use tg, you'll need to have the following installed:
- [ranger](https://github.com/ranger/ranger), [nnn](https://github.com/jarun/nnn):
can be used to choose file when sending, customizable with `FILE_PICKER_CMD`
## Installation
### From PyPI
@ -70,8 +73,7 @@ This option is recommended for development:
> Requires [flit](https://github.com/takluyver/flit) to be installed.
>
> Install it with:
> ```sh
> ```sh
> pip3 install flit
> ```
@ -248,6 +250,7 @@ For navigation arrow keys also can be used.
- `r`: read current chat
- `c`: show list of contacts
- `dd`: delete chat or remove history
- `/`: search in chats
- `?`: show help
## Msgs:

View file

@ -559,7 +559,7 @@ class Controller:
@bind(chat_handler, ["/"])
def search_contacts(self) -> None:
"""Search contacts and set jumps to it if found"""
msg = self.view.status.get_input(prefix="/")
msg = self.view.status.get_input("/")
if not msg:
return self.present_info("Search discarded")

View file

@ -95,8 +95,9 @@ class StatusView:
self.win.addstr(0, 0, msg.replace("\n", " ")[: self.w])
self._refresh()
def get_input(self, buff: str = "", prefix: str = "") -> Optional[str]:
def get_input(self, prefix: str = "") -> Optional[str]:
curses.curs_set(1)
buff = ""
try:
while True: