Giter Club home page Giter Club logo

Comments (5)

gwenn avatar gwenn commented on August 29, 2024

Raw mode is activated only while reading / readline(">>") is called. And deactivated when readline(">>") returns.
And some escape sequences are interpreted only in raw mode.
I guess replxx behaves the same.

from rustyline.

gwenn avatar gwenn commented on August 29, 2024

Same behavior with linefeed:

diff --git a/examples/demo.rs b/examples/demo.rs
index a7ad87c..4754cac 100644
--- a/examples/demo.rs
+++ b/examples/demo.rs
@@ -90,8 +90,8 @@ fn main() -> io::Result<()> {
                     let mut rng = thread_rng();
                     let mut i = 0usize;
                     loop {
-                        writeln!(iface, "[#{}] Concurrent message #{}",
-                            my_thread_id, i).unwrap();
+                        writeln!(iface, "test\x08\x08\x08",
+                            ).unwrap();
                         let wait_ms = rng.gen_range(1, 500);
                         thread::sleep(Duration::from_millis(wait_ms));
                         i += 1;
linefeed % cargo run --example demo
demo> spawn-log-thread
Spawning log thread #0
test
test
test
test
test
demo>
Goodbye.

But if I add one character like "test\x08\x08\x08!"
I get "t!st" with both rustyline and replxx...

from rustyline.

yalikes avatar yalikes commented on August 29, 2024

do we have any plan to add the feature that enable ASCII control character in external printer?
or maybe I just misunderstanding the usage of external printer. because it by design to print plain text info...

from rustyline.

gwenn avatar gwenn commented on August 29, 2024

To print plain or styled text

from rustyline.

michabs avatar michabs commented on August 29, 2024

tested with this bash script:
#!/bin/bash
input="./test.txt"
while IFS= read -r line
do
echo -e "$line"
done < "$input"

test.txt is just one line:
test\b\b\b!

yield (as rustyline):
t!st

from rustyline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.