Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discard resize if already resizing for same size #1092

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:

- name: MacOS_GCC
flavor: Debug
runner: macos-11
runner: macos-12
generator: Ninja
cc: gcc-10
cxx: g++-10
cc: gcc-11
cxx: g++-11

- name: MacOS_Release
flavor: Release
Expand Down
22 changes: 17 additions & 5 deletions src/gui/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1608,11 +1608,22 @@ void Shell::resizeNeovim(int n_cols, int n_rows)
if (!m_nvim || (n_cols == columns() && n_rows == rows())) {
return;
}
if (m_resizing) {
m_resize_neovim_pending = QSize(n_cols, n_rows);
} else {

auto newsize = QSize(n_cols, n_rows);

if (m_resizing.isValid() && m_resizing == newsize) {
// Do not trigger two consecutive resizes for the same size.
// Neovim may fail to resize and issue a resize event that
// would result in a loop
return;
}

if (m_resizing.isValid()) {
m_resize_neovim_pending = newsize;
}
else {
m_nvim->api0()->ui_try_resize(n_cols, n_rows);
m_resizing = true;
m_resizing = newsize;
}
}

Expand All @@ -1632,7 +1643,8 @@ void Shell::resizeEvent(QResizeEvent *ev)
*/
void Shell::neovimResizeFinished()
{
m_resizing = false;
m_resizing = QSize();

if (m_resize_neovim_pending.isValid()) {
resizeNeovim(m_resize_neovim_pending.width(),
m_resize_neovim_pending.height());
Expand Down
2 changes: 1 addition & 1 deletion src/gui/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private slots:
/// Neovim mode descriptions from "mode_change", used by guicursor
QVariantList m_modeInfo;

bool m_resizing{ false };
QSize m_resizing;
QSize m_resize_neovim_pending;
QLabel* m_tooltip{ nullptr };
QPoint m_mouse_pos;
Expand Down
Loading