[PR #30] [MERGED] Insert input into correct character boundary (#26) #573

Closed
opened 2026-02-28 14:50:04 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Rigellute/spotify-tui/pull/30
Author: @fangyi-zhou
Created: 10/8/2019
Status: Merged
Merged: 10/18/2019
Merged by: @Rigellute

Base: masterHead: fix-non-english-inpu


📝 Commits (5)

📊 Changes

4 files changed (+75 additions, -11 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 Cargo.toml (+1 -0)
📝 src/app.rs (+8 -0)
📝 src/handlers/input.rs (+65 -11)

📄 Description

Fatal crash is due to
String::insert(https://doc.rust-lang.org/std/string/struct.String.html#method.insert)

The document says ""Panics if idx is larger than the String's length, or
if it does not lie on a char boundary.""

The solution is to find the correct index to insert into. Alternatively,
we have use a Vec instead of String, but that requires more effort
to change.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Rigellute/spotify-tui/pull/30 **Author:** [@fangyi-zhou](https://github.com/fangyi-zhou) **Created:** 10/8/2019 **Status:** ✅ Merged **Merged:** 10/18/2019 **Merged by:** [@Rigellute](https://github.com/Rigellute) **Base:** `master` ← **Head:** `fix-non-english-inpu` --- ### 📝 Commits (5) - [`804764d`](https://github.com/Rigellute/spotify-tui/commit/804764df8807a6510a4b8aa64683b417c15e67f1) input: Take care of index and width separately - [`c8b45c1`](https://github.com/Rigellute/spotify-tui/commit/c8b45c15485ebd2066ebb83e7ef3905acc1f1bc4) Fix test - [`99c9e6d`](https://github.com/Rigellute/spotify-tui/commit/99c9e6df368bcd0ba8427f488458c7038a658e46) Add comments w.r.t. inputs - [`c976156`](https://github.com/Rigellute/spotify-tui/commit/c9761567544b26ec0155cffceff517faecbeb24c) Fix tests once again - [`e3f0b63`](https://github.com/Rigellute/spotify-tui/commit/e3f0b633eccdd61f32b28ce596549c55216a60ec) Add more tests w.r.t. inputs ### 📊 Changes **4 files changed** (+75 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `Cargo.toml` (+1 -0) 📝 `src/app.rs` (+8 -0) 📝 `src/handlers/input.rs` (+65 -11) </details> ### 📄 Description Fatal crash is due to String::insert(https://doc.rust-lang.org/std/string/struct.String.html#method.insert) The document says ""Panics if idx is larger than the String's length, or if it does not lie on a char boundary."" The solution is to find the correct index to insert into. Alternatively, we have use a Vec<char> instead of String, but that requires more effort to change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 14:50:04 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-tui#573
No description provided.