mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-12-01 00:19:12 +00:00
Merge pull request #55 from Demonthos/fix_single_line_rsx_hot_reloading
fix single line rsx hot reloading
This commit is contained in:
commit
66862e2310
2 changed files with 14 additions and 2 deletions
|
@ -114,8 +114,14 @@ pub async fn hot_reload_handler(
|
||||||
*first = first.split_at(start.column).1;
|
*first = first.split_at(start.column).1;
|
||||||
}
|
}
|
||||||
if let Some(last) = lines.last_mut() {
|
if let Some(last) = lines.last_mut() {
|
||||||
|
// if there is only one line the start index of last line will be the start of the rsx!, not the start of the line
|
||||||
|
if start.line == end.line {
|
||||||
|
*last =
|
||||||
|
last.split_at(end.column - start.column).0;
|
||||||
|
} else {
|
||||||
*last = last.split_at(end.column).0;
|
*last = last.split_at(end.column).0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
let rsx = lines.join("\n");
|
let rsx = lines.join("\n");
|
||||||
messages.push(SetRsxMessage {
|
messages.push(SetRsxMessage {
|
||||||
location: hr,
|
location: hr,
|
||||||
|
|
|
@ -144,8 +144,14 @@ pub async fn startup_hot_reload(port: u16, config: CrateConfig) -> Result<()> {
|
||||||
*first = first.split_at(start.column).1;
|
*first = first.split_at(start.column).1;
|
||||||
}
|
}
|
||||||
if let Some(last) = lines.last_mut() {
|
if let Some(last) = lines.last_mut() {
|
||||||
|
// if there is only one line the start index of last line will be the start of the rsx!, not the start of the line
|
||||||
|
if start.line == end.line {
|
||||||
|
*last =
|
||||||
|
last.split_at(end.column - start.column).0;
|
||||||
|
} else {
|
||||||
*last = last.split_at(end.column).0;
|
*last = last.split_at(end.column).0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
let rsx = lines.join("\n");
|
let rsx = lines.join("\n");
|
||||||
messages.push(SetRsxMessage {
|
messages.push(SetRsxMessage {
|
||||||
location: hr,
|
location: hr,
|
||||||
|
|
Loading…
Reference in a new issue