Skip to content

Commit

Permalink
Don't send empty input, don't align floats to popup if nothing selected
Browse files Browse the repository at this point in the history
  • Loading branch information
rohit-px2 committed Sep 29, 2021
1 parent fb9e4e3 commit 35014ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ void EditorArea::win_float_pos(NeovimObj obj, u32 size)
{
// NW, no need to do anything
}
if (!popup_menu.hidden())
if (!popup_menu.hidden() && popup_menu.selected_idx() != -1)
{
QPoint pum_tr = popupmenu_rect().topRight();
// Don't let the grid get clipped by the popup menu
Expand Down Expand Up @@ -862,7 +862,9 @@ void EditorArea::set_resizing(bool is_resizing)
void EditorArea::keyPressEvent(QKeyEvent* event)
{
event->accept();
nvim->send_input(convert_key(*event));
auto text = convert_key(*event);
if (text.empty()) return;
nvim->send_input(std::move(text));
}

bool EditorArea::focusNextPrevChild(bool /* is_next */)
Expand Down
2 changes: 2 additions & 0 deletions src/popupmenu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ class PopupMenu : public QWidget
}

auto& info_display() { return info_widget; }

auto selected_idx() { return cur_selected; }
private:
void update_dimensions();
/**
Expand Down

0 comments on commit 35014ed

Please sign in to comment.