Skip to content
This repository was archived by the owner on Apr 16, 2023. It is now read-only.

Commit bb547ac

Browse files
authored
Merge pull request #3 from CodeDead/feature/scrollable-difference-result
* Added a scrollbar to make things easier
2 parents 9193d66 + 1418a8c commit bb547ac

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ name = "text-diff"
33
version = "0.1.0"
44
edition = "2021"
55
authors = ["CodeDead <admin@codedead.com>"]
6+
description = "A cross-platform GUI for comparing two text files"
67
readme = "README.md"
78
repository = "https://github.com/CodeDead/text-diff-rs"
89
license-file = "LICENSE"
10+
keywords = ["gui", "ui", "text-diff", "interface", "codedead", "diff", "difference"]
911

1012
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1113

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn main() -> iced::Result {
1111
view::ApplicationContext::run(Settings {
1212
id: Some(String::from("text-diff")),
1313
window: window::Settings {
14-
size: (800, 600),
14+
size: (800, 800),
1515
position: window::Position::Centered,
1616
..window::Settings::default()
1717
},

src/view.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::filereader::FileReader;
55
use crate::style;
66
use crate::vector_comparer::{IVectorComparer, VectorComparer};
77
use crate::vector_exporter::{ExportType, IVectorExporter, VectorExporter};
8-
use iced::{alignment, scrollable, Rule};
8+
use iced::{alignment, scrollable, Rule, Scrollable};
99
use iced::{
1010
button, text_input, Alignment, Button, Column, Container, Element, Length, Radio, Row, Sandbox,
1111
Text, TextInput,
@@ -331,13 +331,21 @@ impl Sandbox for ApplicationContext {
331331
}
332332

333333
let diff_column = self.differences.iter().fold(
334-
Column::new().spacing(10).push(diff_text.size(30)),
334+
Column::new().spacing(10),
335335
|column, theme| column.push(Text::new(format!("- {}", theme))),
336336
);
337337

338+
let scroll_container = Column::new().width(Length::Fill).push(diff_column);
339+
let scroll = Scrollable::new(&mut self.scrollable)
340+
.push(Container::new(scroll_container)
341+
.width(Length::Fill))
342+
.max_height(150)
343+
.style(self.theme);
344+
338345
content = content
339346
.push(Rule::horizontal(20).style(self.theme))
340-
.push(diff_column);
347+
.push(diff_text.size(30))
348+
.push(scroll);
341349

342350
if !self.differences.is_empty() {
343351
let btn_export = Button::new(

0 commit comments

Comments
 (0)