mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-10 03:10:41 +00:00
Fix ending newline problem
This commit is contained in:
parent
afb224b860
commit
4879d8cc71
@ -127,6 +127,9 @@ where
|
||||
|
||||
if self.current_span >= self.spans.len() {
|
||||
// If this was the last chunk, return as is!
|
||||
// Well, make sure we don't end with a newline...
|
||||
let hard_stop = hard_stop || span.text.ends_with('\n');
|
||||
|
||||
return Some(Chunk {
|
||||
width: total_width,
|
||||
segments,
|
||||
|
@ -9,7 +9,6 @@ use std::ops::Deref;
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
use std::sync::Arc;
|
||||
use theme::Effect;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
use utils::lines::spans::{Row, SpanLinesIterator};
|
||||
use utils::markup::{Markup, MarkupText, StyledString};
|
||||
use vec::Vec2;
|
||||
@ -194,15 +193,6 @@ pub struct TextView {
|
||||
width: Option<usize>,
|
||||
}
|
||||
|
||||
// If the last character is a newline, strip it.
|
||||
fn strip_last_newline(content: &str) -> &str {
|
||||
if content.ends_with('\n') {
|
||||
&content[..content.len() - 1]
|
||||
} else {
|
||||
content
|
||||
}
|
||||
}
|
||||
|
||||
impl TextView {
|
||||
/// Creates a new TextView with the given content.
|
||||
pub fn new<S>(content: S) -> Self
|
||||
|
Loading…
Reference in New Issue
Block a user