[TextEdit] Fix right margin rounding clipping last character

(cherry picked from commit 4c8b5f960f3d276c7e218b0830f2324915f8425e)
This commit is contained in:
Anyone4551
2026-02-27 16:47:58 +01:00
committed by Thaddeus Crews
parent 18d11e0ce4
commit 5d17c04c6c
+4 -4
View File
@@ -938,7 +938,7 @@ void TextEdit::_notification(int p_what) {
int left_margin = Math::ceil(style->get_margin(SIDE_LEFT));
int xmargin_beg = left_margin + gutters_width + gutter_padding;
int xmargin_end = size.width - Math::ceil(style->get_margin(SIDE_RIGHT));
int xmargin_end = size.width - Math::floor(style->get_margin(SIDE_RIGHT));
if (draw_minimap) {
xmargin_end -= minimap_width;
}
@@ -3606,7 +3606,7 @@ Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const {
return CURSOR_ARROW;
}
int xmargin_end = get_size().width - Math::ceil(style->get_margin(SIDE_RIGHT));
int xmargin_end = get_size().width - Math::floor(style->get_margin(SIDE_RIGHT));
if (draw_minimap && p_pos.x > xmargin_end - minimap_width && p_pos.x <= xmargin_end) {
return CURSOR_ARROW;
}
@@ -8890,7 +8890,7 @@ void TextEdit::_adjust_viewport_to_caret_horizontally(int p_caret, bool p_maximi
void TextEdit::_update_minimap_hover() {
const Point2 mp = get_local_mouse_pos();
const int xmargin_end = get_size().width - Math::ceil(_get_current_stylebox()->get_margin(SIDE_RIGHT));
const int xmargin_end = get_size().width - Math::floor(_get_current_stylebox()->get_margin(SIDE_RIGHT));
bool hovering_sidebar = mp.x > xmargin_end - minimap_width && mp.x < xmargin_end;
if (!hovering_sidebar) {
@@ -8917,7 +8917,7 @@ void TextEdit::_update_minimap_hover() {
void TextEdit::_update_minimap_click() {
Point2 mp = get_local_mouse_pos();
int xmargin_end = get_size().width - Math::ceil(_get_current_stylebox()->get_margin(SIDE_RIGHT));
int xmargin_end = get_size().width - Math::floor(_get_current_stylebox()->get_margin(SIDE_RIGHT));
if (!dragging_minimap && (mp.x < xmargin_end - minimap_width || mp.x > xmargin_end)) {
minimap_clicked = false;
return;