Skip to content

Commit

Permalink
fix: using chars().count() instead of len()
Browse files Browse the repository at this point in the history
  • Loading branch information
wllfaria committed Jun 12, 2024
1 parent a2736cf commit 0393de4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl Renderable for CollectionViewer<'_> {
self.layout
.req_uri
.x
.add(request.read().unwrap().uri.len() as u16)
.add(request.read().unwrap().uri.chars().count() as u16)
.add(1),
self.layout.req_uri.y.add(1),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,15 @@ impl Renderable for HeadersEditorForm<'_> {
match self.focused_input {
HeadersEditorFormInput::Name => {
frame.set_cursor(
name_size.x.add(header.pair.0.len().add(1) as u16),
name_size.x.add(header.pair.0.chars().count().add(1) as u16),
name_size.y.add(1),
);
}
HeadersEditorFormInput::Value => {
frame.set_cursor(
value_size.x.add(header.pair.1.len().add(1) as u16),
value_size
.x
.add(header.pair.1.chars().count().add(1) as u16),
value_size.y.add(1),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ impl Renderable for CreateDirectoryForm<'_> {
frame.render_widget(hint, hint_size);

frame.set_cursor(
input_size.x.add(self.dir_name.len() as u16).add(1),
input_size
.x
.add(self.dir_name.chars().count() as u16)
.add(1),
input_size.y.add(1),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ impl<'rf, State> Renderable for RequestForm<'rf, State> {

if self.focused_field.eq(&FormField::Name) {
frame.set_cursor(
name_size.x.add(self.request_name.len() as u16).add(1),
name_size
.x
.add(self.request_name.chars().count() as u16)
.add(1),
name_size.y.add(1),
);
}
Expand Down

0 comments on commit 0393de4

Please sign in to comment.