zed/crates
Danilo Leal 0facdfa5ca
editor: Make TextAlign::Center and TextAlign::Right work (#45417)
Closes https://github.com/zed-industries/zed/issues/43208

This PR essentially unblocks the editable number field. The function
that shapes editor lines was hard-coding text alignment to the left,
meaning that whatever different alignment we'd pass through
`EditorStyles`would be ignored. To solve this, I just added a text align
and align width fields to the line paint function and updated all call
sites keeping the default configuration. Had to also add an
`alignment_offset()` helper to make sure the cursor positioning, the
selection background element, and the click-to-focus functionality were
kept in-sync with the non-left aligned editor.

Then... the big star of the show here is being able to add the `mode`
method to the number field, which uses `TextAlign::Center`, thus making
it work as we designed it to work.


https://github.com/user-attachments/assets/3539c976-d7bf-4d94-8188-a14328f94fbf

Next up, is turning the number filed to edit mode where applicable.

Release Notes:

- Fixed a bug where different text alignment configurations (i.e.,
center and right-aligned) wouldn't take effect in editors.
2025-12-19 17:37:15 -08:00
..
acp_thread Add support for provider extensions (but no extensions yet) (#45277) 2025-12-18 17:05:04 -05:00
acp_tools gpui: Make refining a Style properly refine the TextStyle (#42852) 2025-12-15 13:30:13 +00:00
action_log git: Fix bug where opening a git blob from historic commit view could fail (#44226) 2025-12-19 18:55:17 -05:00
activity_indicator releases: Add build number to Nightly builds (#42990) 2025-11-24 13:34:04 +01:00
agent Add support for provider extensions (but no extensions yet) (#45277) 2025-12-18 17:05:04 -05:00
agent_servers Stop spawning ACP/MCP servers with interactive shells (#44826) 2025-12-15 08:22:58 +01:00
agent_settings agent_ui: Implement favorite models selection (#44297) 2025-12-16 16:22:30 -03:00
agent_ui git: Fix bug where opening a git blob from historic commit view could fail (#44226) 2025-12-19 18:55:17 -05:00
agent_ui_v2 agent_ui: Simplify timestamp display (#45296) 2025-12-18 17:49:17 -03:00
ai_onboarding Add support for provider extensions (but no extensions yet) (#45277) 2025-12-18 17:05:04 -05:00
anthropic Improve token count accuracy using Anthropic's API (#44943) 2025-12-16 14:32:41 -05:00
askpass askpass: Use double quotes for script name in helper command (#43689) 2025-11-28 08:18:19 +01:00
assets Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
assistant_slash_command Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
assistant_slash_commands assistant_slash_commands: Fix AI text thread path display bugs on Windows and all platforms (#41880) 2025-12-15 08:24:57 +01:00
assistant_text_thread Finish inline telemetry changes (#44842) 2025-12-15 04:07:44 +00:00
audio Automate settings registration (#42238) 2025-11-07 22:27:14 +00:00
auto_update auto_update: Tentatively prevent auto-update loop on Nightly again (#43670) 2025-11-27 14:08:43 +00:00
auto_update_helper auto_update: Ignore dir removal errors on windows (#42435) 2025-11-11 12:55:19 +00:00
auto_update_ui release_version: Do not use prerelease field (#43669) 2025-11-27 13:46:43 +00:00
aws_http_client Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
bedrock bedrock: Add Bedrock API key authentication support (#41393) 2025-12-17 12:54:57 +01:00
breadcrumbs svg_preview: Remove unnecessary dependency on editor (#43147) 2025-11-20 12:18:50 +01:00
buffer_diff git: Optimistically stage hunks when staging a file, take 2 (#45278) 2025-12-19 19:08:49 +00:00
call Clean up screenshare (#44945) 2025-12-16 05:10:33 +00:00
channel releases: Add build number to Nightly builds (#42990) 2025-11-24 13:34:04 +01:00
cli Make zed --wait work with directories (#44936) 2025-12-16 01:22:41 +00:00
client Fix link opening (#44910) 2025-12-15 20:53:50 -07:00
clock text: Improve panic messages with more information (#42072) 2025-11-06 09:16:45 +00:00
cloud_api_client Use cloud for auto-update (#42246) 2025-11-10 23:00:55 -07:00
cloud_api_types Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
cloud_llm_client supports_streaming_tools member (#44753) 2025-12-13 00:56:06 +00:00
codestral copilot: Add support for Next Edit Suggestion (#44486) 2025-12-17 21:43:42 +01:00
collab Move DB away from the project (#45036) 2025-12-17 01:59:34 +02:00
collab_ui Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
collections Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
command_palette Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
command_palette_hooks Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
component Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
component_preview Separate out component_preview crate and add easy-to-use example binaries (#45382) 2025-12-20 00:34:14 +00:00
context_server Add support for MCP tools/list_changed notification (#42453) 2025-12-16 21:44:39 +00:00
copilot copilot: Add support for Next Edit Suggestion (#44486) 2025-12-17 21:43:42 +01:00
crashes Fix "busy" cursor appearing on startup (#44019) 2025-12-02 16:15:18 -05:00
credentials_provider Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
dap util: Fix zip extraction (#42714) 2025-11-19 12:34:41 +01:00
dap_adapters language: Add LanguageName::new_static to reduce allocations (#44380) 2025-12-08 19:57:02 +01:00
db Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
debug_adapter_extension Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
debugger_tools editor: Add active match highlight for buffer and project search (#44098) 2025-12-04 03:55:04 +05:30
debugger_ui Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
deepseek deepseek: Fix for max output tokens blocking completions (#45236) 2025-12-18 12:47:34 +00:00
denoise Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
diagnostics Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
docs_preprocessor Remove zed dependency from docs_preprocessor (#45130) 2025-12-18 21:59:05 -05:00
edit_prediction Make sweep and mercury API tokens use cx.global instead of OnceLock (#45176) 2025-12-18 00:32:46 +00:00
edit_prediction_cli Remove global workspace trust concept (#45129) 2025-12-17 16:53:42 +00:00
edit_prediction_context Rework edit prediction CLI (#44562) 2025-12-10 17:36:51 -08:00
edit_prediction_types copilot: Add support for Next Edit Suggestion (#44486) 2025-12-17 21:43:42 +01:00
edit_prediction_ui Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
editor editor: Make TextAlign::Center and TextAlign::Right work (#45417) 2025-12-19 17:37:15 -08:00
eval Remove global workspace trust concept (#45129) 2025-12-17 16:53:42 +00:00
eval_utils Fix self-referential symbolic link (#45265) 2025-12-18 17:26:20 +01:00
explorer_command_injector Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
extension Add support for provider extensions (but no extensions yet) (#45277) 2025-12-18 17:05:04 -05:00
extension_api extension api: Make server id types constructible, to ease writing tests (#45174) 2025-12-17 16:25:07 -08:00
extension_cli extension_cli: Properly populate manifest with snippet location (#44425) 2025-12-08 21:49:26 +01:00
extension_host Add support for provider extensions (but no extensions yet) (#45277) 2025-12-18 17:05:04 -05:00
extensions_ui ui: Remove support for unnecessary Switch colors (#44388) 2025-12-08 13:16:19 +00:00
feature_flags Kick off agent v2 (#44190) 2025-12-15 10:14:15 +00:00
feedback Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
file_finder Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
file_icons Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
fs Fix windows path canonicalization (#45145) 2025-12-17 19:55:36 +00:00
fs_benchmarks fs: Reintroduce benchmarks crate (#40689) 2025-10-20 10:30:06 +00:00
fsevent Disable fsevents tests (#43218) 2025-11-20 22:17:50 -07:00
fuzzy fuzzy: Use lowercase representations for matrix size calculation (#44338) 2025-12-08 19:50:20 +01:00
git git: Unify commit popups (#38749) 2025-12-17 17:31:12 -05:00
git_hosting_providers git: Improve self-hosted provider support and Bitbucket integration (#42343) 2025-12-08 13:32:14 -05:00
git_ui git: Fix bug where opening a git blob from historic commit view could fail (#44226) 2025-12-19 18:55:17 -05:00
go_to_line Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
google_ai google_ai: Refactor token count methods in Google AI (#45184) 2025-12-17 20:12:40 -06:00
gpui editor: Make TextAlign::Center and TextAlign::Right work (#45417) 2025-12-19 17:37:15 -08:00
gpui_macros Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
gpui_tokio Allow external handles to be provided to gpui_tokio (#42795) 2025-12-15 16:09:10 +01:00
html_to_markdown Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
http_client Remove reqwest dependency from gpui (#44424) 2025-12-09 09:29:40 -08:00
http_client_tls Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
icons Add adjustments to agent v2 pane changes (#44885) 2025-12-15 13:02:01 -03:00
image_viewer git: Fix bug where opening a git blob from historic commit view could fail (#44226) 2025-12-19 18:55:17 -05:00
inspector_ui Introduce worktree trust mechanism (#44887) 2025-12-16 20:34:00 +02:00
install_cli Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
journal multi_buffer: Typed MultiBufferOffset (#42707) 2025-11-19 22:00:58 +00:00
json_schema_store Specify a schema to use when dealing with JSONC files (#44250) 2025-12-05 20:26:42 +00:00
keymap_editor Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
language git: Fix bug where opening a git blob from historic commit view could fail (#44226) 2025-12-19 18:55:17 -05:00
language_extension language_extension: Handle prefixed WASI windows paths in extension spawning (#44477) 2025-12-09 13:22:57 +01:00
language_model Enforce 5MB per-image limit when converting images for language models (#45313) 2025-12-19 15:04:41 -05:00
language_models Fix OpenRouter giving errors for some Anthropic models (#45399) 2025-12-19 17:04:43 -05:00
language_onboarding Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
language_selector Fix keybind hints flickering in certain scenarios (#40927) 2025-10-22 19:52:38 +00:00
language_tools Add language server version in a tooltip on language server hover (#45302) 2025-12-18 21:59:21 +00:00
languages Support union declarations in C/C++ textobjects.scm (#45308) 2025-12-19 17:37:13 -05:00
line_ending_selector Fix keybind hints flickering in certain scenarios (#40927) 2025-10-22 19:52:38 +00:00
livekit_api Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
livekit_client Make LiveKit source use audio priority (#44881) 2025-12-15 14:58:38 +01:00
lmstudio Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
lsp Add language server version in a tooltip on language server hover (#45302) 2025-12-18 21:59:21 +00:00
markdown Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
markdown_preview Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
media Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
menu Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
migrator workspace: Display a launchpad page when in an empty window & add it as a restore_on_startup value (#44048) 2025-12-16 07:51:28 -03:00
miniprofiler_ui gpui: Unify track_scroll method to receive a reference type (#43518) 2025-11-26 18:03:42 +01:00
mistral Update Mistral models context length to their recommended values (#45194) 2025-12-18 09:49:32 +00:00
multi_buffer git: Fix bug where opening a git blob from historic commit view could fail (#44226) 2025-12-19 18:55:17 -05:00
nc Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
net Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
node_runtime Remove global workspace trust concept (#45129) 2025-12-17 16:53:42 +00:00
notifications git_ui: Add dismiss button to status toast (#44813) 2025-12-15 12:06:17 +00:00
ollama ollama: Fix tool calling (#42275) 2025-11-11 16:10:47 +01:00
onboarding Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
open_ai Add GPT-5.2 support (#44656) 2025-12-11 15:49:10 -05:00
open_router Fix Gemini 3 on OpenRouter (#43416) 2025-11-24 13:24:26 -05:00
outline Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
outline_panel git: Add global git integration enable/disable setting (#43326) 2025-12-18 11:45:26 -05:00
panel Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
paths Introduce MVP Dev Containers support (#44442) 2025-12-10 12:10:43 -08:00
picker Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
prettier Move servers back from the background thread (#44696) 2025-12-12 11:16:17 +00:00
project git: Fix bug where opening a git blob from historic commit view could fail (#44226) 2025-12-19 18:55:17 -05:00
project_benchmarks Remove global workspace trust concept (#45129) 2025-12-17 16:53:42 +00:00
project_panel Add Restore File action in project_panel for git modified files (#42490) 2025-12-19 10:12:01 +00:00
project_symbols Add more preview tab settings and fix janky behavior (#43921) 2025-12-03 21:56:39 +00:00
prompt_store Make prompt store fail-open when DB contains undecodable records (#45312) 2025-12-19 14:59:01 -05:00
proto git: Fix bug where opening a git blob from historic commit view could fail (#44226) 2025-12-19 18:55:17 -05:00
recent_projects Fix stale pending keybinding indicators on focus change (#44678) 2025-12-17 16:51:16 +00:00
refineable gpui: Make refining a Style properly refine the TextStyle (#42852) 2025-12-15 13:30:13 +00:00
release_channel release_version: Do not use prerelease field (#43669) 2025-11-27 13:46:43 +00:00
remote Fix terminal doesn't switch to project directory when opening remote project on Windows (#45328) 2025-12-19 17:06:16 +01:00
remote_server Remove global workspace trust concept (#45129) 2025-12-17 16:53:42 +00:00
repl Multiple priority scheduler (#44701) 2025-12-12 06:32:30 -08:00
reqwest_client Remove reqwest dependency from gpui (#44424) 2025-12-09 09:29:40 -08:00
rich_text Revert "sum_tree: Replace rayon with futures (#41586) (#41846) 2025-11-03 19:25:15 +00:00
rope rope: Optimize rope construction (#44345) 2025-12-15 08:25:50 +01:00
rpc remote: Recognize WSL interop to open browser for codex web login (#44136) 2025-12-04 14:42:26 +00:00
rules_library rules_library: Only store built-in prompts when they are customized (#45112) 2025-12-18 17:21:41 +01:00
scheduler Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
schema_generator Add project settings schema to schema_generator CLI (#44321) 2025-12-16 10:48:14 -05:00
search search: Respect macOS' find pasteboard (#45311) 2025-12-19 13:31:27 -03:00
session zed: Fix session ID mismatching for workspace and telemetry (#43659) 2025-12-01 09:12:31 +01:00
settings editor: Add automatic markdown list continuation on newline and indent on tab (#42800) 2025-12-19 21:44:02 +05:30
settings_json settings_ui: Show migration banner (#41112) 2025-10-27 10:13:26 -04:00
settings_macros Fallible Settings (#42938) 2025-11-21 08:28:17 -07:00
settings_profile_selector Automate settings registration (#42238) 2025-11-07 22:27:14 +00:00
settings_ui settings ui: Change window kind from floating to normal (#45401) 2025-12-19 16:48:53 -05:00
snippet Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
snippet_provider Add editor::InsertSnippet action (#44428) 2025-12-08 21:38:24 +00:00
snippets_ui Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
sqlez Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
sqlez_macros Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
story Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
storybook ui: Remove outdated/unused component stories (#43118) 2025-11-20 01:52:13 -03:00
streaming_diff Revert "sum_tree: Replace rayon with futures (#41586) (#41846) 2025-11-03 19:25:15 +00:00
sum_tree rope: Optimize rope construction (#44345) 2025-12-15 08:25:50 +01:00
supermaven copilot: Add support for Next Edit Suggestion (#44486) 2025-12-17 21:43:42 +01:00
supermaven_api Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
svg_preview svg_preview: Remove unnecessary dependency on editor (#43147) 2025-11-20 12:18:50 +01:00
system_specs releases: Add build number to Nightly builds (#42990) 2025-11-24 13:34:04 +01:00
tab_switcher tab_switcher: Fix missing preview on initial ctrl-shift-tab press (#44959) 2025-12-16 08:26:29 +00:00
task Allow trailing commas in builtin JSONC schemas (#43854) 2025-12-04 15:37:32 -05:00
tasks_ui gpui: Implement From<String> for ElementId (#44447) 2025-12-09 09:08:59 +01:00
telemetry Fix telemetry (#42184) 2025-11-07 11:36:05 +00:00
telemetry_events releases: Add build number to Nightly builds (#42990) 2025-11-24 13:34:04 +01:00
terminal terminal: Improve regex hyperlink performance for long lines (#44721) 2025-12-17 15:53:22 -05:00
terminal_view editor: Make TextAlign::Center and TextAlign::Right work (#45417) 2025-12-19 17:37:15 -08:00
text git: Revert "Ignore whitespace in git blame invocation" (#44648) 2025-12-12 14:28:25 +01:00
theme editor: Add active match highlight for buffer and project search (#44098) 2025-12-04 03:55:04 +05:30
theme_extension Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
theme_importer Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
theme_selector Allow dynamic set_theme based on Appearance (#42812) 2025-12-01 20:52:57 -07:00
time_format Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
title_bar workspace: Make title bar pickers render nearby the trigger when mouse-triggered (#45361) 2025-12-19 13:01:48 -03:00
toolchain_selector toolchains: Fix persistence by not relying on unstable worktree id (#45357) 2025-12-19 14:06:15 +01:00
ui gpui: Fix truncation flickering (#45373) 2025-12-19 13:14:31 -03:00
ui_input editor: Make TextAlign::Center and TextAlign::Right work (#45417) 2025-12-19 17:37:15 -08:00
ui_macros Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
ui_prompt Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
util Redact environment variables from language server spawn errors (#44783) 2025-12-18 21:05:14 +02:00
util_macros Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
vercel Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
vim vim: Add :r[ead] [name] command (#45332) 2025-12-19 15:31:16 +00:00
vim_mode_setting Automate settings registration (#42238) 2025-11-07 22:27:14 +00:00
watch Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
web_search Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
web_search_providers Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
which_key Add Vim-like Which-key Popup menu (#43618) 2025-12-17 11:53:48 -07:00
workspace Make pane::CloseAllItems best effort (#45368) 2025-12-19 16:21:56 +00:00
worktree git: Fix bug where opening a git blob from historic commit view could fail (#44226) 2025-12-19 18:55:17 -05:00
worktree_benchmarks chore: Add worktree_benchmarks to cargo workspace (#45344) 2025-12-19 11:18:36 +01:00
x_ai Add support for Grok 4.1 Fast models in xAI provider (#43419) 2025-12-08 16:38:34 +01:00
zed Separate out component_preview crate and add easy-to-use example binaries (#45382) 2025-12-20 00:34:14 +00:00
zed_actions agent_ui: Improve UX when pasting code into message editor (#45254) 2025-12-18 16:38:47 +01:00
zed_env_vars Enable configuring edit prediction providers through the settings UI (#44505) 2025-12-13 11:06:30 -05:00
zeta_prompt Rework edit prediction CLI (#44562) 2025-12-10 17:36:51 -08:00
zlog zlog: Fix dynamic mod path filtering (#44296) 2025-12-06 17:56:49 +00:00
zlog_settings Automate settings registration (#42238) 2025-11-07 22:27:14 +00:00
ztracing Blockmap sync fix (#44743) 2025-12-17 16:14:57 +00:00
ztracing_macro adds tracing for instrumenting non-async functions (#44147) 2025-12-05 17:23:06 +00:00