microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.38k stars 28.61k forks source link

Word wrapping computations are inaccurate #224493

Open osamesama opened 1 month ago

osamesama commented 1 month ago

Type: Bug

The algorithm for word wrapping in VS Code seems to be based on the assumption that all Unicode characters are the exact same width. This is an invalid assumption -- even with so-called fixed-width fonts (which are a myth; emojis, kanji, and ﷽ are here to stay). Anyway, after we all stopped making console apps and began coding to the web, fixed width fonts stopped being the only way to code -- especially since web apps predominantly render variable-width fonts.

For "statistically typical" English strings, the pedestrian "character counting" method of word wrapping results in overly aggressive word wrapping on-screen, causing a single line to occupy two lines, even when the entire text easily fits on a single line.

VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:06:49.809Z) OS version: Windows_NT x64 10.0.22631 Modes:

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 9 8945HS w/ Radeon 780M Graphics (16 x 3992)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.29GB (17.50GB free)| |Process Argv|anki-import.tsv --crash-reporter-id d432f953-7c41-4022-ab3e-5a417a575ede| |Screen Reader|no| |VM|0%|
Extensions (2) Extension|Author (truncated)|Version ---|---|--- rainbow-csv|mec|3.12.0 remote-wsl|ms-|0.88.2
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 2i9eh265:30646982 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 bdiig495:31013172 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 impr_priority:31102340 nativerepl1:31104043 refactort:31108082 ccplti:31103428 pythonrstrctxt:31103193 ```
vs-code-engineering[bot] commented 1 month ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.92.0. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

osamesama commented 1 month ago

image

osamesama commented 1 month ago

Problem remains in 1.92.