godot icon indicating copy to clipboard operation
godot copied to clipboard

TextEdit minimap adds an extra space for tab characters compared to spaces

Open MewPurPur opened this issue 1 year ago • 5 comments

Tested versions

Latest master at the time (0bcc0e92b3f0ac57d4c4650722f347593a258572)

System information

Pop!_OS 22.04 LTS - X11 - Vulkan (Forward+) - integrated Intel(R) Graphics (ADL GT2) () - 12th Gen Intel(R) Core(TM) i5-1235U (12 Threads)

Issue description

Minimap is supposed to treat each space as 1 pixel. But my tab size is 3, and the TextEdit minimap displays it like it's 4.

image

Steps to reproduce

The issue is most visible when you use Ctrl+Shift+Y and Ctrl+Shift+I to toggle between spaces and tabs for indents.

Minimal reproduction project (MRP)

N/A editor issue

MewPurPur avatar Jan 21 '24 22:01 MewPurPur

For me it seems it's ok

Tab size 1: image

Tab size 4: image

Reading the code it seems uses the correct tab size too:

int minimap_tab_size = minimap_char_size.x * text.get_tab_size();

jsjtxietian avatar Jan 22 '24 04:01 jsjtxietian

Oh, so I was misled.

MewPurPur avatar Jan 22 '24 20:01 MewPurPur

Edited to reflect the actual issue.

MewPurPur avatar Jan 22 '24 20:01 MewPurPur

I... took a look at the code, I have no clue what is causing this, it may be a matter of the renderer rounding floating-point numbers up.

Mickeon avatar Jan 27 '24 16:01 Mickeon

  • related to https://github.com/godotengine/godot/issues/72876

kitbdev avatar May 01 '24 15:05 kitbdev