ZIm/crates
Jason Lee 3eba831de8
Fix closest_index_for_x to get correct offset when only 1 char (#23603)
Release Notes:

- N/A

----------

This bug can easy to replay by `input` example, just enter 1 char and
click on the middle of the char, we can't move cursor to 0, it is always
be 1.

```bash
cargo run -p gpui --example input
```

## Before


https://github.com/user-attachments/assets/3239dd47-278e-4311-9757-5165d1ccd796

## After


https://github.com/user-attachments/assets/4e2c1500-0142-4e28-bf34-7ef1f4929925
2025-01-27 23:18:18 -07:00
..
activity_indicator Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
anthropic Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
assets Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
assistant Fix window double borrows (#23739) 2025-01-27 21:56:29 +00:00
assistant2 assistant2: Add tiny visual adjustments (#23748) 2025-01-27 20:26:34 -03:00
assistant_context_editor Fix window double borrows (#23739) 2025-01-27 21:56:29 +00:00
assistant_settings Add DeepSeek support (#23551) 2025-01-27 13:40:59 -05:00
assistant_slash_command Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
assistant_slash_commands Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
assistant_tool Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
assistant_tools Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
audio Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
auto_update Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
auto_update_ui Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
breadcrumbs Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
call Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
channel Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
cli Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
client Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
clock chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
collab Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
collab_ui Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
collections chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
command_palette Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
command_palette_hooks Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
context_server Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
context_server_settings Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
copilot Fix window double borrows (#23739) 2025-01-27 21:56:29 +00:00
db Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
deepseek Add DeepSeek support (#23551) 2025-01-27 13:40:59 -05:00
diagnostics Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
docs_preprocessor Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
editor Fix run indicators with expanded diff hunks (#23758) 2025-01-27 23:05:46 -07:00
evals Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
extension Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
extension_api chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
extension_cli chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
extension_host Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
extensions_ui Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
feature_flags Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
feedback Update actions to open GitHub issue templates (#23747) 2025-01-27 18:17:43 -05:00
file_finder Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
file_icons Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
fireworks chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
fs Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
fsevent chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
fuzzy chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
git Fix unnecessarily large edits emitted from multi buffer on diff recalculation (#23753) 2025-01-27 18:11:15 -08:00
git_hosting_providers Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
git_ui Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
go_to_line Fix window double borrows (#23739) 2025-01-27 21:56:29 +00:00
google_ai chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
gpui Fix closest_index_for_x to get correct offset when only 1 char (#23603) 2025-01-27 23:18:18 -07:00
gpui_macros Fix window double borrows (#23739) 2025-01-27 21:56:29 +00:00
html_to_markdown Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
http_client chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
image_viewer Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
indexed_docs Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
inline_completion Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
inline_completion_button Fix window double borrows (#23739) 2025-01-27 21:56:29 +00:00
install_cli Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
journal Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
language Silence Rust-Analyzer false-positive (#23724) 2025-01-27 16:38:03 +00:00
language_extension Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
language_model Add DeepSeek support (#23551) 2025-01-27 13:40:59 -05:00
language_model_selector assistant: Preserve selection focus in the model selector (#23713) 2025-01-27 12:29:08 -03:00
language_models Add DeepSeek support (#23551) 2025-01-27 13:40:59 -05:00
language_selector Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
language_tools Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
languages Add auto-completion support for snippet files (#23698) 2025-01-27 12:32:22 +01:00
livekit_client Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
livekit_client_macos Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
livekit_server chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
lmstudio Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
lsp Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
markdown Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
markdown_preview Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
media chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
menu chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
multi_buffer Fix run indicators with expanded diff hunks (#23758) 2025-01-27 23:05:46 -07:00
node_runtime chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
notifications Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
ollama Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
open_ai openai: Add back O1-Preview (#23715) 2025-01-27 14:44:12 +00:00
outline Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
outline_panel Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
paths Add auto-completion support for snippet files (#23698) 2025-01-27 12:32:22 +01:00
picker Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
prettier Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
project Fix unnecessarily large edits emitted from multi buffer on diff recalculation (#23753) 2025-01-27 18:11:15 -08:00
project_panel Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
project_symbols Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
prompt_library Fix window double borrows (#23739) 2025-01-27 21:56:29 +00:00
proto project: Revert project tree impl (again) (#23572) 2025-01-23 16:10:38 -05:00
recent_projects Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
refineable project: Revert project tree impl (again) (#23572) 2025-01-23 16:10:38 -05:00
release_channel Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
remote Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
remote_server Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
repl Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
reqwest_client Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
rich_text Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
rope Rework go to line infrastructure (#23654) 2025-01-25 19:24:19 +00:00
rpc Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
search Fix window double borrows (#23739) 2025-01-27 21:56:29 +00:00
semantic_index Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
semantic_version chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
session Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
settings Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
settings_ui Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
snippet Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
snippet_provider Add auto-completion support for snippet files (#23698) 2025-01-27 12:32:22 +01:00
snippets_ui Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
sqlez Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
sqlez_macros chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
story Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
storybook Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
streaming_diff chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
sum_tree Rework diff rendering to allow putting the cursor into deleted text, soft-wrapping and scrolling deleted text correctly (#22994) 2025-01-24 14:18:22 -07:00
supermaven Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
supermaven_api Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
tab_switcher Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
task Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
tasks_ui Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
telemetry chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
telemetry_events chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
terminal Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
terminal_view Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
text Fix unnecessarily large edits emitted from multi buffer on diff recalculation (#23753) 2025-01-27 18:11:15 -08:00
theme Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
theme_extension Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
theme_importer Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
theme_selector Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
time_format chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
title_bar Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
toolchain_selector Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
ui Add DeepSeek support (#23551) 2025-01-27 13:40:59 -05:00
ui_input Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
ui_macros Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
util Canonicalize paths when running tests (#23655) 2025-01-26 14:56:07 +08:00
vcs_menu Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
vim vim: Fix NextSubwordEnd crash (#23604) 2025-01-27 23:13:13 -07:00
vim_mode_setting Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
welcome Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
workspace workspace: Prefer active window over other local non-collab windows for opening file (#23726) 2025-01-27 23:11:35 -07:00
worktree Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
zed Fix window double borrows (#23739) 2025-01-27 21:56:29 +00:00
zed_actions Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
zed_predict_tos Remove more references to 'model' in GPUI APIs (#23693) 2025-01-27 04:00:27 +00:00
zeta Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00