diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/ui.c | 12 | ||||
-rw-r--r-- | src/nvim/ui.c | 20 |
2 files changed, 10 insertions, 22 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index b10434428c..300f409a0f 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -382,17 +382,11 @@ void nvim_ui_pum_set_bounds(uint64_t channel_id, Float width, Float height, return; } - if (row < 0) { - api_set_error(err, kErrorTypeValidation, "Expected pumpos row >= 0"); - return; - } else if (col < 0) { - api_set_error(err, kErrorTypeValidation, "Expected pumpos col >= 0"); - return; - } else if (width <= 0) { - api_set_error(err, kErrorTypeValidation, "Expected pumpos width > 0"); + if (width <= 0) { + api_set_error(err, kErrorTypeValidation, "Expected width > 0"); return; } else if (height <= 0) { - api_set_error(err, kErrorTypeValidation, "Expected pumpos height > 0"); + api_set_error(err, kErrorTypeValidation, "Expected height > 0"); return; } diff --git a/src/nvim/ui.c b/src/nvim/ui.c index cc9bf42bc8..0a8474ff82 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -237,24 +237,18 @@ int ui_pum_get_height(void) void ui_pum_get_pos(double *pwidth, double *pheight, double *prow, double *pcol) { - double w = 0.0, h = 0.0, r = -1.0, c = -1.0; + double w = 0.0, h = 0.0, r = 0.0, c = 0.0; bool found = false; for (size_t i = 1; i < ui_count; i++) { if (!uis[i]->pum_pos) { continue; } - if (!found) { - w = uis[i]->pum_width; - h = uis[i]->pum_height; - r = uis[i]->pum_row; - c = uis[i]->pum_col; - found = true; - } else { - w = MIN(uis[i]->pum_width, w); - h = MIN(uis[i]->pum_height, h); - r = MIN(uis[i]->pum_row, r); - c = MIN(uis[i]->pum_col, c); - } + w = uis[i]->pum_width; + h = uis[i]->pum_height; + r = uis[i]->pum_row; + c = uis[i]->pum_col; + found = true; + break; } if (found) { *pwidth = w; |