Commit e21e74f813

e21e74f8137232b0a3ba9a6f3169b02a318b5690

parent: a94071d47f

Unsigned

Damir Jelić <poljar@termina.org.uk> · 2021-01-22 21:09 UTC

room: Enable multiline support and fix local echo replacement

Layout: unified · split

Cargo.lock +7 −7
@@ -1058,7 +1058,7 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
10581058[[package]]
10591059name = "matrix-sdk"
10601060version = "0.2.0"
1061source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#cf07fc8e8e44c0857f8230813950f487297127d2"
1061source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#c034de470b02fa9659f0d65c25579739b702e377"
10621062dependencies = [
10631063 "dashmap",
10641064 "futures",
@@ -1080,7 +1080,7 @@ dependencies = [
10801080[[package]]
10811081name = "matrix-sdk-base"
10821082version = "0.2.0"
1083source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#cf07fc8e8e44c0857f8230813950f487297127d2"
1083source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#c034de470b02fa9659f0d65c25579739b702e377"
10841084dependencies = [
10851085 "chacha20poly1305",
10861086 "dashmap",
@@ -1103,7 +1103,7 @@ dependencies = [
11031103[[package]]
11041104name = "matrix-sdk-common"
11051105version = "0.2.0"
1106source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#cf07fc8e8e44c0857f8230813950f487297127d2"
1106source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#c034de470b02fa9659f0d65c25579739b702e377"
11071107dependencies = [
11081108 "async-trait",
11091109 "futures-locks",
@@ -1117,7 +1117,7 @@ dependencies = [
11171117[[package]]
11181118name = "matrix-sdk-crypto"
11191119version = "0.2.0"
1120source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#cf07fc8e8e44c0857f8230813950f487297127d2"
1120source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#c034de470b02fa9659f0d65c25579739b702e377"
11211121dependencies = [
11221122 "aes-ctr",
11231123 "aes-gcm",
@@ -2771,7 +2771,7 @@ dependencies = [
27712771[[package]]
27722772name = "weechat"
27732773version = "0.4.0"
2774source = "git+https://github.com/poljar/rust-weechat#553e2e15f122d56d0b5e55f58d19c8c3cb1764c3"
2774source = "git+https://github.com/poljar/rust-weechat#2044828e5d094f0413c34ea6f6043800e34cdf57"
27752775dependencies = [
27762776 "async-task",
27772777 "async-trait",
@@ -2788,7 +2788,7 @@ dependencies = [
27882788[[package]]
27892789name = "weechat-macro"
27902790version = "0.4.0"
2791source = "git+https://github.com/poljar/rust-weechat#553e2e15f122d56d0b5e55f58d19c8c3cb1764c3"
2791source = "git+https://github.com/poljar/rust-weechat#2044828e5d094f0413c34ea6f6043800e34cdf57"
27922792dependencies = [
27932793 "libc",
27942794 "proc-macro2",
@@ -2822,7 +2822,7 @@ dependencies = [
28222822[[package]]
28232823name = "weechat-sys"
28242824version = "0.4.0"
2825source = "git+https://github.com/poljar/rust-weechat#553e2e15f122d56d0b5e55f58d19c8c3cb1764c3"
2825source = "git+https://github.com/poljar/rust-weechat#2044828e5d094f0413c34ea6f6043800e34cdf57"
28262826dependencies = [
28272827 "bindgen",
28282828 "libc",
src/room/mod.rs +7 −2
@@ -276,6 +276,7 @@ impl RoomHandle {
276276
277277 buffer.enable_nicklist();
278278 buffer.disable_nicklist_groups();
279 buffer.enable_multiline();
279280
280281 buffer.set_localvar("server", server_name);
281282 buffer.set_localvar("nick", &own_nick);
@@ -849,14 +850,18 @@ impl MatrixRoom {
849850
850851 let mut lines = buffer.lines();
851852 let mut first_line = lines.rfind(line_contains_uuid);
852 let mut line_num = 0;
853
854 // We go in reverse order here since we also use rfind(). We got from
855 // the bottom of the buffer to the top since we're expecting these
856 // lines to be freshly printed and thus at the bottom.
857 let mut line_num = rendered.content.lines.len() - 1;
853858
854859 while let Some(line) = &first_line {
855860 let rendered_line = &rendered.content.lines[line_num];
856861
857862 line.set_message(&rendered_line.message);
858863
859 line_num += 1;
864 line_num -= 1;
860865 first_line = lines.next_back().filter(line_contains_uuid);
861866 }
862867 }