melib: rename text_processing to text for the whole brevity thing
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>escape8259-vendor
parent
08518e1ca8
commit
808aa4942d
|
@ -46,7 +46,7 @@ use melib::{
|
|||
email::*,
|
||||
error::{Error, ErrorKind, Result},
|
||||
log,
|
||||
text_processing::GlobMatch,
|
||||
text::GlobMatch,
|
||||
thread::Threads,
|
||||
AddressBook, Collection, LogLevel, SortField, SortOrder,
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
use std::cmp;
|
||||
|
||||
use melib::{backends::AccountHash, text_processing::TextProcessing, Card, CardId, Draft};
|
||||
use melib::{backends::AccountHash, text::TextProcessing, Card, CardId, Draft};
|
||||
|
||||
use crate::{
|
||||
conf, contacts::editor::ContactManager, shortcut, terminal::*, Action::Tab, Component,
|
||||
|
|
|
@ -30,7 +30,7 @@ use melib::{
|
|||
|
||||
use super::*;
|
||||
use crate::{
|
||||
melib::text_processing::{TextProcessing, Truncate},
|
||||
melib::text::{TextProcessing, Truncate},
|
||||
uuid::Uuid,
|
||||
};
|
||||
|
||||
|
|
|
@ -237,8 +237,7 @@ impl Composer {
|
|||
);
|
||||
}
|
||||
if *account_settings!(context[account_hash].composing.format_flowed) {
|
||||
ret.pager
|
||||
.set_reflow(melib::text_processing::Reflow::FormatFlowed);
|
||||
ret.pager.set_reflow(melib::text::Reflow::FormatFlowed);
|
||||
}
|
||||
ret
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ use melib::{
|
|||
attachment_types::{ContentType, MultipartType, Text},
|
||||
error::*,
|
||||
parser::BytesExt,
|
||||
text_processing::Truncate,
|
||||
text::Truncate,
|
||||
utils::xdg::query_default_app,
|
||||
Attachment, Result,
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use melib::{text_processing::Truncate, Envelope, Error, Mail, Result};
|
||||
use melib::{text::Truncate, Envelope, Error, Mail, Result};
|
||||
|
||||
use super::{EnvelopeView, MailView, ViewSettings};
|
||||
use crate::{jobs::JoinHandle, mailbox_settings, Component, Context, ShortcutMaps, UIEvent};
|
||||
|
|
|
@ -24,7 +24,7 @@ use indexmap::IndexMap;
|
|||
use melib::{backends::AccountHash, SortOrder};
|
||||
|
||||
use super::*;
|
||||
use crate::{accounts::MailboxEntry, melib::text_processing::TextProcessing};
|
||||
use crate::{accounts::MailboxEntry, melib::text::TextProcessing};
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
enum MailboxAction {
|
||||
|
|
|
@ -30,7 +30,7 @@ use std::{
|
|||
process::{Command, Stdio},
|
||||
};
|
||||
|
||||
use melib::{email::Attachment, log, text_processing::GlobMatch, Error, Result};
|
||||
use melib::{email::Attachment, log, text::GlobMatch, Error, Result};
|
||||
|
||||
use crate::{
|
||||
state::Context,
|
||||
|
|
|
@ -378,7 +378,7 @@ impl Component for DisplayMessageBox {
|
|||
}) = self.messages.get(self.pos)
|
||||
{
|
||||
let noto_colors = crate::conf::value(context, "status.notification");
|
||||
use crate::melib::text_processing::{Reflow, TextProcessing};
|
||||
use crate::melib::text::{Reflow, TextProcessing};
|
||||
|
||||
let box_width = area.width() / 3;
|
||||
if box_width < 10 {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
use std::{collections::BTreeMap, io::Write};
|
||||
|
||||
use super::*;
|
||||
use crate::melib::text_processing::TextProcessing;
|
||||
use crate::melib::text::TextProcessing;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SVGScreenshotFilter {
|
||||
|
|
|
@ -30,7 +30,7 @@ use std::{
|
|||
|
||||
use melib::{
|
||||
log,
|
||||
text_processing::{search::KMP, wcwidth},
|
||||
text::{search::KMP, wcwidth},
|
||||
};
|
||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||
use smallvec::SmallVec;
|
||||
|
@ -1830,7 +1830,7 @@ pub enum WidgetWidth {
|
|||
mod tests {
|
||||
use crate::terminal::{Screen, Virtual};
|
||||
|
||||
//use melib::text_processing::{Reflow, TextProcessing, _ALICE_CHAPTER_1};
|
||||
//use melib::text::{Reflow, TextProcessing, _ALICE_CHAPTER_1};
|
||||
|
||||
#[test]
|
||||
fn test_cellbuffer_search() {
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
use melib::{
|
||||
error::{Error, Result},
|
||||
text_processing::wcwidth,
|
||||
text::wcwidth,
|
||||
};
|
||||
use nix::sys::wait::{waitpid, WaitPidFlag, WaitStatus};
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use melib::text_processing::TextProcessing;
|
||||
use melib::text::TextProcessing;
|
||||
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq)]
|
||||
pub struct UText {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
//! Various useful utilities.
|
||||
|
||||
use melib::{text_processing::Reflow, ShellExpandTrait};
|
||||
use melib::{text::Reflow, ShellExpandTrait};
|
||||
|
||||
pub type AutoCompleteFn = Box<dyn Fn(&Context, &str) -> Vec<AutoCompleteEntry> + Send + Sync>;
|
||||
|
||||
|
@ -49,7 +49,7 @@ use std::collections::HashSet;
|
|||
use indexmap::IndexMap;
|
||||
|
||||
pub use self::tables::*;
|
||||
use crate::{components::ExtendShortcutsMaps, jobs::JobId, melib::text_processing::TextProcessing};
|
||||
use crate::{components::ExtendShortcutsMaps, jobs::JobId, melib::text::TextProcessing};
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
|
||||
pub enum SearchMovement {
|
||||
|
@ -1193,7 +1193,7 @@ impl Component for Tabbed {
|
|||
let (width, height) = self.help_view.content.area().size();
|
||||
let (cols, rows) = inner_area.size();
|
||||
if let Some(ref mut search) = self.help_view.search {
|
||||
use crate::melib::text_processing::search::KMP;
|
||||
use crate::melib::text::search::KMP;
|
||||
search.positions = self
|
||||
.help_view
|
||||
.content
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use melib::text_processing::{LineBreakText, Truncate};
|
||||
use melib::text::{LineBreakText, Truncate};
|
||||
|
||||
use super::*;
|
||||
use crate::terminal::embedded::EmbeddedGrid;
|
||||
|
@ -244,7 +244,7 @@ impl Pager {
|
|||
self.height = self.text_lines.len();
|
||||
self.width = width;
|
||||
if let Some(ref mut search) = self.search {
|
||||
use melib::text_processing::search::KMP;
|
||||
use melib::text::search::KMP;
|
||||
search.positions.clear();
|
||||
for (y, l) in self.text_lines.iter().enumerate() {
|
||||
search.positions.extend(
|
||||
|
@ -294,7 +294,7 @@ impl Pager {
|
|||
};
|
||||
let new_lines_no = self.text_lines.len() - old_lines_no;
|
||||
if let Some(ref mut search) = self.search {
|
||||
use melib::text_processing::search::KMP;
|
||||
use melib::text::search::KMP;
|
||||
for (y, l) in self.text_lines.iter().enumerate().skip(old_lines_no) {
|
||||
search.positions.extend(
|
||||
l.kmp_search(&search.pattern)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
use super::*;
|
||||
use crate::melib::text_processing::Truncate;
|
||||
use crate::melib::text::Truncate;
|
||||
|
||||
pub struct TextField {
|
||||
inner: UText,
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
use std::{borrow::Cow, collections::HashMap, time::Duration};
|
||||
|
||||
use super::*;
|
||||
use crate::melib::text_processing::TextProcessing;
|
||||
use crate::melib::text::TextProcessing;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
|
||||
enum FormFocus {
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
#![allow(clippy::needless_range_loop)]
|
||||
|
||||
#[cfg(any(feature = "unicode-algorithms", feature = "unicode-algorithms-cached"))]
|
||||
include!("src/text_processing/types.rs");
|
||||
include!("src/text/types.rs");
|
||||
|
||||
fn main() -> Result<(), std::io::Error> {
|
||||
#[cfg(any(feature = "unicode-algorithms", feature = "unicode-algorithms-cached"))]
|
||||
{
|
||||
const MOD_PATH: &str = "src/text_processing/tables.rs";
|
||||
const MOD_PATH: &str = "src/text/tables.rs";
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-changed={}", MOD_PATH);
|
||||
/* Line break tables */
|
||||
|
@ -55,8 +55,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
return Ok(());
|
||||
}
|
||||
if cfg!(feature = "unicode-algorithms-cached") {
|
||||
const CACHED_MODULE: &[u8] =
|
||||
include_bytes!(concat!("./src/text_processing/tables.rs.gz"));
|
||||
const CACHED_MODULE: &[u8] = include_bytes!(concat!("./src/text/tables.rs.gz"));
|
||||
|
||||
let mut gz = GzDecoder::new(CACHED_MODULE);
|
||||
use flate2::bufread::GzDecoder;
|
||||
|
@ -350,7 +349,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
let mut file = File::create(mod_path)?;
|
||||
file.write_all(
|
||||
br#"/*
|
||||
* meli - text_processing crate.
|
||||
* meli - text crate.
|
||||
*
|
||||
* Copyright 2017-2020 Manos Pitsidianakis
|
||||
*
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
use super::*;
|
||||
#[cfg(feature = "text-processing")]
|
||||
use crate::text_processing::grapheme_clusters::TextProcessing;
|
||||
use crate::text::grapheme_clusters::TextProcessing;
|
||||
|
||||
pub fn encode_header(value: &str) -> String {
|
||||
let mut ret = String::with_capacity(value.len());
|
||||
|
|
|
@ -130,7 +130,7 @@ pub mod dbg {
|
|||
}
|
||||
|
||||
#[cfg(feature = "text-processing")]
|
||||
pub mod text_processing;
|
||||
pub mod text;
|
||||
|
||||
pub use utils::{
|
||||
datetime::UnixTimestamp,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* meli - text_processing crate.
|
||||
* meli - text mod.
|
||||
*
|
||||
* Copyright 2017-2020 Manos Pitsidianakis
|
||||
*
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* meli - text_processing crate.
|
||||
* meli - text mod.
|
||||
*
|
||||
* Copyright 2017-2020 Manos Pitsidianakis
|
||||
*
|
||||
|
@ -134,7 +134,7 @@ impl EvenAfterSpaces for str {
|
|||
/// Returns positions where breaks can happen
|
||||
/// Examples:
|
||||
/// ```
|
||||
/// use melib::text_processing::{
|
||||
/// use melib::text::{
|
||||
/// self,
|
||||
/// line_break::LineBreakCandidateIter,
|
||||
/// LineBreakCandidate::{self, *},
|
||||
|
@ -839,7 +839,7 @@ fn search_table(c: u32, t: &'static [(u32, u32, LineBreakClass)]) -> LineBreakCl
|
|||
}
|
||||
|
||||
mod alg {
|
||||
use crate::text_processing::{grapheme_clusters::TextProcessing, *};
|
||||
use crate::text::{grapheme_clusters::TextProcessing, *};
|
||||
|
||||
fn cost(i: usize, j: usize, width: usize, minima: &[usize], offsets: &[usize]) -> usize {
|
||||
let w = offsets[j] + j - offsets[i] - i - 1;
|
||||
|
@ -1805,7 +1805,7 @@ easy to take MORE than nothing.'"#;
|
|||
println!("{}", l);
|
||||
}
|
||||
println!();
|
||||
use crate::text_processing::_ALICE_CHAPTER_1;
|
||||
use crate::text::_ALICE_CHAPTER_1;
|
||||
for l in split_lines_reflow(_ALICE_CHAPTER_1, Reflow::FormatFlowed, Some(72)) {
|
||||
println!("{}", l);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* meli - text_processing mod.
|
||||
* meli - text mod.
|
||||
*
|
||||
* Copyright 2017-2020 Manos Pitsidianakis
|
||||
*
|
||||
|
@ -279,7 +279,7 @@ of the house!’ (Which was very likely true.)"#;
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::text_processing::GlobMatch;
|
||||
use crate::text::GlobMatch;
|
||||
|
||||
#[test]
|
||||
fn test_globmatch() {
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* meli - text_processing mod.
|
||||
* meli - text mod.
|
||||
*
|
||||
* Copyright 2020 Manos Pitsidianakis
|
||||
*
|
||||
|
@ -85,11 +85,11 @@ impl KMP for str {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::text_processing::search::KMP;
|
||||
use crate::text::search::KMP;
|
||||
|
||||
#[test]
|
||||
fn test_search() {
|
||||
use crate::text_processing::_ALICE_CHAPTER_1;
|
||||
use crate::text::_ALICE_CHAPTER_1;
|
||||
for ind in _ALICE_CHAPTER_1.kmp_search("Alice") {
|
||||
println!(
|
||||
"{:#?}",
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* meli - text_processing crate.
|
||||
* meli - text mod.
|
||||
*
|
||||
* Copyright 2017-2020 Manos Pitsidianakis
|
||||
*
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* meli - text_processing crate.
|
||||
* meli - text crate.
|
||||
*
|
||||
* Copyright 2017-2020 Manos Pitsidianakis
|
||||
*
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* meli - text_processing crate.
|
||||
* meli - text mod.
|
||||
*
|
||||
* Copyright 2017-2020 Manos Pitsidianakis
|
||||
*
|
||||
|
@ -145,7 +145,7 @@ fn test_wcwidth() {
|
|||
&"📎\u{FE0E}".code_points().collect::<Vec<_>>(),
|
||||
&[0x1f4ce, 0xfe0e]
|
||||
);
|
||||
use crate::text_processing::grapheme_clusters::TextProcessing;
|
||||
use crate::text::grapheme_clusters::TextProcessing;
|
||||
assert_eq!("●".grapheme_width(), 1);
|
||||
assert_eq!("●📎".grapheme_width(), 3);
|
||||
assert_eq!("●\u{FE0E}📎\u{FE0E}".grapheme_width(), 3);
|
|
@ -53,7 +53,7 @@ use smallvec::SmallVec;
|
|||
use uuid::Uuid;
|
||||
|
||||
#[cfg(feature = "text-processing")]
|
||||
use crate::text_processing::grapheme_clusters::*;
|
||||
use crate::text::grapheme_clusters::*;
|
||||
|
||||
type Envelopes = Arc<RwLock<HashMap<EnvelopeHash, Envelope>>>;
|
||||
|
||||
|
|
Loading…
Reference in New Issue